Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
importScript('User:Lourdes/PageCuration.js'); // Linkback: [[User:Lourdes/PageCuration.js]]
importScript('User:Jackmcbarn/editProtectedHelper.js'); // Linkback: [[User:Jackmcbarn/editProtectedHelper.js]]
importScript('Wikipedia:AutoEd/complete.js'); // Linkback: [[Wikipedia:AutoEd/complete.js]]
importScript('User:Lourdes/PageCuration.js'); // Linkback: [[User:Lourdes/PageCuration.js]]
importScript('User:Jackmcbarn/editProtectedHelper.js'); // Linkback: [[User:Jackmcbarn/editProtectedHelper.js]]
importScript('Wikipedia:AutoEd/complete.js'); // Linkback: [[Wikipedia:AutoEd/complete.js]]
mw.loader.using(['oojs-ui-core', 'oojs-ui-windows'], function() {
$('.mw-rollback-link').click(function(event) {
event.preventDefault();
var targetText = $(event.target).text();
var count = targetText.match(/\d/) ? targetText.match(/\d+/)[0] : null;
var message = 'Roll back ' + (count ? count + ' edits' : 'edit') + ' by ' + mw.util.getParamValue('from', event.target.href) + '?';
OO.ui.confirm(message, {
title: 'Confirm rollback',
actions: [{
action: 'accept',
label: OO.ui.deferMsg('ooui-dialog-message-accept'),
flags: ['primary', 'destructive']
},
{
action: 'reject',
label: OO.ui.deferMsg('ooui-dialog-message-reject'),
flags: 'safe'
}
]
}).done(function(confirmed) {
if (!confirmed) return;
$.ajax({
url: event.target.href,
success: function() {
location.href = mw.util.getUrl('Special:Contributions/' + user.replace(/\+/g, '_')) + '?vanarticle=' + encodeURIComponent(mw.util.getParamValue('title', event.target.href).replace(/_/g, ' '));
},
error: function() {
event.target.text(function(i, val) {
return val + ' [failed]';
});
}
});
});
});
});