User:ArsenalBastion4093/common.js

$(function{	``; // Make Sure That This Script Won't Run Twice.	importArticles({ type: 'script', articles: [ 'u:dev:MediaWiki:MarkBlocked.js', 'u:dev:MediaWiki:InactiveUsers/code.js', 'u:dev:MediaWiki:UserAccountAge/code2.js', 'u:dev:MediaWiki:UserBlockNotification.js', 'u:dev:MediaWiki:SeeMoreActivityButton/code.js', 'u:dev:MediaWiki:BlockSummary.js', 'u:dev:MediaWiki:RelatedDiscussionsPosts.js', 'u:dev:MediaWiki:NewImages.js', 'u:dev:MediaWiki:DiscussionsRailModule/UCP.js', 'u:dev:MediaWiki:MastheadGender/code.js', 'u:dev:MediaWiki:DedicatedTalkButton.js', 'u:dev:MediaWiki:FirstEditDate.js', 'u:dev:MediaWiki:ImportJSPage/code.js', 'u:dev:MediaWiki:Bang.js', 'u:dev:MediaWiki:ProtectionIcons.js', 'u:dev:MediaWiki:WhatLinksHere/code.js', 'u:dev:MediaWiki:Status/code.js', 'u:dev:MediaWiki:CommunityPageRailModule.js', 'u:dev:MediaWiki:DisplayTimer/code.js', 'u:fridaynightfunking:MediaWiki:DedicatedHistoryButton.js', 'u:dev:MediaWiki:WikiActivity.js', 'u:dev:MediaWiki:DiscussionsFeed.js', 'u:dev:MediaWiki:GlobalNavButtons.js', 'u:dev:MediaWiki:Stella.js', 'u:dev:MediaWiki:MassEdit/code.js', 'u:dev:MediaWiki:AjaxUndo/code.js', 'u:dev:MediaWiki:LinkPreview/code.js', 'u:dev:MediaWiki:MastheadRightsBadge.js', 'u:dev:MediaWiki:BackToTopButton/code.js', 'u:dev:MediaWiki:SandboxTab/code.js', 'u:dev:MediaWiki:DiscussionsViewer.js', 'u:dev:MediaWiki:CodeQuickLinks/code.js', 'u:dev:MediaWiki:MarkForDeletion/code.js', 'u:dev:MediaWiki:UserActivityLink.js', // PERSONAL USE ONLY!!! DON'T PUT IT ON WIKIS' IMPORTJS!!! 'u:dev:MediaWiki:Rollback/code.js', // DITTO! 'u:dev:MediaWiki:PreferenceLinks.js', // DITTO! 'u:dev:MediaWiki:SandboxLink/code.js', // DITTO! 'u:dev:MediaWiki:BlogLink/code.js', // DITTO! 'u:dev:MediaWiki:CodeLinksDropdown.js', // DITTO! 'u:dev:MediaWiki:MultiUpload.js', // DITTO! ]	});	$(" @import \"/load.php?mode=articles&articles=u:dev:DiscussionsFeed/style-light.css&only=styles\"; ").appendTo("body.theme-fandomdesktop-light");	$(" @import \"/load.php?mode=articles&articles=u:dev:DiscussionsFeed/style-dark.css&only=styles\"; ").appendTo("body.theme-fandomdesktop-dark");	function Encode(i) {		return encodeURI(i).split("?").join("%3F").split("&").join("%26").split("=").join("%3D").split(";").join("%3B").split("#").join("%23").split('"').join("%22").split("'").join("%27")	}	function URL_param_get(a) {		var arr = location.href.slice(location.origin.length+location.pathname.length+1).split("&")		for (var i in arr) {			arr[i] = arr[i].split("=")			arr[i][0] = decodeURIComponent(arr[i][0])			arr[i][1] = decodeURIComponent(arr[i][1])		}		var obj= Object.fromEntries(arr)		if (typeof(obj[a])!="string") return null		else return obj[a]	}	function URL_param_getall {		var arr = location.href.slice(location.origin.length+location.pathname.length+1).split("&") for (var i in arr) { arr[i] = arr[i].split("=") arr[i][0] = decodeURIComponent(arr[i][0]) arr[i][1] = decodeURIComponent(arr[i][1]) }		return Object.fromEntries(arr) }	function URL_param_parse(o) { var arr = Object.entries(o) for (var i in arr) { arr[i] = Encode(arr[i][0]) + "=" + Encode(arr[i][1]) }		return "?" + arr.join("&") }	window.ApiRequest = function(req){ return new Promise(function(r,t){   		$.ajax("/api.php" + URL_param_parse(req),{ type: "post", success: function(a){r(a)}, error: function(a){t(a)}, })		})	}	// [Code Name="Return To Community Central Button"] if (location.host != "community.fandom.com") { $(".fandom-community-header__community-name-wrapper").append(" ↰ Return To Community Central") }	// [/Code] // [Code Name="UserContribution+RecentChanges+PageRevision Change"] $(".mw-contributions-list li").queue(function{		$(this).find(".mw-changeslist-links").append(' Edit ');		if ($(this).find(".mw-changeslist-diff").length==0) $(this).find(".mw-changeslist-links:not(.mw-usertoollinks) > span:first-child").html('Difference');		else $(this).find(".mw-changeslist-diff").html('Difference');		$(this).find(".mw-changeslist-history").html('History');	}); $("#pagehistory li:first-child").append("&lrm; ").find(".mw-changeslist-links:not(.mw-history-histlinks):not(.mw-usertoollinks)").append(' edit ').appendTo("#pagehistory li:first-child"); $("#pagehistory li:not(:first-child):not(:last-child)").queue(function{		$(this).append("&lrm; ");		$(this).find(".mw-changeslist-links:not(.mw-history-histlinks):not(.mw-usertoollinks)").append(' edit ').appendTo($(this));	}); $("#pagehistory li:last-child").queue(function{		$(this).append("&lrm; edit  ");	}); if ($("body").hasClass("mw-special-Contributions")) $(".mw-special-Contributions .mw-contributions-user-tools .mw-changeslist-links").append(" discussions see him/her at another wiki  personal CSS</a>  personal JS</a> "); $("#see-at-another-wiki").click(function{		var code = prompt("Insert Wiki Name Code!");		if (code == null) return;		var language = prompt("Insert Wiki Language Code!");		if (language == null) return;		open("http://" + (code==""?"community":code) + ".fandom.com" + (language=="en"||language==""?"":"/")+ language + "/wiki/Special:Contributions/" + mw.config.values.profileUserName.split('"').join("&quot;"),"_self");	});	$(".mw-usertoollinks.mw-changeslist-links").queue(function{		var username = $(this).find(".mw-usertoollinks-contribs").html("Contributions").attr("title").split("/")[1];		$(this).append(" Social Activity</a> ");	});	$(".mw-special-Recentchanges [data-mw-revid]").queue(function{ var revid = $(this).attr("data-mw-revid"), pgname = $(this).find(".mw-enhanced-rc-time a, .mw-changeslist-title").attr("title"); if ($(this).find(".mw-changeslist-links:not(.mw-usertoollinks)").length>0) { $(this).find(".mw-changeslist-links:not(.mw-usertoollinks)").append(' Edit</a> ');			if ($(this).find(".mw-changeslist-diff").length==0) $(this).find(".mw-changeslist-links:not(.mw-usertoollinks) > span:first-child").html('Difference</a>') ;			else $(this).find(".mw-changeslist-diff").html('Difference');			$(this).find(".mw-changeslist-history").html('History');		} else {			$(this).find(".mw-enhanced-rc-nested").append(' edit</a> '); }	});	// [/Code]	// [Code Name="Replacement In Fan Feed"] 	Object.defineProperties(Array.prototype,{ random_item: { get: function{ return this[Math.floor(this.length*Math.random)]; },			set: function{ throw TypeError("youtu.be/dQw4w9WgXcQ"); }		},		has: { value: function(a){ for (var i = 0;i<this.length;i++) if (a == this[i]) return true; return false; }		}	});	var Contents = [		{img: "https://i.imgur.com/poCtNRk.gif", link: "//youtu.be/dQw4w9WgXcQ", title: "Rick Astley - Never Gonna Give You Up (Official Music Video)", subtitle: "YouTube"},		{img: "https://i.ytimg.com/vi/ErSmRD67pzo/hqdefault.jpg", link: "https://www.youtube.com/watch?v=ErSmRD67pzo", title: "Discord in 2045", subtitle: "Beluga YouTube"},		{img: "https://i.ytimg.com/vi/caFAItMHPhE/hqdefault.jpg", link: "https://www.youtube.com/watch?v=caFAItMHPhE", title: "Discord in 420 BC", subtitle: "Beluga YouTube"},		{img: "https://i.ytimg.com/vi/aZqA8h2TA-I/hqdefault.jpg", link: "https://www.youtube.com/watch?v=aZqA8h2TA-I", title: "When Your Instagram Gets Hacked", subtitle: "Beluga YouTube"},		{img: "https://i.ytimg.com/vi/ZqhEFk-zdEU/hqdefault.jpg", link: "https://www.youtube.com/watch?v=ZqhEFk-zdEU", title: "If Elon Musk owned Discord...", subtitle: "Beluga YouTube"},		{img: "https://i.ytimg.com/vi/JLSqhWue9BU/hqdefault.jpg", link: "https://www.youtube.com/watch?v=JLSqhWue9BU", title: "When a Discord Mod gets hacked...", subtitle: "Beluga YouTube"}, {img: "https://yt3.ggpht.com/ytc/AMLnZu_iIS6ZdSR284j0d23PTr7Hrd_S6pA6oaO9uVSAAw=s88-c-k-c0x00ffffff-no-rj", link: "https://www.youtube.com/c/Thatonefigoh/videos", title: "Thatonefigoh", subtitle: "YouTube"}, {img: "https://yt3.ggpht.com/A0J6Rt1YweNdTa3j9gEdrfjxlQrowJ-3H5oLrYY96T6jJI5vhI0FKeIG3hRL2sPMztKiRFXh9w=s88-c-k-c0x00ffffff-no-rj", link: "https://www.youtube.com/c/FlashinRahul/videos", title: "Flash in Rahul", subtitle: "YouTube"} ];	function b { $(".mcf-card-article__link").queue(function{			if ($(this).find("a").attr("href").split("sml.fandom.com").length>1) {				var item = Contents.random_item;				$(this).find("a").css("background-image",'linear-gradient(to bottom, rgba(0, 0, 0, 0), #000000), url("' + item.img + '")').attr("href",item.link).attr("title",item.title).html("<span class='mcf-card-article__title'>" + item.title + " <span class='mcf-card-article__subtitle'>"+item.subtitle+" ");			}		}); setTimeout(b,100); }	b; // [/Code] // [Code Name="Mark User Gender,Group"] function getJSON(url) { return new Promise(function(p_return,p_throw){			$.ajax({ type:"get", url:url, dataType:"json", success:function(d) { p_return(d); },				error:function(e) { p_throw(e); }			});		});	}	var GettingUsers = [], GottenUsers = {}, eventListener = new EventTarget, getinlog = function(str,element){ return new Promise(function (r,t){			var username = $(element).attr("href").slice(str.length).split("?")[0].split("#")[0].split("/")[0];			if (GottenUsers[username] == null&&!GettingUsers.has(username)) {				GettingUsers.push(username);				getJSON("/api.php?action=query&list=users&ususers="+username+"&usprop=groups%7Ceditcount%7Cgender%7Cblockinfo&format=json").then(function(query){ if (query.error) return; r({username:username,data:GottenUsers[username] = query.query.users[0]}); eventListener.dispatchEvent(new Event(username)) });			} 			if (GottenUsers[username]==null) {				eventListener.addEventListener(username,function{ r({username:username,data:GottenUsers[username]}) })			} else {				console.log(username,GottenUsers[username]);				r({username:username,data:GottenUsers[username]});			}		}); },	mark = function(str,element,username){ if (GottenUsers[username].invalid!=undefined) { } else if (GottenUsers[username].missing!=undefined) { $(element).addClass("user-unregistered"); } else { if (GottenUsers[username].userid == mw.config.values.wgUserId) $(element).addClass("user-you"); $(element).addClass("user-gender-"+GottenUsers[username].gender); $(element).addClass("user-right-"+GottenUsers[username].groups.join(" user-right-").split("user-right-*").join("")); }	},	getmark = function(str,element){ getinlog(str,element).then(function(r){			mark(str,element,r.username);		}); },	mark_all = function{ $("a[href^='/wiki/User:']").queue(function{			getmark("/wiki/User:",this);		}); $("a[href^='/wiki/Message_Wall:']").queue(function{			getmark("/wiki/Message_Wall:",this);		}); $("a[href^='/wiki/User_talk:']").queue(function{			getmark("/wiki/User_talk:",this);		}); $("a[href^='/wiki/User_blog:']").queue(function{			getmark("/wiki/User_blog:",this);		}); $("a[href^='/wiki/Special:Contributions/']").queue(function{			getmark("/wiki/Special:Contributions/",this);		}); $("a[href^='/wiki/Special:UserProfileActivity/']").queue(function{			getmark("/wiki/Special:UserProfileActivity/",this);		}); setTimeout(mark_all,100); };	mark_all; // [/Code] // [Code Name="Dedicated Move Button"] var move = $(".page-header__actions .wds-list").find("#ca-move"); if (!move.length) { } else { move.parent.remove; move.prepend('<svg class="wds-icon wds-icon-small"><use xlink:href="#wds-icons-arrow-small"> ').addClass("wds-button wds-is-text page-header__action-button has-label"); $(".page-header__actions .wds-list").parents(".wds-dropdown").before(move); }	// [/Code] // [Code Name="Insert Title To Page"] $(".page-header__title").attr("contentEditable","true").on("focus",function{		if ($(this).hasClass("edited")) {			return;		}		$(this).attr("data-original-title",$(this).text)		$(this).addClass("edited");		if ($(".page-header__actions").find(".wds-dropdown").length) {			$(".page-header__actions").find(".wds-dropdown").before('<svg class="wds-icon wds-icon-small"><use xlink:href="#wds-icons-checkmark-small"> </a><svg class="wds-icon wds-icon-small"><use xlink:href="#wds-icons-close-small">  </a>')		} else {			$(".page-header__actions").append('<svg class="wds-icon wds-icon-small"><use xlink:href="#wds-icons-checkmark-small">  </a><svg class="wds-icon wds-icon-small"><use xlink:href="#wds-icons-close-small">  </a>') }		$(this).text(mw.config.values.wgPageName.split("_").join(" ")); $("#ca-done").click(function{			$(".page-header__title").attr("contentEditable","false").text($(".page-header__title").text.split("\n").join(""));			location = location.origin + "/wiki/" + Encode($(".page-header__title").text);		}) $("#ca-cancel").click(function{			$(".page-header__title").removeClass("edited").text($(".page-header__title").attr("data-original-title"))			$("#ca-done, #ca-cancel").remove		}) $(this).on("keydown",function(e){			if (e.key == "Enter") {				$("#ca-done").click			}		}); });	if (mw.config.get('profileUserName')) {		var a = function {			if (!$(".user-identity-header__attributes h1").length) setTimeout(a,500)			else $(".user-identity-header__attributes h1").attr("contentEditable","true").on("focus",function{ if ($(this).hasClass("edited")) { return; }				$(this).addClass("edited"); $(".user-identity-header__actions").append('<button id="u-done" class="wds-button user-identity-header__button" style="margin-left: 8px;"><svg class="wds-icon wds-icon-small"><use xlink:href="#wds-icons-checkmark-small"> Done <button id="u-page" class="wds-button user-identity-header__button" style="margin-left: 8px;"><svg class="wds-icon wds-icon-small"><use xlink:href="#wds-icons-page-small">  Go To This Page <button id="u-cancel" class="wds-button user-identity-header__button" style="margin-left: 8px;"><svg class="wds-icon wds-icon-small"><use xlink:href="#wds-icons-close-small">  Cancel ') $(this).text(mw.config.values.profileUserName.split("_").join(" ")); $("#u-done").click(function{					$(".user-identity-header__attributes h1").attr("contentEditable","false").text($(".user-identity-header__attributes h1").text.split("\n").join(""));					location = location.origin + location.pathname.slice(0,-mw.config.values.profileUserName.length) + Encode($(".user-identity-header__attributes h1").text);				}) $("#u-page").click(function{					$(".user-identity-header__attributes h1").attr("contentEditable","false").text($(".user-identity-header__attributes h1").text.split("\n").join(""));					location = location.origin + "/wiki/" + Encode($(".user-identity-header__attributes h1").text);				}) $("#u-cancel").click(function{					$(".user-identity-header__attributes h1").removeClass("edited").text(mw.config.values.profileUserName)					$("#u-done, #u-cancel, #u-page").remove				}) $(this).on("keydown",function(e){					if (e.key == "Enter") {						$("#u-done").click					}				}); });		};		a	}	// [/Code]	// [Code Name="Masthead UID"]	if (mw.config.get('profileUserName')) {		var b = function {			if ((!$(".user-identity-header__attributes").length) || window.MastheadUIDshown) setTimeout(b,500)			else {				$('<span id="UID_Container" class="user-identity-header__tag">User ID: ' + mw.config.values.profileUserId + ' ').appendTo(".user-identity-header__attributes").find("#UID").attr("contentEditable","true").on("focus",function{ if ($(this).hasClass("edited")) { return; }					$(this).addClass("edited"); $(this).on("keydown",function(e){						if (e.key == "Enter") {							$(this).attr("contentEditable","false").text($(this).text.split("\n").join(""));							if (!(Number($(this).text) > 0)) {								alert("Invalid UID.");								$(this).attr("contentEditable","true").text(mw.config.values.profileUserId)								return;							}							var t = this							$.ajax( location.origin + "/api.php?action=query&format=json&list=users&ususerids=" + $(this).text, {								success: function(q){ if (q.error) { alert(JSON.stringify(q.error)) $(t).attr("contentEditable","true").text(mw.config.values.profileUserId) }									else if ((q.query.users[0].missing === "")) { alert("User Doesn't Exist.") $(t).attr("contentEditable","true").text(mw.config.values.profileUserId) }									else location = location.origin + location.pathname.slice(0,-mw.config.values.profileUserName.length) + Encode(q.query.users[0].name); },								error: function{ alert("Error.") $(t).attr("contentEditable","true").text(mw.config.values.profileUserId) }							})						}					});				});				window.MastheadUIDshown = true			}		};		b	}	// [/Code]	/*/ [Code Name="DisplayMousePosition" Status="Canceled"]	$("#WikiaBar ul").append("<li class='DisplayMousePosition left'> Your Mouse Left The Screen. X: Y: </a></li> .DisplayMousePosition.left .not-leaving-text {display:none}.DisplayMousePosition:not(.left) .leaving-text {display:none} ")	$(document).on('mousemove',function(e){ $(".DisplayMousePositionX").text(e.clientX) $(".DisplayMousePositionY").text(e.clientY) $(".DisplayMousePosition").removeClass("left") })	$(document).on('mouseleave',function(e){ $(".DisplayMousePosition").addClass("left") })	// [/Code] /*/	// [Code Name="Actions"]	if (URL_param_get("action") == "move") location = "/wiki/Special:MovePage/" + Encode(mw.config.values.wgPageName)	// [/Code]	// [Code Name="Share"]	if (mw.config.values.wgPageName.startsWith('Special:BlankPage/Share/')) {		$.ajax("/wiki/" + Encode(mw.config.values.wgPageName.slice(24)) + "?action=raw",{ success:function(a){ $("#mw-content-text p").remove $("#mw-content-text").append(" You Can Share The Page Called " + mw.config.values.wgPageName.slice(24) + "</a> In These Ways: <ul id='ShareWays'></ul>") $("#ShareWays").append('<li>Qzone</li>') },			error: function(a){ $("#mw-content-text p").remove $("#mw-content-text").append("<div class=\"warningbox\" dir=\"ltr\" lang=\"en\"> You're Sharing An 404 Error Page, Which Means This Page Doesn't Exist.  You Can Share The Page Called " + mw.config.values.wgPageName.slice(24) + "</a> In These Ways: <ul id='ShareWays'></ul>") $("#ShareWays").append('<li>Qzone</li>') }		})	}	// [/Code]	// [Code Name="AnotherWiki"]	if ($(".wiki-theuncannyincredible").length) {		$('link[rel="shortcut icon"]').attr("href","https://static.wikia.nocookie.net/the-uncanny-incredible/images/5/57/Phase_9.25.jpg")	}	// [/Code] });