MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
(Created page with "→Any JavaScript here will be loaded for all users on every page load.: →Display banner on archived pages: mw.hook('wikipage.content').add(function() { var cats = mw.config.get('wgCategories'); if (cats && cats.indexOf('Your Category Name') !== -1) { $('.mw-parser-output').prepend( '<div class="category-notice">This article is archived. It is either extremely out of date or no longer relevant. </div>' ); } });") |
No edit summary |
||
| Line 3: | Line 3: | ||
mw.hook('wikipage.content').add(function() { | mw.hook('wikipage.content').add(function() { | ||
var cats = mw.config.get('wgCategories'); | var cats = mw.config.get('wgCategories'); | ||
if (cats && cats.indexOf(' | if (cats && cats.indexOf('Archive') !== -1) { | ||
$('.mw-parser-output').prepend( | $('.mw-parser-output').prepend( | ||
'<div class="category-notice">This article is archived. It is either extremely out of date or no longer relevant. </div>' | '<div class="category-notice">This article is archived. It is either extremely out of date or no longer relevant. </div>' | ||
Revision as of 22:14, 21 April 2026
/* Any JavaScript here will be loaded for all users on every page load. */
/* Display banner on archived pages */
mw.hook('wikipage.content').add(function() {
var cats = mw.config.get('wgCategories');
if (cats && cats.indexOf('Archive') !== -1) {
$('.mw-parser-output').prepend(
'<div class="category-notice">This article is archived. It is either extremely out of date or no longer relevant. </div>'
);
}
});