User:Awesome Aasim/Wikibreakenforcer.js

/* Start wikibreak enforcer: User:Awesome Aasim/Wikibreakenforcer */ function wikibreakenforcer(year, month, day) { var currentDate = new Date; var enforcedDate = new Date(year, month-1, day); var action = mw.config.get("wgAction"); var un = mw.config.get("wgUserName"); var fUN = ""; for (var i = 0; i < un.length; i++) { if (un[i] == " ") { fUN += "_"; } else { fUN += un[i]; }	}	if (!(/.*common\.js.*/.test(mw.config.get("wgTitle")) && mw.config.get("wgNamespaceNumber") == 2) && !(mw.config.get("wgPageName") == "User_talk:Awesome_Aasim/Wikibreakenforcer.js") && currentDate <= enforcedDate) { try {document.getElementById("ca-edit").remove;} catch (Error) {} try {document.getElementById("ca-viewsource").remove;} catch (Error) {} try {document.getElementById("ca-addsection").remove;} catch (Error) {} switch (action) { case "edit": $('#wpTextbox1').attr('disabled', true); $('#wpSave').attr('disabled', true); try {document.getElementById("wikiEditor-ui-toolbar").parentNode.remove;} catch (Error) {} document.getElementById("mw-content-text").innerHTML = " " + document.getElementById("mw-content-text").innerHTML; break; case "history": try { var d = document.getElementsByClassName("mw-history-undo"); for (var i = d.length-1; i >= 0; i--) { d[i].parentNode.parentNode.remove; }				} catch (Error) {} break; case "submit": $('#wpTextbox1').attr('disabled', true); $('#wpSave').attr('disabled', true); try {document.getElementById("wikiEditor-ui-toolbar").parentNode.remove;} catch (Error) {} document.getElementById("mw-content-text").innerHTML = " " + document.getElementById("mw-content-text").innerHTML; break; case "view": try { var d = document.getElementsByClassName("mw-diff-edit"); for (var i = d.length-1; i >= 0; i--) { d[i].remove; }			} catch (Error) {} try { var d = document.getElementsByClassName("mw-diff-tool"); for (var i = d.length-1; i >= 0; i--) { d[i].remove; }			} catch (Error) {} try { var d = document.getElementsByClassName("mw-diff-undo"); for (var i = d.length-1; i >= 0; i--) { d[i].remove; }			} catch (Error) {} try { var d = document.getElementsByClassName("mw-editsection"); for (var i = d.length-1; i >= 0; i--) { d[i].remove; }			} catch (Error) {} break; }	} else if ((action == "edit" || action == "submit") && mw.config.get("wgPageName").includes(fUN) && mw.config.get("wgPageName").includes("common.js") && currentDate <= enforcedDate) { document.getElementById("mw-content-text").innerHTML = " " + document.getElementById("mw-content-text").innerHTML; } }

$("document").ready(function {	wikibreakenforcer(year, month, day); //replace "year", "month", and "day" with the expiry of your wikibreak. No leading zeros! }); /* End enforcer */