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+'"'); }); //