User:Aurelion Sol/global.js

//Chat Options $.getScript("https://raw.github.com/sactage/wikia-js-snippets/master/ChatOptions.js"); importArticles({   type: 'script',    articles: [        'u:dev:NoImageLightbox/code.js',        'u:dev:OldFilePages/code.js',        'u:vstf:User:Joeyaa/wham.js'    ] }); importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); importScriptPage('User:Joeytje50/ChatPMs.js', 'c'); importScriptPage('User:Madnessfan34537/multikick.js', 'callofduty'); importScriptPage('BackToTopButton/code.js', 'dev'); importScriptPage('User:Joeyaa/wham.js','vstf'); importScriptPage('MediaWiki:FindReplace.js', 'kangaroopower'); importScriptURI('http://dev.wikia.com/wiki/BotoneraPopups/Code/en.js?action=raw&ctype=text/javascript&templates=expand'); importStylesheetPage('BotoneraPopups/code.css', 'dev'); importScriptPage('AjaxBatchDelete/code.js', 'dev'); importScriptPage('AutoEditDropdown/code.js', 'dev'); importScriptPage('AjaxRC/code.js', 'dev'); importScriptPage('AjaxPatrol/code.js', 'dev' ); importScriptPage('AjaxUndo/code.js', 'dev' ); AjaxRCRefreshText = 'AJAX'; AjaxRCRefreshHoverText = 'Automatically refresh the page'; ajaxPages = ["Special:RecentChanges","Special:WikiActivity"]; importScriptPage('AjaxRC/code.js', 'dev'); importScriptPage('User:PlasmaTime/quickBlock.js', 'c'); importScriptPage('FastDelete/code.js', 'dev'); importScriptPage('MessageBlocker/code.js', 'dev'); var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': 'spam', 'label': 'spam'}; fdButtons[fdButtons.length] = { 'summary': 'vandalism', 'label': 'vandalism'} fdButtons[fdButtons.length] = { 'summary': 'housekeeping', 'label': 'housekeeping'} $.getScript("https://raw.github.com/sactage/wikia-js-snippets/master/RollbackMods.js"); importArticles({   type: "script",    articles: [        "w:c:dev:RevealAnonIP/usercode.js"    ] }); importArticles( {   type: 'script',    articles: [        // ...        'u:dev:CapsFirst/code.js',        // ...    ] } ); // Youtube info // Written by User:Sactage if (wgCanonicalSpecialPageName == 'Chat') { NodeChatDiscussion.prototype.ytInfoCache = {}; NodeChatDiscussion.prototype.ytInfo = function(chat) { if(mainRoom.isInitialized && !chat.attributes.isInlineAlert) { var text = chat.attributes.text, search = /https?:\/\/(?:www\.|m\.)?youtube\.com[^ ]+v=([^&# ]*)|https?:\/\/(?:www\.)?youtu\.be\/([^&#\? ]*)/im, match = text.match(search); if (match) { var $link = $("a[href='" + match[0] + "']").last, id = match[1] ? match[1] : match[2]; if (this.ytInfoCache.hasOwnProperty(id)) { return $link.attr('title', this.ytInfoCache[id]); }                               $.get("http://gdata.youtube.com/feeds/api/videos/" + id + "?v=2&alt=jsonc", function (data) {                                        try {                                                data = data.data;                                                var info = data.title + ' | ' + data.uploader + ' | ' + data.uploaded.split(/T/)[0] + ' | ' + (data.viewCount || 0) + ' views';                                                mainRoom.viewDiscussion.ytInfoCache[id] = info;                                                $link.attr('title', info);                                        } catch (e) {                                                console.log('fetching youtube data failed');                                                console.error(e);                                        }                                }); }               }        }        mainRoom.model.chats.bind('afteradd', $.proxy(mainRoom.viewDiscussion.ytInfo, mainRoom.viewDiscussion)); } $.getScript('https://raw.github.com/sactage/wikia-js-snippets/master/ChatOptions.js'); importScriptPage('ChatOptions/code.js','dev'); importScriptPage("ChatTags/code.js", "dev"); importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); importScriptPage('User:Joeytje50/tabinsert.js','rs'); importScriptPage('MessageBlocker/code.js', 'dev'); importScriptPage('PurgeButton/code.js', 'dev'); importScriptPage('WHAM/code.js', 'dev'); importScriptPage('MarkForDeletion/code.js', 'dev'); importScriptPage('ArchiveTool/code.js', 'dev'); importScriptPage('EditcountTag/code.js', 'dev'); importScriptPage('MediaWiki:AjaxUndo/code.js', 'coreychambers'); importScriptPage('AjaxRC/code.js', 'dev'); importScriptPage('AjaxPatrol/code.js', 'dev'); importScriptPage('SearchGoButton/code.js', 'dev'); importScriptPage('User:Sactage/scripts/Speedy-Comments.js', 'cod'); importScriptPage('QQX/code.js', 'dev'); importScriptPage('WallGreetingButton/code.js', 'dev'); importScriptPage('MediaWiki:Gadget-HotCat.js', 'dev' ); importScriptPage('CacheCheck/code.js', 'dev' ); importScriptPage('CategoryRenameAuto-update/code.js', 'dev' ); importScriptPage('QuickComments/code.js', 'dev' ); importScriptPage('Tools/Quick_User_Switch/code.js', 'gamedezyner'); importScriptPage('AjaxEmoticons/code.js', 'dev'); importArticles({ type:'script', articles:[ 'w:c:dev:RevealAnonIP/code.js', //Reveal Anonymous User IP  'w:c:dev:ShowHide/code.js',  'w:c:dev:DisplayClock/code.js',  'w:c:dev:QuickTools/advanced.js',  'w:c:dev:AutoEditDropdown/code.js',  'w:c:dev:HideRail/code.js',  'w:c:dev:BackToTopButton/code.js',  'u:dev:MiniComplete/code.js',  'u:dev:HeaderLinks/code.js',  'u:wikimarks:Client.js',  'u:dev:ListFiles/code.js',  'u:dev:NullEditButton/code.js',  'u:dev:Message/code.js',  'u:dev:SearchSuggest/code.js',  'u:dev:QuickModTools/loader.js',  'u:dev:PageMakerPro/code.js',  'u:dev:PurgeButton/code.js',  'u:dev:UserRightsRecord/code.js',  'u:dev:UserRightsRecord/code.js'    ] }); // ********** // Fastdelete // ********** var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': 'Unnecessary ', 'label': 'Unnec'}; fdButtons[fdButtons.length] = { 'summary': 'Off Topic', 'label': 'Off topic'}; fdButtons[fdButtons.length] = { 'summary': 'Spam', 'label': 'Spam'}; fdButtons[fdButtons.length] = { 'summary': 'Housekeeping', 'label': 'Housekeeping'}; // Import for Delete & Delete and Protect buttons if (wgNamespaceNumber == 0) { importScriptPage('User:The Mol Man/FastDeleteProtect.js', 'a'); } else { importScriptPage('FastDelete/code.js', 'dev'); }; // ************** // End Fastdelete // * /*Allow Chat Mods and admins to kick users using /kick */ if (wgUserGroups.indexOf('chatmoderator')!=-1 || wgUserGroups.indexOf('sysop')!=-1) { $(function {	$('[name="message"]').keypress(function(e) { if (e.which == 13) { if (this.value.split(' ')[0] == '/kick') { e.preventDefault; var toKick = this.value.replace(/^\/kick /,'') if (!$('#WikiChatList [data-user="'+toKick+'"]').length) { confirm(toKick + ' is not in this chat. Still try to kick them?')?mainRoom.kick({name: toKick}):undefined; } else { mainRoom.kick({name: toKick}) }				this.value = ''; return true; }		}	}); }); } /* Auto updating recent changes opt-in * See w:c:dev:AjaxRC for info & attribution */ AjaxRCRefreshText = 'Auto-refresh'; AjaxRCRefreshHoverText = 'Automatically refresh the page'; ajaxPages = ["Special:RecentChanges","Especial:WikiActivity","Special:WikiActivity"]; importScriptPage('AjaxRC/code.js', 'dev'); /* MassRenameRevert importScriptPage('MassRenameRevert/code.js', 'dev'); /* VS importArticles({   type: 'script',    articles: [         'u:dev:View_Source/code.js'    ] }); /* Xablau */ importScriptPage('AnchoredRollback/code.js', 'dev'); /* Wow */ importArticles({   type: 'script',    articles: [        'u:dev:APICall/code.js'    ] }); /* Yay */ importArticles({	type: 'script',	articles: [		'u:dev:Thread Inspection/code.js'	] }); /* Test importArticles({   type: 'script',    articles: [        'w:dev:PortableCSSPad/code.js'    ] }); /* k */ importArticles({   type: 'script',    articles: [        'u:dev:QuickToolsv2/code.js'    ] }); //Special CSS controller jQuery(function ($) {   if (mw.config.get('wgCanonicalSpecialPageName') === 'CSS') {        $(".css-editor").prepend(" 100% ");    };    var countcss = 0;    $("#buttom-css").click(function  { countcss += 1; if (countcss == 1) { $(this).text("Default"); $(".css-editor-wrapper").css("width", "100%"); $(".css-side-bar").css("display", "none"); $(".ace_gutter").css("display", "none"); $(".ace_scroller").css("left", "0px"); }       if (countcss == 2) { $(this).text("100%"); $(".css-editor-wrapper").css("width", "auto"); $(".css-side-bar").css("display", "block"); $(".ace_gutter").css("display", "block"); $(".ace_scroller").css("left", "49px"); countcss = 0 }   }); }); /* http://schillmania.com/projects/snowstorm/license.txt || read the license */ window.snowStorm = { // --- common properties --- autoStart: true,		// Whether the snow should start automatically or not. flakesMax: 100,			// Limit total amount of snow made (falling + sticking) flakesMaxActive: 100,		// Limit amount of snow falling at once (less = lower CPU use) animationInterval: 30,		// Theoretical "miliseconds per frame" measurement. 20 = fast + smooth, but high CPU use. 50 = more conservative, but slower excludeMobile: true,		// Snow is likely to be bad news for mobile phones' CPUs (and batteries.) By default, be nice. flakeBottom: null,		// Integer for Y axis snow limit, 0 or null for "full-screen" snow effect followMouse: false,		// Snow movement can respond to the user's mouse snowColor: '#fff',		// Don't eat (or use?) yellow snow. snowCharacter: '&bull;',	// &bull; = bullet, &middot; is square on some systems etc. snowStick: false,		// Whether or not snow should "stick" at the bottom. When off, will never collect. targetElement: document.body,	// element which snow will be appended to (null = document.body) - can be an element ID eg. 'myDiv', or a DOM node reference useMeltEffect: true,		// When recycling fallen snow (or rarely, when falling), have it "melt" and fade out if browser supports it	useTwinkleEffect: false,	// Allow snow to randomly "flicker" in and out of view while falling usePositionFixed: true,		// true = snow does not shift vertically when scrolling. May increase CPU load, disabled by default - if enabled, used only where supported // --- less-used bits --- freezeOnBlur: true,		// Only snow when the window is in focus (foreground.) Saves CPU. flakeLeftOffset: 0,		// Left margin/gutter space on edge of container (eg. browser window.) Bump up these values if seeing horizontal scrollbars. flakeRightOffset: 0,		// Right margin/gutter space on edge of container flakeWidth: 6,			// Max pixel width reserved for snow element flakeHeight: 6,			// Max pixel height reserved for snow element vMaxX: 5,			// Maximum X velocity range for snow vMaxY: 4,			// Maximum Y velocity range for snow zIndex: 1			// CSS stacking order applied to each snowflake }; // --- End of user section --- snowStorm.internal = { // UA sniffing and backCompat rendering mode checks for fixed position, etc.	isIE: navigator.userAgent.match(/msie/i), isIE6: navigator.userAgent.match(/msie 6/i), isWin98: navigator.appVersion.match(/windows 98/i), isMobile: navigator.userAgent.match(/mobile|opera m(ob|in)/i), screenX: null, screenX2: null, screenY: null, scrollY: null, vRndX: null, vRndY: null, windOffset: 1, windMultiplier: 2, flakeTypes: 6, fixedForEverything: false, opacitySupported: true, didInit: false, docFrag: document.createDocumentFragment }; snowStorm.internal.isBackCompatIE = (snowStorm.internal.isIE && document.compatMode == 'BackCompat'); snowStorm.internal.noFixed = (snowStorm.internal.isMobile || snowStorm.internal.isBackCompatIE || snowStorm.internal.isIE6); try { document.createElement('div').style.opacity = '0.5'; } catch(e) { snowStorm.internal.opacitySupported = false; } snowStorm.timers = []; snowStorm.flakes = []; snowStorm.disabled = false; snowStorm.active = false; snowStorm.meltFrameCount = 20; snowStorm.meltFrames = []; snowStorm.events = {}; snowStorm.events.add = function(element, listener, func) { if (!window.addEventListener && window.attachEvent) { element.attachEvent('on' + listener, func); }	else { element.addEventListener.apply(element, Array.prototype.slice.call(arguments, 1)) } } snowStorm.events.remove = function(element, listener, func) { if (!window.addEventListener && window.attachEvent) { element.detachEvent('on' + listener, func); }	else { element.removeEventListener.apply(element, Array.prototype.slice.call(arguments, 1)) } } function rnd(n, min) { if (isNaN(min)) { min = 0; }	return (Math.random * n) + min; } function plusMinus(n) { if (parseInt(rnd(2), 10) == 1) { return n * -1; }	else { return n;	} } snowStorm.randomizeWind = function { snowStorm.internal.vRndX = plusMinus(rnd(snowStorm.vMaxX, 0.2)); snowStorm.internal.vRndY = rnd(snowStorm.vMaxY, 0.2); if (snowStorm.flakes) { for (var i = 0; i < snowStorm.flakes.length; i++) { if (snowStorm.flakes[i].active) { snowStorm.flakes[i].setVelocities; }		}	} }; snowStorm.scrollHandler = function { // "attach" snowflakes to bottom of window if no absolute bottom value was given snowStorm.internal.scrollY = (snowStorm.flakeBottom ? 0 : parseInt(window.scrollY || document.documentElement.scrollTop || document.body.scrollTop, 10)); if (isNaN(snowStorm.internal.scrollY)) { snowStorm.internal.scrollY = 0; // Netscape 6 scroll fix }	if (!snowStorm.internal.fixedForEverything && !snowStorm.flakeBottom && snowStorm.flakes) { for (var i = snowStorm.flakes.length - 1; i >= 0; i--) { if (snowStorm.flakes[i].active == 0) { snowStorm.flakes[i].stick; }		}	} }; snowStorm.resizeHandler = function { if (window.innerWidth || window.innerHeight) { snowStorm.internal.screenX = window.innerWidth - 16 - snowStorm.flakeRightOffset; snowStorm.internal.screenY = (snowStorm.flakeBottom ? snowStorm.flakeBottom : window.innerHeight); } else { snowStorm.internal.screenX = (document.documentElement.clientWidth || document.body.clientWidth || document.body.scrollWidth) - (!snowStorm.internal.isIE ? 8 : 0) - snowStorm.flakeRightOffset; snowStorm.internal.screenY = snowStorm.flakeBottom ? snowStorm.flakeBottom : (document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight); }	snowStorm.internal.screenX2 = parseInt(snowStorm.internal.screenX / 2, 10); }; snowStorm.resizeHandlerAlt = function { snowStorm.internal.screenX = snowStorm.targetElement.offsetLeft + snowStorm.targetElement.offsetWidth - snowStorm.flakeRightOffset; snowStorm.internal.screenY = snowStorm.flakeBottom ? snowStorm.flakeBottom : snowStorm.targetElement.offsetTop + snowStorm.targetElement.offsetHeight; snowStorm.internal.screenX2 = parseInt(snowStorm.internal.screenX/2,10); }; snowStorm.freeze = function { // pause animation if (!snowStorm.disabled) { snowStorm.disabled = 1; } else { return false; }	for (var i = snowStorm.timers.length - 1; i >= 0; i--) { clearInterval(snowStorm.timers[i]); } }; snowStorm.resume = function { if (snowStorm.disabled) { snowStorm.disabled = 0; } else { return false; }	snowStorm.timerInit; }; snowStorm.toggleSnow = function { if (!snowStorm.flakes.length) { // first run snowStorm.start; } else { snowStorm.active = !snowStorm.active; if (snowStorm.active) { snowStorm.show; snowStorm.resume; } else { snowStorm.stop; snowStorm.freeze; }	} }; snowStorm.stop = function { snowStorm.freeze; for (var i = snowStorm.flakes.length - 1; i >= 0; i--) { snowStorm.flakes[i].o.style.display = 'none'; }	snowStorm.events.remove(window, 'scroll', snowStorm.scrollHandler); snowStorm.events.remove(window, 'resize', snowStorm.resizeHandler); if (snowStorm.freezeOnBlur) { if (snowStorm.internal.isIE) { snowStorm.events.remove(document, 'focusout', snowStorm.freeze); snowStorm.events.remove(document, 'focusin', snowStorm.resume); } else { snowStorm.events.remove(window, 'blur', snowStorm.freeze); snowStorm.events.remove(window, 'focus', snowStorm.resume); }	} }; snowStorm.show = function { for (var i = snowStorm.flakes.length - 1; i >= 0; i--) { snowStorm.flakes[i].o.style.display = 'block'; } }; snowStorm.SnowFlake = function(type, x, y) { this.type = type; this.x = x || parseInt(rnd(snowStorm.internal.screenX - 20), 10); this.y = (!isNaN(y) ? y : -rnd(snowStorm.internal.screenY) - 12); this.vX = null; this.vY = null; this.vAmpTypes = [1, 1.2, 1.4, 1.6, 1.8]; // "amplification" for vX/vY (based on flake size/type) this.vAmp = this.vAmpTypes[this.type]; this.melting = false; this.meltFrameCount = snowStorm.meltFrameCount; this.meltFrames = snowStorm.meltFrames; this.meltFrame = 0; this.twinkleFrame = 0; this.active = 1; this.fontSize = (10 + (this.type / 5) * 10); this.o = document.createElement('div'); this.o.innerHTML = snowStorm.snowCharacter; this.o.style.color = snowStorm.snowColor; this.o.style.position = (snowStorm.internal.fixedForEverything ? 'fixed' : 'absolute'); this.o.style.width = snowStorm.flakeWidth + 'px'; this.o.style.height = snowStorm.flakeHeight + 'px'; this.o.style.fontFamily = 'arial,verdana'; this.o.style.cursor = 'default'; this.o.style.overflow = 'hidden'; this.o.style.fontWeight = 'normal'; this.o.style.zIndex = snowStorm.zIndex; snowStorm.internal.docFrag.appendChild(this.o); this.refresh = function { if (isNaN(this.x) || isNaN(this.y)) { // safety check return false; }		this.o.style.left = this.x + 'px'; this.o.style.top = this.y + 'px'; };	this.stick = function { if (snowStorm.internal.noFixed || (snowStorm.targetElement !== document.documentElement && snowStorm.targetElement !== document.body)) { this.o.style.top = (snowStorm.internal.screenY + snowStorm.internal.scrollY - snowStorm.flakeHeight) + 'px'; } else if (snowStorm.flakeBottom) { this.o.style.top = snowStorm.flakeBottom + 'px'; } else { this.o.style.display = 'none'; this.o.style.top = 'auto'; this.o.style.bottom = '0px'; this.o.style.position = 'fixed'; this.o.style.display = 'block'; }	};	this.vCheck = function { if (this.vX >= 0 && this.vX < 0.2) { this.vX = 0.2; } else if (this.vX < 0 && this.vX > -0.2) { this.vX = -0.2; }		if (this.vY >= 0 && this.vY < 0.2) { this.vY = 0.2; }	};	this.move = function { var vX = this.vX * snowStorm.internal.windOffset; this.x += vX; this.y += (this.vY * this.vAmp); if (this.x >= snowStorm.internal.screenX || snowStorm.internal.screenX - this.x < snowStorm.flakeWidth) { // X-axis scroll check this.x = 0; } else if (vX < 0 && this.x - snowStorm.flakeLeftOffset < -snowStorm.flakeWidth) { this.x = snowStorm.internal.screenX - snowStorm.flakeWidth-1; // flakeWidth; }		this.refresh; var yDiff = snowStorm.internal.screenY + snowStorm.internal.scrollY - this.y;		if (yDiff < snowStorm.flakeHeight) { this.active = 0; if (snowStorm.snowStick) { this.stick; } else { this.recycle; }		} else { if (snowStorm.useMeltEffect && this.active && this.type < 3 && !this.melting && Math.random > 0.998) { // ~1/1000 chance of melting mid-air, with each frame this.melting = true; this.melt; // only incrementally melt one frame // this.melting = false; }			if (snowStorm.useTwinkleEffect) { if (!this.twinkleFrame) { if (Math.random > 0.9) { this.twinkleFrame = parseInt(Math.random * 20, 10); }				} else { this.twinkleFrame--; this.o.style.visibility = (this.twinkleFrame && this.twinkleFrame % 2 == 0 ? 'hidden' : 'visible'); }			}		}	};	this.animate = function { // main animation loop // move, check status, die etc.		this.move; };	this.setVelocities = function { this.vX = snowStorm.internal.vRndX + rnd(snowStorm.vMaxX * 0.12, 0.1); this.vY = snowStorm.internal.vRndY + rnd(snowStorm.vMaxY * 0.12, 0.1); };	this.setOpacity = function(o, opacity) { if (!snowStorm.internal.opacitySupported) { return false; }		o.style.opacity = opacity; };	this.melt = function { if (!snowStorm.useMeltEffect || !this.melting) { this.recycle; } else { if (this.meltFrame < this.meltFrameCount) { this.setOpacity(this.o, this.meltFrames[this.meltFrame]); this.o.style.fontSize = this.fontSize - (this.fontSize * (this.meltFrame / this.meltFrameCount)) + 'px'; this.o.style.lineHeight = snowStorm.flakeHeight + 2 + (snowStorm.flakeHeight * 0.75 * (this.meltFrame / this.meltFrameCount)) + 'px'; this.meltFrame++; } else { this.recycle; }		}	};	this.recycle = function { this.o.style.display = 'none'; this.o.style.position = (snowStorm.internal.fixedForEverything ? 'fixed' : 'absolute'); this.o.style.bottom = 'auto'; this.setVelocities; this.vCheck; this.meltFrame = 0; this.melting = false; this.setOpacity(this.o, 1); this.o.style.padding = '0px'; this.o.style.margin = '0px'; this.o.style.fontSize = this.fontSize + 'px'; this.o.style.lineHeight = (snowStorm.flakeHeight + 2) + 'px'; this.o.style.textAlign = 'center'; this.o.style.verticalAlign = 'baseline'; this.x = parseInt(rnd(snowStorm.internal.screenX - snowStorm.flakeWidth - 20), 10); this.y = parseInt(rnd(snowStorm.internal.screenY) * -1, 10) - snowStorm.flakeHeight; this.refresh; this.o.style.display = 'block'; this.active = 1; };	this.recycle; // set up x/y coords etc.	this.refresh; }; snowStorm.snow = function { var active = 0; var used = 0; var waiting = 0; var flake = null; for (var i = snowStorm.flakes.length - 1; i >= 0; i--) { if (snowStorm.flakes[i].active == 1) { snowStorm.flakes[i].move; active++; } else if (snowStorm.flakes[i].active == 0) { used++; } else { waiting++; }		if (snowStorm.flakes[i].melting) { snowStorm.flakes[i].melt; }	}	if (active < snowStorm.flakesMaxActive) { flake = snowStorm.flakes[parseInt(rnd(snowStorm.flakes.length), 10)]; if (flake.active == 0) { flake.melting = true; }	} }; snowStorm.mouseMove = function(e) { if (!snowStorm.followMouse) { return true; }	var x = parseInt(e.clientX, 10); if (x < snowStorm.internal.screenX2) { snowStorm.internal.windOffset = -snowStorm.internal.windMultiplier + (x / snowStorm.internal.screenX2 * snowStorm.internal.windMultiplier); } else { x -= snowStorm.internal.screenX2; snowStorm.internal.windOffset = (x / snowStorm.internal.screenX2) * snowStorm.internal.windMultiplier; } }; snowStorm.createSnow = function(limit, allowInactive) { for (var i = 0; i < limit; i++) { snowStorm.flakes.push(new snowStorm.SnowFlake(parseInt(rnd(snowStorm.internal.flakeTypes), 10))); if (allowInactive || i > snowStorm.flakesMaxActive) { snowStorm.flakes[snowStorm.flakes.length - 1].active = -1; }	}	snowStorm.targetElement.appendChild(snowStorm.internal.docFrag); }; snowStorm.timerInit = function { snowStorm.timers = (!snowStorm.internal.isWin98 ? [setInterval(snowStorm.snow, snowStorm.animationInterval)] : [setInterval(snowStorm.snow, snowStorm.animationInterval * 3), setInterval(snowStorm.snow, snowStorm.animationInterval)]); }; snowStorm.init = function { for (var i = 0; i < snowStorm.meltFrameCount; i++) { snowStorm.meltFrames.push(1 - (i / snowStorm.meltFrameCount)); }	snowStorm.randomizeWind; snowStorm.createSnow(snowStorm.flakesMax); // create initial batch snowStorm.events.add(window, 'resize', snowStorm.resizeHandler); snowStorm.events.add(window, 'scroll', snowStorm.scrollHandler); if (snowStorm.freezeOnBlur) { if (snowStorm.internal.isIE) { snowStorm.events.add(document, 'focusout', snowStorm.freeze); snowStorm.events.add(document, 'focusin', snowStorm.resume); } else { snowStorm.events.add(window, 'blur', snowStorm.freeze); snowStorm.events.add(window, 'focus', snowStorm.resume); }	}	snowStorm.resizeHandler; snowStorm.scrollHandler; if (snowStorm.followMouse) { snowStorm.events.add(snowStorm.internal.isIE ? document : window, 'mousemove', snowStorm.mouseMove); }	snowStorm.animationInterval = Math.max(20, snowStorm.animationInterval); snowStorm.timerInit; }; snowStorm.start = function(bFromOnLoad) { if (!snowStorm.internal.didInit) { snowStorm.internal.didInit = true; } else if (bFromOnLoad) { // already loaded and running return true; }	if (typeof snowStorm.targetElement == 'string') { var targetID = snowStorm.targetElement; snowStorm.targetElement = document.getElementById(targetID); if (!snowStorm.targetElement) { throw new Error('Snowstorm: Unable to get targetElement "' + targetID + '"'); }	}	if (!snowStorm.targetElement) { snowStorm.targetElement = (!snowStorm.internal.isIE ? (document.documentElement ? document.documentElement : document.body) : document.body); }	if (snowStorm.targetElement !== document.documentElement && snowStorm.targetElement !== document.body) { snowStorm.resizeHandler = snowStorm.resizeHandlerAlt; // re-map handler to get element instead of screen dimensions }	snowStorm.resizeHandler; // get bounding box elements snowStorm.usePositionFixed = (snowStorm.usePositionFixed && !snowStorm.internal.noFixed); // whether or not position:fixed is supported snowStorm.internal.fixedForEverything = snowStorm.usePositionFixed; if (snowStorm.internal.screenX && snowStorm.internal.screenY && !snowStorm.disabled) { snowStorm.init; snowStorm.active = true; } }; function doDelayedStart { setTimeout(function {		snowStorm.start(true);	}, 20); // event cleanup snowStorm.events.remove(snowStorm.internal.isIE ? document : window, 'mousemove', doDelayedStart); } function doStart { if (!snowStorm.excludeMobile || !snowStorm.internal.isMobile) { if (snowStorm.freezeOnBlur) { snowStorm.events.add(snowStorm.internal.isIE ? document : window, 'mousemove', doDelayedStart); } else { doDelayedStart; }	}	// event cleanup snowStorm.events.remove(window, 'load', doStart); } // hooks for starting the snow if (snowStorm.autoStart) { snowStorm.events.add(window, 'load', doStart, false); }