User:Entidade Sombria BWD/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'        'u:dev:MediaWiki:Discussions Delete All/code.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:nanaki:MediaWiki:MessagingCleanup.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'); importArticles({   type: 'script',    articles: [         'u:dev:View_Source/code.js'    ] }); importScriptPage('AnchoredRollback/code.js', 'dev'); importArticles({   type: 'script',    articles: [        'u:dev:APICall/code.js'    ] }); importArticles({	type: 'script',	articles: [		'u:dev:Thread Inspection/code.js'	] }); importArticles({   type: 'script',    articles: [        'w:dev:MediaWiki: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); }

/* if (mw.config.get('wgUserGroups').indexOf('poweruser') + mw.config.get('wgUserGroups').indexOf('vstf') + mw.config.get('wgUserGroups').indexOf('staff') + mw.config.get('wgUserGroups').indexOf('helper') == -4) return; switch (mw.config.get('wgCanonicalSpecialPageName')) { case "Contributions": $('#contentSub a:last-child').after(' | Nuke'); break; case "Specialpages": if (!$('a[title="Special:Nuke"]').length) $('.mw-specialpagerestricted a[title="Special:Undelete"]').after('Mass delete'); else $('.mw-specialpagerestricted a[title="Special:Nuke"]').after('Mass delete (JavaScript)'); break; case "Blankpage": if ($.getUrlVar('blankspecial') == "nuke") main; break; default: return; break; } function main { var config = mw.config.get([		'stylepath',		'wgArticlePath',		'wgFormattedNamespaces',		'wgMainpage',		'wgSiteName'	]), token = mw.user.tokens.get('editToken'), API = new mw.Api, articlePath = config.wgArticlePath.slice(0,-2), images, RCTitles, usercontribs, recentchanges, maxLimit, count, escapedTitle; $('.header-column.header-title h1').text('Nuke'); document.title = "Nuke - " + config.wgSiteName; wgCanonicalSpecialPageName = "Nuke"; if ($.getUrlVar('nukeuser')) { var user = $.getUrlVar('nukeuser'), deleteReason = window.nukeDeleteReason || "Mass removal of pages created by " + user.replace(/_/g,' '); $('#mw-content-text p').html('Switch to Nuke main form The following pages were created by ' + user.replace(/_/g,' ') + '; put in a comment and hit the button to delete them. Reason for deletion:  Delete</a> Delete</a>'); $('#nuke-status').html('Getting pages... please wait <img src="' + config.stylepath + '/common/progress-wheel.gif"/>'); API.get({		action: 'query',		list: 'usercontribs',		ucnamespace: $.getUrlVar('nukenamespace') || '',		ucuser: user,		uclimit: 5000,		cb: new Date.getTime 		}) .done(function(d) {			if (!d.error) {				usercontribs = d.query.usercontribs;				maxLimit = $.getUrlVar('nukelimit') || 5000;				count = 0;				images = [];				for (var i in usercontribs) {					if (count >= maxLimit)							break;					if (usercontribs[i].hasOwnProperty('new')) {						escapedTitle = encodeURIComponent(usercontribs[i].title);						if (!$.getUrlVar('nukematch') || new RegExp($.getUrlVar('nukematch')).test(usercontribs[i].title)) {							$('#nuke-query-results').append('<li class="nuke-query-result"><input type="checkbox" class="nuke-title-check" checked="checked"/> ' + usercontribs[i].title + '</a></li>');							if (usercontribs[i].title.slice(0,5) == "File:")								images.push(usercontribs[i].title);							count++;														}					}				}				if (!$('.nuke-query-result').length)					$('#nuke-status').html(' No user contributions found '); else { displayImages; $('#nuke-status').empty; }			}			else $('#nuke-status').html(' Failed to get user contributions: ' + d.error.code + ' '); })		.fail(function { $('#nuke-status').html(' Failed to get user contributions '); });	}	else {		$('#mw-content-text p').html('This tool allows for mass deletions of pages recently added by a given user or IP address. Input the username or IP address to get a list of pages to delete, or leave blank for all users. Username, IP address or blank: <input type="text" id="nuke-username"/> Pattern for the page name: <input type="text" id="nuke-match"/> Limit to namespace: <select id="nuke-namespace"><option value="All">All <option value="Main" ns="0">Main <option value="Project" ns="4">Project <option value="Project talk" ns="5">Project talk <option value="Talk" ns="1">Talk <option value="User" ns="2">User <option value="User talk" ns="3">User talk <option value="File" ns="6">File <option value="File talk" ns="7">File talk <option value="Template" ns="10">Template <option value="Template talk" ns="11">Template talk <option value="Help" ns="12">Help <option value="Help talk" ns="13">Help talk <option value="Category" ns="14">Category <option value="Category talk" ns="15">Category talk Maximum number of pages: <input type="text" id="nuke-max" value="500"/> Go</a>  '); $('#nuke-rc').click(function {			if ($(this).attr('disabled')) return;			$(this).attr('disabled','disabled');			if ($('#nuke-username').val) {				var locationStr = articlePath + 'Special:Blankpage?blankspecial=nuke&nukeuser=' + $('#nuke-username').val;				if ($('#nuke-namespace').val != "All")					locationStr += '&nukenamespace=' + $('#nuke-namespace option:selected').attr('ns');				if ($.isNumeric($('#nuke-max').val) && $('#nuke-max').val > 0)					locationStr += '&nukelimit=' + $('#nuke-max').val;				if ($('#nuke-match').val)					locationStr += '&nukematch=' + $('#nuke-match').val;				location.replace(locationStr);				return;			}			$('#nuke-query-results').empty;			if ($('.nuke-submit').length) {				$('.nuke-submit').remove;				$('#mw-content-text > p:nth-child(1) > br:nth-child(14)').remove;			}			$('#nuke-status').html('Getting pages... please wait <img src="' + config.stylepath + '/common/progress-wheel.gif"/>');			API.get({ action: 'query', list: 'recentchanges', rcshow: '!bot', rctype: 'new|log', rclimit: 5000, cb: new Date.getTime })			.done(function(d) { if (!d.error) { recentchanges = d.query.recentchanges; RCTitles = []; maxLimit = $('#nuke-max').val || 5000; count = 0; images = []; for (var i in recentchanges) { if (count >= maxLimit) break; if ((($('#nuke-namespace').val == "Main" && recentchanges[i].title.split(':').length === 1) || $('#nuke-namespace').val == "All" || $('#nuke-namespace').val == "Project" && new RegExp(config.wgFormattedNamespaces[4] + ':').test(recentchanges[i].title) || $('#nuke-namespace').val == "Project talk" && new RegExp(config.wgFormattedNamespaces[5] + ':').test(recentchanges[i].title) || new RegExp($('#nuke-namespace').val + ':').test(recentchanges[i].title)) && (recentchanges[i].type == "new" || (recentchanges[i].type == "log" && recentchanges[i].ns == 6)) && $.inArray(recentchanges[i].title,RCTitles) == -1) { if (!$('#nuke-match').val || new RegExp($('#nuke-match').val).test(recentchanges[i].title)) { RCTitles.push(recentchanges[i].title); escapedTitle = encodeURIComponent(recentchanges[i].title); $('#nuke-query-results').append('<li class="nuke-query-result"><input type="checkbox" class="nuke-title-check" checked="checked"/>  ' + recentchanges[i].title + '</a></li>'); if (recentchanges[i].title.slice(0,5) == "File:") images.push(recentchanges[i].title); count++; }						}					}					if (!$('.nuke-query-result').length) $('#nuke-status').html(' No recent changes found '); else { displayImages; $('#nuke-query-results').before(' Delete</a>').after('Delete</a>'); $('#nuke-status').empty; }				}				else $('#nuke-status').html(' Failed to get recent changes: ' + d.error.code + ' '); })			.fail(function { $('#nuke-status').html(' Failed to get recent changes '); });			$(this).removeAttr('disabled');		}); }	$('.nuke-submit').click(function {		if (!$('.nuke-query-result').length || $(this).attr('disabled')) return;		$('.nuke-submit').attr('disabled','disabled');		$('#nuke-status').html('Deleting pages... please wait <img src="' + config.stylepath + '/common/progress-wheel.gif"/>');		$('.nuke-title-check:checked').each(function(i) { var title = $(this).parent.find('a').text; setTimeout(function {				API.post({ action: 'delete', title: title, reason: $('#nuke-delete-reason').val || '', bot: true, token: token })				.done(function(d) { if (!d.error) { console.log('Deletion of ' + title + ' successful!'); } else { console.log('Failed to delete ' + title + ': '+ d.error.code); }				})				.fail(function { console.log('Failed to delete ' + title); });				if (i === $('.nuke-title-check:checked').length - 1) {					setTimeout(function { location.replace(articlePath + config.wgMainpage); }, 1000);	 				}			}, i*100); });	});	function displayImages { if (images.length < 1) return; API.post({ //using POST instead of GET for longer string threshold		action: 'query',		prop: 'imageinfo',		titles: images.join('|'),		iiprop: 'url',		iilimit: 500		}) .done(function(d) {			if (!d.error) {				for (var i in d.query.pages) {					if (d.query.pages[i].missing != "")						$('a[href="' + articlePath + encodeURIComponent(d.query.pages[i].title) + '"]').parent.children('.nuke-title-check').after('<img src="' + d.query.pages[i].imageinfo[0].url + '" width="120" height="77" /></a>');				}			}		}); } } }) (this.jQuery, this.mediaWiki); // Have the user icon on the global nav link to userpage $('.wds-dropdown__toggle.wds-global-navigation__dropdown-toggle > img').wrap($("", 	{ 		href: mw.config.get("wgServer") + "/wiki/User:" + mw.config.get("wgUserName")	} )); // BEGIN BotoneraPopups importArticles({ type: "script", articles: [ "u:dev:MediaWiki:BotoneraPopups/BotoneraPopups.js", "u:dev:MediaWiki:BotoneraPopups/WikiArticle.js", "u:dev:MediaWiki:BotoneraPopups/UILang/en.js", "u:dev:MediaWiki:BotoneraPopups/code.js" ] }); // END
 * Nuke
 * Reverse engineered Nuke extension
 * Is faster than the original and won't freeze up when deleting many pages
 * https://www.mediawiki.org/wiki/Extension:Nuke is the page of the official MW extension
 * @author Ozuzanna
 * @TODO
 * use usercontribs API when Wikia update to MW 1.23+
 * check if pages exist? - can use imageinfo to help reduce requests
 * (function($, mw) {