Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2014
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     Script: anti-string.js
  3.     Version: 0.1
  4.     Author: Simon
  5.     Date: 2014-07-14
  6.     Description: Displays the option to kick a user based on a string found.
  7.  */
  8.  
  9. <script>
  10.     var str = 'yolo';
  11.     var idUser = 79519;
  12.     var i = 0;
  13.  
  14.     setInterval(findString, 5000);
  15.  
  16.     function findString() {
  17.         $('#chat').find('div.user-' + idUser).each(
  18.             function() {
  19.                 $(this).find('div.content').each(
  20.                     function() {
  21.                         if ($(this).attr('title') != 'validated') {
  22.                             if ($(this).html().toLowerCase().search(str) != -1)
  23.                                 $(this).append(' <strong>[anti-string]</strong> <span style="color:red">' + str.toUpperCase() + ' DETECTED!</span>' +
  24.                                                ' <span id="btn' + i + '"><input type="button" value="Kick" onclick="kick(' + i + ');" /><input type="button" value="Ignore" onclick="ignore(' + i +');" />');
  25.                             $(this).attr('title', 'validated');
  26.                             i++;
  27.                         }
  28.                     }
  29.                 );
  30.             }
  31.         );
  32.     }
  33.  
  34.     function kick(index) {
  35.         $.post('http://chat.stackexchange.com/rooms/‌​kickuser/' + document.location.href.split('/')[4], { fkey:fkey().fkey,userId:idUser });
  36.         $('#btn' + index).html('Action: <strong>Kicked.</strong>');
  37.     }
  38.  
  39.     function ignore(index) {
  40.         $('#btn' + index).html('Action: <strong>Ignored.</strong>');
  41.     }
  42. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement