User:Dantman/LogoHunter.js

/* */

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

var logoView; var logoimage; 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'; a.setAttribute('onmouseover', 'javascript: huntLogo( this, \'' + logo + '\' );'); a.setAttribute('onmouseout', 'javascript: killLogo( this );'); }	logoview = document.createElement( 'div' ); logoimage = document.createElement( 'img' ); logoview.id = 'logoview'; logoview.style.display = 'none'; logoview.appendChild( logoimage ); document.getElementById( 'content' ).appendChild( logoview ); }

function huntLogo( element, url ) { logoimage.src = url; logoview.style.display = 'block'; }

function killLogo( element ) { logoview.style.display = 'none'; }

/* */