User:RansomTime/monobook.js

importScriptPage('User:RansomTime/monobook.js', 'monchbox');

importArticles({   type: "style",    article: "url:randomtime:MediaWiki:Monobook.css" }); $(function {   // an overly long script to allow a ?showBlogsFromDays paramater to newpages, that loads up    // a list of blog pages for n days back    // for easy patrolling    var queryString = function( p ) {        // this should be defined already, but sometimes isn't, sadface        var    re = RegExp('[&?]' + p + '=([^&]*)'),            matches;        if ( matches = re.exec( document.location ) ) {            try {                return decodeURI(matches[1]);            } catch ( e ) {            }        }        return null;    };

if (wgPageName === "Special:NewPages" && queryString( 'showBlogsFromDays' )) {

var newPagesGetMonth = function(date) { // returns a string that is the 2 digit month var month = date.getUTCMonth; month++; // MediaWiki dates start at 1, JS start at 0 if (month >= 10) { return String(month); } else { return "0" + String(month); }       };

var newPagesGetDay = function (date) { //as above but for date, 2 digits var day = date.getUTCDate; if (day >= 10) { return String(day); } else { return "0" + String(day); }       };

var newPagesgetDateString = function (offset) { // returns a string in MW format for the date // @param offset - an integer of days to go back from today

var day = new Date; if (offset) { var dateOffset = (24*60*60*1000) * offset; day.setTime(day.getTime - dateOffset); }           return String(day.getUTCFullYear) + newPagesGetMonth(day) + newPagesGetDay(day); };

var offset = parseInt(queryString( 'showBlogsFromDays' ) - 1); var target = "http://community.wikia.com/wiki/Special:NewPages?dir=prev&offset=" + newPagesgetDateString(offset) + "&hidepatrolled=0&namespace=500"; window.location.href = target; } });