User:Ozuzanna/oneClickKickBan.js

//one-click kick and ban buttons for every unique message (not continued messages) //@author Ozuzanna if (mw.config.get('wgCanonicalSpecialPageName') !== "Chat" || !$("#WikiChatList #user-" + mw.config.get('wgUserName')).hasClass('chat-mod')) return; var config; //used for banning //add CSS mw.util.addCSS('.quick-kick { color:orange;cursor:pointer;} .quick-ban { color:red;cursor:pointer;}'); //set event listener mainRoom.model.chats.bind("afteradd", function (child) {	if (!$('#entry-' + child.cid).hasClass('inline-alert') && !$('#entry-' + child.cid).hasClass('continued'))		$('#entry-' + child.cid).children('.username').append(' (Kick) (Ban) '); }); $('#Chat_' + roomId).on('click', 'ul li .username .quick-kick', function {	//perform kick	mainRoom.kick({ name: $(this).parents.eq(1).attr('data-user') }); }).on('click', 'ul li .username .quick-ban', function {	//perform ban	config = new models.BanCommand({ userToBan: $(this).parents.eq(1).attr('data-user'), time: 7200, reason: 'Banned using oneClickKickBan' });	mainRoom.socket.socket.send(config.xport); }); }) (this.jQuery, this.mediaWiki);
 * (function($, mw) {