MediaWiki:Gadget-modrollback.js

From AnOtherWiki, the free encyclopedia written by, for, and about the Otherkin community.

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)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
// From [[Wikipedia:MediaWiki:Gadget-modrollback.js]]
addOnloadHook(function() {
 var ds = document.getElementsByTagName('td');
  for(var i=0; i<ds.length; i++) {
   var a = ds[i];
   if(a.className == 'diff-ntitle') {
    var fs = a.getElementsByTagName('a');
    for(var j=0; j<fs.length; j++) {
     var b = fs[j];
     if(b.firstChild.data == 'rollback') {
      var oldhref = ''+b.href;
      var usr = b.href.split('from=')[1].split('&')[0];
      var cont = wgServer + wgScript + '?title=Special:Contributions/' + usr;
      b.href = 'javascript:void(0)';
      b.onclick = function() {
      var http = sajax_init_object();
      http.open('GET', oldhref, true);
      http.setRequestHeader("Connection", "close");
      http.send(null);
      http.onreadystatechange= function() {
      window.location.href = (cont);
      }
     }
    }
   }
  }
 }
})