KKeine Bearbeitungszusammenfassung |
Ghost (Diskussion | Beiträge) K Fixes |
||
| (6 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
var letItSnow = | var letItSnow = | ||
{ | { | ||
snowPer100x100Pixels : 0. | snowPer100x100Pixels : 0.35, | ||
snowing : true, | snowing : true, | ||
snow : [], | snow : [], | ||
interval : null, | interval : null, | ||
loopindex : 0, | loopindex : 0, | ||
letItSnow : function(p) | letItSnow : function(p) | ||
{ | { | ||
| Zeile 12: | Zeile 12: | ||
if (letItSnow.interval) letItSnow.stopIt(true); | if (letItSnow.interval) letItSnow.stopIt(true); | ||
letItSnow.newSnow(true); | letItSnow.newSnow(true); | ||
letItSnow.interval = window.setInterval( | letItSnow.interval = window.setInterval(letItSnow.loop, 50); | ||
}, | }, | ||
loop : function() | loop : function() | ||
| Zeile 37: | Zeile 37: | ||
this.y = 0 + Math.random()*window.innerHeight - (inWindow ? 0 : window.innerHeight); | this.y = 0 + Math.random()*window.innerHeight - (inWindow ? 0 : window.innerHeight); | ||
this.e = document.createElement("img"); | this.e = document.createElement("img"); | ||
this.e.src = " | this.e.src = "https://stargatewiki.de/images/3/36/SGW-Schnee.png"; | ||
this.e.alt = "*"; | this.e.alt = "*"; | ||
this.e.style.width = "30px"; | this.e.style.width = "30px"; | ||
this.e.style.height = "30px"; | this.e.style.height = "30px"; | ||
this.e.style.position = " | this.e.style.position = "fixed"; | ||
this.e.style.left = Math.floor(this.x + Math.sin(this.y*this.vx)*this.dx)+"px"; | this.e.style.left = Math.floor(this.x + Math.sin(this.y*this.vx)*this.dx)+"px"; | ||
this.e.style.top = Math.floor(this.y)+"px"; | this.e.style.top = Math.floor(this.y)+"px"; | ||
this.e.style.zIndex = "100"; | this.e.style.zIndex = "100"; | ||
document.body.appendChild(this.e); | document.body.appendChild(this.e); | ||
this.fall = function() | this.fall = function() | ||
{ | { | ||
this.y += this.vy; | this.y += this.vy; | ||
if (this.y >= window.innerHeight) return true; | if (this.y >= window.innerHeight) return true; | ||
this.e.style.left = Math.floor(this.x + Math.sin(this.y*this.vx)*this.dx)+"px"; | this.e.style.left = Math.floor(this.x + Math.sin(this.y*this.vx)*this.dx)+"px"; | ||
this.e.style.top = Math.floor(this.y)+"px"; | this.e.style.top = Math.floor(this.y)+"px"; | ||
| Zeile 69: | Zeile 69: | ||
for (var i=0; i<letItSnow.snow.length; ++i) | for (var i=0; i<letItSnow.snow.length; ++i) | ||
letItSnow.snow[i].remove(); | letItSnow.snow[i].remove(); | ||
letItSnow.snow = | letItSnow.snow = []; | ||
}, | }, | ||
addButton : function() | addButton : function() | ||
{ | { | ||
var w = document.getElementById("ca-watch"); | var w = document.getElementById("ca-watch"); | ||
var skin = mw.config.get('skin') | |||
if (!w) w = document.getElementById("ca-unwatch"); | if (!w) w = document.getElementById("ca-unwatch"); | ||
var node = addPortletLink((skin=="vector" ? "p-views" : "p-cactions"), "#", "Schnee", "ca-snow", "Schneeanimation an- und ausschalten", "s", w); | var node = mw.util.addPortletLink((skin=="vector" ? "p-views" : "p-cactions"), "#", "Schnee", "ca-snow", "Schneeanimation an- und ausschalten", "s", w); | ||
if (node) | if (node) | ||
{ | { | ||
| Zeile 95: | Zeile 96: | ||
var img = document.createElement("img"); | var img = document.createElement("img"); | ||
img.alt = "Schneeanimation an- oder ausschalten"; | img.alt = "Schneeanimation an- oder ausschalten"; | ||
img.src = " | img.src = "https://stargatewiki.de/images/3/36/SGW-Schnee.png"; | ||
img.style.width = "24px"; | img.style.width = "24px"; | ||
img.style.height = "24px"; | img.style.height = "24px"; | ||