Jump to content

User:Anne drew/WatchingIndicator.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Anne drew (talk | contribs) at 01:41, 25 January 2018 (add check for multiple instances). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
let asked = false
document.getElementById('wpSave').onmousedown = function(event) {
	let text = document.getElementById('wpTextbox1').value;
	if((text.match(/````/g)||[]).length == 1 || (text.match(/(~~){2}/g)||[]).length == 1 || confirm("Multiple instances found. Continue?")){
		if(text.search(/(~~){2}|````/g) > -1){
			if(confirm("Replace 4 tildes (or ````) with custom signature?"))
				text = text.replace(/(~~){2}|````/g, "<span style='font-family:serif'>– by [[user talk:Anne drew Andrew and Drew|<span class='nobreak'>AdA&D</span>]]<small> at 00:34, 25 January 2018 (UTC)</small></span>");
			asked = true
		}
	}
}