MediaWiki:Halloween.js — различия между версиями
Материал из Guild Wars 2 wiki
Blood (обсуждение | вклад) |
Blood (обсуждение | вклад) |
||
Строка 16: | Строка 16: | ||
pumpkin.style.backgroundPosition = coords[Math.random() * coords.length ^ 0]; | pumpkin.style.backgroundPosition = coords[Math.random() * coords.length ^ 0]; | ||
document.getElementById("p-logo").appendChild(pumpkin); | document.getElementById("p-logo").appendChild(pumpkin); | ||
+ | |||
+ | setInterval(function() { | ||
+ | pumpkin.style.backgroundPosition = coords[Math.random() * coords.length ^ 0]; | ||
+ | }, 5000); | ||
})(); | })(); |
Версия 16:06, 21 октября 2018
/** Halloween.js * Показ случайной тыквы в шапке на Хэллоуин * Автор Blood :) */ (function() { var pumpkin, coords; //Если сейчас не октябрь, то ничего не делаем if (new Date().getMonth() != 9) return; pumpkin = document.createElement("div"); coords = ["2px 0px", "-65px 0px", "-136px 0px", "-1px -66px", "-66px -66px", "-134px -66px"]; pumpkin.setAttribute("class", "pumpkin"); pumpkin.style.backgroundPosition = coords[Math.random() * coords.length ^ 0]; document.getElementById("p-logo").appendChild(pumpkin); setInterval(function() { pumpkin.style.backgroundPosition = coords[Math.random() * coords.length ^ 0]; }, 5000); })();