MediaWiki:Monobook.js/Halloween.js: Unterschied zwischen den Versionen

(test)
 
Keine Bearbeitungszusammenfassung
 
(3 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
/**
/*
  ** Ghosts - Halloween -  JavaScript
<pre>
  ** This script and many more are free at
*/
  ** http://rainbow.arch.scriptmania.com/scripts/
 
  */
/******************************************
if(!window.Halloween) Halloween=new Object();
* Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
Halloween.ghostImages = new Array(  
* Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code
"<img src='http://rainbow.arch.scriptmania.com/scripts/ghost3.gif'>",
* Last updated Nov 9th, 05' by DD. This notice must stay intact for use
"<img src='http://rainbow.arch.scriptmania.com/scripts/ghost1.gif'>",
******************************************/
"<img src='http://rainbow.arch.scriptmania.com/scripts/ghost2.gif'>",
 
"<img src='http://rainbow.arch.scriptmania.com/scripts/ghost2.gif'>"
//Configure below to change URL path to the snow image
);
var snowsrc=new Array(8)
var ns4 = document.layers;
snowsrc[0]="http://cdn1.iconfinder.com/data/icons/yooicons_set09_halloween/32/ninja_ghost.png";
var ie4 = document.all;
snowsrc[1]="http://cdn1.iconfinder.com/data/icons/yooicons_set09_halloween/32/geek_zombie.png";
Halloween.makeLayer = function(id)
snowsrc[2]="http://cdn1.iconfinder.com/data/icons/yooicons_set09_halloween/32/cheshire_cat.png";
{
snowsrc[3]="http://cdn1.iconfinder.com/data/icons/hallowen_linux/32/Witch_Hat.png";
var el = document.getElementById ? document.getElementById(id) :
snowsrc[4]="http://cdn1.iconfinder.com/data/icons/IconsLandVistaHalloween/PNG/32x32/Pirate.png";
document.all ? document.all[id] :
snowsrc[5]="http://cdn1.iconfinder.com/data/icons/yooicons_set09_halloween/32/pumpkin.png";
  document.layers[id];
snowsrc[6]="http://cdn1.iconfinder.com/data/icons/IconsLandVistaHalloween/PNG/32x32/Shock.png";
if(ns4) el.style=el;
snowsrc[7]="http://cdn1.iconfinder.com/data/icons/IconsLandVistaHalloween/PNG/32x32/Cool.png";
el.sP=function(x,y){this.style.left = x;this.style.top=y;};
// Configure below to change number of snow to render
el.show=function(){ this.style.visibility = "visible"; }
var no = 10;
el.hide=function(){ this.style.visibility = "hidden"; }
// Configure whether snow should disappear after x seconds (0=never):
if(ns4 || window.opera)  
var hidesnowtime = 0;
el.sO = function(pc){return 0;};
// Configure how much snow should drop down before fading ("windowheight" or "pageheight")
else if(ie4)
var snowdistance = (wgPageName == "Main_Page/editcopy")?"windowheight":"pageheight";
el.sO = function(pc)
 
{
// Ensures variables are declared but undefined, unless user sets them in their .js
if(this.style.filter=="")
var noSnow;
this.style.filter="alpha(opacity=100);";
var userSnowNum;
this.filters.alpha.opacity=pc;
 
}
///////////Stop Config//////////////////////////////////
else
 
el.sO = function(pc){this.style.MozOpacity=pc/100;}
var ie4up = (document.all) ? 1 : 0;
var ns6up = (document.getElementById&&!document.all) ? 1 : 0;


return el;
function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
}


if(window.innerWidth)
var dx, xp, yp; // coordinate and position variables
{
var am, stx, sty; // amplitude and step variables
gX=function(){return innerWidth;};
var i, doc_width = 800, doc_height = 600;
gY=function(){return innerHeight;};
 
if (ns6up) {
doc_width = self.innerWidth - 40;
doc_height = self.innerHeight;
} else if (ie4up) {
doc_width = iecompattest().clientWidth - 40;
doc_height = iecompattest().clientHeight;
}
}
else
 
