<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Discussion on Twitter Filter | Userscripts.org</title>
    <link>http://userscripts.org/scripts/show/36522</link>
    <description>Recent comments on userscript: Twitter Filter</description>
    <language>en-us</language>
    <ttl>60</ttl>
    <item>
      <title>block username?, replied by Piroghi</title>
      <description>&lt;p&gt;Using Jeff's idea I modified the filter_tweets function so that a user's tweets are filtered if the screen-name matches the blacklist except when the particular tweet matches whitelist (please don't judge my js too harshly cos I don't know any :)&lt;/p&gt;

&lt;p&gt;(You may want to change the titles of the filters a bit on the page too)&lt;/p&gt;

&lt;p&gt;  function filter_tweets(_whitelist, _blacklist) {
&lt;br /&gt;    whitelist = _whitelist || readCookie('gmscript_filter_whitelist') || '';
&lt;br /&gt;    blacklist = _blacklist || readCookie('gmscript_filter_blacklist') || '';
&lt;br /&gt;    whitelist = ('null' == whitelist) ? '' : whitelist;
&lt;br /&gt;    blacklist = ('null' == blacklist) ? '' : blacklist;
&lt;br /&gt;    whitelist_regex = ('' == whitelist) ? null : new RegExp(whitelist, 'i');
&lt;br /&gt;    blacklist_regex = ('' == blacklist) ? null : new RegExp(blacklist, 'i');&lt;/p&gt;

&lt;p&gt;    //$('.entry-content').each(function() {
&lt;br /&gt;    //  inner = this.innerHTML;
&lt;br /&gt;    //  if((null == whitelist_regex) || (null == inner.match(whitelist_regex)))
&lt;br /&gt;    //    if(inner.match(blacklist_regex))
&lt;br /&gt;    //      $(this).parents('.hentry.status').hide();
&lt;br /&gt;    //});&lt;/p&gt;

&lt;p&gt;    // Filter by tweet screen-name but still have whitelist act on entry-content
&lt;br /&gt;    $('.status-body').each(function() {
&lt;br /&gt;      screen_name = this.getElementsByClassName('screen-name')[0].innerHTML;
&lt;br /&gt;      entry_content = this.getElementsByClassName('entry-content')[0].innerHTML;
&lt;br /&gt;      if((null == whitelist_regex) || (null == entry_content.match(whitelist_regex)))
&lt;br /&gt;        if(screen_name.match(blacklist_regex))
&lt;br /&gt;          $(this).parents('.hentry.status').hide();
&lt;br /&gt;    }); 
&lt;br /&gt;  }&lt;/p&gt;</description>
      <pubDate>Tue, 08 Sep 2009 10:15:57 +0000</pubDate>
      <guid isPermaLink="false">userscripts.org:20834:167177</guid>
      <author>Piroghi</author>
      <link>http://userscripts.org/posts/167177</link>
    </item>
    <item>
      <title>block username?, replied by Jeff MacMichael</title>
      <description>&lt;p&gt;Awesome, Barry - just was I was looking for.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;@dsjkvf&lt;/b&gt; - to block a username, add this to the end of &lt;i&gt;function filter_tweets&lt;/i&gt;:
&lt;br /&gt;&lt;code&gt;	// Filter by tweet author
&lt;br /&gt;    $('.screen-name').each(function() {
&lt;br /&gt;      inner = this.innerHTML;
&lt;br /&gt;      if((null == whitelist_regex) || (null == inner.match(whitelist_regex)))
&lt;br /&gt;        if(inner.match(blacklist_regex))
&lt;br /&gt;          $(this).parents('.hentry.status').hide();
&lt;br /&gt;    });&lt;/code&gt;
&lt;br /&gt;It's the same as the content search, but on screen name. There's undoubtedly a more elegant way to do this, but I don't think it breaks the logic.&lt;/p&gt;</description>
      <pubDate>Mon, 18 May 2009 19:51:16 +0000</pubDate>
      <guid isPermaLink="false">userscripts.org:20834:123056</guid>
      <author>Jeff MacMichael</author>
      <link>http://userscripts.org/posts/123056</link>
    </item>
    <item>
      <title>block username?, replied by dsjkvf</title>
      <description>&lt;p&gt;is it possible to block a username? it seems I only succeed to filter a certain word, not a user.&lt;/p&gt;</description>
      <pubDate>Mon, 26 Jan 2009 08:53:09 +0000</pubDate>
      <guid isPermaLink="false">userscripts.org:20834:92040</guid>
      <author>dsjkvf</author>
      <link>http://userscripts.org/posts/92040</link>
    </item>
  </channel>
</rss>
