User:Magiczocker/common.js

(function(mw) {	'use strict';	if (mw.config.get('wgCanonicalSpecialPageName') !== 'Userrights') return;

var reason;

function addButton(label, text) { var button = document.createElement('button'); button.type = 'button'; button.textContent = label; button.style.marginRight = '4px'; button.addEventListener('click', function {			reason.value = text;		}); return button; }

mw.hook('wikipage.content').add(function($content) {		var reasonTable = $content.find('#mw-userrights-table-outer')[0];		reason = $content.find('#wpReason')[0];		var cell = reasonTable.rows[0].insertCell(2);

cell.append(			addButton('Administrator', 'Promoting to administrator per discussion at '),			addButton('Autopatrol',   'Trusted, constructive, and active user, no need to patrol'),			addButton('Bureaucrat',    'Promoting to bureaucrat per discussion at '),			addButton('Directors',     'Admin on mcw-')		); }); })(window.mediaWiki);