MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 17: | Line 17: | ||
var html = data.parse.text['*']; | var html = data.parse.text['*']; | ||
$('.mw-parser-output').prepend(html); | $('.mw-parser-output').prepend(html); | ||
$('.mw-parser-output').prepend('\n'); | |||
} | } | ||
} | } | ||
}); | }); | ||
}); | }); | ||
Revision as of 22:21, 21 April 2026
mw.hook('wikipage.content').add(function () {
var cats = mw.config.get('wgCategories');
if (!cats || cats.indexOf('Archive') === -1) return;
// Call the MediaWiki API to parse the template
$.ajax({
url: mw.util.wikiScript('api'),
data: {
action: 'parse',
text: '{{Archived}}',
contentmodel: 'wikitext',
format: 'json'
},
dataType: 'json',
success: function (data) {
if (data.parse && data.parse.text) {
var html = data.parse.text['*'];
$('.mw-parser-output').prepend(html);
$('.mw-parser-output').prepend('\n');
}
}
});
});