User:Iamunknown/undo.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.
//<source lang="javascript">
if(window.location.href.indexOf('undoafter') != -1) {

	addOnloadHook(function() { 

		summaries = {
			'BLP': '[[WP:BLP|negative and contentious unsourced biographical information]]', 
			'ENC': '[[WP:SANDBOX|good-faith but unencyclopedic edits]]'
		};

		var div = document.createElement('div');

		for(var i in summaries) {

			var divSub = document.createElement('div');
			var txtNode = document.createTextNode(i);
			divSub.appendChild(txtNode);
			divSub.onclick = (function() {
				document.getElementById('wpSummary').value += (": " + summaries[i])
			});
			divSub.style.color = "#002bb8";
			divSub.style.cursor = "pointer";
			divSub.style.textDecoration = "underline";
			div.appendChild(divSub);

		}

		getElementsByClassName(document.getElementById('editform'), 'div', 'editButtons')[0].appendChild(div);

	});

}
//</source>