Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Script: anti-string.js
- Version: 0.1
- Author: Simon
- Date: 2014-07-14
- Description: Displays the option to kick a user based on a string found.
- */
- <script>
- var str = 'yolo';
- var idUser = 79519;
- var i = 0;
- setInterval(findString, 5000);
- function findString() {
- $('#chat').find('div.user-' + idUser).each(
- function() {
- $(this).find('div.content').each(
- function() {
- if ($(this).attr('title') != 'validated') {
- if ($(this).html().toLowerCase().search(str) != -1)
- $(this).append(' <strong>[anti-string]</strong> <span style="color:red">' + str.toUpperCase() + ' DETECTED!</span>' +
- ' <span id="btn' + i + '"><input type="button" value="Kick" onclick="kick(' + i + ');" /><input type="button" value="Ignore" onclick="ignore(' + i +');" />');
- $(this).attr('title', 'validated');
- i++;
- }
- }
- );
- }
- );
- }
- function kick(index) {
- $.post('http://chat.stackexchange.com/rooms/kickuser/' + document.location.href.split('/')[4], { fkey:fkey().fkey,userId:idUser });
- $('#btn' + index).html('Action: <strong>Kicked.</strong>');
- }
- function ignore(index) {
- $('#btn' + index).html('Action: <strong>Ignored.</strong>');
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement