User:Kyoko/monobook.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure whether the code is safe, you can ask at the appropriate village pump.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
// Script from [[User:Lupin/recent2.js]]
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 //
 // Edit tools for the vandal whack-a-mole game
/*
 
 Put some functions in the toolbox for the anti-vandal whack-a-mole game.
 Documented at http://en.wikipedia.org/wiki/User:Kbh3rd/Vandal_warning_toolbox
 
 */
 // <pre><nowiki>
 
 
 // ****************
 //  Google Lookup
 // ****************
 function whackGoogleLookup () {
    var q = "" + (window.getSelection ? window.getSelection()
                                      : document.getSelection ? document.getSelection()
                                                              : document.selection.createRange().text);
    if (!q)
        q = prompt("You didn't select any text.  Enter a search phrase:", "");
    if (q!=null)
        // location="http://www.google.com/search?q=" + escape(q).replace(/ /g, "+");
        window.open("http://www.google.com/search?q=" + escape(q).replace(/ /g, "+") ,'new-tab') ;
 }
 
 // **************
 // Warnings
 // **************
 
 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 ("Article name?\n(Empty+OK for a generic message.)\n(Cancel now aborts.)", a) ;
      if (a == null) return ;
      if (a != null && a != "") {
        message = message.replace(/\|/,"|"+a) ;
        summary += " in [[" + a + "]]" ;
      } else {
        message = msg2 ;
      }
    }
    f.wpTextbox1.value += "\n\n" + message + " ~~~~ <br clear=\"both\">\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:User:Kyoko/warning 1|}}",    "{{subst:User:Kyoko/warning 1}}",   "1. Experimenting"); }
 function whackSelf   () { whackEdit ("{{subst:User:Kyoko/warning 1s|}}", "{{subst:User:Kyoko/warning 1s}}","1s. Self-reverted test"); }
 function whackWarn2  () { whackEdit ("{{subst:User:Kyoko/warning 2|}}",    "{{subst:User:Kyoko/warning 2}}",   "2. Unhelpful edit"); }
 function whackWarn3  () { whackEdit ("{{subst:User:Kyoko/warning 3|}}",    "{{subst:User:Kyoko/warning 3}}",   "3. Please stop vandalising"); }
 function whackWarn4  () { whackEdit ("{{subst:User:Kyoko/warning 4|}}",    "{{subst:User:Kyoko/warning 4}}",   "4. Last chance to stop vandalising"); }
 function whackBlank  () { whackEdit ("{{subst:User:Kyoko/warning 2b|}}",   "{{subst:User:Kyoko/warning 2b}}",  "2a. Blanking"); }
 function whackBlatant() { whackEdit ("{{subst:User:Kyoko/warning bv|}}",       "{{subst:User:Kyoko/warning bv}}",      "Blatant vandalism"); }
 function whackBlocked() { whackEdit ("{{subst:vblock}}",      "",                  "Blocked"); }
 function whackSpam   () { whackEdit ("{{subst:uw-spam2|}}",     "{{subst:uw-spam2}}",    "Spam"); }
 function whackSmile   () { whackEdit ("{{subst:User:Kyoko/Smile|}}",   "{{subst:User:Kyoko/Smile}}", "Smile"); }
 function whackHug   () { whackEdit ("{{subst:User:Kyoko/Hug|}}",   "{{subst:User:Kyoko/Hug}}", "A hug for your edits"); }
 
 function whackBlocked2(){whackEdit ("[[Image:Modern_clock_chris_kemps_01.png|left|32px]]"
      + "You have been temporarily [[Wikipedia:Blocking policy|blocked from editing]] because of your disruptive edits."
      + " You are [[Wikipedia:Contributing to Wikipedia|invited to contribute]]"
      + " in a [[Wikipedia:Five pillars|constructive manner]] as soon as the block expires.", "", "Blocked"); }
 
 // **************************************************
 // Installation
 // **************************************************
 
 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);',   'warn Test', 'toolbox_warn1');
    whack_addToolboxLink('javascript:{whackSelf ();};void(0);',   'warn Self Test', 'toolbox_selftest');
    whack_addToolboxLink('javascript:{whackWarn2();};void(0);',   'warn Unhelpful', 'toolbox_warn2');
    whack_addToolboxLink('javascript:{whackWarn3();};void(0);',   'warn Please stop', 'toolbox_warn3');
    whack_addToolboxLink('javascript:{whackWarn4();};void(0);',   'warn Last chance', 'toolbox_warn4');
    whack_addToolboxLink('javascript:{whackBlank();};void(0);',   'warn Blanking', 'toolbox_warn2a');
    whack_addToolboxLink('javascript:{whackBlatant();};void(0);', 'warn Blatant', 'toolbox_blatant');
    whack_addToolboxLink('javascript:{whackBlocked2();};void(0);','warn *BLOCKED*', 'toolbox_block');
    whack_addToolboxLink('javascript:{whackSpam ();};void(0);',   'warn Spam', 'toolbox_spam');
    whack_addToolboxLink('javascript:{whackSmile ();};void(0);','warn Smile', 'toolbox_smile');
    whack_addToolboxLink('javascript:{whackHug ();};void(0);','warn Hug', 'toolbox_hug');
  } else {
    whack_addToolboxLink('javascript:{whackGoogleLookup();};void(0);', 'Google', 'toolbox_googlelookup');
  }
 }
 
 
 // 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>
 //
// [[User:Lupin/popups.js]]
 
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
popupDelay=0.3
popupImages=false;
popupRevertSummaryPrompt=true;
//
//
//Back-up edit counter
//Visit [[User:Interiot/Tool2/code.js]] in emergencies!
document.write('<script type="text/javascript" src="' 
    + 'http://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js' 
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
// Script from [[User:ais523/editcount.js]]
importScript('User:ais523/editcount.js'); //[[User:ais523/editcount.js]]
 
importScript('User:Omegatron/monobook.js/addlink.js'); //[[User:Omegatron/monobook.js/addlink.js]]
 
importScript('User:Gimmetrow/fixRefs.js'); //[[User:Gimmetrow/fixRefs.js]]