MediaWiki:Chat.js/multiKick.js

// credit given to Club Penguin Wiki - modified (& cleaner :P) version of http://clubpenguin.wikia.com/wiki/MediaWiki:Chat.js/multiKick.js chatOptions.modules.multiKick.modOnly = true; if (wgUserGroups.indexOf("chatmoderator") != -1) { chatOptions.modules.multiKick.open = function { var $multiKickWindowHTML = $.showCustomModal( "Multi Kick", ' Select the users you would like to kick:  ', {            id: "multiKickWindow",            width: 400,            buttons: [                {                    id: "cancel",                    message: "Cancel",                    handler: function  {                        chatOptions.modules.multiKick.cancel;                    }                },                {                    id: "chatPlugins.modules.multiKick.start",                    defaultButton: true,                    message: "Kick",                    handler: function  {                        chatOptions.modules.multiKick.start;                    }                }            ]        }); $(".close").click(chatOptions.modules.multiKick.cancel); $('body').append(' '); multiKickUserTable = ""; for (var i = 0;i < Object.keys(mainRoom.model.users._byCid).length; i++) { if (i % 2) { multiKickUserTable += ' ' + mainRoom.model.users._byCid[Object.keys(mainRoom.model.users._byCid)[i]].attributes.name + ' '; multiKickUserTable += ' '; }           else { multiKickUserTable += ' '; multiKickUserTable += ' ' + mainRoom.model.users._byCid[Object.keys(mainRoom.model.users._byCid)[i]].attributes.name + ' '; }       }        if ((Object.keys(mainRoom.model.users._byCid).length % 2) != 1) { multiKickUserTable += ' '; }       $('#multiKickUserTable').append(multiKickUserTable); };   chatOptions.modules.multiKick.cancel = function { $('#multiKickWindow').remove; $('.blackout').remove; };   chatOptions.modules.multiKick.start = function { if ($(".multiKickUser:checked").length === 0) { $("#multiKickHeader").css("color", "red").css("font-weight", "bold"); return; }       else { users = []; for (var i = 0; i < $(".multiKickUser:checked").length; i++) { mainRoom.kick({name:$(".multiKickUser:checked")[i].value}); }           chatOptions.modules.multiKick.cancel; }   };    if( !$("#multiKickButton").length ) { $('form#Write').append('Multi Kick'); }   $("#multiKickButton").click(chatOptions.modules.multiKick.open); } console.log("[OPTIONS] Multi Kick: Loaded");