MediaWiki:Common.js/plok.js

/* plok */

if (["view", "history"].indexOf(mw.config.get("wgAction")) > -1) { $(function {	var url = ["http://images.wikia.com/clubpenguin/images/1/1c/Ghost_Puffle_in_game.gif", "http://images.wikia.com/clubpenguin/images/thumb/8/83/PH_Giveaway_PH_clean.png/85px-PH_Giveaway_PH_clean.png", "http://images.wikia.com/clubpenguin/images/thumb/c/c7/Plok_Box_Dimension.png/170px-Plok_Box_Dimension.png"][2],		duration = 8,		el = $(' ');	$(el).on("contextmenu", function(e) { e.preventDefault; });	function keyframes(type) {		var a = typeof type === "string" ? "-" + type + "-" : "",			b = ( // img '@' + a + 'keyframes animation-plok-img {\n' + '\tfrom {margin-top: 20px}\n' + '\tto {margin-top: 80px;}\n' + '}\n' + // figure '@' + a + 'keyframes animation-plok-figure {\n' + '\t0% {left: -200px;}\n' + '\t0.35% {left: ' + ($(window).width + 10) + 'px;}\n' + // 0.22 is the equivalent to 8 seconds, but 0.35 is better per the up-down waving '\t100% {left: ' + ($(window).width + 10) + 'px;}\n' + '}'			);		return b;	}	function propertiesImg(type) {		var a = typeof type === "string" ? "-" + type + "-" : "";		return ( '\t' + a + 'animation-name: animation-plok-img;\n' + '\t' + a + 'animation-duration: 2500ms;\n' + '\t' + a + 'animation-delay: 0s;\n' + '\t' + a + 'animation-iteration-count: infinite;\n' + '\t' + a + 'animation-direction: alternate;\n' );	}	function propertiesFigure(type) {		var a = typeof type === "string" ? "-" + type + "-" : "";		return ( '\t' + a + 'animation-name: animation-plok-figure;\n' + '\t' + a + 'animation-duration: 3600s;\n' + '\t' + a + 'animation-delay: ' + (3600 - (new Date.getMinutes * 60 + new Date.getSeconds)) + 's;\n' + '\t' + a + 'animation-iteration-count: infinite;\n' + '\t' + a + 'animation-timing-function: linear;\n' );	}	mw.util.addCSS( 'figure#timer-animation {\n'+ '\tz-index: 999999999999;\n' + '\tposition: fixed;\n' + '\ttop: 80px;\n' + '\tleft: -200px;\n' + propertiesFigure("moz") + propertiesFigure("webkit") + propertiesFigure("o") + propertiesFigure + '}\n' + 'figure#timer-animation img {\n'+ '\tmargin-top: 0;\n' + propertiesImg("moz") + propertiesImg("webkit") + propertiesImg("o") + propertiesImg + '}\n' + keyframes("moz") + '\n' + keyframes("webkit") + '\n' + keyframes("o") + '\n' + keyframes );	$("body").append(el); }); }