Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/**
* ChangeModelButton.js
* @author MonkeysHK <https://dev.fandom.com/wiki/User:MonkeysHK>
* @license CC-BY-SA 3.0
*/
$.when(mw.loader.using(['mediawiki.api', 'mediawiki.jqueryMsg']), mw.hook('wikipage.content'))
.then(function () {
return new mw.Api().loadMessagesIfMissing(['changecontentmodel-legend']);
})
.then(function () {
var config = mw.config.get([
'wgIsArticle',
'wgPageName',
'wgUserGroups',
]);
if (
!config.wgIsArticle ||
window.ChangeModelButtonLoaded ||
!/content-moderator|sysop|soap|wiki-specialist|staff/.test(config.wgUserGroups.join('\n'))
) {
return;
}
window.ChangeModelButtonLoaded = true;
if ($(".page-header__actions .wds-dropdown a:contains(Change content model)").length === 0)
$('.page-header__contribution-buttons .wds-list, .page-header__actions .wds-list').first().append(
$('<li>').append(
$('<a>', {
text: mw.msg('changecontentmodel-legend'),
href: new mw.Title('ChangeContentModel', -1).getUrl({
pagetitle: config.wgPageName.replaceAll('_', ' ')
}),
})
)
);
});