Mass Rollback

Design of the Mass Rollback

by ShoeMaker

HTML

<div id="mr-ui" style="z-index: 1000; background-color: #FFDBDB; padding: 4px; border: 1px solid #BB7070; border-radius: 6px; text-align: left; font-size: 11px; color: black; display: block; position: absolute; top: 100px; left: 500px; width; 150px;" class="ui-draggable">
    <form action="#" method="get">
        <div style="font-weight: bold; border-bottom: 1px solid #AAA; padding: 4px;">	<span id="mr-title">Mass Rollback</span>
	<span style="float: right; text-transform: none;">
				<a id="mr-close" style="cursor: pointer" onclick="MRollback.GUI.close();">
					<img src="http://upload.wikimedia.org/wikipedia/commons/b/b6/Chrome_close_button.png"/>
				</a>
			</span>

        </div>
        <div>
            <div style="display: inline-block; padding: 4px; vertical-align: middle;">
                <div style="margin: 4px auto;">
                    <div style="display: inline-block; margin-right: 10px;">
                        <input name="Select_summary" type="radio" value="Vandal" onChange="isVandal()" />Vandal only account
                        <input name="Select_summary" type="radio" value="Sock" onChange="isSock()" />Sock puppet
                        <input name="Select_summary" type="radio" value="Custom" checked="checked" onChange="isCustom()" />Custom summary:</div>
                    <div style="display: none;" id="mr-sockinfo">
                        <input id="SM" type="text" size="60px" style="display: inline-block;" placeholder="Sockmaster's username" onKeyUp="isSock()" />
                    </div>
                    <textarea id="mr-sum" cols="64" rows="4" maxlength="255" spellcheck="true" style="display: block;" autofocus></textarea>
                </div>
                <div style="margin: 4px auto;">
                    <div style="display: inline-block; width: 4em;">How many:</div>
                    <input id="mr-limit" value="25" max="500" size="3" pattern="[\d]{1,3}" title="1-999" type="text" autocomplete="off"...

JavaScript

var wgPageName = "Special:Contributions/Example";
var thisUser = wgPageName.substring(wgPageName.indexOf("/") + 1, wgPageName.length);


function isVandal() {
    if ($('#mr-sum').prop('readonly') === false) {
        $('#mr-sum').prop('readonly', true);
    }
    $('#mr-sockinfo').css('display', 'none');
    $('#mr-sum').css('background-color', '#CCC');
    $('#mr-sum').text('[[User:Technical 13/MRollback|Mass rollback]] of [[Special:Contributions/' + thisUser + '|the edits]] of this [[WP:SPA|]] [[WP:VANDAL|vandal only]] account.');
}

function isSock() {
    if ($('#mr-sum').prop('readonly') === false) {
        $('#mr-sum').prop('readonly', true);
    }
    $('#mr-sockinfo').css('display', 'block');
    var sockMaster = $('#SM').val();
    $('#mr-sum').css('background-color', '#CCC');
    $('#mr-sum').text('[[User:Technical 13/MRollback|Mass rollback]] of [[Special:Contributions/' + thisUser + '|the edits]] of this [[WP:SOCK|sock puppet]] of [[WP:Sockpuppet investigations/' + sockMaster + '|' + sockMaster + ']].');
}

function isCustom() {
    if ($('#mr-sum').prop('readonly') === true) {
        $('#mr-sum').prop('readonly', false);
    }
    $('#mr-sockinfo').css('display', 'none');
    $('#mr-sum').css('background-color', '#FFF');
}