MediaWiki:Common.js

/* Custom user rights icons on userpages start */ if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk" || wgPageName.indexOf("Special:Contributions") != -1){ importScript('MediaWiki:Common.js/userRightsIcons.js'); } /* Custom user rights icons on userpages end */

/* Countdown Timer Begin*/ importArticles({   type: "script",    articles: [        "w:c:dev:Countdown/code.js"    ] }); /* Countdown Timer End*/ /* Better Countdown Timer Begin*/ $(function{	importArticles({ type: "script", articles: ["u:zh.pad.wikia.com:MediaWiki:CountDown.js"] }, {		type: "style", articles: ["u:zh.pad.wikia.com:MediaWiki:CountDown.css"] }); });

/* warframe Countdown Timer End*/

//Onload functions var cond=""; $(function{	importArticles({ type: "script", articles: ["l:MediaWiki:CountDowndi.js"] }, {		type: "style", articles: ["l:MediaWiki:CountDowndi.css"] });

}); //Onload functions var cond=""; $(function{ importArticles({		type: "script",		articles: ["l:MediaWiki:CountDownred.js"]	}, {		type: "style",		articles: ["l:MediaWiki:CountDownred.css"]	});

}); /* Better Countdown Timer End */

/* AJAX tooltips begin*/

var $tfb;

// hides the tooltip function hideTip { $tfb.html("").removeClass("tooltip-ready").addClass("hidden").css("visibility","hidden"); }

// displays the tooltip function displayTip(e) { $tfb.not(":empty").removeClass("hidden").addClass("tooltip-ready"); moveTip(e); $tfb.not(":empty").css("visibility","visible"); }

// moves the tooltip function moveTip(e) { var newTop = e.clientY + ((e.clientY > ($(window).height/2)) ? -($tfb.not(".hidden").innerHeight+20):20); var newLeft = e.clientX + ((e.clientX > ($(window).width/2)) ? -($tfb.not(".hidden").innerWidth+20):20); $tfb.not(".hidden").css({"position":"fixed","top":newTop + "px","left":newLeft + "px"}); }

// AJAX tooltips function showTip(e) { $t=$(this); $p=$t.parent; if ($p.hasClass("selflink")==false) { $t.removeAttr("title"); $p.removeAttr("title"); $tfb.load("/"+$t.data("tt").replace(/ /g,"_").replace(/\?/g,"%3F")+"?action=render div.tooltip-content",function { if ($tfb.html == "") $tfb.html(' Error This target either has no tooltip or was not intended to have one. '); $tfb.find(".tooltip-content").css("display",""); displayTip(e); }); } }

function bindTT { $t=$(this); $p=$t.parent; if ($p.hasClass("selflink") == false) $t.data("tt", $p.attr("title").replace(" (page does not exist)","").replace("?","%3F")).mouseover(showTip).mouseout(hideTip).mousemove(moveTip); }

// check to see if it is active then do it $(function { $("#bodyContent").mouseover(hideTip); $("#bodyContent").append(' '); $tfb = $("#tfb"); $("#bodyContent span.ajaxttlink").each(bindTT); });

/* Simple tooltips */ importScriptPage('MediaWiki:Tooltip.js', 'joeplayground');

/* Dynamic pictures begin*/ ( function { 'use strict'; var dynamicImages = document.getElementsByClassName( 'dynamic-images'), i, imageSet, j; for ( i = 0; i < dynamicImages.length; i++ ) { imageSet = dynamicImages[i].getElementsByClassName( 'image' ); for ( j = 0; j < imageSet.length; j++ ) { if ( j > 0 ) { imageSet[j].style.display = 'none'; } imageSet[j].addEventListener( 'click', function ( event ) { event.stopImmediatePropagation; event.preventDefault; this.style.display = 'none'; if ( this.nextElementSibling !== null ) { this.nextElementSibling.style.display = 'inline'; } else { this.parentNode.getElementsByClassName( 'image' )[0].style.display = 'inline'; } }); } } } ); /* Dynamic pictures end*/

// ============================================================ // displayTimer // ============================================================ //Add a clock to the WikiHeader //Modified from work by Patrick Westerhoff [poke]: //http://bulbapedia.bulbagarden.net/wiki/MediaWiki:Monobook.js hookEvent( 'load', displayTimer ); function displayTimer {   if ( typeof( timerDisplay ) !== 'undefined' && timerDisplay === false ) return; var date; if (skin == 'oasis') {   var timerParent = document.getElementById( 'WikiHeader' ).getElementsByTagName( 'div' )[0]; }   if (skin == 'monobook') {   var timerParent = document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0]; }   var timerLink   = document.createElement( 'a' ); var timerObj   = document.createElement( 'li' ); timerLink.href              = '/wiki/' + wgPageName + '?action=purge'; timerLink.title             = 'Purge the server cache and update the contents of this page.' timerObj.id                 = 'displayTimer'; timerObj.style.textTransform = 'none'; timerObj.style.fontWeight   = 'bold'; timerObj.style.fontSize     = '100%'; timerObj.appendChild( timerLink ); timerParent.insertBefore( timerObj, timerParent.firstChild ); if (skin == 'oasis') {       $('#displayTimer').css({'position': "inherit", 'right': "0px", 'top': "-28px"}); }   var month = new Array(12); month[0] = "Jan"; month[1] = "Feb"; month[2] = "Mar"; month[3] = "Apr"; month[4] = "May"; month[5] = "Jun"; month[6] = "Jul"; month[7] = "Aug"; month[8] = "Sep"; month[9] = "Oct"; month[10] = "Nov"; month[11] = "Dec"; function actualizeUTC {       timerDate           = new Date; timerLink.innerHTML = ( timerDate.getUTCDate    < 10 ? '0' : '' ) + timerDate.getUTCDate     + ' ' + ( timerDate.getUTCMonth   < 10 ?  :   ) + month[timerDate.getUTCMonth] + ' ' + ( timerDate.getUTCFullYear < 10 ? '0' : '' ) + timerDate.getUTCFullYear + ' ' + ( timerDate.getUTCHours   < 10 ? '0' : '' ) + timerDate.getUTCHours    + ':' + ( timerDate.getUTCMinutes < 10 ? '0' : '' ) + timerDate.getUTCMinutes  + ':' + ( timerDate.getUTCSeconds < 10 ? '0' : '' ) + timerDate.getUTCSeconds  + ' (UTC)'; }   function actualizeCustom {       timerDate           = new Date; timerDate.setMinutes ( timerDate.getMinutes + timerDate.getTimezoneOffset + timerTimezone * 60 ); timerLink.innerHTML = ( timerDate.getDate    < 10 ? '0' : '' ) + timerDate.getDate     + ' ' + ( timerDate.getMonth   < 10 ?  :   ) + month[timerDate.getMonth] + ' ' + ( timerDate.getFullYear < 10 ? '0' : '' ) + timerDate.getFullYear + ' ' + ( timerDate.getHours   < 10 ? '0' : '' ) + timerDate.getHours    + ':' + ( timerDate.getMinutes < 10 ? '0' : '' ) + timerDate.getMinutes  + ':' + ( timerDate.getSeconds < 10 ? '0' : '' ) + timerDate.getSeconds + ' (UTC' + ( timerTimezone < 0 ? '' : '+' ) + timerTimezone + ')'; }   // start if ( typeof( timerTimezone ) !== 'number' ) {       actualizeUTC; setInterval( actualizeUTC, 1000 ); }   else {       actualizeCustom; setInterval( actualizeCustom, 1000 ); }