free cum tribute Live cams!
Click Here to register for a free forum account
Simple 1-step registration process. Be able to upload photos/post topics/PM/Chat, remove pop-up ADs, subscribe to topics and access many more features.

HOWTO: Blocking chat spammers

Includes forum games such as Fuck Marry Kill, Queen of Cum game, What would you do to her game, and a topic to post your Y!M and MSN and SKYPE for live cam cumming General non cumming on pictures chat
Forum rules
18+

HOWTO: Blocking chat spammers

Unread postby bnl » Mon Feb 16, 2015 2:37 pm

I made a script to block assholes on the chat.

You need the GreaseMonkey extension on Firefox or the TamperMonkey one on Chrome.

Then you create this new script:

Code: Select all
// ==UserScript==
// @name        cppBan
// @namespace   cppBan
// @include     http://www.cumonprintedpics.com/*
// @version     1
// @grant       none
// ==/UserScript==
(function () {
  function initcppBan() {
    var e = window.jQuery;
    (window.cppBan = function () {
      e.fn.cppBan = function () {
        var banArray;
        banArray = [
          'rightsaidfred',
          'michaelangelofoto'
        ];
        e.each(banArray, function (banKey, banValue) {
          e('div#chat > div.post:contains("' + banValue + '")').remove();
        });
      };
      setInterval(function () {
        e('#chat').cppBan();
      }, 1000);
    }) ()
  }
  var v = '1.7.2';
  if (typeof window.jQuery == 'undefined' || window.jQuery.fn.jquery < v) {
    var done = false;
    var script = document.createElement('script');
    script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/' + v + '/jquery.min.js';
    script.onload = script.onreadystatechange = function () {
      if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
        done = true;
        initcppBan()
      }
    };
    document.getElementsByTagName('head') [0].appendChild(script)
  } else {
    initcppBan()
  }
}) ();


If you need to block new spammers, edit the banArray list like this:
Code: Select all
        banArray = [
          'rightsaidfred',
          'michaelangelofoto'
          'user3',
          'user4'
        ];
bnl
Normal Poster
 
Posts: 74
Joined: Wed Aug 21, 2013 3:10 am
Karma: 67

Re: HOWTO: Blocking chat spammers

Unread postby anonfaker » Mon Feb 16, 2015 3:03 pm

Thank you sir.
Karma for fakes would be appreciated
See my work here viewtopic.php?f=12&t=148713
Yes, I take requests. Priority is given to young ones or family members.
User avatar
anonfaker
Normal Poster
 
Posts: 91
Joined: Sat Aug 23, 2014 10:04 pm
Karma: 136

Re: HOWTO: Blocking chat spammers

Unread postby bnl » Mon Feb 16, 2015 4:34 pm

Update to remove anyone who posts more than 3 pics at once in the chat:
Code: Select all
// ==UserScript==
// @name        cppBan
// @namespace   cppBan
// @include     http://www.cumonprintedpics.com/*
// @version     2
// @grant       none
// ==/UserScript==
(function () {
  function initcppBan() {
    var e = window.jQuery;
    (window.cppBan = function () {
      e.fn.cppBan = function () {
        var banArray;
        banArray = [
          'rightsaidfred',
          'michaelangelofoto'
        ];
        e.each(banArray, function (banKey, banValue) {
          e('div#chat > div.post:contains("' + banValue + '")').remove();
        });
        var target = e('#chat') [0];
        var observer = new MutationObserver(function (mutations) {
          mutations.forEach(function (mutation) {
            var newNodes = mutation.addedNodes;
            if (newNodes !== null) {
              var $nodes = e(newNodes);
              $nodes.each(function () {
                var imageArray;
                var $node = e(this);
                if ($node.hasClass('post')) {
                  e.each(banArray, function (banKey, banValue) {
                    console.log('Blocked, user:', imageArray.length);
                    $node.filter(':contains("' + banValue + '")').remove();
                  });
                  imageArray = $node.find('img').not('img[src^=\'./images/smilies/\']');
                  if (imageArray.length > 3) {
                    console.log('Blocked, too many images:', imageArray.length);
                    $node.remove();
                  }
                }
              });
              observer.takeRecords();
            }
          });
        });
        // Configuration of the observer:
        var config = {
          attributes: true,
          childList: true,
          characterData: true
        };
        // Pass in the target node, as well as the observer options
        observer.observe(target, config);
      };
      e('#chat').cppBan();
    }) ()
  }
  var v = '1.7.2';
  if (typeof window.jQuery == 'undefined' || window.jQuery.fn.jquery < v) {
    var done = false;
    var script = document.createElement('script');
    script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/' + v + '/jquery.min.js';
    script.onload = script.onreadystatechange = function () {
      if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
        done = true;
        initcppBan()
      }
    };
    document.getElementsByTagName('head') [0].appendChild(script)
  } else {
    initcppBan()
  }
}) ();
bnl
Normal Poster
 
Posts: 74
Joined: Wed Aug 21, 2013 3:10 am
Karma: 67

Re: HOWTO: Blocking chat spammers

Unread postby bnl » Mon Feb 16, 2015 5:23 pm

I made a script to block assholes on the chat. It allows blocking some usernames and people who post too many pics at once.

You need the GreaseMonkey extension on Firefox or the TamperMonkey one on Chrome.

Then you create this new script:

Code: Select all
// ==UserScript==
// @name        cppBan
// @namespace   cppBan
// @include     http://www.cumonprintedpics.com/*
// @version     2
// @grant       none
// ==/UserScript==
(function () {
  function initcppBan() {
    var e = window.jQuery;
    (window.cppBan = function () {
      e.fn.cppBan = function () {
        var banArray, maxPics;
        maxPics = 3;
        banArray = [
          'rightsaidfred',
          'michaelangelofoto'
        ];
        e.each(banArray, function (banKey, banValue) {
          e('div#chat > div.post:contains("' + banValue + '")').remove();
        });
        var target = e('#chat') [0];
        var observer = new MutationObserver(function (mutations) {
          mutations.forEach(function (mutation) {
            var newNodes = mutation.addedNodes;
            if (newNodes !== null) {
              var $nodes = e(newNodes);
              $nodes.each(function () {
                var imageArray;
                var $node = e(this);
                if ($node.hasClass('post')) {
                  e.each(banArray, function (banKey, banValue) {
                    if ($node.filter(':contains("' + banValue + '")').length) {
                      console.log('Blocked, user:', banValue);
                      $node.remove();                     
                    }
                  });
                  imageArray = $node.find('img').not('img[src^=\'./images/smilies/\']');
                  if (imageArray.length > maxPics) {
                    console.log('Blocked, too many images:', imageArray.length);
                    $node.remove();
                  }
                }
              });
              observer.takeRecords();
            }
          });
        });
        // Configuration of the observer:
        var config = {
          attributes: true,
          childList: true,
          characterData: true
        };
        // Pass in the target node, as well as the observer options
        observer.observe(target, config);
      };
      e('#chat').cppBan();
    }) ()
  }
  var v = '1.7.2';
  if (typeof window.jQuery == 'undefined' || window.jQuery.fn.jquery < v) {
    var done = false;
    var script = document.createElement('script');
    script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/' + v + '/jquery.min.js';
    script.onload = script.onreadystatechange = function () {
      if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
        done = true;
        initcppBan()
      }
    };
    document.getElementsByTagName('head') [0].appendChild(script)
  } else {
    initcppBan()
  }
}) ();


If you need to block new spammers, edit the banArray list like this:
Code: Select all
        banArray = [
          'rightsaidfred',
          'michaelangelofoto'
          'user3',
          'user4'
        ];


You can change the maxPics parameter to whatever you want.
bnl
Normal Poster
 
Posts: 74
Joined: Wed Aug 21, 2013 3:10 am
Karma: 67

Re: HOWTO: Blocking chat spammers

Unread postby AnonReject » Mon Feb 16, 2015 7:34 pm

I can't get this to work. Anyway you can explain how to properly do this?
Image
User avatar
AnonReject
Active Poster
 
Posts: 246
Joined: Wed Dec 24, 2014 5:35 am
Location: Around the corner and up your butt.
Karma: 42

Re: HOWTO: Blocking chat spammers

Unread postby AnonReject » Mon Feb 16, 2015 9:43 pm

AnonReject wrote:I can't get this to work. Anyway you can explain how to properly do this?


Got it to work, problem solved!
Image
User avatar
AnonReject
Active Poster
 
Posts: 246
Joined: Wed Dec 24, 2014 5:35 am
Location: Around the corner and up your butt.
Karma: 42

Re: HOWTO: Blocking chat spammers

Unread postby Hazer » Mon Feb 16, 2015 11:47 pm

Any chance this will work for Opera also ?
Hazer
Active Poster
 
Posts: 235
Joined: Thu Dec 26, 2013 12:28 pm
Karma: 34

Re: HOWTO: Blocking chat spammers

Unread postby bnl » Mon Feb 16, 2015 11:59 pm

Hazer wrote:Any chance this will work for Opera also ?

I can't test it but try using it with this extension https://addons.opera.com/en/extensions/ ... display=en
bnl
Normal Poster
 
Posts: 74
Joined: Wed Aug 21, 2013 3:10 am
Karma: 67

Re: HOWTO: Blocking chat spammers

Unread postby bnl » Tue Feb 17, 2015 1:16 pm

I made a script to block assholes on the chat. It allows blocking some usernames and people who post too many pics at once.
Now updated to block wall of text.

You need:

Then you create this new script:

Code: Select all
// ==UserScript==
// @name        cppBan
// @namespace   cppBan
// @include     http://www.cumonprintedpics.com/*
// @version     3
// @grant       none
// ==/UserScript==
(function () {
  function initcppBan() {
    var e = window.jQuery;
    (window.cppBan = function () {
      e.fn.cppBan = function () {
        var banArray,
        maxPics;
        var imageArray,
        textContent;
        maxPics = 3;
        maxText = 2200;
        banArray = [
          'rightsaidfred',
          'michaelangelofoto',
          'chantal4master',
          'j_hanson'
        ];
       
        //initial cleaning
        e.each(banArray, function (banKey, banValue) {
          e('div#chat > div.post:contains("' + banValue + '")').remove();
        });
        e('div#chat > div.post').each(function () {
          var $node = e(this);
          imageArray = $node.find('img').not('img[src^=\'./images/smilies/\']');
          if (imageArray.length > maxPics) {
            console.info('Blocked, too many images:', imageArray.length);
            $node.remove();
          }
          textContent = $node.find('div.content').text();
          if (textContent.length > maxText) {
            console.info('Blocked, too much text:', textContent.length);
            $node.remove();
          }
        })
       
        //dynamic filtering
        var target = e('#chat') [0];
        var observer = new MutationObserver(function (mutations) {
          mutations.forEach(function (mutation) {
            var newNodes = mutation.addedNodes;
            if (newNodes !== null) {
              var $nodes = e(newNodes);
              $nodes.each(function () {
                var $node = e(this);
                if ($node.hasClass('post')) {
                  e.each(banArray, function (banKey, banValue) {
                    if ($node.filter(':contains("' + banValue + '")').length) {
                      console.info('Blocked, user:', banValue);
                      $node.remove();
                    }
                  });
                  imageArray = $node.find('img').not('img[src^=\'./images/smilies/\']');
                  if (imageArray.length > maxPics) {
                    console.info('Blocked, too many images:', imageArray.length);
                    $node.remove();
                  }
                  textContent = $node.find('div.content').text();
                  if (textContent.length > maxText) {
                    console.info('Blocked, too much text:', textContent.length);
                    $node.remove();
                  }
                }
              });
              observer.takeRecords();
            }
          });
        });
       
        var config = {
          attributes: true,
          childList: true,
          characterData: true
        };
       
        observer.observe(target, config);
      };
      e('#chat').cppBan();
    }) ()
  }
  var v = '1.7.2';
  if (typeof window.jQuery == 'undefined' || window.jQuery.fn.jquery < v) {
    var done = false;
    var script = document.createElement('script');
    script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/' + v + '/jquery.min.js';
    script.onload = script.onreadystatechange = function () {
      if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
        done = true;
        initcppBan()
      }
    };
    document.getElementsByTagName('head') [0].appendChild(script)
  } else {
    initcppBan()
  }
}) ();


If you need to block new spammers, edit the banArray list like this:
Code: Select all
        banArray = [
          'rightsaidfred',
          'michaelangelofoto',
          'chantal4master',
          'user4'
          'user5',
        ];

You can change the maxPics and maxText parameters to whatever you want. By default, posts with more than 3 images and posts with more than 2,200 characters are blocked.
bnl
Normal Poster
 
Posts: 74
Joined: Wed Aug 21, 2013 3:10 am
Karma: 67

Re: HOWTO: Blocking chat spammers

Unread postby redronnie » Tue Feb 17, 2015 1:51 pm

bnl wrote:I made a script to block assholes on the chat. It allows blocking some usernames and people who post too many pics at once.
Now updated to block wall of text.

You need:

Then you create this new script:

Code: Select all
// ==UserScript==
// @name        cppBan
// @namespace   cppBan
// @include     http://www.cumonprintedpics.com/*
// @version     3
// @grant       none
// ==/UserScript==
(function () {
  function initcppBan() {
    var e = window.jQuery;
    (window.cppBan = function () {
      e.fn.cppBan = function () {
        var banArray,
        maxPics;
        var imageArray,
        textContent;
        maxPics = 3;
        maxText = 2200;
        banArray = [
          'rightsaidfred',
          'michaelangelofoto',
          'chantal4master',
          'j_hanson'
        ];
       
        //initial cleaning
        e.each(banArray, function (banKey, banValue) {
          e('div#chat > div.post:contains("' + banValue + '")').remove();
        });
        e('div#chat > div.post').each(function () {
          var $node = e(this);
          imageArray = $node.find('img').not('img[src^=\'./images/smilies/\']');
          if (imageArray.length > maxPics) {
            console.info('Blocked, too many images:', imageArray.length);
            $node.remove();
          }
          textContent = $node.find('div.content').text();
          if (textContent.length > maxText) {
            console.info('Blocked, too much text:', textContent.length);
            $node.remove();
          }
        })
       
        //dynamic filtering
        var target = e('#chat') [0];
        var observer = new MutationObserver(function (mutations) {
          mutations.forEach(function (mutation) {
            var newNodes = mutation.addedNodes;
            if (newNodes !== null) {
              var $nodes = e(newNodes);
              $nodes.each(function () {
                var $node = e(this);
                if ($node.hasClass('post')) {
                  e.each(banArray, function (banKey, banValue) {
                    if ($node.filter(':contains("' + banValue + '")').length) {
                      console.info('Blocked, user:', banValue);
                      $node.remove();
                    }
                  });
                  imageArray = $node.find('img').not('img[src^=\'./images/smilies/\']');
                  if (imageArray.length > maxPics) {
                    console.info('Blocked, too many images:', imageArray.length);
                    $node.remove();
                  }
                  textContent = $node.find('div.content').text();
                  if (textContent.length > maxText) {
                    console.info('Blocked, too much text:', textContent.length);
                    $node.remove();
                  }
                }
              });
              observer.takeRecords();
            }
          });
        });
       
        var config = {
          attributes: true,
          childList: true,
          characterData: true
        };
       
        observer.observe(target, config);
      };
      e('#chat').cppBan();
    }) ()
  }
  var v = '1.7.2';
  if (typeof window.jQuery == 'undefined' || window.jQuery.fn.jquery < v) {
    var done = false;
    var script = document.createElement('script');
    script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/' + v + '/jquery.min.js';
    script.onload = script.onreadystatechange = function () {
      if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
        done = true;
        initcppBan()
      }
    };
    document.getElementsByTagName('head') [0].appendChild(script)
  } else {
    initcppBan()
  }
}) ();


If you need to block new spammers, edit the banArray list like this:
Code: Select all
        banArray = [
          'rightsaidfred',
          'michaelangelofoto',
          'chantal4master',
          'user4'
          'user5',
        ];

You can change the maxPics and maxText parameters to whatever you want. By default, posts with more than 3 images and posts with more than 2,200 characters are blocked.


you are a genius man!! Thanks for this! ;)
redronnie
Normal Poster
 
Posts: 70
Joined: Thu Nov 17, 2011 5:52 pm
Karma: 4

Re: HOWTO: Blocking chat spammers

Unread postby bnl » Tue Feb 17, 2015 2:13 pm

I made a script to block assholes on the chat. It allows blocking some usernames and people who post too many pics at once.
Version 3: updated to block wall of text.
Version 4: updated to reduce extra large image in the chat.

You need:

Then you create this new script:

Code: Select all
// ==UserScript==
// @name        cppBan
// @namespace   cppBan
// @include     http://www.cumonprintedpics.com/*
// @version     4
// @grant       none
// ==/UserScript==
(function () {
  function initcppBan() {
    var e = window.jQuery;
    (window.cppBan = function () {
      e.fn.cppBan = function () {
        var banArray, maxPics, maxSize;
        var imageArray, textContent;
        maxPics = 3;
        maxSize = '640px';
        maxText = 2200;
        banArray = [
          'rightsaidfred',
          'michaelangelofoto',
          'chantal4master',
          'j_hanson',
          'chris19'
        ];
        //initial cleaning
        e('<style type="text/css">#chat .content img {max-width:' + maxSize + ';max-height:' + maxSize + ';width:auto;height:auto;display:inline-block}</style>').appendTo('head');
        e('div#chat > div.post').each(function () {
          var $node = e(this);
          e.each(banArray, function (banKey, banValue) {
            if ($node.filter(':contains("' + banValue + '")').length) {
              console.info('Blocked, user:', banValue);
              $node.remove();
            }
          });
          imageArray = $node.find('img').not('img[src^=\'./images/smilies/\']');
          if (imageArray.length > maxPics) {
            console.info('Blocked, too many images:', imageArray.length);
            $node.remove();
          }
          textContent = $node.find('div.content').text();
          if (textContent.length > maxText) {
            console.info('Blocked, too much text:', textContent.length);
            $node.remove();
          }
        })
        //dynamic filtering
        var target = e('#chat') [0];
        var observer = new MutationObserver(function (mutations) {
          mutations.forEach(function (mutation) {
            var newNodes = mutation.addedNodes;
            if (newNodes !== null) {
              var $nodes = e(newNodes);
              $nodes.each(function () {
                var $node = e(this);
                if ($node.hasClass('post')) {
                  e.each(banArray, function (banKey, banValue) {
                    if ($node.filter(':contains("' + banValue + '")').length) {
                      console.info('Blocked, user:', banValue);
                      $node.remove();
                    }
                  });
                  imageArray = $node.find('img').not('img[src^=\'./images/smilies/\']');
                  if (imageArray.length > maxPics) {
                    console.info('Blocked, too many images:', imageArray.length);
                    $node.remove();
                  }
                  textContent = $node.find('div.content').text();
                  if (textContent.length > maxText) {
                    console.info('Blocked, too much text:', textContent.length);
                    $node.remove();
                  }
                }
              });
              observer.takeRecords();
            }
          });
        });
        var config = {
          attributes: true,
          childList: true,
          characterData: true
        };
        observer.observe(target, config);
      };
      e('#chat').cppBan();
    }) ()
  }
  var v = '1.7.2';
  if (typeof window.jQuery == 'undefined' || window.jQuery.fn.jquery < v) {
    var done = false;
    var script = document.createElement('script');
    script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/' + v + '/jquery.min.js';
    script.onload = script.onreadystatechange = function () {
      if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
        done = true;
        initcppBan()
      }
    };
    document.getElementsByTagName('head') [0].appendChild(script)
  } else {
    initcppBan()
  }
}) ();



If you need to block new spammers, edit the banArray list like this:
Code: Select all
        banArray = [
          'rightsaidfred',
          'michaelangelofoto',
          'chantal4master',
          'user4'
          'user5',
        ];

You can change the maxPics, maxText and maxSize parameters to whatever you want. By default, posts with more than 3 images and posts with more than 2,200 characters are blocked. Image size is limited at 640px (width or height).
bnl
Normal Poster
 
Posts: 74
Joined: Wed Aug 21, 2013 3:10 am
Karma: 67

Re: HOWTO: Blocking chat spammers

Unread postby Xman » Tue Feb 17, 2015 2:22 pm

hmm
Check this out viewtopic.php?f=21&t=168004
And I would might tribute/fake/caption/write on your girl in return!
Send me a private message if you are up for it!
User avatar
Xman
Extreme Poster
 
Posts: 568
Joined: Sun Jun 22, 2014 3:10 pm
Karma: 29

Re: HOWTO: Blocking chat spammers

Unread postby j_hanson » Tue Feb 17, 2015 2:41 pm

Wow, thanks for putting me in with the list guys. I really appreciate it since, you know, I was trying a different approach as to just complaining about said spammers or pleading for them to quit. At any rate, you missed "boredsoyoucanbetoo", so thanks again for putting me in with the list. Also, it's funny, because to get people to this topic I included this link. Kind of wish I hadn't done that now. Now I can't chat with a lot of people that otherwise would see my posts.

Also, there is the problem with me not being able to get this script to work on the Greasemonkey extension on Firefox. I've tried using different names, not putting names except for where it prompts me to do so, not including the URL in the "Include" section, including the URL in said section, refreshing the page, closing the browser and restarting, all to no avail. Any helps please? AnonReject tried helping but he's using Chrome and we were trying to get it to work with no luck.
User avatar
j_hanson
 
Posts: 24
Joined: Tue Jun 18, 2013 4:23 pm
Karma: 3

Re: HOWTO: Blocking chat spammers

Unread postby bnl » Tue Feb 17, 2015 2:45 pm

j_hanson wrote:Wow, thanks for putting me in with the list guys. I really appreciate it since, you know, I was trying a different approach as to just complaining about said spammers or pleading for them to quit. At any rate, you missed "boredsoyoucanbetoo", so thanks again for putting me in with the list. Also, it's funny, because to get people to this topic I included this link. Kind of wish I hadn't done that now. Now I can't chat with a lot of people that otherwise would see my posts.

You were spamming as much as the others at one point.

j_hanson wrote:Also, there is the problem with me not being able to get this script to work on the Greasemonkey extension on Firefox. I've tried using different names, not putting names except for where it prompts me to do so, not including the URL in the "Include" section, including the URL in said section, refreshing the page, closing the browser and restarting, all to no avail. Any helps please? AnonReject tried helping but he's using Chrome and we were trying to get it to work with no luck.

Copy the entire script in your clipboard, then when you click "New User Script…", select "Use Script from Clipboard".
bnl
Normal Poster
 
Posts: 74
Joined: Wed Aug 21, 2013 3:10 am
Karma: 67

Re: HOWTO: Blocking chat spammers

Unread postby bnl » Tue Feb 17, 2015 2:48 pm

I made a script to block assholes on the chat. It allows blocking some usernames and people who post too many pics at once.
Version 3: updated to block wall of text.
Version 4: updated to reduce extra large image in the chat.

You need:

Then you create a new script and copy-paste the following code (you can click "Use Script from Clipboard" in Firefox):

Code: Select all
// ==UserScript==
// @name        cppBan
// @namespace   cppBan
// @include     http://www.cumonprintedpics.com/*
// @version     4
// @grant       none
// ==/UserScript==
(function () {
  function initcppBan() {
    var e = window.jQuery;
    (window.cppBan = function () {
      e.fn.cppBan = function () {
        var banArray, maxPics, maxSize;
        var imageArray, textContent;
        maxPics = 3;
        maxSize = '640px';
        maxText = 2200;
        banArray = [
          'rightsaidfred',
          'michaelangelofoto',
          'chantal4master'
        ];
        //initial cleaning
        e('<style type="text/css">#chat .content img {max-width:' + maxSize + ';max-height:' + maxSize + ';width:auto;height:auto;display:inline-block}</style>').appendTo('head');
        e('div#chat > div.post').each(function () {
          var $node = e(this);
          e.each(banArray, function (banKey, banValue) {
            if ($node.filter(':contains("' + banValue + '")').length) {
              console.info('Blocked, user:', banValue);
              $node.remove();
            }
          });
          imageArray = $node.find('img').not('img[src^=\'./images/smilies/\']');
          if (imageArray.length > maxPics) {
            console.info('Blocked, too many images:', imageArray.length);
            $node.remove();
          }
          textContent = $node.find('div.content').text();
          if (textContent.length > maxText) {
            console.info('Blocked, too much text:', textContent.length);
            $node.remove();
          }
        })
        //dynamic filtering
        var target = e('#chat') [0];
        var observer = new MutationObserver(function (mutations) {
          mutations.forEach(function (mutation) {
            var newNodes = mutation.addedNodes;
            if (newNodes !== null) {
              var $nodes = e(newNodes);
              $nodes.each(function () {
                var $node = e(this);
                if ($node.hasClass('post')) {
                  e.each(banArray, function (banKey, banValue) {
                    if ($node.filter(':contains("' + banValue + '")').length) {
                      console.info('Blocked, user:', banValue);
                      $node.remove();
                    }
                  });
                  imageArray = $node.find('img').not('img[src^=\'./images/smilies/\']');
                  if (imageArray.length > maxPics) {
                    console.info('Blocked, too many images:', imageArray.length);
                    $node.remove();
                  }
                  textContent = $node.find('div.content').text();
                  if (textContent.length > maxText) {
                    console.info('Blocked, too much text:', textContent.length);
                    $node.remove();
                  }
                }
              });
              observer.takeRecords();
            }
          });
        });
        var config = {
          attributes: true,
          childList: true,
          characterData: true
        };
        observer.observe(target, config);
      };
      e('#chat').cppBan();
    }) ()
  }
  var v = '1.7.2';
  if (typeof window.jQuery == 'undefined' || window.jQuery.fn.jquery < v) {
    var done = false;
    var script = document.createElement('script');
    script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/' + v + '/jquery.min.js';
    script.onload = script.onreadystatechange = function () {
      if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
        done = true;
        initcppBan()
      }
    };
    document.getElementsByTagName('head') [0].appendChild(script)
  } else {
    initcppBan()
  }
}) ();



If you need to block new spammers, edit the banArray list like this:
Code: Select all
        banArray = [
          'rightsaidfred',
          'michaelangelofoto',
          'chantal4master',
          'user4'
          'user5',
        ];

You can change the maxPics, maxText and maxSize parameters to whatever you want. By default, posts with more than 3 images and posts with more than 2,200 characters are blocked. Image size is limited at 640px (width or height).
bnl
Normal Poster
 
Posts: 74
Joined: Wed Aug 21, 2013 3:10 am
Karma: 67

Re: HOWTO: Blocking chat spammers

Unread postby j_hanson » Tue Feb 17, 2015 2:51 pm

I know I was. I addressed that in my post. I was also spamming with how to do the Control Panel>>User Preferences>>Edit Display Options>>Display Images Within Posts and also included a link to this very topic. Because I've been on here for two years and the spammers always come and I felt it was a grand way to get rid of the problem, and that people who don't know how to change the user preferences wouldn't see what I was posting because of the spammers.

At any rate thank you, I have yet to try that one instance.

EDIT: I can't thank you enough for putting me off the list. You'll see that I'm not a spammer, and I'm glad COPP told me "At least one new post has been made to this topic..." because I wouldn't have seen the post before submitting. Thanks again, and thank you for helping!
EDIT:EDIT: I added karma for ya. I really hope to add another karma tomorrow when I can again, so I put this in to hopefully remind myself.
User avatar
j_hanson
 
Posts: 24
Joined: Tue Jun 18, 2013 4:23 pm
Karma: 3

Re: HOWTO: Blocking chat spammers

Unread postby usinggirlsisfun » Sat Feb 21, 2015 2:42 pm

I can't get it to work in Chrome, I tried adding "Xphooto" to the ban array list, it says the script is active when I visit the site but all his spam chat posts are still there. I installed tampermonkey, created and enabled the script but no luck
usinggirlsisfun
Respected Member
Respected Member
 
Posts: 682
Joined: Tue Nov 01, 2011 1:14 pm
Karma: 58

Re: HOWTO: Blocking chat spammers

Unread postby usinggirlsisfun » Sat Feb 21, 2015 3:39 pm

Cancel that, it's working now, I had tried to add a new user to the ban array list which didn't work, when I replaced one of the ones already there with the new name it's worked. Not sure why I couldn't add a new name to the list though
usinggirlsisfun
Respected Member
Respected Member
 
Posts: 682
Joined: Tue Nov 01, 2011 1:14 pm
Karma: 58

Re: HOWTO: Blocking chat spammers

Unread postby bnl » Sat Feb 21, 2015 9:08 pm

usinggirlsisfun wrote:I can't get it to work in Chrome, I tried adding "Xphooto" to the ban array list, it says the script is active when I visit the site but all his spam chat posts are still there. I installed tampermonkey, created and enabled the script but no luck

You need to reload the page if you edit the script.
bnl
Normal Poster
 
Posts: 74
Joined: Wed Aug 21, 2013 3:10 am
Karma: 67

Re: HOWTO: Blocking chat spammers

Unread postby usinggirlsisfun » Sat Feb 21, 2015 9:13 pm

I did refresh the page but it seems to only work when I replace a name already there rather than add a name, maybe I did a typo or something when I tried to add , I'll try again when another spammer appears. Worked a treat today when that idiot was on !
usinggirlsisfun
Respected Member
Respected Member
 
Posts: 682
Joined: Tue Nov 01, 2011 1:14 pm
Karma: 58

Re: HOWTO: Blocking chat spammers

Unread postby bnl » Sat Feb 21, 2015 9:33 pm

idk then? Make sure it's comma separated, between quotes, and don't add a comma for the last name. Ex:

Code: Select all
        banArray = [
          'rightsaidfred',
          'michaelangelofoto',
          'chantal4master',
          'chris19'
        ];
bnl
Normal Poster
 
Posts: 74
Joined: Wed Aug 21, 2013 3:10 am
Karma: 67

Re: HOWTO: Blocking chat spammers

Unread postby filthyolduk » Sat Feb 21, 2015 11:14 pm

Sir, you are a prince among men, and as soon as I've posted sufficient messages to allow me to give Karma, then said will be winging its way towards you.
Yours is the single best thing I've ever read on here.
It really does work, folks!
filthyolduk
 
Posts: 48
Joined: Sat Jul 12, 2014 3:08 pm
Location: UK, off the M20
Karma: 9

Re: HOWTO: Blocking chat spammers

Unread postby Persona non grata » Sun Feb 22, 2015 1:34 pm

Excellent stuff, bnl. You officially violated xphooto's spamming fucking arse. :lol:

Karma on the way. ;)
>>>Retired<<<
User avatar
Persona non grata
Respected Member
Respected Member
 
Posts: 2939
Joined: Wed May 18, 2011 8:03 pm
Karma: 1776

Re: HOWTO: Blocking chat spammers

Unread postby xphoooto » Mon Feb 23, 2015 12:35 pm

http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore http://xphooto.com/explore
xphoooto
 
Posts: 3
Joined: Sat Feb 21, 2015 5:09 pm
Karma: -27

Re: HOWTO: Blocking chat spammers

Unread postby bnl » Mon Feb 23, 2015 3:42 pm

Persona non grata wrote:Excellent stuff, bnl. You officially violated xphooto's spamming fucking arse. :lol:

Karma on the way. ;)

xphooto doesn't seem happy about it.
bnl
Normal Poster
 
Posts: 74
Joined: Wed Aug 21, 2013 3:10 am
Karma: 67

Re: HOWTO: Blocking chat spammers

Unread postby Persona non grata » Mon Feb 23, 2015 5:56 pm

Fuck him and fuck his spamming waste of human resources. :twisted:

Maybe a new version to block everything is needed though I'm thinking adding someone like him as a foe in the User Control Panel, would have the same effect.
>>>Retired<<<
User avatar
Persona non grata
Respected Member
Respected Member
 
Posts: 2939
Joined: Wed May 18, 2011 8:03 pm
Karma: 1776

Re: HOWTO: Blocking chat spammers

Unread postby ta37887 » Thu Feb 26, 2015 7:34 pm

Thanks for putting the work into this!
ta37887
 
Posts: 13
Joined: Thu Feb 26, 2015 2:12 am
Karma: 7

Re: HOWTO: Blocking chat spammers

Unread postby bnl » Mon Mar 23, 2015 7:21 pm

I made a script to block assholes on the chat. It allows blocking some usernames and people who post too many pics at once.
Version 3: updated to block wall of text.
Version 4: updated to reduce extra large image in the chat.
Version 4.1: updated for Chrome.

You need:

Then you create a new script and copy-paste the following code (you can click "Use Script from Clipboard" in Firefox):

Code: Select all
// ==UserScript==
// @name        cppBan
// @namespace   cppBan
// @include     http://www.cumonprintedpics.com/*
// @version     4.1
// @grant       none
// ==/UserScript==
(function () {
    function initcppBan() {
        var e = window.jQuery;
        (window.cppBan = function () {
            e.fn.cppBan = function () {
                var banArray, maxPics, maxSize;
                var imageArray, textContent;
                maxPics = 3;
                maxSize = '640px';
                maxText = 2200;
                banArray = [
                    'rightsaidfred',
                    'michaelangelofoto',
                    'chantal4master',
                    'chris19',
                    'xphoooto',
                    'dirtycreamwhores',
                    'NigelFarage'
                ];
                //initial cleaning
                e('<style type="text/css">#chat .content img {max-width:' + maxSize + ';max-height:' + maxSize + ';width:auto;height:auto;display:inline-block}</style>').appendTo('head');
                e('div#chat > div.post').each(function () {
                    var $node = e(this);
                    e.each(banArray, function (banKey, banValue) {
                        if ($node.filter(':contains("' + banValue + '")').length) {
                            console.info('Blocked, user:', banValue);
                            $node.remove();
                        }
                    });
                    imageArray = $node.find('img').not('img[src^=\'./images/smilies/\']');
                    if (imageArray.length > maxPics) {
                        console.info('Blocked, too many images:', imageArray.length);
                        $node.remove();
                    }
                    textContent = $node.find('div.content').text();
                    if (textContent.length > maxText) {
                        console.info('Blocked, too much text:', textContent.length);
                        $node.remove();
                    }
                });
                //dynamic filtering
                var target = document.getElementById('chat');
                var observer = new MutationObserver(function (mutations) {
                    mutations.forEach(function (mutation) {
                        var newNodes = mutation.addedNodes;
                        if (newNodes !== null) {
                            var $nodes = e(newNodes);
                            $nodes.each(function () {
                                var $node = e(this);
                                if ($node.hasClass('post')) {
                                    e.each(banArray, function (banKey, banValue) {
                                        if ($node.filter(':contains("' + banValue + '")').length) {
                                            console.info('Blocked, user:', banValue);
                                            $node.remove();
                                        }
                                    });
                                    imageArray = $node.find('img').not('img[src^=\'./images/smilies/\']');
                                    if (imageArray.length > maxPics) {
                                        console.info('Blocked, too many images:', imageArray.length);
                                        $node.remove();
                                    }
                                    textContent = $node.find('div.content').text();
                                    if (textContent.length > maxText) {
                                        console.info('Blocked, too much text:', textContent.length);
                                        $node.remove();
                                    }
                                }
                            });
                            observer.takeRecords();
                        }
                    });
                });
                var config = {
                    attributes: false,
                    childList: true,
                    characterData: false,
                    subtree: true
                };
                observer.observe(target, config);
            };
            e('#chat').cppBan();
        }) ();
    }
    var v = '1.7.2';
    if (typeof window.jQuery == 'undefined' || window.jQuery.fn.jquery < v) {
        var done = false;
        var script = document.createElement('script');
        script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/' + v + '/jquery.min.js';
        script.onload = script.onreadystatechange = function () {
            if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
                done = true;
                initcppBan();
            }
        };
        document.getElementsByTagName('head') [0].appendChild(script)
    } else {
        initcppBan();
    }
}) ();


