Jump to content

User:Aidan9382/scripts/quickfix-enclose.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* Unused: [[:Category:Pages using deprecated enclose attributes]] has been cleared */
var ef = document.editform, tb = ef.wpTextbox1, es = ef.wpSummary;
if (tb && tb.style.length == 0 && !(document.title.indexOf(".js") > -1 && document.title.indexOf(" talk:") == -1) && !es.value) {
	if (tb.value && tb.value.search("enclose=") > -1) { //I dont do JS, so lets just be inefficient
		tb.value = tb.value.replaceAll(" enclose=none"," inline");
		tb.value = tb.value.replaceAll("|enclose=none","|inline=1");
		tb.value = tb.value.replaceAll(" enclose=\"none\""," inline");
		tb.value = tb.value.replaceAll("|enclose=\"none\"","|inline=1");
		tb.value = tb.value.replaceAll(" enclose=div","");
		tb.value = tb.value.replaceAll("|enclose=div","");
		tb.value = tb.value.replaceAll(" enclose=\"div\"","");
		tb.value = tb.value.replaceAll("|enclose=\"div\"","");
		tb.value = tb.value.replaceAll(" enclose=pre","");
		tb.value = tb.value.replaceAll("|enclose=pre","");
		tb.value = tb.value.replaceAll(" enclose=\"pre\"","");
		tb.value = tb.value.replaceAll("|enclose=\"pre\"","");
		es.value = "[[:Category:Pages using deprecated enclose attributes]] ([[User:Aidan9382/scripts/quickfix-enclose.js|Via js script]])";
	}
}