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.
/**
* Anchored Rollback
* @description Perform rollbacks without changing location
* @author Ozank
*/
(function() {
if (window.AnchoredRollbackLoaded) {
return;
}
window.AnchoredRollbackLoaded = true;
var config = mw.config.get([
'stylepath',
'wgUserGroups'
]),
isBot = config.wgUserGroups.indexOf('bot') !== -1 ||
window.anchoredRollbackBot,
msg;
function click(e) {
var $this = $(this),
href = new URL($this.attr('href'), location.href);
// validate that link is a rollback link for current wiki
if (
href.hostname !== location.hostname ||
href.searchParams.get('action') !== 'rollback'
) {
return;
}
e.preventDefault();
if (isBot) {
href.searchParams.set("bot", 1);
}
$this.addClass('mw-ajax-loader');
$.ajax(href.toString(), {
dataType: 'text'
}).done(function() {
$this
.css({
'color': 'var(--theme-page-text-mix-color, gray)',
'text-decoration': 'line-through'
})
.removeAttr('href title')
.text(msg)
.removeClass('mw-ajax-loader');
});
}
function init(i18n) {
msg = i18n.msg('rollbacked').plain();
$(document.body).on('click', '.mw-rollback-link > a[href]', click);
}
importArticle({
type: 'script',
article: 'u:dev:MediaWiki:I18n-js/code.js'
});
mw.hook('dev.i18n').add(function(i18no) {
i18no.loadMessages('AnchoredRollback').then(init);
});
})();