User:Jcstroh/vector.js

// Custom Google search // Disabled // importScript("User:Csewiki/vector.js"); // document.write('<\/link>'); //

// MouseOver for references, from sv:WP:Referenser // $( setupRefMouseOver ); function setupRefMouseOver { var sups = document.getElementById( 'bodyContent' ).getElementsByTagName( 'sup' ); for (i = 0; i < sups.length; i++ ) { if (sups[i].className == 'reference') { sups[i].onmouseover = refMouseOver; } } } function refMouseOver( event ) { if ( !event ) { // IE verkar inte skicka med event-parametern event = window.event; } if ( this.hasReferencePopup ) { return; } var referencePopupElement = document.getElementById( 'ref-popup' ); if ( !referencePopupElement ) { referencePopupElement = document.createElement( 'span' ); referencePopupElement.setAttribute( 'id', 'ref-popup' ); referencePopupElement.style.position = 'fixed'; referencePopupElement.style.zIndex = 100; referencePopupElement.style.background = 'white'; referencePopupElement.style.border = '1px solid #808080'; referencePopupElement.style.lineHeight = '1em'; referencePopupElement.onmouseout = refMouseOut; } else { referencePopupElement.parentNode.hasReferencePopup = false; } var referenceId = this.firstChild.href.split( '#' )[1]; var referenceText = document.getElementById( referenceId ).innerHTML; referencePopupElement.innerHTML = referenceText; referencePopupElement.style.left = event.clientX + 'px'; referencePopupElement.style.top = event.clientY + 'px'; referencePopupElement.style.display = 'inline'; this.appendChild( referencePopupElement ); this.hasReferencePopup = true; } function refMouseOut( event ) { this.style.display = 'none'; this.innerHTML = ''; this.parentNode.hasReferencePopup = false; }