{
dx = new Array();
gX=function(){return document.body.clientWidth-30;};
xp = new Array();
gY=function(){return document.body.clientHeight-30;};
yp = new Array();
}
am = new Array();
Halloween.ghostOutput=function()
stx = new Array();
{
sty = new Array();
for(var i=0 ; i<Halloween.ghostImages.length ; i++)
id = new Array();
document.write(ns4 ? "<LAYER  NAME='gh"+i+"'>"+Halloween.ghostImages[i]+"</LAYER>" :
for (i = 0; i < no; ++ i) {
  "<DIV id='gh"+i+"' style='position:absolute'>"+Halloween.ghostImages[i]+"</DIV>" );
dx[i] = 0; // set coordinate variables
xp[i] = Math.random()*(doc_width-50); // set position variables
}
yp[i] = Math.random()*doc_height;
Halloween.ghostSprites = new Array();
am[i] = Math.random()*20; // set amplitude variables
Halloween.ghostStartAni = function()
stx[i] = 0.02 + Math.random()/10; // set step variables
{
sty[i] = 0.7 + Math.random(); // set step variables
for(var i=0 ;i<Halloween.ghostImages.length;i++)
id[i] = Math.floor(Math.random()*8); // set image id
{
if (ie4up||ns6up) {
var el=Halloween.makeLayer("gh"+i);
document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i+20 +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc[id[i]]+"' width=\"30px\" height=\"30px\" border=\"0\"><\/div>");
el.x=Math.random()*gX();
el.y=Math.random()*gY();
el.tx=Math.random()*gX();
el.ty=Math.random()*gY();
el.dx=-5+Math.random()*10;
el.dy=-5+Math.random()*10;
el.state="off";
el.op=0;
el.sO(el.op);
el.hide();
Halloween.ghostSprites[i] = el;
}
}
setInterval("Halloween.ghostAni()", 40);
}
}
Halloween.ghostAni = function()
{
for(var i=0 ;i<Halloween.ghostSprites.length;i++)
{
el=Halloween.ghostSprites[i];


if(el.state == "off")
function snowIE_NS6() { // IE and NS6 main animation function
{
  if (typeof(noSnow) != "undefined" && noSnow > 0) {
if(Math.random() > .99)
for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
{
  }
el.state="up";
  else {
el.show();
if (typeof(userSnowNum) != "undefined" && userSnowNum < no) {
}
for (i=userSnowNum; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden";
}
no = userSnowNum;
else if(el.state == "on")
}
{
doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
if(Math.random() > .98)
doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")? iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
el.state="down";
for (i = 0; i < no; ++ i) { // iterate for every dot
}
yp[i] += sty[i];
else if(el.state == "up")
if (yp[i] > doc_height-50) {
{
xp[i] = Math.random()*(doc_width-am[i]-30);
el.op += 2;
yp[i] = 0;
el.sO(el.op);
stx[i] = 0.02 + Math.random()/10;
if(el.op==100)
sty[i] = 0.7 + Math.random();
el.state = "on";
id[i] = Math.floor(Math.random()*8);
}
else if(el.state == "down")
{
el.op -= 2;
if(el.op==0)
{
el.hide();
el.state = "off";
}
else
el.sO(el.op);
}
}
dx[i] += stx[i];
document.getElementById("dot"+i).style.top=yp[i]+"px";
document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";
}
snowtimer=setTimeout("snowIE_NS6()", 10);
  }
}


var X = (el.tx - el.x);
function hidesnow(){
var Y = (el.ty - el.y);
if (window.snowtimer) clearTimeout(snowtimer)
var len = Math.sqrt(X*X+Y*Y);
for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
if(len < 1) len = 1;
}
var dx = 20 * (X/len);
var dy = 20 * (Y/len);
var ddx = (dx - el.dx)/10;
var ddy = (dy - el.dy)/10;
el.dx += ddx;
el.dy += ddy;
el.sP(el.x+=el.dx,el.y+=el.dy);


if(Math.random() >.95 )
if (ie4up||ns6up){
{
addOnloadHook(snowIE_NS6());
el.tx = Math.random()*gX();
if (hidesnowtime>0)
el.ty = Math.random()*gY();
setTimeout("hidesnow()", hidesnowtime*1000)
}
 
}
}
Halloween.ghostStart = function()
{
if(Halloween.ghostLoad)Halloween.ghostLoad();
Halloween.ghostStartAni();
}
}
Halloween.ghostOutput();
/******************************************
Halloween.ghostLoad=window.onload;
* End Snow Effect Script
window.onload=Halloween.ghostStart;
******************************************/
/*
</pre>
*/

Aktuelle Version vom 27. Oktober 2012, 19:46 Uhr

/*
<pre>
*/

/******************************************
* Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
* Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code
* Last updated Nov 9th, 05' by DD. This notice must stay intact for use
******************************************/

//Configure below to change URL path to the snow image
var snowsrc=new Array(8)
snowsrc[0]="http://cdn1.iconfinder.com/data/icons/yooicons_set09_halloween/32/ninja_ghost.png";
snowsrc[1]="http://cdn1.iconfinder.com/data/icons/yooicons_set09_halloween/32/geek_zombie.png";
snowsrc[2]="http://cdn1.iconfinder.com/data/icons/yooicons_set09_halloween/32/cheshire_cat.png";
snowsrc[3]="http://cdn1.iconfinder.com/data/icons/hallowen_linux/32/Witch_Hat.png";
snowsrc[4]="http://cdn1.iconfinder.com/data/icons/IconsLandVistaHalloween/PNG/32x32/Pirate.png";
snowsrc[5]="http://cdn1.iconfinder.com/data/icons/yooicons_set09_halloween/32/pumpkin.png";
snowsrc[6]="http://cdn1.iconfinder.com/data/icons/IconsLandVistaHalloween/PNG/32x32/Shock.png";
snowsrc[7]="http://cdn1.iconfinder.com/data/icons/IconsLandVistaHalloween/PNG/32x32/Cool.png";
// Configure below to change number of snow to render
var no = 10;
// Configure whether snow should disappear after x seconds (0=never):
var hidesnowtime = 0;
// Configure how much snow should drop down before fading ("windowheight" or "pageheight")
var snowdistance = (wgPageName == "Main_Page/editcopy")?"windowheight":"pageheight";

// Ensures variables are declared but undefined, unless user sets them in their .js
var noSnow;
var userSnowNum;

///////////Stop Config//////////////////////////////////

var ie4up = (document.all) ? 1 : 0;
var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

function iecompattest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

var dx, xp, yp; // coordinate and position variables
var am, stx, sty; // amplitude and step variables
var i, doc_width = 800, doc_height = 600;

if (ns6up) {
	doc_width = self.innerWidth - 40;
	doc_height = self.innerHeight;
} else if (ie4up) {
	doc_width = iecompattest().clientWidth - 40;
	doc_height = iecompattest().clientHeight;
}

dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();
id = new Array();
for (i = 0; i < no; ++ i) {
	dx[i] = 0; // set coordinate variables
	xp[i] = Math.random()*(doc_width-50); // set position variables
	yp[i] = Math.random()*doc_height;
	am[i] = Math.random()*20; // set amplitude variables
	stx[i] = 0.02 + Math.random()/10; // set step variables
	sty[i] = 0.7 + Math.random(); // set step variables
	id[i] = Math.floor(Math.random()*8); // set image id
	if (ie4up||ns6up) {
		document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i+20 +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc[id[i]]+"' width=\"30px\" height=\"30px\" border=\"0\"><\/div>");
	}
}

