Site Notice |
---|
We have a limited coverage policy. Please check our coverage page to see which articles are allowed. |
Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
m (Created page with "→Any JavaScript here will be loaded for all users on every page load.: →Collapsible Tables: if ( wgIsArticle || window.location.href.indexOf( 'action=submit' ) > -1 ) { ...") |
m |
||
Line 1: | Line 1: | ||
− | / | + | // -------------------------------------------------------- |
− | / | + | // addPurge |
− | + | // adds a "purge" tab (after "watch") | |
− | if ( | + | // -------------------------------------------------------- |
− | { | + | 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'); | ||
} | } | ||
+ | }); | ||
+ | // |
Revision as of 03:52, 21 November 2010
// -------------------------------------------------------- // 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'); } }); //