User:Thundercraft5/common.js

/** User:Thundercraft5/common.js * This is my common.js, you are free to copy anything as long as you attribute * this page. * * =====Contents===== * *Personal Adjustments *	*Upper icons adjustment *	*Top Menu *	* * * Major Scripts *	*blockListLookup *	*rangeBlockLinks *	*blockListTools //#==================================================# //# PERSONAL ADJUSTMENTS //#==================================================# window.dontWantRoleSpecificJS = true;

window.test = new Proxy({	test: "$", }, {	deleteProperty: function(o, k) {		throw new TypeError(o, k);	}, });

try { delete test.test; } catch (e) { console.warn(e); }

var inter = setInterval(function {   var userGroups = mw.config.get('wgUserGroups');    var canBlock = /sysop|util|staff|helper|global-discussions-moderator|wiki-manager|soap/.test(userGroups.join('\n'));    if ($('[class^="ReplyCreate_reply-create"]').length) {        clearInterval(inter);

function changeCommentLinks {

$('span[class^="EntityHeader_header-details"] > div[class^="wds-avatar EntityHeader_avatar"] > a').each(function {               var user = $(this).attr('href').replace(/\/wiki\/(User:|Special:Contributions\/)/gi, ''),                    isIP = /^(?:(?:\d{1,3}\.){3}\d{1,3}|([0-9A-F]{0,4}:){1,7}[0-9A-F]{0,4})(?:\/\d{2})?$/gi.test(user),                    $link = $(this).parent.parent.children('a:last-of-type:not(.mw-user-anon-link)'),                    $this = $(this);

$link .attr('href', '/wiki/Special:Contributions/' + user) .html(user);

$this.attr('href', '/wiki/Special:Contributions/' + user);

$link.after(                   ' (', $('', {                       href: "/wiki/Message_wall:" + user,                        html: "wall",                        title: "Message_wall:" + user,                        class: "mw-user-anon-link",                    }), canBlock ? ' &bull; ' : "", canBlock ? $('', {                       href: "/wiki/Special:Block/" + user,                        html: "block",                        title: "Special:Block/" + user,                        class: "mw-user-anon-link",                    }) : "", ')'               );            });        }

changeCommentLinks;

$('[class^="ReplyList_view-all-replies"]').click(function {           setTimeout(changeCommentLinks, 25);        }); } }, 25);

document.addEventListener('keydown', function(e) {   var key = e.key.toLowerCase;    if (key === "l" && e.ctrlKey) {        e.preventDefault;        document.querySelector('.oo-ui-iconElement-icon.oo-ui-icon-gotoLine').click;    } else if (key === "s" && e.ctrlKey) {        e.preventDefault;        document.querySelector('.oo-ui-iconElement-icon.oo-ui-icon-pilcrow').click;    } });

// Lua Syntax highlighting function var libs = { "package": true, "table": true, "string": true, "io": true, "file": true, "math": true, "utf8": true, "coroutine": true, "debug": true, "os": true, "util": true, "number": true, "mw": true, };    var keywords = { "time": true, "cos": true, "sin": true, "huge": true, "wrap": true, "len": true, "lower": true, "config": true, "open": true, "close": true, "input": true, "require": true, "format": true, "min": true, "max": true, "cosh": true, "sinh": true, "tan": true, "tanh": true, "gsub": true, "gmatch": true, "upper": true, "concat": true, "unpack": true, "tonumber": true, "type": true, "sub": true, "create": true, "date": true, "error": true, "output": true, "rep": true, "pairs": true, "ipairs": true, "pow": true, "maxn": true, "match": true, "remove": true, "sort": true, "log": true, "seeall": true, "byte": true, "char": true, "find": true, "reverse": true, "preload": true, "loaded": true, "init": true, "clock": true, "rad": true, "random": true, "pi": true, "mod": true, "modf": true, "log10": true, "ldexp": true, "exp": true, "expr": true, "dofile": true, "print": true, "running": true, "status": true, "yield": true, "cpath": true, "loadlib": true, "path": true, "searchers": true, "searchpath": true, "dump": true, "packsize": true, "codes": true, "offset": true, "charpattern": true, "mininteger": true, "ult": true, "randomseed": true, "flush": true, "lines": true, "popen": true, "read": true, "seek": true, "write": true, "setvbuf": true, "difftime": true, "execute": true, "exit": true, "getenv": true, "rename": true, "getinfo": true, "getlocal": true, "isyieldable": true, "fmod": true, "deg": true, "ceil": true, "floor": true, "abs": true, "acos": true, "asin": true, "atan": true, "atan2": true, "traceback": true, "stack": true, "pcall": true, "xpcall": true, "call": true, "select": true, "getmetatable": true, "next": true, "assert": true, "join": true, "name": true, "__index": true, "__newindex": true, "__call": true, "__mode": true, "__add": true, "__sub": true, "__mul": true, "__div": true, "__mod": true, "__pow": true, "__unm": true, "__concat": true, "__eq": true, "__lt": true, "__le": true, "__pairs": true, "__ipairs": true, "__metatable": true, "__tostring": true, "metatable": true, "rawset": true, "rawget": true, "set": true, "get": true, "new": true, "class": true, "load": true, "loaders": true, "object": true, "style": true, "title": true, "tag": true, };    function copySet(o) { var newArr = []; Object.keys(o).forEach(function(key) {            newArr.push(key);         }); return newArr; }    var libsArr = copySet(libs) , keywordsArr = copySet(keywords); $('.p').each(function {        var $this = $(this),             $text = $this.html;         if ($text.match(/([\(\)\{\}\[\]]+)/g)) {             $this.html($text.replace(/([\(\)\{\}\[\]]+)/, ' $1 '));         }     }); $('.n').each(function {        var $this = $(this),             $text = $this.html;         if ($text.match(new RegExp('^(' + keywordsArr.join('|') + ")$", 'gi'))) {             $this.removeClass('n').addClass('nf');         } else if ($text.match(new RegExp('^(' + libsArr.join('|') + ")$", 'gi'))) {             $this.removeClass('n').addClass('lb');         } else if (($this.next.html || "").match(/( ([\(\{]+[\}\)]*)<\/span>|^\")/)) {             $this.removeClass('n').addClass('f');         } else if ($this.next.html === ":") {             $this.addClass('nc').removeClass('n');         }     }); });
 * (function {

var pagePathname = mw.config.get('wgArticlePath').replace('$1', ''), sitename = mw.config.get('wgSiteName'), userGroups = mw.config.get('wgUserGroups'), namespace = mw.config.get("wgNamespaceNumber"), pagename = mw.config.get('wgPageName'), wikiUrl = mw.config.get('wgServer').replace(/https?:\/\//g, ''), server = mw.config.get('wgServer');

var inter = setInterval(function {	if ($('.ace_content').length && Number($('.ace_content').css('height').replace('px', '')) < 700) {		clearInterval(inter);		$('.ui-resizable, .ace_content').css('height', '700px');		$('.ui-resizable-handle').click;		$('.ui-resizable-handle').resize;	} }, 50);

var inter = setInterval(function {	if ($('.ace_content').length && namespace === 828) {		clearInterval(inter);		mw.loader.implement("ext.scribunto.edit__custom", function($, jQuery, require, module) { (function {				var histList = [''], histPos = 0, question, input, output, $spinner, sessionContent = null, sessionKey = null, pending = !1, clearNextRequest = !1;				function refocus {					input.blur;					input.focus;				}				function initConsole {					input = document.getElementById('mw-scribunto-input');					output = document.getElementById('mw-scribunto-output');					$spinner = $.createSpinner({ size: 'small', type: 'block' });					recalculateInputHeight;					println(mw.msg('scribunto-console-intro'), 'mw-scribunto-message');				}				function inputKeydown(e) {					if (e.shiftKey && e.keyCode === 13) {} else if (e.keyCode === 13) {						go;					} else if (e.keyCode === 38) {						if (e.ctrlKey || caretInFirstLine(input)) {							hist('up');						}					} else if (e.keyCode === 40) {						if (e.ctrlKey || caretInLastLine(input)) {							hist('down');						}					}					setTimeout(recalculateInputHeight, 0);				}				function inputFocus {					if (sessionContent === null) {						return;					}					if (clearNextRequest) {						return;					}					if (getContent !== sessionContent) {						printClearBar('scribunto-console-cleared');						clearNextRequest = !0;					}				}				function caretInFirstLine(textbox) {					var firstLineBreak;					if (textbox.selectionStart === undefined) {						return true;					}					firstLineBreak = textbox.value.indexOf('\n'); return ((firstLineBreak === -1) || (textbox.selectionStart <= firstLineBreak)); }				function caretInLastLine(textbox) { var lastLineBreak; if (textbox.selectionEnd === undefined) { return true; }					lastLineBreak = textbox.value.lastIndexOf('\n'); return (textbox.selectionEnd > lastLineBreak); }				function recalculateInputHeight { var rows = input.value.split(/\n/).length + 1 + (window.opera ? 1 : 0); if (input.rows !== rows) { input.rows = rows; }				}				function println(s, type) { var newdiv; if ((s = String(s))) { newdiv = document.createElement('div'); newdiv.appendChild(document.createTextNode(s)); newdiv.className = type; output.appendChild(newdiv); return newdiv; }				}				function printClearBar(msg) { $(' ').attr('class', 'mw-scribunto-clear').text(mw.msg(msg)).appendTo(output); }				function hist(direction) { var L = histList.length; if (L === 1) { return; }					if (direction === 'up') { if (histPos === L - 1) { histList[histPos] = input.value; }						if (histPos > 0) { histPos--; setTimeout(function {								var caretPos;								input.value = '';								input.value = histList[histPos];								caretPos = input.value.length;								if (input.setSelectionRange) {									input.setSelectionRange(caretPos, caretPos);								}							}, 0); }					} else { if (histPos < L - 1) { histPos++; input.value = histList[histPos]; } else if (histPos === L - 1) { if (input.value) { histList[histPos] = input.value; ++histPos; input.value = ''; }						}					}				}				function printQuestion(q) { println(q, 'mw-scribunto-input'); }				function printError(er) { var lineNumberString; if (er.name) { lineNumberString = (er.lineNumber !== undefined) ? (' on line ' + er.lineNumber + ': ') : ': '; println(er.name + lineNumberString + er.message, 'mw-scribunto-error'); } else { println(er, 'mw-scribunto-error'); }				}				function setPending { pending = !0; input.readOnly = !0; $spinner.insertBefore(input); }				function clearPending { $spinner.remove; pending = !1; input.readOnly = !1; }				function go { var params, api, content, sentContent; if (pending) { return; }					question = input.value; if (question === '') { return; }					histList[histList.length - 1] = question; histList[histList.length] = ''; histPos = histList.length - 1; input.value = ''; setTimeout(function {						input.value = '';					}, 0); recalculateInputHeight; printQuestion(question); params = { action: 'scribunto-console', title: mw.config.get('wgPageName'), question: question };					content = getContent; sentContent = !1; if (!sessionKey || sessionContent !== content) { params.clear = !0; params.content = content; sentContent = !0; }					if (sessionKey) { params.session = sessionKey; }					if (clearNextRequest) { params.clear = !0; clearNextRequest = !1; }					api = new mw.Api; setPending; api.post(params).done(function(result) {						if (result.sessionIsNew ===  && !sentContent) {							printClearBar('scribunto-console-cleared-session-lost');							sessionContent = null;							clearPending;							input.value = params.question;							go;							return;						}						sessionKey = result.session;						sessionContent = content;						if (result.type === 'error') {							$(' ').addClass('mw-scribunto-error').html(result.html).appendTo(output);						} else {							if (result.print !== ) {								println(result.print, 'mw-scribunto-print');							}							if (result.return !== '') {								println(result.return, 'mw-scribunto-normalOutput');							}						}						clearPending;						setTimeout(refocus, 0);					}).fail(function(code, result) {						if (result.error && result.error.info) {							printError(result.error.info);						} else if (result.exception) {							printError('Error sending API request: ' + result.exception); } else { mw.log(result); printError('error'); }						clearPending; setTimeout(refocus, 0); });				}				function getContent {					var $textarea = $('#wpTextbox1')					, context = $textarea.data('wikiEditor-context');					if (context === undefined || context.codeEditor === undefined) {						return $textarea.val;					} else {						return $textarea.textSelection('getContents');					}				}				function onClearClick {					$('#mw-scribunto-output').empty;					clearNextRequest = !0;					refocus;				}				function clearOutput {					$('#mw-scribunto-output').empty;					refocus;				}				function initEditPage {					$('#mw-scribunto-console').first.remove;					var $wpTextbox1, 						$console = $('#mw-scribunto-console');					if (!$console.length) {						$wpTextbox1 = $('#wpTextbox1');						$console = $(' ').attr({ id: 'mw-scribunto-console' });						console.log(!$('.editOptions').length);						$('.editOptions').before($console);					}					$(' ')						.attr('class', 'mw-scribunto-console-fieldset')						.append( $(' ')								 .text(mw.msg('scribunto-console-title')							 ) )						.append($(' '))						.append( $(' ').append(								$(' ').attr({ id: 'mw-scribunto-input', 'class': 'mw-scribunto-input', wrap: 'off', rows: 1, dir: 'ltr', lang: 'en' })								.bind('keydown', inputKeydown)								.bind('focus', inputFocus)							) )						.append( $(' ').append(								$(' ')									.attr({ type: 'button', value: mw.msg('scribunto-console-output-clear') })									.bind('click', clearOutput),

$(' ')									.attr({										type: 'button',										value: mw.msg('scribunto-console-clear')									}) .bind('click', onClearClick) )						)						.wrap(' ') .appendTo($console); initConsole; }				$(function {					var action = mw.config.get('wgAction');					if (action === 'edit' || action === 'submit' || action === 'editredlink') {						initEditPage;					}				}); });		}, {			"css": [".mw-scribunto-console-fieldset{background:#fff;color:#000} #mw-scribunto-output{white-space:pre;white-space:pre-wrap} #mw-scribunto-input{width:100%;border:0;padding:0;overflow:auto;background:#e0e0e0}.mw-scribunto-input{color:#00f;font:inherit;font-weight:bold;margin-top:0.5em}.mw-scribunto-normalOutput{color:#000;background:#fff}.mw-scribunto-print{color:#630;background:#fff}.mw-scribunto-error{color:#f00;background:#fff}.mw-scribunto-propList{color:#008000;background:#fff}.mw-scribunto-message{color:#008000;background:#fff}.mw-scribunto-tabcomplete{color:#800080;background:#fff}.mw-scribunto-clear{color:#f00;text-align:center;margin-top:1em;border-bottom:1px solid #f00}"]		}, {			"scribunto-console-output-clear": "Clear Console Output",			"scribunto-console-clear": "Clear Console State",			"scribunto-console-cleared": "The console state was cleared because the module was updated.", "scribunto-console-cleared-session-lost": "The console state was cleared because the session data was lost.", "scribunto-console-intro": "* The module exports are available as the variable \"p\", including unsaved modifications.\n* Precede a line with \"=\" to evaluate it as an expression or use print. Use mw.logObject for tables.\n* Use mw.log and mw.logObject in module code to send messages to this console.", "scribunto-console-title": "Debug console" }, null);	} });

/* Upper icons adjustment */ $('a[href="' + pagePathname + 'Special:CreatePage"]').remove; $('a[title="Wiki Activity"]').after(	$('', { class: "wds-button wds-is-secondary", href: "/wiki/Special:AbuseLog", title: "Abuse Log", html: " " }) ); $('a[href="' + pagePathname + 'Special:WikiActivity"]') .attr('href', pagePathname + 'Special:RecentChanges') .attr('title', 'Recent Changes'); $('a[href="' + pagePathname + 'Special:AdminDashboard"]') .first .after(		$('', { class: "wds-button wds-is-secondary", href: pagePathname + 'Special:AbuseFilter', title: "Abuse Filter Management", html: "    ", })		);

/* Top Menu */ var topListSelector = 'div.wds-community-header__wiki-buttons > div.wds-dropdown ul.wds-list.wds-is-linked'; $(topListSelector) .empty .attr('title', 'More Tools and Links') .append(		$('', { html: $('', {				href: pagePathname + "Special:BlockLookup",				html: "Block Lookup",				title: 'Special:BlockLookup',			}), }),		$('', { html: $('', {				href: pagePathname + "Special:BlockList",				html: "Blocked Users",				title: 'Special:BlockList',			}), }),		$('', { html: $('', {				href: pagePathname + "Special:AllMessages",				html: "All System Messages",				title: 'Special:AllMessages',			}), }),		$('', { html: $('<a>', {				href: pagePathname + "Special:AllPages",				html: "All pages",				title: 'Special:AllPages',			}) }),		$('<li>', { html: $('<a>', {				href: pagePathname + "Special:Watchlist",				html: "Watch list",				title: 'Special:Watchlist',			}) }),		$('<li>', { html: $('<a>', {				href: pagePathname + "Special:ListUsers",				html: "Users List",				title: 'Special:ListUsers',			}) }),		$('<li>', { html: $('<a>', {				href: pagePathname + "Special:ListGroupRights",				html: "User Group Rights",				title: 'Special:ListGroupRights',			}) })	);

