User:TheDragonFire/scripts/steamroller.js

// // // steamroller.js - Your standard roller on steroids. // // To install, place User:TheDragonFire/scripts/steamroller.js on Special:MyPage/Common.js. //

mw.loader.using(['oojs-ui-core', 'oojs-ui-windows'], function { $('.mw-rollback-link a').click(function(event) { event.preventDefault; var count = event.target.innerText.match(/\d+/) ? event.target.innerText.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/' + mw.util.getParamValue('from', event.target.href).replace(/\+/g, '_')) + '?vanarticle=' + encodeURIComponent(mw.util.getParamValue('title', event.target.href).replace(/_/g, ' ')); },       error: function { event.target.text(function(index, text) {           return text + ' [failed]';          }); }     });    });  }); });

//