function snowIE_NS6() { // IE and NS6 main animation function
  if (typeof(noSnow) != "undefined" && noSnow > 0) {
	for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
  }
  else {
	if (typeof(userSnowNum) != "undefined" && userSnowNum < no) {
		for (i=userSnowNum; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden";
		no = userSnowNum;
	}
	doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
	doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")? iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
	for (i = 0; i < no; ++ i) { // iterate for every dot
		yp[i] += sty[i];
		if (yp[i] > doc_height-50) {
			xp[i] = Math.random()*(doc_width-am[i]-30);
			yp[i] = 0;
			stx[i] = 0.02 + Math.random()/10;
			sty[i] = 0.7 + Math.random();
			id[i] = Math.floor(Math.random()*8);
		}
		dx[i] += stx[i];
		document.getElementById("dot"+i).style.top=yp[i]+"px";
		document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";
	}
	snowtimer=setTimeout("snowIE_NS6()", 10);
  }
}

function hidesnow(){
	if (window.snowtimer) clearTimeout(snowtimer)
	for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
}

if (ie4up||ns6up){
	addOnloadHook(snowIE_NS6());
	if (hidesnowtime>0)
		setTimeout("hidesnow()", hidesnowtime*1000)
}
/******************************************
* End Snow Effect Script
******************************************/
/*
</pre>
*/