//#==================================================# //# MAJOR SCRIPTS //#==================================================#

/* blockListLookup */ mw.loader.using(['mediawiki.api', 'mediawiki.util', 'wikia.window', 'jquery']).then(function {	var api = new mw.Api,		pagePathname = mw.config.get('wgArticlePath').replace('$1', ),		sitename = mw.config.get('wgSiteName'),		userGroups = mw.config.get('wgUserGroups'),		namespace = mw.config.get('wgNamespace'),		pagename = mw.config.get('wgPageName'),		wikiUrl = mw.config.get('wgServer').replace(/https?:\/\//g, ),		server = mw.config.get('wgServer'),		sep = ' • ',		sep2 = ' | ';

window.blockLookup = {}; config = window.blockLookup || {};

const canBlock = /sysop|util|staff|helper|global-discussions-moderator|wiki-manager|soap/.test(userGroups.join('\n')) , canDelete = /content-moderator|threadmoderator|sysop|soap|staff|helper|global-discussions-moderator|wiki-manager|content-team-member|util/.test(userGroups.join('\n')) , canCheckUser = /soap|staff|helper|wiki-manager|content-team-member|checkuser|util/.test(userGroups.join('\n')) , hasGlobalRights = /soap|staff|helper|wiki-manager|content-team-member|checkuser|util/.test(userGroups.join('\n')) ;

var $main = { logDebug: function(data) { var msg = '[BlockListLookup V0.1] [DEBUG]:';

Array.isArray(data) && data.unshift(msg); mw.log.apply(window, Array.isArray(data) ? data : [msg, data]); },		logMsg: function(data) { var msg = '[BlockListLookup V0.1] [LOG]:';

Array.isArray(data) && data.unshift(msg); console.log.apply(window, Array.isArray(data) ? data : [msg, data]); },

logWarn: function(data) { var msg = '[BlockListLookup V0.1] [WARN]:';

Array.isArray(data) && data.unshift(msg); console.warn.apply(window, Array.isArray(data) ? data : [msg, data]); },

logError: function(data) { var msg = '[BlockListLookup V0.1] [ERROR]:';

Array.isArray(data) && data.unshift(msg); console.error.apply(window, Array.isArray(data) ? data : [msg, data]); },

formatDate: function(timestamp, showCurrentTimeZone) { var dateOptions = { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: true, timeZone: Intl.DateTimeFormat.resolvedOptions.timeZone, };

return (timestamp === 'infinity' || timestamp === 'indefinite') ? 'Infinite' : Intl.DateTimeFormat('en-US', dateOptions).format(Date.parse(timestamp)) + (showCurrentTimeZone ? ' (Current Time Zone)' : ""); },

parse: function(wikitext) { var defer = jQuery.Deferred;

new mw.Api.get({ action: 'parse', text: wikitext }) .done(function(data) {					if (data.error) {						defer.reject(data);					} else {						defer.resolve(data.parse.text["*"]);					}				}) .fail(defer.reject);

return defer; },

getData: function(value) { var isId = value.match(/^\#?\d+$/gi), isIp = value ? value.match(/^(?:(?:\d{1,3}\.){3}\d{1,3}|([0-9A-F]{0,4}:){1,7}[0-9A-F]{0,4})(?:\/\d{2})?$/gi) : false, isUser = !isIp && !isId;

value = isId ? value.replace('#', '') : value; $main.logMsg('Getting main data...'); return new mw.Api.post({				action: 'query',				list: 'blocks',				bkprop: 'id|user|by|timestamp|expiry|reason|flags',				bkids: isId && !isUser && !isIp ? value : undefined,				bkusers: isUser ? value : undefined,				bkip: isIp && !isId && !isUser ? value : undefined			}); },

status: function { $('#mw-blocklookup-output').html(				$(' ', { id: 'mw-block-lookup-info__status', html: $(' ') .attr({							src: 'https://images.wikia.nocookie.net/dev/images/8/82/Facebook_throbber.gif',							alt: 'Getting Data...',							border: 0,						}) .css({ 'vertical-align': 'baseline', 'margin-left': '73px' }) .after(' ', 'Getting Data please wait...') })			);		},

toggleElements: function(v) { var selectors = [ '#mw-block-lookup-associated-namespace', '#mw-block-lookup-namespace', '#mw-block-lookup-tagfilter', '#mw-block-lookup-wpSearchTitle', '#log-limit', '#wpTarget', '#block-lookup', '#mw-block-lookup-wpSearchFilter', 'input[name="mw-block-lookup-ns-invert"]', 'input[name="mw-block-lookup-associated-namespace"]', ];			$('#block-lookup').attr('value', 'Look up block information'); $(selectors.join(', ')).attr('disabled', Boolean(v)); switch(Boolean(v)) { case(false): $main.logMsg('Processes are complete, reneabling GUI...'); break; case(true): $main.logMsg('Begining processes, disabling GUI...'); break; }		},

queryAbuseLog: function(u, s, lim) { var $promise = $.Deferred;

if (u === undefined) { $promise.reject;

return $promise; }			$main.logMsg('Getting Abuse log data...'); $.get(mw.util.getUrl('Special:AbuseLog', { wpSearchUser: u,				limit: lim, wpSearchFilter: $("#mw-block-lookup-wpSearchFilter").val, wpSearcTitle: $("#mw-block-lookup-wpSearchTitle").val, })).done(function(data) {				var $content = $(data)					.children('#WikiaPage')					.children('.WikiaPageContentWrapper')					.children('#WikiaMainContent')					.children('#WikiaMainContentContainer')					.children('#WikiaArticle')					.children('#mw-content-text')					.children('ul');

$(s).html($content.html); return ''; }).then(function(d) { $promise.resolve; $main.logMsg('Successfully appended abuse log data!'); });

return $promise; },

queryBlockLog: function(u, s, lim) { var $promise = $.Deferred; $main.logMsg('Getting block log data...'); if (u === undefined) { $promise.reject;

$main.toggleElements(false);

return $promise; }

$main.appendBlockResults(u, s, lim, $promise); $main.logMsg('Successfully appended block log!'); return $promise; },

getBlockData: function(user, limit) { $main.logMsg('Getting block data...'); return new mw.Api.post({				"action": "query",				"format": "json",				"list": "logevents",				"leprop": "ids|title|type|user|timestamp|details|parsedcomment",				"letype": "block",				"letitle": "User:" + user,				"lelimit": limit || 10,			}); },

formBlockLogHtml: function(o) { var timestamp = o.timestamp, blocker = o.blocker, pagePathname = o.pagePathname, target = o.target, action = o.action, reason = o.reason, duration = o.duration, flags = o.flags, sep = o.sep; $main.logMsg('Forming block log HTML...'); return $('<li>', {				id: "mw-block-lookup__block-log",				html: [					$main.formatDate(timestamp, false),					' ',					$('<a>', { html: blocker, title: "User:" + blocker, href: pagePathname + 'User:' + blocker, }),					' (',					$('<a>', {						html: 'wall',						title: "Message Wall:" + blocker,						href: pagePathname + 'Message_Wall:' + blocker,					}), sep, $('<a>', {						html: 'contribs',						title: "Special:Contributions/" + blocker,						href: pagePathname + 'Special:Contributions/' + blocker,					}), sep, $('<a>', {						html: 'block',						title: "Special:Block/" + blocker,						href: pagePathname + 'Special:Block/' + blocker,					}), ') ',					$main.formatBlockLogAction(action),					' ',					$('<a>', { html: target, title: "User:" + target, href: pagePathname + 'User:' + target, }),					' (',					$('<a>', {						html: 'wall',						title: "Message Wall:" + target,						href: pagePathname + 'Message_Wall:' + target,					}), sep, $('<a>', {						html: 'contribs',						title: "Special:Contributions/" + target,						href: pagePathname + 'Special:Contributions/' + target,					}), ') ',					action !== "unblock" ? 'with an expiry time of ' : '',					duration,					' (', flags ? flags.join(', ') : '', ') ',					reason ? $('<i>', { html: ['(', reason, ')'] }) : '',					reason && canBlock ? $(' ', { html: [ " (",							$('<a>', { href: pagePathname + "Special:Unblock/" + target, title: 'Special:Unblock/' + target, html: "unblock" }),							sep2,							$('<a>', { href: pagePathname + "Special:Block/" + target, title: 'Special:Block/' + target, html: "change block" }),						]					}) : "",					reason && canBlock ? ')' : "",				]			});		},		formatBlockLogAction: function(action) { switch (action) { case ("block"): return "blocked"; case ("reblock"): return "changed block settings for"; case ("unblock"): return "unblocked"; }		},

formatFlags: function(k, i, array) { switch (k) { case ("noautoblock"): array[i] = 'autoblock disabled'; break;

case ("anononly"): array[i] = 'anonymous users only'; break;

case ("nocreate"): array[i] = "account creation disabled"; break;

case ("noemail"): array[i] = 'email disabled'; break;

case ("nousertalk"): array[i] = 'cannot edit own talk page'; break;

case ("angry-autoblock"): array[i] = 'enhanced autoblock enabled'; break; }		},

appendBlockResults: function(user, selector, limit, $promise) {

$main.getBlockData(user, limit).done(function(data) {				var blocks = data.query.logevents;				$main.logMsg('Block data retreived!');				blocks.forEach(function(key, i, arr) { var blocker = key.user, action = key.action, reason = key.parsedcomment, target = key.title.replace('User:', ''), duration = action !== 'unblock' ? key.block.duration : undefined, flags = action !== 'unblock' ? key.block.flags.split(',') : undefined, pagePathname = mw.config.get('wgArticlePath').replace('$1', ''), sep = ' | ', timestamp = key.timestamp;

flags ? flags.forEach($main.formatFlags) : undefined; $main.logMsg('Appending block data...'); $(selector).append($main.formBlockLogHtml({ timestamp: timestamp, blocker: blocker, pagePathname: pagePathname, target: target, action: action, reason: reason, duration: duration ? duration.replace('indefinite', 'infinite') : undefined, flags: flags, sep: sep, }));					$main.logMsg('Successfully appended block data!'); });				return '';			}).then(function(d) {				$promise.resolve;			}); },

formHtml: function(o) { var blocker = o.blocker, expiry = o.expiry, id = o.id, reason = o.reason, timestamp = o.timestamp, target = o.target, error = o.error;

if (error) { return ($(' ', { id: "mw-block-lookup-info__result", html: error.info, }));			}

var flags = [], anonOnly = o.anonOnly, allowTalk = o.allowTalk, noCreate = o.noCreate, automatic = o.automatic, autoblock = o.autoblock, noEmail = o.noEmail;

var targetIsIp = target ? target.match(/^(?:(?:\d{1,3}\.){3}\d{1,3}|([0-9A-F]{0,4}:){1,7}[0-9A-F]{0,4})(?:\/\d{2})?$/gi) : false; var targetIsId = target === undefined;

if (anonOnly === '') flags.push('Anonymous users only'); if (noCreate === '') flags.push('Account creation disabled'); if (autoblock !== '' && !targetIsIp && !targetIsId) flags.push('Autoblock disabled'); if (noEmail === '') flags.push('Email disabled'); if (allowTalk !== '') flags.push('Cannot edit own talk page');

return ($(' ', { id: "mw-block-lookup-info__result", html: [ $(' ', { html: "Block information", id: "mw-block-lookup-info__header" }), $('<ul>', {						id: "mw-block-lookup-result__list",						html: [							$('<li>', { id: "mw-block-lookup-info__blocker", html: $('<b>', {									html: 'Blocking Admin: ',								}).after(									$('<a>', { html: blocker, href: pagePathname + blocker, title: 'User:' + blocker, id: "mw-block-lookup-info__blocker__user", }),									' (',									$('<a>', {										html: 'wall',										href: pagePathname + 'Message_Wall:' + blocker,										title: 'Message Wall:' + blocker,										id: "mw-block-lookup-info__blocker__wall",									}), sep2, $('<a>', {										html: 'contribs',										href: pagePathname + 'Special:Contributions/' + blocker,										title: 'Special:Contributions/' + blocker,										id: "mw-block-lookup-info__blocker__contribs",									}), canBlock ? sep2 : "", canBlock ? $('<a>', {										html: 'block',										href: pagePathname + 'Special:Block/' + blocker,										title: 'Special:Block/' + blocker,										id: "mw-block-lookup-info__blocker__block",									}) : "", ')'								)							}),							$('<li>', { id: "mw-block-lookup-info__expiry", html: $('<b>', {									html: 'Block Expiry: ',								}).after($main.formatDate(expiry)) }),							$('<li>', { id: "mw-block-lookup-info__timestamp", html: $('<b>', {									html: 'Block Timestamp: ',								}).after($main.formatDate(timestamp)) }),							$('<li>', { id: "mw-block-lookup-info__blockid", html: $('<b>', {									html: 'Block ID: ',								}).after(									$(' ', { html: '#' + id }),									' (', canBlock && targetIsId ? $('<a>', {										html: 'unblock',										href: pagePathname + 'Special:Unblock?wpTarget=' + '%23' + id,										title: 'Special:Unblock?wpTarget=' + '#' + id,										id: "mw-block-lookup__target__id-unblock",									}) : "", canBlock && targetIsId ? sep : "", $('<a>', {										html: 'view in block list',										href: pagePathname + 'Special:BlockList?wpTarget=' + '%23' + id,										title: 'Special:Unblock?wpTarget=' + '#' + id,										id: "mw-block-lookup__target__id-unblock",									}), ")",									targetIsId ? ' (Autoblock of a user\'s IP address) ' : ""								) }),							$('<li>', { id: "mw-block-lookup-info__reason", html: $('<b>', {									html: 'Block Reason: ',								}).after($('<i>', { html: reason || 'No reason provided' })) }),							target !== undefined ? $('<li>', { id: "mw-block-lookup-info__target", html: $('<b>', {									html: 'Block Target: ',								}).after(									$('<a>', { html: target, href: pagePathname + (targetIsIp ? 'Special:Contributions/' : 'User:') + target, title: (targetIsIp ? 'Special:Contributions/' : 'User:') + target, id: "mw-block-lookup__target__user", }),									$(' ', {										style: "font-size: 14px", html: [ ' (',											$('<a>', { html: 'Wall', href: pagePathname + 'Message_Wall:' + target, title: 'Message Wall:' + target, id: "mw-block-lookup__target__wall", }), !targetIsIp ? sep : '', !targetIsIp ? $('<a>', { html: 'Contribs', href: pagePathname + 'Special:Contribs/' + target, title: 'Special:Contribs/' + target, id: "mw-block-lookup__target__contribs", }) : "",											canDelete ? sep : "",											canDelete ? $('<a>', { html: 'Del. Contribs', href: pagePathname + 'Special:DeletedContributions/' + target, title: 'Special:DeletedContributions/' + target, id: "mw-block-lookup-tools__local-links__del-contribs", }) : "",											sep,											$('<a>', { html: 'Block Log', href: pagePathname + 'Special:Log/block?page=User:' + target, title: 'Special:Log/block', id: "mw-block-lookup-tools__local-links__block-log", }),											sep,											$('<a>', { html: 'Logs', href: pagePathname + 'Special:Log/' + target, title: 'Special:Log/' + target, id: "mw-block-lookup-tools__local-links__logs", }), !targetIsIp ? sep : "", !targetIsIp ? $('<a>', { html: 'Uploads', href: pagePathname + 'Special:Log/upload/' + target, title: 'Special:Log/upload/' + target, id: "mw-block-lookup-tools__local-links__uploads", }) : "",											sep,											$('<a>', { html: 'Abuse Log', href: pagePathname + 'Special:AbuseLog?wpSearchUser=' + target, title: 'Abuse Log for ' + target, id: "mw-block-lookup-tools__local-links__abuse-log", }),											canBlock ? sep : "",											canBlock ? $('<a>', { html: 'Block', href: pagePathname + 'Special:Block/' + target, title: 'Special:Block/' + target, id: "mw-block-lookup__tacirget__block", }) : "",											canBlock ? sep : "",											canBlock ? $('<a>', { html: 'Unblock', href: pagePathname + 'Special:Unblock/' + target, title: 'Special:Unblock/' + target, id: "mw-block-lookup__tacirget__unblock", }) : "",											canDelete ? sep : "",											canDelete ? $('<a>', { html: 'Nuke', href: pagePathname + 'Special:BlankPage?blankspecial=nuke&nukeuser=' + target + "&returnto=Special:BlockLookup/" + encodeURI(target) + '&returntoparams=' + encodeURI(location.search), title: 'Special:Nuke/' + target, id: "mw-block-lookup__target__unblock", }) : "",											canCheckUser ? sep : "",											canCheckUser ? $('<a>', { html: 'Check User', href: pagePathname + 'Special:Checkuser?user=' + target, title: 'Special:CheckUser', id: "mw-block-lookup__target__checkuser", }) : "",											')',											targetIsIp ? " (" +											(												target.match(/^(?:[0-9A-F]{0,4}:){1,7}[0-9A-F]{0,4}(\/\d{2})?$/gi) ? "IPv6" : "IPv4" ) +											(												target.match(/^(?:(?:\d{1,3}\.){3}\d{1,3}|(?:[0-9A-F]{0,4}:){1,7}[0-9A-F]{0,4})(\/\d{2})?$/i)[1] ? ', CIDR range ' + target.match(/^(?:(?:\d{1,3}\.){3}\d{1,3}|(?:[0-9A-F]{0,4}:){1,7}[0-9A-F]{0,4})(\/\d{2})?$/i)[1] : ""											) +											") " :											"",										]									})								)							}) : "",							$('<li>', { id: 'mw-block-lookup-info__params', html: [ 'Block Parameters: ', flags.join(', '), ],							}),						]					}), !targetIsId ? $(' ', {						id: "mw-block-lookup-tools__header",						style: "margin-top: 20px",						html: "Tools, Actions, and Links"					}) : "", !targetIsId ? $('<ul>', {						id: "mw-block-lookup-tools__list",						html: [							targetIsIp ? $('<li>', { id: "mw-block-lookup-tools__ip-tools", html: $('<b>', {									html: 'IP Tools: ',								}) }).append($(' ', {								style: 'font-size: 14px',								html: [									$('<a>', { html: "Spam blacklist check", id: "mw-block-lookup-tools__ip-tools__spam-blacklist", href: "https://cleantalk.org/blacklists/" + target, }),									sep,									$('<a>', { html: "WHOIS", id: "mw-block-lookup-tools__ip-tools__whois", href: "https://cleantalk.org/whois/" + target, }),									sep,									$('<a>', { html: "Proxy check", id: "mw-block-lookup-tools__ip-tools__proxy-check", href: "https://www.ipqualityscore.com/free-ip-lookup-proxy-vpn-test/lookup/" + target, }),									sep,									$('<a>', { html: "Geolocate", id: "mw-block-lookup-tools__ip-tools__geolocate", href: "https://tools.keycdn.com/geo?host=" + target, }),									sep,									$('<a>', { html: "Google", id: "mw-block-lookup-tools__ip-tools__google", href: "https://www.google.com/search?safe=off&num=50&hl=en&q=" + target, })								]							})) : "",							hasGlobalRights ? $('<li>', { id: "mw-block-lookup-tools__global-actions", html: [ 'Gobal Actions: ', $(' ', {										style: "font-size: 14px;",										html: [											$('<a>', { html: "Global block", id: "mw-block-lookup-tools___global-actions__gblock", href: 'https://community.fandom.com/wiki/Special:Phalanx?type=8&target=' + target + '&wpPhalanxCheckBlocker=' + target, }),											sep,											$('<a>', { html: "Multi Lookup", id: "mw-block-lookup-tools___global-actions__multi-lookup", href: 'https://community.fandom.com/wiki/Special:MultiLookup?wptarget=' + target, }),											sep,											$('<a>', { html: "Gladius", id: "mw-block-lookup-tools___global-actions__gladius", href: 'https://internal-soap.fandom.com/wiki/G?users=' + target + '&wiki=' + wikiUrl + '&useskin=oasis', }),											sep,											$('<a>', { html: "Global Nuke", id: "mw-block-lookup-tools___global-actions__gnuke", href: 'https://internal-soap.fandom.com/wiki/GN?user=' + target + '&useskin=oasis', }),											sep,											$('<a>', { html: "LC or ML", id: "mw-block-lookup-tools__global-actions__lc-ml", href: 'https://internal-soap.fandom.com/wiki/' + (														target.match(/^(?:(?:\d{1,3}\.){3}\d{1,3}|(?:[0-9A-F]{0,4}:){1,7}[0-9A-F]{0,4})(\/\d{2})?$/i) ?														"LC" :														"ML"													) + '?user=' + target + '&useskin=oasis', })										],									}),								],							}) : "",							$('<li>', { id: "mw-block-lookup-tools__global-links", html: [ 'Global Links: ', $('<a>', {										html: target,										href: 'https://community.fandom.com/wiki/' + (targetIsIp ? 'Special:Contributions/' : 'User:') + target,										title: 'w:c:' + (targetIsIp ? 'Special:Contributions/' : 'User:') + target,										id: "mw-block-lookup-tools__global-links__cc-user",									}), $(' ', {										style: "font-size: 14px",										html: [											' (', $('<a>', {												html: 'CC Wall',												href: 'https://community.fandom.com/wiki/' + 'Message_Wall:' + target,												title: 'w:c:Message Wall:' + target,												id: "mw-block-lookup-tools__global-links__cc-wall",											}), !targetIsIp ? sep : '', !targetIsIp ? $('<a>', {												html: 'CC Contribs',												href: 'https://community.fandom.com/wiki/' + 'Special:Contribs/' + target,												title: 'w:c:Special:Contribs/' + target,												id: "mw-block-lookup-tools__global-links__cc-contribs",											}) : "", !targetIsIp ? sep : "", !targetIsIp ? $('<a>', {												html: 'CC Logs',												href: 'https://community.fandom.com/wiki/' + 'Special:Log/' + target,												title: 'w:c:Special:Log/' + target,												id: "mw-block-lookup-tools__global-links__cc-wall",											}) : "", sep, $('<a>', {												html: 'CC Abuse Log',												href: 'https://community.fandom.com/wiki/' + 'Special:AbuseLog?wpSearchUser=' + target,												title: 'Community central abuse log for ' + target,												id: "mw-block-lookup-tools__global-links__cc-abuse-log",											}), ')',										]									})								],							}),						],					}) : "", !targetIsId ? $(' ', { html: "Block log", id: "mw-block-lookup-block-log__header" }) : "", !targetIsId ? $(' ', {						id: "mw-block-lookup-block-log__container",						html: $('<ul>', { id: "mw-block-lookup-block-log__list", html: '', }),					}) : "", !targetIsId ? $(' ', { html: "Abuse log", id: "mw-block-lookup-abuse-log__header" }) : "", !targetIsId ? $(' ', {						id: "mw-block-lookup-abuse-log__container",						html: $('<ul>', { id: "mw-block-lookup-abuse-log__list", html: 'No abuse logs found for this user.', }),					}) : "", !targetIsId ? $(' ', { html: "Recent User Contributions", id: "mw-block-lookup-contribs__header" }) : "", !targetIsId ? $(' ', {						id: "mw-block-lookup-contribs__container",						html: $('<ul>', { id: "mw-block-lookup-contribs__list", html: 'No changes were found matching these criteria.', }),					}) : "",				]			}));		},

initHtml: function { $main.logMsg('Forming main UI HTML...'); $('#mw-content-text') .html([					$(' ', { id: "mw-block-lookup-toplinks", style: "border:2px solid #e9e9e9; padding: 0 0.5em; margin-bottom: 1em;", html: $(' ', {							html: [								'Links: ',								$('<a>', { href: "/wiki/Special:RecentChanges", title: "Special:RecentChanges", target: "_blank", html: "Recent Changes", }),								' – ',								$('<a>', { href: "/wiki/Special:Log/block", title: "Special:Log/block", target: "_blank", html: 'Block log', }),								' – ',								$('<a>', { href: "/wiki/Special:AbuseLog", title: "Special:AbuseLog", target: "_blank", html: 'Abuse Log', }),								' – ',								$('<a>', { href: "/wiki/Special:BlockList", title: "Special:BlockList", target: "_blank", html: 'Block List', }),								$(' ', {									style: "float:right;", html: $('<a>', {										href: "https://dev.fandom.com/wiki/BlockLookup",										title: "BlockLookup on dev wiki",										style: "font-size: x-small",										html: 'BlockLookup on dev wiki',									}) }),								$(' ', { style: "clear:both;" })							]						}) }),					'Use the form below to get information about a user\'s block. There are a number of tools avaliable here for ease of use.',				]).append(					$(' ', { html: [ $(' ', {								style: "padding: 2px",								html: "Block information Lookup"							}), 'IP address, username, or Block ID: ', $(' ', {								size: 45,								name: "wpTarget",								id: "wpTarget",								value: mw.util.getParamValue('users') || pagename.split('/')[1] || mw.util.getParamValue('wpTarget'),							}), $(' '),							'Log display limit: ', $(' ', {								type: "text",								size: 20,								value: 15,								id: "log-limit",								name: "log-limit",							}), $(' '),							'Contributions namespace: ', $(' ', {								id: "mw-block-lookup-namespace",								name: "mw-block-lookup-namespace",								html: [									$(' ', { value: "", selected: "", html: "All", }),									$(' ', {										value: 0, html: "(Main)", }),									$(' ', {										value: 1, html: "Talk", }),									$(' ', {										value: 2, html: "User", }),									$(' ', {										value: 3, html: "User talk", }),									$(' ', {										value: 4, html: 'Project', }),									$(' ', {										value: 5, html: "Project talk", }),									$(' ', {										value: 6, html: "File", }),									$(' ', {										value: 7, html: "File talk", }),									$(' ', {										value: 8, html: "MediaWiki", }),									$(' ', {										value: 9, html: "MediaWiki talk", }),									$(' ', {										value: 10, html: "Template", }),									$(' ', {										value: 11, html: "Template talk", }),									$(' ', {										value: 12, html: "Help", }),									$(' ', {										value: 13, html: "Help talk", }),									$(' ', {										value: 14, html: "Category", }),									$(' ', {										value: 15, html: "Category talk", }),									$(' ', {										value: 110, html: "Forum", }),									$(' ', {										value: 111, html: "Forum talk", }),									$(' ', {										value: 500, html: "User blog", }),									$(' ', {										value: 501, html: "User blog comment", }),									$(' ', {										value: 502, html: "Blog", }),									$(' ', {										value: 503, html: "Blog talk", }),									$(' ', {										value: 828, html: "Module", }),									$(' ', {										value: 829, html: "Module talk", }),									$(' ', {										value: 1200, html: "Message Wall", }),									$(' ', {										value: 1201, html: "Thread", }),									$(' ', {										value: 1202, html: "Message Wall Greeting", }),									$(' ', {										value: 2000, html: "Board", }),									$(' ', {										value: 2001, html: "Board Thread", }),									$(' ', {										value: 2002, html: "Topic", }),								]							}),							$(' ', {								style: "white-space: nowrap",								html: [									$(' ', { name: "mw-block-lookup-ns-invert", type: "checkbox", value: 1, id: "mw-block-lookup-ns-invert", title: "Check this box to hide changes to pages within the selected namespace (and the associated namespace if checked)", class: "mw-input", checked: mw.util.getParamValue('nsInvert') ? true : false, }),									' ',									$(' ', {										'for': "mw-block-lookup-ns-invert", class: "mw-input", title: "Check this box to hide changes to pages within the selected namespace (and the associated namespace if checked)", html: "Exclude namespace", }),									" ",								]							}),							$(' ', {								style: "white-space: nowrap",								html: [									$(' ', { name: "", type: "checkbox", value: 1, id: "mw-block-lookup-associated-namespace", title: "Check this box to also include the talk or subject namespace associated with the selected namespace", class: "mw-input", checked: mw.util.getParamValue('associated') ? true : false, }),									' ',									$(' ', {										'for': "mw-block-lookup-associated-namespace", class: "mw-input", title: "Check this box to also include the talk or subject namespace associated with the selected namespace", html: "Associated namespace", }),									' ',								]							}),							$(' '),							'Contributions ', $('<a>', {								html: 'Tag',								href: pagePathname + 'Special:Tags',							}), ' filter: ', $(' ', {								type: 'text',								id: "mw-block-lookup-tagfilter",								value: mw.util.getParamValue('tagfilter'),							}), $(' '),							'Abuse Log Page Title: ', $(' ', {								type: 'text',								id: "mw-block-lookup-wpSearchTitle",								value: mw.util.getParamValue('wpSearchTitle'),							}), $(' '),							'Abuse Log Filter ID: ', canBlock ? $(' ', {								type: 'text',								id: "mw-block-lookup-wpSearchFilter",								value: mw.util.getParamValue('wpSearchFilter'),							}) : "", $(' ', {								html: $(' ', { style: "margin-top: 5px;", type: "submit", value: "Look up block information", name: "block-lookup", id: "block-lookup", title: "[enter]", accesskey: "enter", }),							}),						]					}),					$(' ', {						html: '', id: "mw-blocklookup-output", })				);		},

queryContribs: function(user, selector, limit) { var $promise = $.Deferred; if (user === undefined) return; $main.logMsg('Getting user contributions..'); $.get(mw.util.getUrl('Special:Contributions/' + user, { limit: limit, namespace: $('#mw-block-lookup-namespace').val, nsInvert: $('#mw-block-lookup-ns-invert').attr('checked') ? 1 : 0,				associated: $('#mw-block-lookup-associated-namespace').attr('checked') ? 1 : 0,				tagfilter: $('#mw-block-lookup-tagfilter').val, })).done(function(data) {				var $content = $(data)					.children('#WikiaPage')					.children('.WikiaPageContentWrapper')					.children('#WikiaMainContent')					.children('#WikiaMainContentContainer')					.children('#WikiaArticle')					.children('#mw-content-text')					.children('ul');

$(selector).html($content.html); return ''; }).then(function(d) { $promise.resolve; $main.logMsg('Successfully retreived contributions!'); });			return $promise;		},

reject: function($promise, msg) { $('#mw-blocklookup-output').html(				$(' ', { css: { 'font-weight': 'bold', },					html: [ 'Error In Getting block data: ' + msg, ],				})			);			$main.toggleElements(false); $main.logWarn(msg); $promise.reject; },		appendResult: function(value, limit) { var $promise = $.Deferred; $main.getData(value).done(function(data) {				var isError = !data.query && data.error;

if (isError) { $main.reject($promise, data.error.info); return $promise; }

block = data.query.blocks[0] || {};

$main.status;

$('#block-lookup').attr('disabled', 'disabled'); $('#block-lookup').attr('value', 'Loading...');

if (data.query.blocks.length === 0) { $main.reject($promise, 'The username/block ID/IP address is not blocked, or the user does not exist.'); $main.toggleElements(false); return $promise; }

var blocker = block.by, expiry = block.expiry, id = block.id, reason = block.reason, timestamp = block.timestamp, target = block.user,

anonOnly = block.anononly, noEmail = block.noemail, wallDisabled = block.allowusertalk, autoblock = block.autoblock, automatic = block.automatic, nocreate = block.nocreate,

targetIsIp = target ? target.match(/^(?:(?:\d{1,3}\.){3}\d{1,3}|([0-9A-F]{0,4}:){1,7}[0-9A-F]{0,4})(?:\/\d{2})?$/gi) : false;

$main.parse(reason).done(function(parsedHtml) {					var outputHtml = $main.formHtml({ blocker: blocker, id: id, expiry: expiry, reason: parsedHtml, timestamp: timestamp, target: target, anonOnly: block.anononly, noEmail: block.noemail, autoblock: block.autoblock, allowTalk: !block.allowusertalk, automatic: block.automatic, nocreate: block.nocreate, error: data.error, });					$main.logMsg('Displaying HTML...');					$('#mw-blocklookup-output').html( $(' ', {							id: "mw-block-lookup-info__fieldset",							html: [								$(' ', { name: "collapse", id: "collapse", type: "checkbox", css: { display: "none", },								}),								$(' ', {									style: "padding: 5.5px", html: [ $(" ", {											'for': "collapse",											css: {												cursor: "pointer",											},											html: "Lookup Result",										}) ],									id: "mw-block-lookup-info__legend", }),								outputHtml,							]						}) );				});

return data; }).then(function(data) { var block = data.query.blocks[0] || {}; target = block.user;

$main.queryBlockLog(target, '#mw-block-lookup-block-log__list', limit) .done(function {						$main.queryAbuseLog(target, '#mw-block-lookup-abuse-log__list', limit)						.done(function { $main.queryContribs(target, '#mw-block-lookup-contribs__list', limit) .done(function {								$promise.resolve;							}); });					});			});

return $promise; },

blockListHtml: function { $('form.visualClear').before(				$(' ', { id: "mw-blocklist-toplinks", style: "border:2px solid #e9e9e9; padding: 0 0.5em; margin-bottom: 1em;", html: [ 'Tools: ', $('<a>', {							href: pagePathname + 'Special:BlockLookup',							html: 'Block lookup',							title: 'Special:BlockLookup',						}), $(' ', {							css: {								height: '1px',								border: 0,								'background-color': '#a79494',								margin: '0.36em',							},						}), $('Links: '), $('<a>', {							href: "/wiki/Special:RecentChanges",							title: "Special:RecentChanges",							target: "_blank",							html: "Recent Changes",						}), ' – ',						$('<a>', {							href: "/wiki/Special:Log/block",							title: "Special:Log/block",							target: "_blank",							html: 'Block log',						}), ' – ',						$('<a>', {							href: "/wiki/Special:AbuseLog",							title: "Special:AbuseLog",							target: "_blank",							html: 'Abuse Log',						}), ]				})			);		},

specialPagesHtml: function { $('table.mw-specialpages-table ul > li > a[href="' + pagePathname + 'Special:BlockList"]') .parent .after($('<li>', { html: $('<a>', {						html: 'Block Lookup',						title: 'Special:BlockLookup',						href: pagePathname + 'Special:BlockLookup',					}) }));		},

init: function { document.title = 'Block Lookup | ' + sitename + ' | Fandom';

$main.logMsg('Forming Main UI...'); $main.initHtml; $('#wpTarget').focus; $('#PageHeader h1.page-header__title').text('Block Lookup');

$('#mw-block-lookup-namespace').val(mw.util.getParamValue('namespace'));

$('#wpTarget, #log-limit, #mw-block-lookup-wpSearchFilter, #mw-block-lookup-wpSearchTitle, #mw-block-lookup-tagfilter').keypress(function(e) {				if (e.key === 'Enter' && !$('#block-lookup').attr('disabled')) {					$('#block-lookup').click;				}			});

$main.logMsg('Ready, waiting for input...');

importArticle({ type: "style", article: "u:hypixel-skyblock:User:Thundercraft5/styles.css" });

$('#block-lookup').click(function {				var value = $('#wpTarget').val,					isId = value.match(/^\#?\d+$/gi),					isIp = value.match(/^(?:(?:\d{1,3}\.){3}\d{1,3}|([0-9A-F]{0,4}:){1,7}[0-9A-F]{0,4})(?:\/\d{2})$/gi),					isUser = !isIp && !isId,					$prevElement = $('#' + document.activeElement.id);				$main.logDebug([ 'Inputted value is:', value || '(blank)' ]);

var loglimit = Number($('#log-limit').val || mw.util.getParamValue('loglimit') || mw.util.getParamValue('limit')) || 15, value = isId ? value.replace('#', '') : value;

$main.toggleElements(true);

$main.appendResult(value, loglimit).done(function {					var callbacks = window.lookupOnClickCallbacks || [];					$main.logMsg('Main processes done, executing final external callbacks...');					callbacks.forEach(function(f, i) { if ($.isFunction(f)) { f; $main.logMsg('Successfully executed callback at index #' + i + '!'); } else { $main.logWarn(['Failed to execute a onClickCallback function at index #' + i + ':', 'key is not a function']); }					});					$main.toggleElements(false);					$prevElement.focus;					$main.logDebug([ 'Prevoiusly focused element is:', $prevElement ]);					$main.logDebug([ 'Inputted URL parameters: ', {							users: mw.util.getParamValue('users'), wpTarget: mw.util.getParamValue('wpTarget'), nsInvert: mw.util.getParamValue('nsInvert'), associated: mw.util.getParamValue('associated'), tagfilter: mw.util.getParamValue('tagfilter'), wpSearchTitle: mw.util.getParamValue('wpSearchTitle'), wpSearchFilter: mw.util.getParamValue('wpSearchFilter'), namespace: mw.util.getParamValue('namespace'), loglimit: mw.util.getParamValue('loglimit'), limit: mw.util.getParamValue('limit'), blankspecial: mw.util.getParamValue('blankspecial'), }					]);				});			});		},	};

if (window.blockLookupInit) { $main.logWarn('Script Double loaded, exiting...'); return; }	window.blockLookupInit = true;

if (		(mw.util.getParamValue('blankspecial') === "blocklookup" && pagename === "Special:BlankPage") ||		pagename.match(/Special:BlockLookup(\/.+)?/)	) { $main.init; } else if (pagename === "Special:AdminDashboard" || pagename === "Special:SpecialPages") { $main.specialPagesHtml; $main.logMsg('Page is Special:SpecialPages, or is Special:AdminDashboard, appending link...'); } else if (pagename === "Special:BlockList") { $main.blockListHtml; $main.logMsg('Page is Special:BlockList, appending tool links...'); } else { $main.logMsg('Page is not a supported page, or namespace is not supported, exiting...'); }

});

/* rangeBlockLinks */ var token = mw.user.tokens.values.editToken, fullpagename = mw.config.get("wgPageName"), pagename = mw.config.get("wgTitle"), namespace = mw.config.get("wgNamespaceNumber"), username = mw.config.get("wgTitle").split('/')[1], usergroups = mw.config.get('wgUserGroups');
 * (function($, mw, window) {

if (		namespace !== -1		|| !pagename.match(/(?:\d{1,3}\.){3}\d{1,3}/)		|| !/sysop|soap|staff|helper|global-discussions-moderator|wiki-manager/gmi.test(usergroups.join)		|| window.rangeBlockLinksInit	) { console.log('RangeBlockLinks: Import conditions not met, skipping import.'); return; }	window.rangeBlockLinksInit = true; function makeRangeBlockLink(range) { return([				"<a href=\"/wiki/Special:Block/",				username,				'/',				range,				"\" title=\"Block the /",				range,				" CIDR range this IP address originates from\"",				" id=\"rangelinks-range-block-CIDR-" + range + "\"",				">/",				range,				"</a>",			].join('')); }	$("#contentSub > a[href=\"/wiki/Special:Block/" + username + "\"]") .after(			" <small id=\"rangeblock-links\">(" + [					makeRangeBlockLink(24), makeRangeBlockLink(22), makeRangeBlockLink(20), makeRangeBlockLink(18), makeRangeBlockLink(16), ].join(' • ') + ") "		);

console.log('RangeBlockLinks: Successfully added range block links!'); })(jQuery, mediaWiki, window);

/* blockListTools */ function _main { var pagePathname = mw.config.get('wgArticlePath').replace('$1', ''), $ipToolsSel = $('td.TablePager_col_ipb_target span.mw-usertoollinks'), namespace = mw.config.get("wgNamespaceNumber"), pagename = mw.config.get("wgTitle");
 * (function {

function logMsg(data) { return console.log('BlockListTools:', typeof(data) === 'object' ? data.join(' ') : data); }

if (namespace !== -1 && pagename !== 'BlockList') { logMsg('Namespace/page is not supported, skipping importing script.'); return; }

window.blockListToolsInit = true;

/* IP tools */ $ipToolsSel.each(function(i) {           /* Variables within iterator */            var $elem = $(this).children('a'),                href = $elem.prop('href'),                ip = href.match(/(\d{1,3}\.){3}\d{1,3}/g),                classes = $elem.prop('class'),                user = href.split(':')[2];

if (ip) { $elem.first.after(                   " &bull; ",                    /* Proxy Check/General Info */                    $('<a>', { href: "//www.ipqualityscore.com/free-ip-lookup-proxy-vpn-test/lookup/" + ip, title: "Proxy check for " + ip, html: "PC", class: $elem.prop('class'), }),                   " &bull; ",                    /* Spam Blacklist check */                    $('<a>', { href: "//cleantalk.org/blacklists/" + ip, title: "Spam Blacklist check for " + ip, html: "BC", class: $elem.prop('class'), }),                   " &bull; ",                    $('<a>', { href: "https://cleantalk.org/whois/" + ip, title: "WHOIS for " + ip, html: "WHOIS", class: $elem.prop('class'), })               );            }        });        logMsg('Sucessfully appended IP tool links!');

/* Variables */ var blOpsArray = [], blActionsSel = 'span.mw-blocklist-actions', cbSel = 'a[title^="Special:Block/"]', uSel = 'a[title^="Special:Unblock/"]';

/* Get Block List Unblock/Block Links and store them */ $(blActionsSel).each(function(i, elem) {           elem.remove;            blOpsArray.push(elem);        });

/* Append Stored elements */ $('td.TablePager_col_ipb_timestamp').each(function(i, elem) {           elem.append(blOpsArray[i]);        });

/* Adjustments */ $(blActionsSel).before(' '); /* Iterate over new elements */ $('span.mw-blocklist-actions > a').each(function(i, elem) {           var $this = $(this);            /* Save User variable for future modifications */            user = $this.prop('title').match(/Special\:((?:Un)?block)\/(.+)/i);            user = user ? user[2] : null;            /* Format Titles */            $this.prop('title', $this.prop('title').replace(/Special\:((?:Un)?block)\/(.+)/i, function(match, $1, $2) {               if ($1.toLowerCase == 'block') {                    return 'Change block settings for ' + $2;               } else {                    return 'Unblock ' + $2;               }            }));

/* Shorten Link Text */ if ($this.html.toLowerCase == 'change block') { $this.html('CB'); } else { $this.html('U'); }

if (i % 2 === 1) { /* Extra Tool Links */ $this.after(' | ', $('<a>', { href: pagePathname + 'Special:AbuseLog?wpSearchUser=' + user, html: "AL", title: "Abuse logs for " + user }));           }        });        logMsg('Sucessfully Modified block list action links!');    }	window.ajaxCallAgain = window.ajaxCallAgain || [];	window.ajaxCallAgain.push(_main);	_main })(jQuery, mediaWiki, window);