Jump to content

User:The Obento Musubi/icons.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/***********************
 **    Title icons    **
 ***********************/
 
function getElementsByClass(searchClass, node, tag) {
if (node == null) node = document;
if (tag == null) tag = '*';
return getElementsByClassName(node, tag, searchClass);
}

function titleicons() {
var h1 = document.getElementsByTagName("h1")[0];
var icons = getElementsByClass( "icon", document, "div" );
for( var j = icons.length; j > 0; --j ){
icons[j-1].style.display = "block"; /* cancels "display: none" by default */
icons[j-1].style.marginLeft = "0.3em";
if( skin == "modern" ){
icons[j-1].style.marginTop = "0.2em";
}
h1.parentNode.insertBefore(icons[j-1], h1); /* shift of the element */
}
}
addOnloadHook(titleicons);
 
function coordinate() {
var h1 = document.getElementsByTagName("h1")[0];
var icons = getElementsByClass( "coordinates", document, "div" );
for( var j = icons.length; j > 0; --j ){
icons[j-1].style.display = "block"; /* cancels "display: none" by default */
icons[j-1].style.marginLeft = "0.3em";
if( skin == "modern" ){
icons[j-1].style.marginTop = "0.2em";
}
h1.parentNode.insertBefore(icons[j-1], h1); /* shift of the element */
}
}
addOnloadHook(coordinate);