User:DoriSmith/common.js

(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 + " " ; 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 + " "; }   liEl.innerHTML += " " ;

var before = document.getElementById("n-mainpage-description"); before.parentNode.insertBefore(liEl, before);

// Add link to my own page mw.util.addPortletLink('p-tb', 'http://en.wikipedia.org/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://en.wikipedia.org/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