User:PenguinEncounter2/common.js

/* jshint esversion: 8, esnext: false */ var banner_once = false function banner { if (banner_once) return banner_once = true; console.info("parsing bans"); // keep drama to reasonable levels by banning ANI, other "bad places" var bans = [ "Administrators' noticeboard/Incidents", "Arbitration/Requests/Enforcement", ];	var opts = new URLSearchParams(document.location.search); if (opts.has("unblock")) return; var k = document.querySelector(".mw-page-title-main"); if (!k) return; if (bans.includes(k.textContent.trim)) { console.info("no drama for you. add ?unblock if you really need the drama"); document.location.pathname = "/wiki/User:PenguinEncounter2"; } } window.addEventListener("DOMContentLoaded", banner); if (document.readyState !== "loading") banner;

function waitForMatch(match, f) { var iid = -1; iid = setInterval(function {		if (document.querySelector(match)) {			clearInterval(iid);			console.debug("clearing interval #" + iid);			f;		}	}, 10); }

waitForMatch("body", function {	console.info("starting highlighter");	const target = document.querySelector('body');	const config = { subtree: true, childList: true };	function onMutate {		document.querySelectorAll('a.mw-userlink > bdi:not(.userlink-me)').forEach( function(e) { if (/^\s*PenguinEncounter2\s*$/.test(e.innerText)) { e.style.color = "#ff8000"; e.style.fontStyle = "italic"; e.classList.add("userlink-me"); }		});	}	new MutationObserver(onMutate).observe(target, config); });

function mkSidebarItem(label, target) { var sidebarItem = document.createElement("li"); var sidebarLink = document.createElement("a"); sidebarLink.innerHTML = label; sidebarLink.href = "#"; sidebarLink.addEventListener("click", function(e) {       e.preventDefault;        e.stopPropagation;        target(e);    });

sidebarItem.appendChild(sidebarLink); sidebarItem.classList.add("mw-list-item"); document.querySelector("#p-tb .vector-menu-content-list").appendChild(sidebarItem); } importScript('User:PenguinEncounter2/glance-install/live-dev.js'); // Backlink: User:PenguinEncounter2/glance-install/live-dev.js //importScript('User:PenguinEncounter2/sandbox.js'); // Backlink: User:PenguinEncounter2/sandbox.js importScript('User:Enterprisey/cv-revdel.js'); // Backlink: User:Enterprisey/cv-revdel.js