Jump to content

User:PC78/monobook.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by PC78 (talk | contribs) at 08:17, 1 September 2019. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
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');
    },
    install : function(){
    with(highlightRedirects)
      {
      tab_redirects = addPortletLink ('p-cactions', 'javascript:highlightRedirects.run();', 'redirects');
      if(document.getElementById('ca-history')) 
        document.getElementById('ca-history').parentNode.appendChild(tab_redirects);
      }
    }
  };
addOnloadHook(highlightRedirects.install);
}