MediaWiki:Admin.js

/* JavaScript here is intended for use by ZW admins */ // To use these functions, add the following line to your "user"/monobook.js: // // importScript('MediaWiki:admin.js'); //

// // addLogs // adds a 'page logs' link to the toolbox bar (if the page is a special page, then no link is displayed) // addOnloadHook(function {    if ( wgCanonicalNamespace == "Special" )        return;  // don't display link for special pages

url = wgServer + "/index.php?title=Special:Log&page=" + encodeURIComponent(wgPageName);

addPortletLink("p-tb", url, "Page logs", "pt-logs"); }); //

// // addScript // adds a 'user scripts' link to the toolbox bar, which links to the user's personal monobook.js page //

addOnloadHook(function {    url = wgServer + "/Special:MyPage/monobook.js";

addPortletLink("p-tb", url, "User scripts", "pt-js"); }); //

// // redirects // adds a tab to the top of pages, when clicked it highlights all links on the page that are redirects. // if (wgAction != 'edit' && wgCanonicalNamespace != 'Special' && wgAction != 'history' && wgAction != 'delete' && wgAction != 'watch' && wgAction != 'unwatch' && wgAction != 'protect' && wgAction != 'markpatrolled' && wgAction != 'rollback' && document.URL.indexOf('diff=') <= 0) { var highlightRedirects = { tab_redirects : null, addStylesheetRule : function(tag, style) { var ss = document.styleSheets[0]; if (ss.insertRule) { ss.insertRule(tag + '{' + style + '}', ss.cssRules.length); } else if (ss.addRule) { ss.addRule(tag, style); } }, run : function { highlightRedirects.addStylesheetRule('a.mw-redirect', 'color:green'); highlightRedirects.addStylesheetRule('a.mw-redirect:visited', 'color:darkgreen'); }, install : function { with(highlightRedirects) {  addPortletLink ('p-cactions', 'javascript:highlightRedirects.run;', 'redirects', 'ca-redirects', 'Highlights all links which are redirects', '1') || addPortletLink ('views', 'javascript:highlightRedirects.run;', 'redirects', 'ca-redirects', 'Highlights all links which are redirects', '1'); } } }; addOnloadHook(highlightRedirects.install); } //

// // user rights // adds a link in the tool box while on user pages to a user's rights management page. // addOnloadHook(function {    if (wgNamespaceNumber != "2" && wgNamespaceNumber != "3")        return;  // restrict to User and User talk    var title = wgTitle;    addPortletLink('p-tb', '/Special:Userrights/'+title, 'User rights', 't-userrights', 'User rights for "'+title+'"'); }); //

// // adminrights.js         (adapted from http://en.wikipedia.org/wiki/User:Ais523/adminrights.js) // This script highlights links to admins' userpages in the bodyContent (that is, everything but the tabs, personal // links at the top of the screen and sidebar) of Special or History pages, by giving them a colored background. //

var adminrights=new Array; adminrights['Adam']=1; adminrights['Ando']=1; adminrights['Axiomist']=1; adminrights['Captain%20Cornflake']=1; adminrights['Cody']=1; adminrights['Dany36']=1; adminrights['Davogones']=1; adminrights['Deku%20Link']=1; adminrights['Dustin']=1; adminrights['Fury%20Three']=1; adminrights['Jason']=1; adminrights['Lysia']=1; adminrights['Mandi']=1; adminrights['Mases']=1; adminrights['Matt']=1; adminrights['Melchizedek']=1; adminrights['Nathan']=1; adminrights['Steven']=1; adminrights['Tappy']=1; adminrights['Xizor']=1; adminrights['Yumil']=1;

//Highlighting script. Based on User:ais523/highlightmyname.js. function highlightadmins(n,p) //node, parent node { while(n!=null) {   if(n.nodeType==1&&n.tagName.toLowerCase=="a") //anchor {     if(n.href.indexOf("http://www.zeldawiki.org/User:")!=-1) {       var u=n.href.split("http://www.zeldawiki.org/User:")[1]; if(adminrights[u.split("_").join("%20")]==1) {         n.style.color="#00CC00"; if(n.className==null||n.className=="") n.className="ais523_adminrights_admin"; else n.className+="ais523_adminrights_admin"; }       n=n.nextSibling; }     else if(n.href.indexOf("http://www.zeldawiki.org/index.php?title=User:")!=-1) {       var u=n.href.split("http://www.zeldawiki.org/index.php?title=User:")[1]; if(adminrights[u.split("_").join("%20")]==1) {         n.style.color="#00CC00"; if(n.className==null||n.className=="") n.className="ais523_adminrights_admin"; else n.className+=" ais523_adminrights_admin"; }       n=n.nextSibling; }     else {       if(n.firstChild!=null) highlightadmins(n.firstChild,n); n=n.nextSibling; }   }    else {     if(n.firstChild!=null) highlightadmins(n.firstChild,n); n=n.nextSibling; } } }

if (wgCanonicalNamespace == 'Special' || wgAction == 'history') { addOnloadHook(function {   highlightadmins(document.getElementById('bodyContent').firstChild, document.getElementById('bodyContent')); }); } //