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.
// [[User:Lupin/popups.js]] - please include this line 
mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');
popupSubpopups=true;
popupFixDabs=true;
popupThumbAction="sizetoggle";
popupAdminLinks=true;
popupDragHandle='popupTopLinks';

function addlilink(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;
}

/***********************************************************************
                         EDIT SECTION ZERO
***********************************************************************/
// [[Wikipedia:WikiProject_User_scripts/Scripts/Add_edit_section_0]]
 
//If you are not editing a page, a tab will appear allowing you to eidt the 
// 0th section of a page (the top area usually used as an introduction.

/* Edit section zero caption button */
$(function () {
   var x;
   if (!(x = document.getElementById('ca-edit') )) return;
   var url;
   if (!(url = x.getElementsByTagName('a')[0] )) return;
   if (!(url = url.href )) return;
   var y = mw.util.addPortletLink('p-cactions', url+"&section=0", '0', 'ca-edit-0',
                          'Edit the lead section of this page', '0', x.nextSibling);
   y.className = x.className;  // steal classes from the the edit tab...
   x.className = 'istalk';     // ...and make the edit tab have no right margin
   // exception: don't steal the "selected" class unless actually editing section 0:
   if (/(^| )selected( |$)/.test(y.className)) {
       if (!document.editform || !document.editform.wpSection
           || document.editform.wpSection.value != "0") {
           y.className = y.className.replace(/(^| )selected( |$)/g, "$1");
           x.className += ' selected';
       }
   }
});
/* End */
//////////////

/***********************************************************************
                          VANDAL VARNINGS
***********************************************************************/
// BASED ON User:Pilotguy/whackamole.js
// To fight vandalism
// **************
// 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 += 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"+":test|}}", "{{subst"+":test}}", "Experimenting");
}

function whackTestart  () {
whackEdit ("{{subst"+":testarticle|}}", "{{subst"+":testarticle}}", "Test Article");
}

function whackWarn2  () {
whackEdit ("{{subst"+":test2|}}", "{{subst"+":test2}}", "Nonsense edit"); 
}

function whackWarn2a  () {
whackEdit ("{{subst"+":test2a|}}", "{{subst"+":test2a}}", "Removing content"); 
}

function whackWarn3  () {
whackEdit ("{{subst"+":test3|}}", "{{subst"+":test3}}", "Please stop vandalizing");
}

function whackWarn4  () {
whackEdit ("{{subst"+":test4|}}", "{{subst"+":test4}}", "Last chance to stop vandalising");
}

function whackOnlyWarning  () {
whackEdit ("{{subst"+":test4im|}}", "{{subst"+":test4im}}", "Last chance to stop vandalising");
}

function whackBlocked() {
whackEdit ("{{subst"+":block}}", "", "Blocked"); 
}

function whackBlocked2() {
whackEdit ("{{subst"+":block2}}", "", "Blocked temp"); 
}

function whackSpam   () {
whackEdit ("{{subst"+":spam|}}", "{{subst"+":spam}}", "Don't spam");
}

// **************************************************
// 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:{whackTestart();};void(0);',
     'Warn Test Article', 'toolbox_warn1');
   whack_addToolboxLink('javascript:{whackWarn2();};void(0);',
     'Warn Nonsense', 'toolbox_warn2');
   whack_addToolboxLink('javascript:{whackWarn2a();};void(0);',
     'Warn Don\'t remove', 'toolbox_warn2a');
   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:{whackOnlyWarning();};void(0);',
     'Only warning', 'toolbox_onlywarning');
   whack_addToolboxLink('javascript:{whackSpam ();};void(0);',
     'Warn Spam', 'toolbox_spam');
   whack_addToolboxLink('javascript:{whackBlocked();};void(0);',
     'Warn Blocked1', 'toolbox_block1');
   whack_addToolboxLink('javascript:{whackBlocked2();};void(0);',
     'Warn Blocked2', 'toolbox_block2');

 } else {
   whack_addToolboxLink('http://simple.wikipedia.org/wiki/Special:Wantedpages',
     'Wanted pages', 'toolbox_wantedpages');
   whack_addToolboxLink('http://simple.wikipedia.org/wiki/Special:Wantedcategories',
     'Wanted cats', 'toolbox_wantedcats');
   whack_addToolboxLink('http://simple.wikipedia.org/wiki/Special:Shortpages',
     'Short pages', 'toolbox_shortpages');
   whack_addToolboxLink('http://simple.wikipedia.org/wiki/Special:Withoutinterwiki',
     'Without iw', 'toolbox_uncatpages');
   whack_addToolboxLink('http://simple.wikipedia.org/wiki/Special:Uncategorizedpages',
     'Uncat pages', 'toolbox_uncatpages');
 }
}

// onload 
window.simpleAddOnload=function(f) {
  if (window.addEventListener) window.addEventListener("load", f, false);
  else if (window.attachEvent) window.attachEvent("onload",f);
}

simpleAddOnload(playWhackMoles);