Jump to content

User:Andy M. Wang/warn.js

From Wikipedia, the free encyclopedia
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.
 // Modified from [[User:Kbh3rd/Vandal warning toolbox]].
 // Templates have been changed, upgraded, and increased.
 // Better formatting.
 // Google is quite useless, and it is removed.
 // CHANGES MADE IN THIS FILE AFFECTS ME AND EVERYONE ELSE WHO MAY USE IT. Be careful.
 
 // <pre><nowiki>
 
 function whackEdit (message, msg2, summary) {
    var f = document.editform ;
    var tbox = document.editform.wpTextbox1 ;
    var a = "" + (window.getSelection ? window.getSelection()
                                      : document.getSelection ? document.getSelection()
                                                              : document.selection.createRange().text);
    if (msg2 != "") {
      a = prompt ("Enter article or user name implied. Only clicking OK gives generic message.", a) ;
      if (a == null) return ;
      if (a != null && a != "") {
        message = message.replace(/\|/,"|"+a) ;
        summary += ": [[" + a + "]]" ;
      } else {
        message = msg2 ;
      }
    }
    f.wpTextbox1.value += "\n\n" + message + " ~~~~ \n" ;
    f.wpSummary.value = summary ;
    f.wpMinoredit.checked=false;
    f.wpWatchthis.checked=false;
    f.wpTextbox1.focus();
    if (f.wpTextbox1.scrollTop || true) f.wpTextbox1.scrollTop = f.wpTextbox1.scrollHeight ;
 }
 
 function whackWarn1   () { whackEdit ("{{subst:uw-vandalism1|}}",   "{{subst:uw-vandalism1}}",   "Uw-v1"); }
 function whackWarn2   () { whackEdit ("{{subst:uw-vandalism2|}}",   "{{subst:uw-vandalism2}}",   "Uw-v2"); }
 function whackWarn3   () { whackEdit ("{{subst:uw-vandalism3|}}",   "{{subst:uw-vandalism3}}",   "Uw-v3"); }
 function whackWarn4   () { whackEdit ("{{subst:uw-vandalism4|}}",   "{{subst:uw-vandalism4}}",   "Uw-v4"); }
 function whackWarn4im () { whackEdit ("{{subst:uw-vandalism4im|}}", "{{subst:uw-vandalism4im}}", "Uw-v4im"); }
 function whackBv      () { whackEdit ("{{subst:uw-bv|}}",           "{{subst:uw-bv}}",           "Uw-bv"); }
 function whackDelete1 () { whackEdit ("{{subst:uw-delete1|}}",      "{{subst:uw-delete1}}",      "Uw-delete1"); }
 function whackDelete2 () { whackEdit ("{{subst:uw-delete2|}}",      "{{subst:uw-delete2}}",      "Uw-delete2"); }
 function whackDelete3 () { whackEdit ("{{subst:uw-delete3|}}",      "{{subst:uw-delete3}}",      "Uw-delete3"); }
 function whackDelete4 () { whackEdit ("{{subst:uw-delete4|}}",      "{{subst:uw-delete4}}",      "Uw-delete4"); }
 function whackDelete4im () { whackEdit ("{{subst:uw-delete4im|}}",  "{{subst:uw-delete4im}}",    "Uw-delete4im"); }
 function whackJoke1   () { whackEdit ("{{subst:uw-joke1|}}",        "{{subst:uw-joke1}}",        "Uw-joke1"); }
 function whackJoke2   () { whackEdit ("{{subst:uw-joke2|}}",        "{{subst:uw-joke2}}",        "Uw-joke2"); }
 function whackJoke3   () { whackEdit ("{{subst:uw-joke3|}}",        "{{subst:uw-joke3}}",        "Uw-joke3"); }
 function whackJoke4   () { whackEdit ("{{subst:uw-joke4|}}",        "{{subst:uw-joke4}}",        "Uw-joke4"); }
 function whackCreate1 () { whackEdit ("{{subst:uw-create1|}}",      "{{subst:uw-create1}}",      "Uw-create1"); }
 function whackCreate2 () { whackEdit ("{{subst:uw-create2|}}",      "{{subst:uw-create2}}",      "Uw-create2"); }
 function whackCreate3 () { whackEdit ("{{subst:uw-create3|}}",      "{{subst:uw-create3}}",      "Uw-create3"); }
 function whackCreate4 () { whackEdit ("{{subst:uw-create4|}}",      "{{subst:uw-create4}}",      "Uw-create4"); }
 function whackMove1   () { whackEdit ("{{subst:uw-move1|}}",        "{{subst:uw-move1}}",        "Uw-move1"); }
 function whackMove2   () { whackEdit ("{{subst:uw-move2|}}",        "{{subst:uw-move2}}",        "Uw-move2"); }
 function whackMove3   () { whackEdit ("{{subst:uw-move3|}}",        "{{subst:uw-move3}}",        "Uw-move3"); }
 function whackMove4   () { whackEdit ("{{subst:uw-move4|}}",        "{{subst:uw-move4}}",        "Uw-move4"); }
 function whackUpv1    () { whackEdit ("{{subst:uw-upv1|}}",         "{{subst:uw-upv1}}",         "Uw-upv1"); }
 function whackUpv2    () { whackEdit ("{{subst:uw-upv2|}}",         "{{subst:uw-upv2}}",         "Uw-upv2"); }
 function whackUpv3    () { whackEdit ("{{subst:uw-upv3|}}",         "{{subst:uw-upv3}}",         "Uw-upv3"); }
 function whackUpv4    () { whackEdit ("{{subst:uw-upv4|}}",         "{{subst:uw-upv4}}",         "Uw-upv4"); }
 function whackSpam1   () { whackEdit ("{{subst:uw-spam1|}}",        "{{subst:uw-spam1}}",        "Uw-spam1"); }
 function whackSpam2   () { whackEdit ("{{subst:uw-spam2|}}",        "{{subst:uw-spam2}}",        "Uw-spam2"); }
 function whackSpam3   () { whackEdit ("{{subst:uw-spam3|}}",        "{{subst:uw-spam3}}",        "Uw-spam3"); }
 function whackSpam4   () { whackEdit ("{{subst:uw-spam4|}}",        "{{subst:uw-spam4}}",        "Uw-spam4"); }
 function whackSpam4im () { whackEdit ("{{subst:uw-spam4im|}}",      "{{subst:uw-spam4im}}",      "Uw-spam4im"); }
 function whackNpov1   () { whackEdit ("{{subst:uw-npov1|}}",        "{{subst:uw-npov1}}",        "Uw-npov1"); }
 function whackNpov2   () { whackEdit ("{{subst:uw-npov2|}}",        "{{subst:uw-npov2}}",        "Uw-npov2"); }
 function whackNpov3   () { whackEdit ("{{subst:uw-npov3|}}",        "{{subst:uw-npov3}}",        "Uw-npov3"); }
 function whackNpov4   () { whackEdit ("{{subst:uw-npov4|}}",        "{{subst:uw-npov4}}",        "Uw-npov4"); }
 function whackNpa1   () { whackEdit ("{{subst:uw-npa1|}}",        "{{subst:uw-npa1}}",        "Uw-npa1"); }
 function whackNpa2   () { whackEdit ("{{subst:uw-npa2|}}",        "{{subst:uw-npa2}}",        "Uw-npa2"); }
 function whackNpa3   () { whackEdit ("{{subst:uw-npa3|}}",        "{{subst:uw-npa3}}",        "Uw-npa3"); }
 function whackNpa4   () { whackEdit ("{{subst:uw-npa4|}}",        "{{subst:uw-npa4}}",        "Uw-npa4"); }
 function whackNpa4im () { whackEdit ("{{subst:uw-npa4im|}}",      "{{subst:uw-npa4im}}",      "Uw-npa4im"); }
 
 window.whack_addlilink=function(tabs, url, name, id, title, key){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    if(id) {
      if(key && title) ta[id] = [key, title];
      else if(key)     ta[id] = [key, ''];
      else if(title)   ta[id] = ['', title];
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
 }
 
 window.whack_addToolboxLink=function(url, name, id){
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    whack_addlilink(tb, url, name, id);
 }
 
 window.playWhackMoles=function() {
 
  if (document.title.match("Editing User talk:") ) {
    whack_addToolboxLink('javascript:{whackWarn1();};void(0);',   'Uw-v1',   'toolbox_warn1');
    whack_addToolboxLink('javascript:{whackWarn2();};void(0);',   'Uw-v2',   'toolbox_warn2');
    whack_addToolboxLink('javascript:{whackWarn3();};void(0);',   'Uw-v3',   'toolbox_warn3');
    whack_addToolboxLink('javascript:{whackWarn4();};void(0);',   'Uw-v4',   'toolbox_warn4');
    whack_addToolboxLink('javascript:{whackWarn4im();};void(0);', 'Uw-v4im', 'toolbox_warn4im');
    whack_addToolboxLink('javascript:{whackBv();};void(0);',      'Bv',      'toolbox_bv');
    whack_addToolboxLink('javascript:{whackDelete1();};void(0);', 'Delete1', 'toolbox_delete1');
    whack_addToolboxLink('javascript:{whackDelete2();};void(0);', 'Delete2', 'toolbox_delete2');
    whack_addToolboxLink('javascript:{whackDelete3();};void(0);', 'Delete3', 'toolbox_delete3');
    whack_addToolboxLink('javascript:{whackDelete4();};void(0);', 'Delete4', 'toolbox_delete4');
    whack_addToolboxLink('javascript:{whackDelete4im();};void(0);', 'Delete4im', 'toolbox_delete4im');
    whack_addToolboxLink('javascript:{whackJoke1();};void(0);',   'Joke1',   'toolbox_joke1');
    whack_addToolboxLink('javascript:{whackJoke2();};void(0);',   'Joke2',   'toolbox_joke2');
    whack_addToolboxLink('javascript:{whackJoke3();};void(0);',   'Joke3',   'toolbox_joke3');
    whack_addToolboxLink('javascript:{whackJoke4();};void(0);',   'Joke4',   'toolbox_joke4');
    whack_addToolboxLink('javascript:{whackCreate1();};void(0);', 'Create1', 'toolbox_create1');
    whack_addToolboxLink('javascript:{whackCreate2();};void(0);', 'Create2', 'toolbox_create2');
    whack_addToolboxLink('javascript:{whackCreate3();};void(0);', 'Create3', 'toolbox_create3');
    whack_addToolboxLink('javascript:{whackCreate4();};void(0);', 'Create4', 'toolbox_create4');
    whack_addToolboxLink('javascript:{whackMove1();};void(0);',   'Move1', 'toolbox_move1');
    whack_addToolboxLink('javascript:{whackMove2();};void(0);',   'Move2', 'toolbox_move2');
    whack_addToolboxLink('javascript:{whackMove3();};void(0);',   'Move3', 'toolbox_move3');
    whack_addToolboxLink('javascript:{whackMove4();};void(0);',   'Move4', 'toolbox_move4');
    whack_addToolboxLink('javascript:{whackUpv1();};void(0);',    'Upv1',    'toolbox_upv1');
    whack_addToolboxLink('javascript:{whackUpv2();};void(0);',    'Upv2',    'toolbox_upv2');
    whack_addToolboxLink('javascript:{whackUpv3();};void(0);',    'Upv3',    'toolbox_upv3');
    whack_addToolboxLink('javascript:{whackUpv4();};void(0);',    'Upv4',    'toolbox_upv4');
    whack_addToolboxLink('javascript:{whackSpam1();};void(0);',   'Spam1',   'toolbox_spam1');
    whack_addToolboxLink('javascript:{whackSpam2();};void(0);',   'Spam2',   'toolbox_spam2');
    whack_addToolboxLink('javascript:{whackSpam3();};void(0);',   'Spam3',   'toolbox_spam3');
    whack_addToolboxLink('javascript:{whackSpam4();};void(0);',   'Spam4',   'toolbox_spam4');
    whack_addToolboxLink('javascript:{whackSpam4im();};void(0);', 'Spam4im', 'toolbox_spam4im');
    whack_addToolboxLink('javascript:{whackNpov1();};void(0);',   'Npov1',   'toolbox_npov1');
    whack_addToolboxLink('javascript:{whackNpov2();};void(0);',   'Npov2',   'toolbox_npov2');
    whack_addToolboxLink('javascript:{whackNpov3();};void(0);',   'Npov3',   'toolbox_npov3');
    whack_addToolboxLink('javascript:{whackNpov4();};void(0);',   'Npov4',   'toolbox_npov4');
    whack_addToolboxLink('javascript:{whackNpa1();};void(0);',   'Npa1',   'toolbox_npa1');
    whack_addToolboxLink('javascript:{whackNpa2();};void(0);',   'Npa2',   'toolbox_npa2');
    whack_addToolboxLink('javascript:{whackNpa3();};void(0);',   'Npa3',   'toolbox_npa3');
    whack_addToolboxLink('javascript:{whackNpa4();};void(0);',   'Npa4',   'toolbox_npa4');
    whack_addToolboxLink('javascript:{whackNpa4im();};void(0);',   'Npa4im',   'toolbox_npa4im');
 
  }
 }
 
 // onload 
 window.simpleAddOnload=function(f) {
   if (window.addEventListener) window.addEventListener("load", f, false);
   else if (window.attachEvent) window.attachEvent("onload",f);
 }
 
 simpleAddOnload(playWhackMoles);
 
 // </nowiki></pre>