Jump to content

User:Btphelps/modern.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.
/* Invoke citation bot */
importScript('User:Smith609/citations.js');

/* Mark blocked users */
importScript('User:NuclearWarfare/Mark-blocked_script.js');

/* Fix common link formatting errors */
importScript('User:Magnus_Manske/LinkFixr.js');

/* Fix common formatting issues*/
importScript('User:Ohconfucius/script/Common Terms.js');

/* Fix common formatting issues in references */
importScript('User:Ohconfucius/script/Sources.js'); //

// Move to commons helper
importScript('User:Fran_Rogers/CH2_en.js');

// Twinkle hack
importScript('User:AzaToth/morebits.js');

// default for https://en.wikipedia.org/wiki/Wikipedia:AutoEd
importScript('Wikipedia:AutoEd/complete.js');
autoEdClick = false;

/* Date consistency fixer */
importScript('User:Ohconfucius/script/MOSNUM dates.js');

/* DYK counter */
importScript('User:Shubinator/DYKcheck.js');

/* Duplicate link checker */
importScript('User:Ucucha/duplinks.js'); //

/* status scripts */
importScript('User:Xenocidic/statusChanger2.js');
importScript('User:TheDJ/qui.js')

/* white space, heading, template fixes */
/* importScript('User:Cameltrader/Advisor.js');*/

/* Prose counter */
importScript('User:Dr_pda/prosesize.js'); 

/*  Semi-automated peer review tool  */
importScript('User:AndyZ/peerreviewer.js'); //[[User:AndyZ/peerreviewer.js]]

/*  Organize references according to user preferences. */
importScript( 'User:Kaniivel/RefConsolidate_start.js' );

/*** BEGIN WIKIBREAK ENFORCER ***/
addOnloadHook(function() {
 
        /*** Start editing here ***/
 
        // When you want to end your break?
        // no leading zeroes. (example: 7 - correct, 07 - incorrect)
 
        var date = { year: 2012, month: 12, day: 30};
        var time = { hours: 12, minutes: 0, seconds: 0 };
 
        /*** Stop editing here ***/
 
        var currentDate = new Date();
        var enforcedBreakEnd = new Date(
                date.year,date.month-1,date.day,time.hours,time.minutes,time.seconds);
        if (currentDate <= enforcedBreakEnd) {
                alert("Enforced wikibreak until "+enforcedBreakEnd.toLocaleString()
                        + "\n(now is "+currentDate.toLocaleString()+")\n\nBye!");
                location = "http://"+location.host+"/w/index.php?title="
                        + "Special:Userlogout&returnto=Main_Page";
        }
});

/*** END WIKIBREAK ENFORCER ***/


/* Sorts your watchlist by namespace, and also adds spaces for readability. */
addOnloadHook(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);
  }
});