|
|
Line 1: |
Line 1: |
| /* Any JavaScript here will be loaded for all users on every page load. */ | | /* Any JavaScript here will be loaded for all users on every page load. */ |
|
| |
| // --------------------------------------------------------
| |
| // addPurge
| |
| // adds a "purge" tab (after "watch")
| |
| // --------------------------------------------------------
| |
| addOnloadHook(function () {
| |
| if (wgAction != 'edit' && wgCanonicalNamespace != 'Special' && wgAction != 'history' && wgAction != 'delete' && wgAction != 'watch' && wgAction
| |
| != 'unwatch' && wgAction != 'protect' && wgAction != 'markpatrolled' && wgAction != 'rollback' && document.URL.indexOf('diff=') <= 0
| |
| && document.URL.indexOf('oldid=') <=0)
| |
| { var hist; var url;
| |
| if (!(hist = document.getElementById('ca-history') )) return;
| |
| if (!(url = hist.getElementsByTagName('a')[0] )) return;
| |
| if (!(url = url.href )) return;
| |
| addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
| |
| 'Purge', 'ca-purge', 'Purge server cache for this page', '0');
| |
| }
| |
| });
| |
| //
| |
|
| |
| // --------------------------------------------------------
| |
| // redirects
| |
| // adds a tab to the top of pages, when clicked it highlights all links on the page that are redirects.
| |
| // --------------------------------------------------------
| |
| if (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:red');
| |
| highlightRedirects.addStylesheetRule('a.mw-redirect:visited', 'color:hotpink');
| |
| },
| |
|
| |
| install : function()
| |
| {
| |
| with(highlightRedirects)
| |
| {
| |
| addPortletLink ('p-cactions', 'javascript:highlightRedirects.run();', 'Redirects', 'ca-redirects', 'Highlights all links which are redirects', 'r') ||
| |
| addPortletLink ('views', 'javascript:highlightRedirects.run();', 'Redirects', 'ca-redirects', 'Highlights all links which are redirects', 'r');
| |
| }
| |
| }
| |
|
| |
| };
| |
|
| |
| addOnloadHook(highlightRedirects.install);
| |
| }
| |
| //
| |
|
| |
|
| // -------------------------------------------------------- | | // -------------------------------------------------------- |