User:MarshMelon/chat.js

var afterChat = function (chat) { var t = chat.attributes.text, n = chat.attributes.name, isInline = chat.attributes.isInlineAlert || false, context = mainRoom.viewDiscussion.chatUL.children.last; if ( t.match(/ has been destabilized by /) && isInline && wgCityId == "621556") { var userr = t.match(/\[\[User:.*?\|(.*?)]]/)[1]; var $el = $('#Chat_' + mainRoom.roomId + ' .inline-alert').last; $el.append('(Quick Ban)'); $el.find('.quick-ban').click(function {           var time = prompt('Ban length', '20 minutes');            var reason = prompt('Ban reason', 'Misbehaving in chat');            mainRoom.socket.send(new models.BanCommand({                userToBan: userr,                 time: $.time(time),                 reason: reason            }).xport);        }); // Play the sound. $(' ', {           id: 'ping',            src: PING_SOUND,            autoplay: true        }).appendTo('body'); // Display desktop notifications. if (Notification.permission === 'granted') { var notificationKick = new Notification(userr + " was kick'd!", {               body: 'Ban them quick man!',                icon: mainRoom.model.users.findByName(userr) ? mainRoom.model.users.findByName(userr).attributes.avatarSrc.slice(0, -2) + '150' :              }); }   } }; mainRoom.model.chats.bind('afteradd', afterChat);