MediaWiki:Common.js: Difference between revisions

From A KoL Wiki
imported>Caseyweederman
mNo edit summary
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.
Line 22: Line 22:
/* end assumption block */
/* end assumption block */


if (!window.onloadFuncts) {
var onloadFuncts = [];
}
function addOnloadHook(hookFunct) {
// Allows add-on scripts to add onload functions
onloadFuncts[onloadFuncts.length] = hookFunct;
}
function MainPage(){
console.log("this actually gets run, I know, I am as surprised as you are.");
var mpTitle = "Main Page";
var isMainPage = (document.title.substr(0, document.title.lastIndexOf(" - ")) == mpTitle);
    if ((isMainPage || /[\/=:]Main_Page/.test(document.location)) && document.getElementById('p-cactions')) {
          document.getElementById('p-cactions').getElementsByTagName("nobr")[0].innerHTML = "Main Page";
console.log("What did this do? Did it even get run?");
      }
}


/* "throbbing" code */
/* "throbbing" code */
Line 94: Line 76:
};
};
jQuery(moveDrifty);
jQuery(moveDrifty);
addOnloadHook(MainPage);


/*</pre>*/
/*</pre>*/

Revision as of 03:24, 12 March 2015

/*<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>*/