If you need to block new spammers, edit the banArray list like this:
Code: Select all
        banArray = [
          'rightsaidfred',
          'michaelangelofoto',
          'chantal4master',
          'user4'
          'user5',
        ];

You can change the maxPics, maxText and maxSize parameters to whatever you want. By default, posts with more than 3 images and posts with more than 2,200 characters are blocked. Image size is limited at 640px (width or height).
bnl
Normal Poster
 
Posts: 74
Joined: Wed Aug 21, 2013 3:10 am
Karma: 67

Re: HOWTO: Blocking chat spammers

Unread postby bnl » Tue Apr 14, 2015 2:11 pm

I made a script to block assholes on the chat. It allows blocking some usernames and people who post too many pics at once.
Version 3: updated to block wall of text.
Version 4: updated to reduce extra large image in the chat.
Version 4.1: updated for Chrome.
Version 4.2:
  • Now blocks message with TOO MANY CAPS
  • Code cleanup
  • You can get stats about blocked message in your browser console with the function cppBanStats()

You need:

Then you create a new script and copy-paste the following code (you can click "Use Script from Clipboard" in Firefox):

Code: Select all
// ==UserScript==
// @name        cppBan
// @namespace   cppBan
// @include     http://www.cumonprintedpics.com/*
// @version     4.2
// @grant       none
// ==/UserScript==
(function () {
    function initcppBan() {
        var e = window.jQuery;
        var banArray, stat_TotalBlocked = 0,
            stat_BlockedUsers = {},
            stat_BlockedImages = {},
            stat_BlockedText = {},
            stat_BlockedCaps = {};
        (window.cppBan = function () {
            var maxPics, maxSize, maxText, maxCapsWords;
            var imageArray, textContent, capsWords;

            //config
            maxPics = 3;
            maxSize = '640px';
            maxText = 2200;
            maxCapsWords = 10;
            banArray = [
                    'rightsaidfred',
                    'michaelangelofoto',
                    'chantal4master',
                    'chris19',
                    'xphoooto',
                    'dirtycreamwhores',
                    'NigelFarage'
                ];

            e('<style type="text/css">#chat .content img {max-width:' + maxSize + ';max-height:' +
                maxSize + ';width:auto;height:auto;display:inline-block}</style>').appendTo(
                'head');
            var removeIdiots = function (posts) {
                posts.each(function () {
                    var $node = e(this);
                    var profile = $node.find('#profile a').text();
                    e.each(banArray, function (banKey, banValue) {
                        if ($node.find('#profile a').text() === banValue) {
                            console.info('Blocked, user:', profile);
                            if (stat_BlockedUsers[profile] === undefined) {
                                stat_BlockedUsers[profile] = 1;
                            } else {
                                stat_BlockedUsers[profile] += 1;
                            }
                            stat_TotalBlocked += 1;
                            $node.remove();
                        }
                    });
                    imageArray = $node.find('img').not(
                        'img[src^=\'./images/smilies/\']');
                    if (imageArray.length > maxPics) {
                        console.info('Blocked, too many images:', imageArray.length);
                        if (stat_BlockedImages[profile] === undefined) {
                            stat_BlockedImages[profile] = 1;
                        } else {
                            stat_BlockedImages[profile] += 1;
                        }
                        stat_TotalBlocked += 1;
                        $node.remove();
                    }
                    textContent = $node.find('div.content').text();
                    if (textContent.length > maxText) {
                        console.info('Blocked, too much text:', textContent.length);
                        if (stat_BlockedText[profile] === undefined) {
                            stat_BlockedText[profile] = 1;
                        } else {
                            stat_BlockedText[profile] += 1;
                        }
                        stat_TotalBlocked += 1;
                        $node.remove();
                    }
                    capsWords = textContent.match(/([A-Z']+)/g);
                    if (capsWords && capsWords.length > maxCapsWords) {
                        console.info('Blocked, too much caps:', capsWords.length);
                        if (stat_BlockedCaps[profile] === undefined) {
                            stat_BlockedCaps[profile] = 1;
                        } else {
                            stat_BlockedCaps[profile] += 1;
                        }
                        stat_TotalBlocked += 1;
                        $node.remove();
                    }
                });
            };

            //initial cleaning
            removeIdiots(e('div#chat > div.post'));

            //dynamic filtering
            var target = document.getElementById('chat');
            var observer = new MutationObserver(function (mutations) {
                mutations.forEach(function (mutation) {
                    var newNodes = mutation.addedNodes;
                    if (newNodes !== null) {
                        removeIdiots(e(newNodes));
                        observer.takeRecords();
                    }
                });
            });
            var config = {
                attributes: false,
                childList: true,
                characterData: false,
                subtree: true
            };
            observer.observe(target, config);
        })();

        window.cppBanStats = function () {
            console.log(
                'Total banned users: ' + banArray.length + '\n' +
                'Messages blocked this session: ' + stat_TotalBlocked + '\n' +
                'Blocked users: ' + JSON.stringify(stat_BlockedUsers) + '\n' +
                'Blocked images: ' + JSON.stringify(stat_BlockedImages) + '\n' +
                'Wall of text: ' + JSON.stringify(stat_BlockedText) + '\n' +
                'Caps Lock Malfunction: ' + JSON.stringify(stat_BlockedCaps)
            );
        };

    }
    var v = '1.7.2';
    if (typeof window.jQuery == 'undefined' || window.jQuery.fn.jquery < v) {
        var done = false;
        var script = document.createElement('script');
        script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/' + v + '/jquery.min.js';
        script.onload = script.onreadystatechange = function () {
            if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
                done = true;
                initcppBan();
            }
        };
        document.getElementsByTagName('head')[0].appendChild(script);
    } else {
        initcppBan();
    }
})();


If you need to block new spammers, edit the banArray list like this:
Code: Select all
        banArray = [
          'rightsaidfred',
          'michaelangelofoto',
          'chantal4master',
          'user4',
          'user5'
        ];

You can change the maxPics, maxText, maxCapsWord and maxSize parameters to whatever you want. By default, posts with more than 3 images, posts with more than 2,200 characters and posts with more than 10 Caps words are blocked. Image size is limited at 640px (width or height).
bnl
Normal Poster
 
Posts: 74
Joined: Wed Aug 21, 2013 3:10 am
Karma: 67

Re: HOWTO: Blocking chat spammers

Unread postby bnl » Tue Apr 14, 2015 8:44 pm

I made a script to block assholes on the chat. It allows blocking some usernames and people who post too many pics at once.

  • Version 3: updated to block wall of text.
  • Version 4.1: updated for Chrome.
  • Version 4.2:
    • Now blocks message with TOO MANY CAPS
    • Code cleanup
  • Version 5:
    You can now use commands in the chat bar:
    • /ignore usernameIgnore username
    • /unignore usernameUnignore username
    • /listignoredDisplay the list of ignored users
    • /listsettingsDisplay automatic ignore settings
    • /set setting valueChange the value of a setting.
        Valid setting are: maxPics, maxSize, maxText, maxCapsWords
    • /statsDisplay statistics about ignored users for this session.
    • /helpDisplay this help message.

Installation
You need:

Then you create a new script and copy-paste the following code (you can click "Use Script from Clipboard" in Firefox):

Code: Select all
// ==UserScript==
// @name        cppBan
// @namespace   cppBan
// @include     http://www.cumonprintedpics.com/*
// @version     5.0
// @grant       none
// ==/UserScript==
(function () {
    function initcppBan() {
        var e = window.jQuery;
        (window.cppBan = function () {
            var maxPics, maxSize, maxText, maxCapsWords;
            var banArray, imageArray, textContent, capsWords;
            var stat_TotalBlocked = 0,
                stat_BlockedUsers = {},
                stat_BlockedImages = {},
                stat_BlockedText = {},
                stat_BlockedCaps = {};

            //Default config
            maxPics = 3;
            maxSize = '640';
            maxText = 2200;
            maxCapsWords = 15;
            banArray = [
                'rightsaidfred',
                'michaelangelofoto',
                'chantal4master',
                'chris19',
                'xphoooto',
                'dirtycreamwhores',
                'nigelfarage'
            ];

            var removeIdiots = function (posts) {
                posts.each(function () {
                    var $node = e(this);
                    var profile = $node.find('#profile a').text();
                    e.each(banArray, function (banKey, banValue) {
                        if ($node.find('#profile a').text().toLowerCase() === banValue) {
                            console.info('Blocked, user:', profile);
                            if (stat_BlockedUsers[profile] === undefined) {
                                stat_BlockedUsers[profile] = 1;
                            } else {
                                stat_BlockedUsers[profile] += 1;
                            }
                            stat_TotalBlocked += 1;
                            $node.addClass('cppHidden');
                        }
                    });
                    imageArray = $node.find('img').not(
                        'img[src^=\'./images/smilies/\']'
                    );
                    if (imageArray.length > maxPics) {
                        console.info('Blocked, too many images:', imageArray.length);
                        if (stat_BlockedImages[profile] === undefined) {
                            stat_BlockedImages[profile] = 1;
                        } else {
                            stat_BlockedImages[profile] += 1;
                        }
                        stat_TotalBlocked += 1;
                        $node.addClass('cppHidden');
                    }
                    textContent = $node.find('div.content').text();
                    if (textContent.length > maxText) {
                        console.info('Blocked, too much text:', textContent.length);
                        if (stat_BlockedText[profile] === undefined) {
                            stat_BlockedText[profile] = 1;
                        } else {
                            stat_BlockedText[profile] += 1;
                        }
                        stat_TotalBlocked += 1;
                        $node.addClass('cppHidden');
                    }
                    capsWords = textContent.match(/([A-Z']+)/g);
                    if (capsWords && capsWords.length > maxCapsWords) {
                        console.info('Blocked, too much caps:', capsWords.length);
                        if (stat_BlockedCaps[profile] === undefined) {
                            stat_BlockedCaps[profile] = 1;
                        } else {
                            stat_BlockedCaps[profile] += 1;
                        }
                        stat_TotalBlocked += 1;
                        $node.addClass('cppHidden');
                    }
                });
            };

            var reloadParams = function () {
                e('.cppHidden').removeClass('cppHidden');
                removeIdiots(e('div#chat > div.post'));
            };

            var setParam = function (param, value) {
                switch (param) {
                case 'maxpics':
                    maxPics = value;
                    localStorage.maxPics = maxPics;
                    alertify.log('maxPics set to ' + maxPics, 'success', 5000);
                    break;
                case 'maxsize':
                    maxSize = value;
                    localStorage.maxSize = maxSize;
                    e('#chat .content img').css({
                        'max-width': maxSize + 'px',
                        'max-height': maxSize + 'px'
                    });
                    alertify.log('maxSize set to ' + maxSize + 'px', 'success', 5000);
                    break;
                case 'maxtext':
                    maxText = value;
                    localStorage.maxText = maxText;
                    alertify.log('maxText set to ' + maxText + ' characters', 'success', 5000);
                    break;
                case 'maxcapswords':
                    maxCapsWords = value;
                    localStorage.maxCapsWords = maxCapsWords;
                    alertify.log('maxCapsWords set to ' + maxCapsWords, 'success', 5000);
                    break;
                }
                reloadParams();
            };

            var parseCommand = function () {
                var input = e('input#message').prop('value');
                if (/^\s*\/\w+/i.test(input)) {
                    var command, param1, param2;
                    command = input.match(/^\s*\/(\w+)/i)[1];
                    if (command) {
                        command = command.toLowerCase();
                    }
                    param1 = input.match(/(\w+)/g)[1];
                    if (param1) {
                        param1 = param1.toLowerCase();
                    }
                    param2 = input.match(/(\w+)/g)[2];

                    switch (command) {
                    case 'ignore':
                        if (!param1) {
                            alertify.log('An username to ignore is needed', 'error', 5000);
                        } else {
                            if (banArray.indexOf(param1) > -1) {
                                alertify.log(param1 + ' is already ignored', '', 5000);
                            } else {
                                banArray.push(param1);
                                localStorage.banArray = JSON.stringify(banArray);
                                reloadParams();
                                alertify.log(param1 + ' added to the ignore list',
                                    'success', 5000);
                            }
                        }
                        break;
                    case 'unignore':
                        if (!param1) {
                            alertify.log('An username to unignore is needed', 'error', 5000);
                        } else {
                            if (banArray.indexOf(param1) === -1) {
                                alertify.log(param1 + ' is not ignored', '', 5000);
                            } else {
                                banArray.splice(banArray.indexOf(param1), 1);
                                localStorage.banArray = JSON.stringify(banArray);
                                reloadParams();
                                alertify.log(param1 + ' removed from the ignore list',
                                    'success', 5000);
                            }
                        }
                        break;
                    case 'listignored':
                        alertify.alert(
                            '<strong>Ignored users:</strong> <br><br>' + banArray.toString()
                            .replace(/,/g, ', ')
                        );
                        break;
                    case 'listsettings':
                        alertify.alert(
                            '<strong>Current settings:</strong> <br><br>' +
                            'maxPics = ' + maxPics + '<br>' +
                            'maxSize = ' + maxSize + '<br>' +
                            'maxText = ' + maxText + '<br>' +
                            'maxCapsWords = ' + maxCapsWords + '<br>'
                        );
                        break;
                    case 'set':
                        if (/maxPics|maxSize|maxText|maxCapsWords/i.test(param1)) {
                            if (!param2) {
                                alertify.log('A value must be provided.', 'error', 5000);
                            } else if (isNaN(param2)) {
                                alertify.log('The value must be a valid number.', 'error',
                                    5000);
                            } else {
                                setParam(param1, param2);
                            }
                        } else {
                            alertify.log(
                                'Unknow setting. Valid settings are: maxPics, maxSize, maxText, maxCapsWords',
                                'error', 5000);
                        }
                        break;
                    case 'stats':
                        alertify.alert(
                            '<strong>Stats for session:</strong> <br><br>' +
                            'Total banned users: ' + banArray.length + '<br>' +
                            'Messages blocked this session: ' + stat_TotalBlocked +
                            '<br>' +
                            'Blocked users: ' + JSON.stringify(stat_BlockedUsers) +
                            '<br>' +
                            'Blocked images: ' + JSON.stringify(stat_BlockedImages) +
                            '<br>' +
                            'Wall of text: ' + JSON.stringify(stat_BlockedText) +
                            '<br>' +
                            'Caps Lock Malfunction: ' + JSON.stringify(stat_BlockedCaps)
                        );
                        break;
                    case 'help':
                        alertify.alert(
                            '<strong>List of valid commands:</strong> <br><br>' +
                            '<strong>/ignore username</strong>&emsp;<em>Ignore username</em><br>' +
                            '<strong>/unignore username</strong>&emsp;<em>Unignore username</em><br>' +
                            '<strong>/listignored</strong>&emsp;<em>Display the list of ignored users</em><br>' +
                            '<strong>/listsettings</strong>&emsp;<em>Display automatic ignore settings</em><br>' +
                            '<strong>/set setting value</strong>&emsp;<em>Change the value of a setting.</em><br>' +
                            '&emsp;&emsp;<em>Valid setting are: maxPics, maxSize, maxText, maxCapsWords</em><br>' +
                            '<strong>/stats</strong>&emsp;<em>Display statistics about ignored users for this session.</em><br>' +
                            '<strong>/help</strong>&emsp;<em>Display this help message.</em>'
                        );
                        break;
                    default:
                        alertify.log('Unknown command: ' + command, 'error', 5000);
                    }
                    e('input#message').prop('value', '');
                } else {
                    handle_send('add', document.getElementById('text'));
                }
            }

            var init = function () {
                // get config
                if (!localStorage.banArray) {
                    localStorage.maxPics = maxPics;
                    localStorage.maxSize = maxSize;
                    localStorage.maxText = maxText;
                    localStorage.maxCapsWords = maxCapsWords;
                    localStorage.banArray = JSON.stringify(banArray);
                } else {
                    maxPics = localStorage.maxPics;
                    maxSize = localStorage.maxSize;
                    maxText = localStorage.maxText;
                    maxCapsWords = localStorage.maxCapsWords;
                    banArray = JSON.parse(localStorage.banArray);
                }

                // style
                e('<style type="text/css">' +
                    '  #chat .content img {' +
                    '    max-width:' + maxSize + 'px;' +
                    '    max-height:' + maxSize + 'px;' +
                    '    width:auto;' +
                    '    height:auto;' +
                    '    display:inline-block' +
                    '  }' +
                    '  .cppHidden {' +
                    '    display: none;' +
                    '  }' +
                    '  .alertify, .alertify-log {' +
                    '    font-size: 125%;' +
                    '  }' +
                    '  .alertify-logs {' +
                    '    position: fixed;' +
                    '    z-index: 5000;' +
                    '    top: 50px; left: 50%;' +
                    '    width: 300px;' +
                    '    margin-left: -150px;' +
                    '  }' +
                    '</style>'
                ).appendTo('head');

                // command interception
                e('form#text').attr('onsubmit', '');
                e(document).on("submit", 'form#text', parseCommand);

                //initial cleaning
                removeIdiots(e('div#chat > div.post'));

                //dynamic filtering
                var target = document.getElementById('chat');
                var observer = new MutationObserver(function (mutations) {
                    mutations.forEach(function (mutation) {
                        var newNodes = mutation.addedNodes;
                        if (newNodes !== null) {
                            removeIdiots(e(newNodes));
                            observer.takeRecords();
                        }
                    });
                });
                var config = {
                    attributes: false,
                    childList: true,
                    characterData: false,
                    subtree: true
                };
                observer.observe(target, config);
            };

            init();

        })();
    }

    var loadCss = function (array, callback) {
        var loader = function (src, handler) {
            var css = document.createElement('link');
            css.rel = 'stylesheet';
            css.href = src;
            css.onload = css.onreadystatechange = function () {
                css.onreadystatechange = css.onload = null;
                handler();
            };
            var head = document.getElementsByTagName('head')[0];
            (head || document.body).appendChild(css);
        };
        (function () {
            if (array.length !== 0) {
                loader(array.shift(), arguments.callee);
            } else {
                callback && callback();
            }
        }());
    };

    var loadScripts = function (array, callback) {
        var loader = function (src, handler) {
            var script = document.createElement('script');
            script.src = src;
            script.onload = script.onreadystatechange = function () {
                script.onreadystatechange = script.onload = null;
                handler();
            };
            var head = document.getElementsByTagName('head')[0];
            (head || document.body).appendChild(script);
        };
        (function () {
            if (array.length !== 0) {
                loader(array.shift(), arguments.callee);
            } else {
                callback && callback();
            }
        }());
    };

    loadCss([
        'https://cdnjs.domain4sales.com.com/ajax/libs/alertify.js/0.3.11/alertify.core.min.css',
        'https://cdnjs.domain4sales.com.com/ajax/libs/alertify.js/0.3.11/alertify.bootstrap.min.css'
    ], function () {
        loadScripts([
            'https://cdnjs.domain4sales.com.com/ajax/libs/jquery/2.1.0/jquery.min.js',
            'https://cdnjs.domain4sales.com.com/ajax/libs/alertify.js/0.3.11/alertify.min.js'
        ], function () {
            initcppBan();
        });
    });

}());
bnl
Normal Poster
 
Posts: 74
Joined: Wed Aug 21, 2013 3:10 am
Karma: 67

Next Page

  • Similar topics
    Replies
    Views
    Last post

Return to General Talk

Who is online

Users browsing this forum: AussiBull, Coppacobana, MC117, sgtasif and 56 guests