User:C886553/autowarn.js

$(document).ready(function {	function makeLink(user) {		var a = document.createElement('a');		a.href = wgScript + '?title=User_Talk:' + encodeURIComponent(user) + '&preload=User:Ajraddatz/warn;		a.title = 'Warn this user.';		a.appendChild(document.createTextNode('warn'));		return a;	}	// http://www.netlobo.com/url_query_string_javascript.html	function getParam(name) {		name = name.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]');		var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); 		var results = regex.exec(window.location.href);		if (results == null) {			return '';		} else {			return decodeURIComponent(results[1]);		}	}	if (wgAction == 'rollback') {		var page = document.getElementById('bodyContent');		var p = document.createElement('p');		p.style.fontWeight = 'bold';		p.appendChild(document.createTextNode('You can '));		p.appendChild(makeLink(getParam('from')));		p.appendChild(document.createTextNode(' this user.')); page.insertBefore(p, page.firstChild); } else if (wgAction == 'history') { var list = document.getElementById('pagehistory'); var items = list.getElementsByTagName('li'); for (i = 0; i < items.length; i++) { var user = getElementsByClassName(items[i], 'a', 'mw-userlink')[0].innerHTML; var undo = getElementsByClassName(items[i], 'span', 'mw-history-undo')[0]; undo.appendChild(document.createTextNode(' | ')); undo.appendChild(makeLink(user)); }	} else if (wgAction == 'view' && getParam('diff')) { var user = getElementsByClassName(document.getElementById('mw-diff-ntitle2'), 'a', 'mw-userlink')[0].innerHTML; var undo = document.getElementById('mw-diff-ntitle1').firstChild; undo.appendChild(document.createTextNode(' ('));		undo.appendChild(makeLink(user));		undo.appendChild(document.createTextNode(')')); } else if (wgAction == 'edit') {

document.getElementById('wpSummary').value += ' Warning using upgraded Auto CVU'; document.getElementById('editform').submit; } });