| Line 1: |
Line 1: |
| − | /*!
| |
| − | // Snow.js - v0.0.3
| |
| − | // kurisubrooks.com
| |
| − | */
| |
| | | | |
| − | // Amount of Snowflakes
| |
| − | var snowMax = 35;
| |
| − |
| |
| − | // Snowflake Colours
| |
| − | var snowColor = ["#DDD", "#EEE"];
| |
| − |
| |
| − | // Snow Entity
| |
| − | var snowEntity = "•";
| |
| − |
| |
| − | // Falling Velocity
| |
| − | var snowSpeed = 0.75;
| |
| − |
| |
| − | // Minimum Flake Size
| |
| − | var snowMinSize = 8;
| |
| − |
| |
| − | // Maximum Flake Size
| |
| − | var snowMaxSize = 24;
| |
| − |
| |
| − | // Refresh Rate (in milliseconds)
| |
| − | var snowRefresh = 50;
| |
| − |
| |
| − | // Additional Styles
| |
| − | var snowStyles = "cursor: default; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; -o-user-select: none; user-select: none;";
| |
| − |
| |
| − | /*
| |
| − | // End of Configuration
| |
| − | // ----------------------------------------
| |
| − | // Do not modify the code below this line
| |
| − | */
| |
| − |
| |
| − | var snow = [],
| |
| − | pos = [],
| |
| − | coords = [],
| |
| − | lefr = [],
| |
| − | marginBottom,
| |
| − | marginRight;
| |
| − |
| |
| − | function randomise(range) {
| |
| − | rand = Math.floor(range * Math.random());
| |
| − | return rand;
| |
| − | }
| |
| − |
| |
| − | function initSnow() {
| |
| − | var snowSize = snowMaxSize - snowMinSize;
| |
| − | marginBottom = document.body.scrollHeight - 5;
| |
| − | marginRight = document.body.clientWidth - 15;
| |
| − |
| |
| − | for (i = 0; i <= snowMax; i++) {
| |
| − | coords[i] = 0;
| |
| − | lefr[i] = Math.random() * 15;
| |
| − | pos[i] = 0.03 + Math.random() / 10;
| |
| − | snow[i] = document.getElementById("flake" + i);
| |
| − | snow[i].style.fontFamily = "inherit";
| |
| − | snow[i].size = randomise(snowSize) + snowMinSize;
| |
| − | snow[i].style.fontSize = snow[i].size + "px";
| |
| − | snow[i].style.color = snowColor[randomise(snowColor.length)];
| |
| − | snow[i].style.zIndex = 1000;
| |
| − | snow[i].sink = snowSpeed * snow[i].size / 5;
| |
| − | snow[i].posX = randomise(marginRight - snow[i].size);
| |
| − | snow[i].posY = randomise(2 * marginBottom - marginBottom - 2 * snow[i].size);
| |
| − | snow[i].style.left = snow[i].posX + "px";
| |
| − | snow[i].style.top = snow[i].posY + "px";
| |
| − | }
| |
| − |
| |
| − | moveSnow();
| |
| − | }
| |
| − |
| |
| − | function resize() {
| |
| − | marginBottom = document.body.scrollHeight - 5;
| |
| − | marginRight = document.body.clientWidth - 15;
| |
| − | }
| |
| − |
| |
| − | function moveSnow() {
| |
| − | for (i = 0; i <= snowMax; i++) {
| |
| − | coords[i] += pos[i];
| |
| − | snow[i].posY += snow[i].sink;
| |
| − | snow[i].style.left = snow[i].posX + lefr[i] * Math.sin(coords[i]) + "px";
| |
| − | snow[i].style.top = snow[i].posY + "px";
| |
| − |
| |
| − | if (snow[i].posY >= marginBottom - 2 * snow[i].size || parseInt(snow[i].style.left) > (marginRight - 3 * lefr[i])) {
| |
| − | snow[i].posX = randomise(marginRight - snow[i].size);
| |
| − | snow[i].posY = 0;
| |
| − | }
| |
| − | }
| |
| − |
| |
| − | setTimeout("moveSnow()", snowRefresh);
| |
| − | }
| |
| − |
| |
| − | for (i = 0; i <= snowMax; i++) {
| |
| − | document.write("<span id='flake" + i + "' style='" + snowStyles + "position:absolute;top:-" + snowMaxSize + "'>" + snowEntity + "</span>");
| |
| − | }
| |
| − |
| |
| − | window.addEventListener('resize', resize);
| |
| − | window.addEventListener('load', initSnow);
| |
| − |
| |
| − | /* Any JavaScript here will be loaded for all users on every page load. */
| |
| − |
| |
| − | // ------------ CITY GATE
| |
| − | if ($.inArray("City Gate", mw.config.get('wgCategories')) > -1) {
| |
| − |
| |
| − | $(function () {
| |
| − |
| |
| − | "use strict";
| |
| − |
| |
| − | $('body').css('background', 'url(https://vignette.wikia.nocookie.net/drawntolife/images/f/f9/City_Wall_Background.png/revision/latest?cb=20160629180154) top center no-repeat fixed')
| |
| − |
| |
| − | $('body').css('background-size', 'cover')
| |
| − |
| |
| − | });
| |
| − | }
| |
| − |
| |
| − |
| |
| − | // ------------ BEACH GATE
| |
| − | if ($.inArray("Beach Gate", mw.config.get('wgCategories')) > -1) {
| |
| − |
| |
| − | $(function () {
| |
| − |
| |
| − | "use strict";
| |
| − |
| |
| − | $('body').css('background', 'url(https://vignette.wikia.nocookie.net/drawntolife/images/c/c9/BeachgateBG.png/revision/latest?cb=20160606134434) top center no-repeat fixed')
| |
| − |
| |
| − | $('body').css('background-size', 'cover')
| |
| − |
| |
| − | });
| |
| − | }
| |
| − |
| |
| − |
| |
| − | // ------------ SNOW GATE
| |
| − | if ($.inArray("Snow Gate", mw.config.get('wgCategories')) > -1) {
| |
| − |
| |
| − | $(function () {
| |
| − |
| |
| − | "use strict";
| |
| − |
| |
| − | $('.skin-oasis').css('background', 'url(https://vignette.wikia.nocookie.net/drawntolife/images/7/72/SnowGate_Mountains_Background.png/revision/latest?cb=20160425205730) top center no-repeat fixed')
| |
| − |
| |
| − | $('.skin-oasis').css('background-size', 'cover')
| |
| − |
| |
| − | });
| |
| − | }
| |
| − |
| |
| − | // ------------ FOREST GATE
| |
| − | if ($.inArray("Forest Gate", mw.config.get('wgCategories')) > -1) {
| |
| − |
| |
| − | $(function () {
| |
| − |
| |
| − | "use strict";
| |
| − |
| |
| − | $('body').css('background', 'url(https://vignette.wikia.nocookie.net/drawntolife/images/3/38/TwiliteBGTrees.png/revision/latest?cb=20160428133906) top center no-repeat fixed')
| |
| − |
| |
| − | $('body').css('background-size', 'cover')
| |
| − |
| |
| − | });
| |
| − | }
| |
| − |
| |
| − |
| |
| − | // ------------ WILFRE'S WASTELAND
| |
| − | if ($.inArray("Wilfre's Wasteland", mw.config.get('wgCategories')) > -1) {
| |
| − |
| |
| − | $(function () {
| |
| − |
| |
| − | "use strict";
| |
| − |
| |
| − | $('body').css('background', 'url(https://vignette.wikia.nocookie.net/drawntolife/images/1/1a/WilfresWasteland_Background_%28Lighter%29.jpg/revision/latest?cb=20160428154823) top center no-repeat fixed')
| |
| − |
| |
| − | $('body').css('background-size', 'cover')
| |
| − |
| |
| − | });
| |
| − | }
| |
| − |
| |
| − | // ------------ GALACTIC JUNGLE
| |
| − | if ($.inArray("Galactic Jungle", mw.config.get('wgCategories')) > -1) {
| |
| − |
| |
| − | $(function () {
| |
| − |
| |
| − | "use strict";
| |
| − |
| |
| − | $('body').css('background', 'url(https://vignette.wikia.nocookie.net/drawntolife/images/6/64/GalacticJungle_Background_%28Lighter%29.jpg/revision/latest?cb=20160428153304) top center no-repeat fixed')
| |
| − |
| |
| − | $('body').css('background-size', 'cover')
| |
| − |
| |
| − | });
| |
| − | }
| |
| − |
| |
| − | // ------------ LAVASTEAM
| |
| − | if ($.inArray("Lavasteam", mw.config.get('wgCategories')) > -1) {
| |
| − |
| |
| − | $(function () {
| |
| − |
| |
| − | "use strict";
| |
| − |
| |
| − | $('body').css('background', 'url(https://vignette.wikia.nocookie.net/drawntolife/images/8/8e/Lavasteam_Background_%28Lighter%29.jpg/revision/latest?cb=20160428152821) top center no-repeat fixed')
| |
| − |
| |
| − | $('body').css('background-size', 'cover')
| |
| − |
| |
| − | });
| |
| − | }
| |
| − |
| |
| − | // ------------ WATERSONG
| |
| − | if ($.inArray("Watersong", mw.config.get('wgCategories')) > -1) {
| |
| − |
| |
| − | $(function () {
| |
| − |
| |
| − | "use strict";
| |
| − |
| |
| − | $('body').css('background', 'url(https://vignette.wikia.nocookie.net/drawntolife/images/5/5a/Watersong_Background_%28Lighter%29.jpg/revision/latest?cb=20160428151916) top center no-repeat fixed')
| |
| − |
| |
| − | $('body').css('background-size', 'cover')
| |
| − |
| |
| − | });
| |
| − | }
| |
| − |
| |
| − |
| |
| − | // ------------ TwoRealms
| |
| − | if ($.inArray("Drawn to Life: Two Realms", mw.config.get('wgCategories')) > -1) {
| |
| − |
| |
| − | $(function () {
| |
| − |
| |
| − | "use strict";
| |
| − |
| |
| − | $('body').css('background', 'url(https://vignette.wikia.nocookie.net/drawntolife/images/e/e5/SteamBackdrop.jpg/revision/latest?cb=20201105173515) top center no-repeat fixed')
| |
| − |
| |
| − | $('body').css('background-size', 'cover')
| |
| − |
| |
| − | });
| |
| − | }
| |