User:Incnis Mrsi/wipe.js

var troublemaker = "121.222.190.130"; // "76.189.109.155"; var substantiation = "Dickery"; // "Sanctions"; // This script mostly improves edit summaries referring to the aforementioned user, in three ways. // First, it adds a meaningful edit summary to all respective // rollback links generated with MediaWiki interface. Modified links become boldfaced. // In edit mode, it provides a button that removes all lines signed by the troublemaker. // The script also enriches edit summaries for action=edit&undo=…

// Feel free to use it via //   importScript('User:Incnis Mrsi/wipe.js'); // from your personal script.

var summaryBox; // document.getElementById("wpSummary")

// var WipeHim = new RegExp('^.+\\[\\[User talk:'+troublemaker+'\\|talk\\]\\]\\) [0-2][0-9]:[0-5][0-9], [0-9]{1,2} [JFMASOND][a-z]+ 201[3-9] \\(UTC\\)$',"mg");

// function wipe_em_out { //	var wpTextbox1 = document.editform.wpTextbox1; //	var text = wpTextbox1.value; //	wpTextbox1.value = text.replace(WipeHim,""); //       var summ = summaryBox.value; //       if ( //           (summ == '') //        || summ.match(/^\/\*.+\*\/ *$/) //        ) { //          summaryBox.value = summ + substantiation + //           ': removed posts of ' + troublemaker + //            ' (talk) using user:Incnis Mrsi/wipe.js'; //       } // }

function wipe_init { summaryBox = document.getElementById("wpSummary"); if (summaryBox) { var summ = summaryBox.value; if (        (summ.substr(0,15) == 'Undid revision ')      && (summ.indexOf('') > 0)    ) {      summaryBox.value = substantiation + ': ' + summ;    } //    var editForm = document.getElementById( 'editform' ); //    if (editForm.wpTextbox1.value.indexOf('([[User talk:'+troublemaker+'|talk)') >= 0) { //	var button = document.createElement( 'a' ); //	button.id = 'wipe-out'; //	button.title = 'Wipe '+troublemaker+' out'; //	button.href = 'javascript:wipe_em_out;'; //	button.innerHTML = ' ' + troublemaker + ' '; //	editForm.appendChild(button); //    }  }  else {    var links = document.getElementById('mw-content-text').getElementsByTagName('a');    for (var i in links) {      var URL = links[i].href;      if ( URL && ( URL.indexOf('&action=rollback&from='+troublemaker) >= 0 ) ) {        links[i].href += '&summary=' + substantiation +          ':%20removed%20edits%20of%20' + troublemaker +          '%20(talk)%20using%20user:Incnis_Mrsi/wipe.js';        if ( links[i].style ) {           links[i].style.fontWeight = 600;        }      }    }  } };

addOnloadHook(wipe_init);