User:ArsenalBastion4093's Here!/common.js

$(function{	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.split("#")[0].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.split("#")[0].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) delete obj[""] return obj }	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)}, })		})	}	Object.defineProperties(String.prototype,{		containing:{			value(a){return this.split(a).length>1}		}	}) $(" .mw-body-header, .editedtitle {display:flex;}.editedtitle{list-style-type:none;margin:0;flex-direction: column;} ") $("#firstHeading").attr("contentEditable","true").on("focus",function{		if ($(this).hasClass("edited")) {			return;		}		$(this).attr("data-original-title",$(this).text)		$(this).addClass("edited");		$(".mw-body-header").append(' DoneCancel')		$(this).text(mw.config.values.wgPageName.split("_").join(" "));		$("#ca-done a").click(function{ $("#firstHeading").attr("contentEditable","false").text($("#firstHeading").text.split("\n").join("")); location = location.origin + "/wiki/" + Encode($("#firstHeading").text); })		$("#ca-cancel a").click(function{ $("#firstHeading").removeClass("edited").text($("#firstHeading").attr("data-original-title")) $("#ca-done, #ca-cancel").remove })		$(this).on("keydown",function(e){ if (e.key == "Enter") { $("#ca-done").click }		});	});	})