MediaWiki:Common.js: Difference between revisions
From Heroes of Might and Magic: Olden Era Official Wiki
No edit summary Tag: Reverted |
No edit summary Tag: Manual revert |
||
| Line 27: | Line 27: | ||
mw.loader.using('mediawiki.util').then(function () { | mw.loader.using('mediawiki.util').then(function () { | ||
mw.util.addPortletLink( | mw.util.addPortletLink( | ||
'p- | 'p-tb', | ||
mw.util.getUrl(null, { | mw.util.getUrl(null, { | ||
action: 'purge', | action: 'purge', | ||
Revision as of 17:08, 7 May 2026
/* Any JavaScript here will be loaded for all users on every page load. */
$(function() {
var $box = $('#spellboxv-display');
$('.spell-link').hover(
function() {
var spellName = $(this).data('spell');
var apiUrl = mw.util.wikiScript('api');
$.post(apiUrl, {
action: 'parse',
format: 'json',
text: '{{#invoke:SpellTableUtil|spellBoxV|name=' + spellName + '}}',
contentmodel: 'wikitext'
}, function(data) {
var html = data.parse.text['*'];
$box.html(html).show();
});
},
function() {
$box.hide().empty();
}
);
});
/* Purge cache button for the toolbox sidebar. */
mw.loader.using('mediawiki.util').then(function () {
mw.util.addPortletLink(
'p-tb',
mw.util.getUrl(null, {
action: 'purge',
forcelinkupdate: 1
}),
'Update page cache',
't-purge'
);
});


