User:Emperor Jarjarkine/warn.js

// $(document).ready(function {      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]);		}       }       var diff = getParam('diff');       var oldid = getParam('oldid');       var id = (diff && diff != "next" && diff != "prev" && oldid && diff > oldid) ? diff : (oldid)?oldid:"";       $(".mw-rollback-link").children.attr("href", $(".mw-rollback-link").children.attr("href") + "&id=" + id);       if (wgAction == 'rollback') {                var a = document.createElement('a');                var user = getParam('from');                a.href = wgScript + '?title=User_talk:' + user + '&action=edit&page=' + wgPageName + '&id=' + getParam('id');                a.appendChild(document.createTextNode('warn')); a.title = 'Warn this user.'; var pa = document.getElementById('bodyContent'); var p = document.createElement('p'); p.style.fontWeight = 'bold'; p.appendChild(document.createTextNode('You can ')); p.appendChild(a); p.appendChild(document.createTextNode(' this user.')); if(skin=='monobook') pa.insertBefore(p, pa.firstChild); // for monobook else { var pw = document.getElementById('WikiaArticle'); pw.insertBefore(p, pw.firstChild); // for oasis }      }       else if(wgAction == 'edit' && getParam('page')) { var obj = document.getElementById('wpTextbox1'); obj.value += '\n' + getParam('page').replace(/_/g, ' ') + ''; document.getElementById('wpSummary').value += 'Warn'; } }); //