User:Dantman/LogoHunter.js

/* */

//////////////////////// // Logo Hunter Script // ////////////////////////

var oldLogo; var logoElm; addOnloadHook(setupLogoHunter); function setupLogoHunter { var boxes = getElementsByClassName( document, '*', 'clickhere' ); for( var b = 0; b < boxes.length; b++ ) { var a = boxes[b].getElementsByTagName('a')[0]; var subdomain = a.title.replace(/^(w:)?c:/i, ''); var logo = 'http://' + subdomain + '.wikia.com/images/b/bc/Wiki.png'; boxes[b].setAttribute('onmouseover', 'javascript: huntLogo(\'' + logo + '\');'); boxes[b].setAttribute('onmouseout', 'javascript: killLogo;'); }	var pLogo = document.getElementById( 'p-logo' ); logoElm = pLogo.getElementsByTagName('a')[0]; oldLogo = logoElm.style.backgroundImage; }

function huntLogo( url ) { logoElm.style.backgroundImage = 'url(' + url + ')'; }

function killLogo { logoElm.style.backgroundImage = oldLogo; }

/* */