-
-
Save daanl/5820576 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name JabbR: Admin Kick Banned Users | |
// @namespace http://jabbr.net.admin/ | |
// @version 0.1 | |
// @description Kick mother bitches from JabbR who have been a pesk. | |
// @match https://jabbr.net/* | |
// @copyright 2013+, JabbR people | |
// @require http://code.jquery.com/jquery-latest.js | |
// ==/UserScript== | |
$(unsafeWindow).load(function() { | |
//var username = window.prompt("User to kick"); | |
var usernames = [ | |
'ryancat', | |
'bannedUser2' | |
]; | |
j = unsafeWindow.$; | |
var origHandler =j.connection.chat.client.addUser; | |
j.connection.chat.client.addUser = function (user, room, isOwner) { | |
origHandler(user,room,isOwner); | |
if (j.inArray(user.Name, usernames) > -1) { | |
var newId = unsafeWindow.chat.utility.newId(); | |
var activeRoom = j.connection.chat.state.activeRoom; | |
j.connection.chat.server.send({id:newId, content:"/kick " + user.Name, room: activeRoom}); | |
} | |
}; | |
setTimeout(doSearch, 1000*10, usernames); | |
}); | |
function doSearch(usernames) { | |
$.each(usernames, function(){ | |
var found = $(document).find(".users.current li[data-name='" + this + "']"); | |
if(found.length > 0) { | |
doKick(chat, this); | |
} | |
}); | |
} | |
function doKick(chat, username) { | |
console.log('Kicking user: ' + username); | |
var newId = unsafeWindow.chat.utility.newId(); | |
var activeRoom = unsafeWindow.$.connection.chat.state.activeRoom; | |
console.log('NewId: ' + newId); | |
console.log('ActiveRoom: ' + activeRoom); | |
unsafeWindow.$.connection.chat.server.send({id:newId, content:"/kick " + username, room: activeRoom}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment