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') { 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') || addPortletLink ('views', 'javascript:highlightRedirects.run;', 'redirects'); } } }; addOnloadHook(highlightRedirects.install); } //