MediaWiki:Chat.js/multiPM.js

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