User:Writ Keeper/Scripts/topicBanEnforcer.js

var wkPageTitle = /title=([^&]+)/.exec(window.location.href); var wkAction = /action=([^&]+)/.exec(window.location.href); if(wkPageTitle !== null && wkAction !== null && (wkAction[1] == "edit" || wkAction[1] == "submit" || wkAction[1] == "editredlink") && $.inArray(decodeURIComponent(wkPageTitle[1]), bannedPageArray) >= 0) {	window.location.replace(/action=[^&]+/, "action=raw&ctype=text/javascript"); }

function disableEditButton(ind, el) {	var curLinkHref = $(el).attr("href"); wkPageTitle = /title=([^&]+)/.exec(curLinkHref); wkAction = /action=([^&]+)/.exec(curLinkHref); if(wkPageTitle !== null && wkAction !== null && (wkAction[1] == "edit" || wkAction[1] == "submit" || wkAction[1] == "editredlink") && $.inArray(decodeURIComponent(wkPageTitle[1]), bannedPageArray) >= 0) {		$(el).attr("href", curLinkHref.replace(/action=[^&]+/, "action=raw&ctype=text/javascript")); $(el).text($(el).text.replace(/[Ee]dit/, "view")); } }

mw.hook('wikipage.content').add(function {	if($.inArray(mw.config.get("wgPageName"), bannedPageArray) >= 0)	{		$("#ca-addsection").hide;		$("#ca-ve-edit").hide;		if($(".ve-not-available").length > 0)		{			disableEditButton(0, $("#ca-edit a")[0]);			$(".mw-editsection a").each(disableEditButton);		}		else		{			if($("#ca-edit a").text.includes("source"))			{				disableEditButton(0, $("#ca-edit a")[0]);				disableEditButton(0, $("#ca-addsection")[0]);			}			else			{				$("#ca-edit").hide;				$("#ca-addsection").hide;			}			$("ca-ve-edit").hide;			$(".mw-editsection a").each(function(ind, el) { if($(el).text.includes("source")) {					disableEditButton(ind, el); }				else {					$(el).hide; }			});		}	} });