Jump to content

User:Phatom87/monobook.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.
//refToolbar
importScript('User:Mr.Z-man/refToolbar 2.0.js');

//hot Cats
importScript('User:TheDJ/Gadget-HotCat.js');
//stub tagging 
importScript('User:Ais523/stubtagtab2.js');
//importScript('User:Phatom87/stubtagtab2-alt.js');

//watch new pages
npp_refresh = 7;
npp_num_pages = 20;
importScript('User:TheJosh/Scripts/NewPagePatrol.js');

//monitor resecent changes
rcp_refresh = 7;
rcp_num_pages = 20;
importScript('User:TheJosh/Scripts/RecentChangesPatrol.js');

//translate the side bar.
importScript('User:Tra/sidebartranslate.js'); //[[User:Tra/sidebartranslate.js]]
//tag helper for articles
importScript('User:Drilnoth/codefixer.js'); //See [[User:Drilnoth/codefixer.js/doc]] for details

FriendlyConfig = {
watchTaggedPages : false
};


importScript('User:Ioeth/friendly.js');

//install twinkle
importScript('User:AzaToth/twinkle.js');


// [[User:Dschwen/highlightredirects.js]] - please include this line 
document.write('<script type="text/javascript" src="' 
+ 'http://en.wikipedia.org/w/index.php?title=User:Dschwen/highlightredirects.js' 
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

// from [http://en.wikipedia.org/w/index.php?title=User:Thebainer/monobook.js&oldid=32546177 User:Thebainer/monobook.js]

// adds a 'logs for this page' link to the toolbox bar
// if the page is a user's page, talk page or subpage, the link will go to logs for the user instead
// if the page is a special page, then no link is displayed

$(function () {
 
// if this is a user, show the logs for the user rather than the page
if ( mw.config.get('wgCanonicalNamespace') == "User" || mw.config.get('wgCanonicalNamespace') == "User_talk" ) {
  url = mw.config.get('wgServer') + "/w/index.php?title=Special:Log&user=" + mw.config.get('wgTitle').split("/")[0];
} else if ( mw.config.get('wgCanonicalNamespace') == "Special" ) {
  // don't display link for special pages
  return;
} else {
  url = mw.config.get('wgServer') + "/w/index.php?title=Special:Log&page=" + mw.config.get('wgPageName');
}
 
mw.util.addPortletLink("p-tb", url, "Logs", "pt-logs");
//user links code


if (mw.config.get('wgTitle').indexOf("/") != -1 || document.title.indexOf("- History -") != -1)  //no subpages or history
return;
if (mw.config.get('wgCanonicalNamespace') == "User" || mw.config.get('wgCanonicalNamespace') == "User_talk") {
var username = encodeURIComponent( mw.config.get('wgTitle') );
mw.util.addPortletLink("p-cactions", mw.config.get('wgServer') + "/wiki/Special:Contributions/" + username, "Contribs", "ca-contrib", "User contributions");
mw.util.addPortletLink("p-cactions", mw.config.get('wgServer') + "/w/index.php?title=Special:Prefixindex&prefix=" + username + "&namespace=2", "Userspace", "", "List of pages in this user's userspace");
}



});


//Localized time/date script

function numToMonth(num) {
   if (num==0) {return "Janurary";}
   else if (num==1) {return "February";}
   else if (num==2) {return "March";}
   else if (num==3) {return "April";}
   else if (num==4) {return "May";}
   else if (num==5) {return "June";}
   else if (num==6) {return "July";}
   else if (num==7) {return "August";}
   else if (num==8) {return "September";}
   else if (num==9) {return "October";}
   else if (num==10) {return "November";}
   else if (num==11) {return "December";}
}
 
function monthToNum(month) {
   var tmp = new Date(month + " 1, 2006");
   return tmp.getMonth();
}
 
function adjustTime(str, hour, minute, day, month, year,  offset, s) {
   var time = new Date();
   time.setUTCHours(hour);
   time.setUTCMinutes(minute);
   time.setUTCDate(day);
   time.setUTCMonth(monthToNum(month));
   time.setUTCFullYear(year);

   var timeStr = "";
   if (time.getHours()<10) {timeStr += "0";}
   timeStr += parseInt(time.getHours()) + ":";
   if (time.getMinutes()<10) {timeStr += "0";}
   timeStr += parseInt(time.getMinutes());
   timeStr += ", ";
   timeStr += time.getDate();
   timeStr += " ";
   timeStr += numToMonth(time.getMonth());
   timeStr += " ";
   timeStr += time.getFullYear();
   timeStr += " (UTC";
   var offset = -1*time.getTimezoneOffset()/60;
   if (offset >= 0) {timeStr += "+";}
   timeStr += offset + ")";
   return timeStr;
}

function adjustTime2(str, hour, minute, month, day, year,  offset, s) {
   return adjustTime(str, hour, minute, day, month, year, offset, s);
}
/*Returns the name of the page. For example, if you were browsing the "[[foo]]" WP page, getPname() would return "foo".*/
function getPname() {
  return mw.config.get('wgPageName').replace(/_/g, ' ');
}

// installing popups [[User:Lupin/popups.js]]

mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');
//varrious settings for popups
popupDelay=.6;//default is a little short for me get popups without meaning to
popupSubpopups=false;//I don't need popups within popups.
popupRedlinkRemoval=true;
popupFixDabs=true;
popupEditCounterTool="custom"
popupEditCounterUrl="http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=$1&site=en.wikipedia.org"

// installation of the wikEd editing page extension

wikEdComboPresetOptions = [];
wikEdComboPresetOptions['summary'] = ['','Stub sorting. [[Wikipedia:WikiProject_Stub_sorting|You can help!]]', 'copyedit', 'reply', 'article created', 'intro rewrite',
'linkfix', 'fixing typos', 'formatting source text', '{wikEdUsing}'
];

wikEdRegExTypoFix = true;

// install [[User:Cacycle/diff]] text diff code
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/diff.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

// install [[User:Pilaf/Live_Preview]] page preview tool
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Pilaf/livepreview.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

// install [[User:Mboverload/RegExTypoFix|RegExTypoFix]] common typo fixer
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/RegExTypoFix.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

// install [[User:Cacycle/wikEd international]] translation here

// install [[User:Cacycle/wikEd]] editing page extension
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');