User:Langloisrg/monobook.js

Source: 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.
// Script from [[User:Wmahan/wpspell.js]]
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Wmahan/wpspell.js'
             + '&action=raw&ctype=text/javascript');

//Interiot's javascript edit counter
if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) {
  mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript'); }
// Script from [[User:Lupin/recent2.js]]
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js'
             + '&action=raw&ctype=text/javascript');
// [[User:Lupin/popups.js]]

mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
             + '&action=raw&ctype=text/javascript');

$(function () {
    var query_prefix = "title=Special:Watchlist&action=submit&remove=1&id[]=";
    //var query_prefix = "action=unwatch&title=";

    if (window.location.href.indexOf("Special:Watchlist") < 0) return;
    if (window.location.href.indexOf("Special:Watchlist/edit") >= 0) return;

    var links = document.getElementById('content').getElementsByTagName('a');
    for (var i = 0; i < links.length; i++) {
        if (links[i].href.substring(links[i].href.length-15) != '&action=history')
            continue;
        var unwatch = document.createElement('a');
        unwatch.href = "/w/index.php?" + query_prefix + encodeURIComponent(links[i].title);
        unwatch.title = "Unwatch "+links[i].title;
        unwatch.appendChild(document.createTextNode("unwatch"));
        links[i].parentNode.insertBefore(unwatch, links[i].nextSibling);
        // kluge to handle case where "diff" is unlinked:
        var delim = links[i].previousSibling;
        delim = (delim.nodeType == 3 ? delim.nodeValue : "");
        links[i].parentNode.insertBefore(document.createTextNode(delim.replace(/^.*diff/, "")), unwatch);
    }
});

// install [[User:Pilaf/Live_Preview]] page preview tool
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Pilaf/livepreview.js'
+ '&action=raw&ctype=text/javascript');

wikEdLoadRegExTypoFix = true;
wikEdRegExTypoFix = true;
// install [[User:Cacycle/wikEd]] in-browser text editor
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript');


importScript('User:Lupin/editcount.js'); //[[User:Lupin/editcount.js]]
popupEditCounterTool='custom';
popupEditCounterUrl='http://en.wikipedia.org/wiki/User:$1?ectarget=$1';

//Complete
importScript('Wikipedia:AutoEd/complete.js');

//Reword script
importScript('User:M/reword.js')

== Watchlist sorter ==
<pre> <nowiki>
Sorts your watchlist by namespace, and also adds spaces for readability.
*/
$(function (){
  if (location.href.indexOf('Special:Watchlist') == -1) return; //Are we on a watchlist?
  //days = document.getElementById('bodyContent').getElementsByTagName('ul');
  days = document.evaluate( //Hell knows how it works - found in "Dive into Greasemonkey"
    "//ul[@class='special']",
    document,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);
  for (d = 0; d < days.snapshotLength; d++) { //For each day
    day = days.snapshotItem(d);
    newday = document.createElement('ul'); //This will replace the old listing
    while ((diffs = day.getElementsByTagName('li')).length > 0) { //Are there any diffs left?
      //Try to extract the namespace
      As = diffs[0].getElementsByTagName('a');
      if (As[0].innerHTML == 'diff')
        pagename = As[2].innerHTML;
      else
        pagename = As[1].innerHTML;
      if (pagename.indexOf(':') == -1)
        namespace = 'Main';
      else
        namespace = pagename.split(':')[0]; //This will fail for articles which contain ":" in name
      hdrs = newday.getElementsByTagName('h5'); //Get the list of namespace headers
      hdr = null;
      for (j=0; j<hdrs.length; j++) //Find the header
        if (hdrs[j].innerHTML==namespace) {
          hdr = hdrs[j]; break;
        }
      if (hdr==null) { //Not found? Make a new one!
        hdr = document.createElement('h5');
        hdr.innerHTML = namespace;
        newday.appendChild(hdr);
        namespacesub = document.createElement('ul');
        newday.appendChild(namespacesub);
      }
      hdr.nextSibling.appendChild(diffs[0]); //Move the diff
    }
    newday.appendChild(document.createElement('hr')); //For readablility
    day.parentNode.replaceChild(newday,day);
  }
});

//Adds a link to the toolbox for determining page size
{{subst:js|User:Dr_pda/prosesize.js}}

//Helps with determining article history
{{subst:js|User:Dr pda/articlehistory.js}}

//Populates persondata based in data in the infobox}}
{{subst:js|User:Dr pda/persondata.js}}

//This function adds a link to the toolbox which, when clicked on a Category page, prompts for the name of a template,
//checks if the pages listed contain that template, and changes the bullet to a tick mark if so.
//To use this function add <nowiki>{{subst:js|User:Dr pda/templatecheck.js}}</nowiki> to your monobook.js
//
mw.loader.load('//en.wikipedia.org/w/index.php?title=User%3ADr+pda%2Ftemplatecheck.js&action=raw&ctype=text/javascript'); // [[User:Dr pda/templatecheck.js]]

// [[User:Ale_jrb/Scripts/igloo]]

mw.loader.load('//en.wikipedia.org/w/index.php?title=User%3AAle_jrb%2FScripts%2Figloo.js&action=raw&ctype=text/javascript'); // [[User:Ale_jrb/Scripts/igloo.js]]

importScript('User:Anomie/linkclassifier.js'); // Linkback: [[User:Anomie/linkclassifier.js]]
importStylesheet('User:Anomie/linkclassifier.css'); // Linkback: [[User:Anomie/linkclassifier.css]]

importScript('User:Anomie/pagestats.js'); // Linkback: [[User:Anomie/pagestats.js]]

importScript('User:Anomie/unwatch.js'); // Linkback: [[User:Anomie/unwatch.js]]

importScript('User:Anomie/util.js');
importScript('User:Anomie/useridentifier.js'); // Linkback: [[User:Anomie/useridentifier.js]]