User:Archanamiya/highlightredirects.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
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() { tab_redirects.innerHTML = 'undo'; tab_redirects.title = 'Undo redirect highlighting'; highlightRedirects.addStylesheetRule('a', 'color:gray'); highlightRedirects.addStylesheetRule('a.mw-redirect', 'color:green'); }, install : function() { with(highlightRedirects) { tab_redirects = addPortletLink ('p-cactions', 'javascript:highlightRedirects.run();', 'ca-redirects','Highlight the redirects'); if( document.getElementById('ca-history') ) document.getElementById('ca-history').parentNode.appendChild( tab_redirects ); } } }; // Hook up installation function addOnloadHook(highlightRedirects.install); }