MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

// Ajax auto-refresh var ajaxPages = ['Special:RecentChanges','Special:WikiActivity','Special:Contributions']; var AjaxRCRefreshText = 'Auto-refresh'; // END Ajax auto-refresh

// Last edit details on articles window.lastEdited = { avatar: true, size: true, diff: true, comment: true, time: 'timestamp', namespaces: { include: [], exclude: ["User_blog", "User_blog_comment"] },   pages: ["The_Caster_Chronicles_Wiki"] }; // END Last edit details on articles

//// Additional customization for LastEdited addOnloadHook(function { $(".lastEdited").contents.filter(function { return this.nodeType === 3; }).wrap(" ");

var span = $(".lastEdited span"); span.filter(':contains("Current size")').prependTo(".lastEdited").css('display','block'); }); //// Engineered by User:Ohmystar

importArticles({   type: "script",    articles: [        "u:dev:ShowHide/code.js",        "u:dev:RevealAnonIP/code.js",        "u:dev:Countdown/code.js",        "u:dev:BackToTopButton/code.js",        "u:dev:ReferencePopups/code.js",        "u:dev:TopEditors/code.js",        "u:dev:DupImageList/code.js",        "u:dev:SearchSuggest/code.js",        "u:dev:AjaxRC/code.js",        "u:dev:LastEdited/code.js"    ] });

// ************************************************************************************************************* // **************************** Experimental javascript countdown timer (Splarka) ****************************** // ******************************************** Version 0.0.2 ************************************************** // ************************************************************************************************************* // ******************* Code Source: Redwall Wiki - redwall.wikia.com/wiki/MediaWiki:Common.js ****************** // ************************************************************************************************************* // Embed with a span class="countdowntimer", eg: // April 12 2008 00:00:01 AM EST // default replacement text can accompany, eg: *javascript required* function updatetimer(i) { var now = new Date; var then = timers[i].eventdate; var diff = count=Math.floor((then.getTime-now.getTime)/1000); // catch bad date strings if(isNaN(diff)) { timers[i].firstChild.nodeValue = '** ' + timers[i].eventdate + ' **' ; return; } // catch negative dates if(diff<0) { diff = -diff; var left = 'ago since'; } else { var left = 'until'; } // calcuate the diff left = (diff%60) + ' seconds ' + left; diff=Math.floor(diff/60); if(diff > 0) left = (diff%60) + ' minutes and ' + left; diff=Math.floor(diff/60); if(diff > 0) left = (diff%24) + ' hours, ' + left; diff=Math.floor(diff/24); if(diff > 0) left = diff + ' days, ' + left timers[i].firstChild.nodeValue = left; // a setInterval is more efficient, but calling setTimeout // makes errors break the script rather than infinitely recurse tim[i] = setTimeout('updatetimer(' + i + ')',1000); } function checktimers { var untimers = getElementsByClassName(document, 'span', 'notimer'); for(var i=0;i < untimers.length; i++) { untimers[i].style.display = 'none'; } timers = getElementsByClassName(document, 'span', 'countdowntimer');  //global tim = new Array; // generic holder for the timeouts, global if(timers.length == 0) return; for(var i=0;i < timers.length; i++) { timers[i].eventdate = new Date(timers[i].firstChild.nodeValue); timers[i].firstChild.nodeValue = '0 days 0 hours 0 minutes 0 seconds'; timers[i].style.display = 'inline'; updatetimer(i); //start it up  } } addOnloadHook(checktimers)