MediaWiki:Common.js

From A KoL Wiki
Revision as of 03:24, 12 March 2015 by imported>Caseyweederman (Removed onloadfuncts, which were broken and non-operational, and we've been fine without them. Sorry, SomeStranger, people can't choose redirect from the More menu any more.)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/*<pre>*/

/* Assuming this section is for custom extensions */
var skin = "vector";
var stylepath = "/thekolwiki/skins";
var wgArticlePath = "/thekolwiki/index.php/$1";
var wgScriptPath = "/thekolwiki";
var wgServer = "http://kol.coldfront.net/";
//var wgCanonicalNamespace = "";
//var wgCanonicalSpecialPageName = false;
//var wgNamespaceNumber = 0;
//var wgPageName = "Main_Page";
//var wgTitle = "Main Page";
//var wgArticleId = "13173";
//var wgIsArticle = true;
//var wgUserName = null;
//var wgUserGroups = null;
var wgUserLanguage = "en";
var wgContentLanguage = "en";
var wgBreakFrames = false;
//var wgCurRevisionId = "98546089";
/* end assumption block */


/* "throbbing" code */
var throbs = document.querySelectorAll(".throbtext");
if (throbs.length>0) {
  throb_out();
}

function throb_out() {
  var throbs = document.querySelectorAll(".throbtext");
  for (var i=0;i<throbs.length;i++) {
    fadeDown(throbs.item(i),Math.random()*400,0.5);
  }
  setTimeout(throb_in,400+Math.random()*200);
}

function throb_in() {
  var throbs = document.querySelectorAll(".throbtext");
  for (var i=0;i<throbs.length;i++) {
    fadeUp(throbs.item(i),Math.random()*400,Math.min(.95,Math.random()+.5));
  }
  setTimeout(throb_out,400+Math.random()*200);
}

function fadeDown( elem, time, dest ) {
	var startOpacity = elem.style.opacity || 1;
        var opacityStep = Math.abs(dest-startOpacity)/(time/5);

	(function goDn() {
		elem.style.opacity = Number(elem.style.opacity) - Number(opacityStep);
                if (elem.style.opacity>dest)
  		   setTimeout( goDn, 5 );
	})();
}

function fadeUp( elem, time, dest ) {
	var startOpacity = elem.style.opacity || 1;
        var opacityStep = Math.abs(dest-startOpacity)/(time/5);

	(function goUp() {
		elem.style.opacity = Number(elem.style.opacity) + Number(opacityStep);
                if (elem.style.opacity<dest)
  		   setTimeout( goUp, 5 );
	})();
}
/* end "throbbing" code */

/* for drifting the underlay images of crimbots */
var moveDrifty = function () {
   var drifty = $('#driftypoo');
   var top = Math.floor(Math.random() * 51);
   var left = Math.floor(Math.random() * 51);
   drifty.animate({top: top, left: left}, 2000, 'swing', moveDrifty);
};
jQuery(moveDrifty);

/*</pre>*/