Jump to content

User:Aidan9382/scripts/quickfix-source.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 source tags]] now only contains userspace js/css pages */
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("source") > -1) { //I dont do JS, so lets just be inefficient
		tb.value = tb.value.replaceAll("<source","<syntaxhighlight");
		tb.value = tb.value.replaceAll("</source>","</syntaxhighlight>");
		tb.value = tb.value.replaceAll("{{#tag:source","{{#tag:syntaxhighlight");
		es.value = "[[:Category:Pages using deprecated source tags]] ([[User:Aidan9382/scripts/quickfix-source.js|Via js script]])";
	}
}