User:DoriSmith/common.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
The accompanying .css page for this skin is at User:DoriSmith/common.css. |
(function ($) { // Wrap with anonymous function
// updates to wikEd
var wikEdConfig = {};
wikEdConfig.regExTypoFix = true;
wikEdConfig.comboPresetOptions = {};
wikEdConfig.comboPresetOptions.summary = [
'Redirect to already-existing article', 'Copyedit', 'Reply', 'Linkfix', 'Fixing typos', 'Removing linkspam',
'Reverting test', 'Reverting vandalism', 'Add relevant tags', 'Keep', 'Del', '+1'
];
// From User:Lunchboxhero/vector.js
var book_source_URL = "http://www.worldcat.org/search?qt=wikipedia&q=MAGICNUMBER";
importScript('User:Lunchboxhero/externISBN.js');
importScript('User:Ais523/adminrights.js');
// importScript('User:Ais523/catwatch.js');
importScript('User:Ais523/watchlistnotifier.js');
importScript('User:Anomie/ajaxpreview.js'); // Linkback: [[User:Anomie/ajaxpreview.js]]
importScript('User:Anomie/linkclassifier.js');
importScript('User:Dr_pda/prosesize.js');
importScript('User:Equazcion/SidebarHistoryTools.js');
importScript('User:js/6tabs-vector.js');
importScript('User:Mr.Z-man/closeAFD.js');
importScript('User:Topbanana/RLRL_SR_Utility.js' );
importScript('User:Ucucha/duplinks.js');
importScript('Wikipedia:AutoEd/complete.js');
importScript('User:DoriSmith/scripts/getdiff.js'); // Add my own stuff
// AutoEd tweaks
autoEdMinor = false;
autoEdClick = false;
function myStuff() {
// This section adds the current time to the userpage block, just before the username
var liEl = document.createElement('li');
liEl.id = 'pt-time';
var months = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ");
var time = new Date();
var mins = (time.getMinutes() > 9) ? ":" + time.getMinutes() : ":0" + time.getMinutes();
liEl.innerHTML = get12Hour(time.getHours()) + mins + getAmPm(time.getHours()) + ", ";
liEl.innerHTML += time.getDate() + " " + months[time.getMonth()] + " ";
liEl.innerHTML += time.getFullYear() + "<br>" ;
var dateStr = time.toUTCString().substr(0,time.toUTCString().length-4);
if (Date.parse(dateStr)) {
var utcDate = new Date(Date.parse(dateStr));
liEl.innerHTML += utcDate.getHours() + mins + " UTC, " + utcDate.getDate() + " ";
liEl.innerHTML += months[utcDate.getMonth()] + " " + utcDate.getFullYear() + "<br>";
}
liEl.innerHTML += "<br>" ;
var before = document.getElementById("n-mainpage-description");
before.parentNode.insertBefore(liEl, before);
// Add link to my own page
mw.util.addPortletLink('p-tb', 'http://wiki.riteme.site/wiki/User:DoriSmith/ActionList', 'Action List', 't-actions');
// Move watch/unwatch to p-cactions
addWatch("ca-watch");
addWatch("ca-unwatch");
// Move contributions to p-cactions
var username = wgTitle.split("/")[0];
var contribsTabURL = "http://wiki.riteme.site/w/index.php?title=Special:Contributions&limit=250&uselang=en&target=" + username;
mw.util.addPortletLink('p-cactions', contribsTabURL , 'Contribs', 'ca-contribs');
// Misc useful functions
function get12Hour(currHr) {
return (currHr%12==0) ? 12 : currHr%12;
}
function getAmPm(currHr) {
return (currHr<12) ? " am" : " pm";
}
function addWatch(menuItem) {
if (document.getElementById(menuItem)) {
var caItem = document.getElementById(menuItem).firstChild;
var caHref = (caItem.getAttribute('href',2)) ? caItem.getAttribute('href',2) : caItem.firstChild.getAttribute('href',2);
mw.util.addPortletLink('p-cactions', caHref, menuItem.substr(3,1).toUpperCase()+menuItem.substr(4), menuItem);
}
}
}
// addOnloadHook(myStuff);
} (jQuery)); // End wrap with anonymous function