MediaWiki:Selector.js

function creatEvent(e, id) { e.setAttribute('onmouseenter', 'CursorEnter("' + id + '");') e.setAttribute('onmouseleave', 'CursorLeave("' + id + '");') } function CursorEnter(id) { StylingElement(id, '1'); $(window).trigger('scroll'); } function CursorLeave(id) { StylingElement(id, '0'); $(window).trigger('scroll'); } function Init { var elems = document.getElementsByTagName('*'); for (i = 0; i < elems.length; i++) { var elem = elems[i]; if (!elem.className || !elem.className.split) { continue; }   var ID; var elemClasses = elem.className.split(' '); for (var j = 0; j < elemClasses.length; j++) {     var elemClass = elemClasses[j]; if (elemClass.substring(0, 2) == '_t') {       ID = elemClass.substring(2); creatEvent(elem, ID); break; }   }  } } function StylingElement(id, flag) { var elems = document.getElementsByTagName('*'); for (i = 0; i < elems.length; i++) { var elem = elems[i]; if (!elem.className || !elem.className.split) { continue; }   var elemClasses = elem.className.split(' '); for (var j = 0; j < elemClasses.length; j++) {     var elemClass = elemClasses[j]; if (elemClass.substring(0, 2) == '_c') {       if (elemClass.substring(2) == id) {         if (flag == '0') { elem.style.display = 'none'; elem.style.opacity = 0; } else { elem.style.display = 'block'; $(elem).animate({             opacity: 1            }, 700) }       } else { elem.style.display = 'none'; elem.style.opacity = 0; }     }      var cn = elem.className.replace(/ t_select/g, ).replace(/ t_unselect/g, ); if (elemClass == '_t' + id) {       elem.className = cn + ' t_select'; } else if (elemClass.substring(0, 2) == '_t') { elem.className = cn + ' t_unselect'; }   }  } } addOnloadHook(Init);