Google Groups spam filter

V

VK

As these bags, t-shirts and other crap sellers from China are not
calming, I wrote for myself a small Google Groups spam filter. I wrote
in about 10 min where 8 were spent for studying Google page HTML
structure, so it might be as crappy as it get :) I am more concerned
that some "shipping" offers are still sliding through so I overlooked
something important in the string search.
I am also wondering what would be the regexp pattern to sort out all
posts with pseudo-graphics in them like:
♥Paypal Payment♥cheap SMET jeans wholesale(www.wholesale789..com)
∴★paypal payment★∴ wholesale cheap the hottest Belt at www.ecyaya.com

and mixtures of Asian and Latin letters (but not Asian and Latin
words) like:
இ◥இ◤ 2009 Prada handbags get low price wholesale at WEBSITE: www.fjrjtrade.com
<paypal payment>===<free shipping>

Both Greasemonkey and IE7Pro are using the script metadata, but they
are using slightly different installation mechanics, so I placed the
script to the relevant installation sites. The code is also pasted at
the bottom of this post.

for Greasemonkey (https://addons.mozilla.org/en-US/firefox/addon/748):
http://userscripts.org/scripts/show/59377

for IE7Pro (http://www.ie7pro.com):
http://www.iescripts.org/view-scripts-676p1.htm

script:

// ==UserScript==
// @name ggNoSpam
// @namespace http://www.geocities.com/schools_ring
// @description Google Groups spam filter
// @include http://groups.google.tld/*
// ==/UserScript==

window.addEventListener('load', function(e) {

var msg = null;

var div = document.getElementsByTagName('DIV');

var i = 0;

for (i=0; i<div.length; i++) {
if (div.className == 'maincontoutboxatt') {
msg = div.
getElementsByTagName('TABLE')[0].
tBodies[0].
rows;
break;
}
}

for (var i=0; i<msg.length; i++) {
if ((msg.textContent.toLowerCase()).indexOf('wholesale') != -1) {
msg.style.display = 'none';
}
}
}, false);
 
F

Francesco S. Carta

As these bags, t-shirts and other crap sellers from China are not
calming, I wrote for myself a small Google Groups spam filter. I wrote
in about 10 min where 8 were spent for studying Google page HTML
structure, so it might be as crappy as it get :) I am more concerned
that some "shipping" offers are still sliding through so I overlooked
something important in the string search.
I am also wondering what would be the regexp pattern to sort out all
posts with pseudo-graphics in them like:
♥Paypal Payment♥cheap SMET jeans wholesale(www.wholesale789.com)
∴★paypal payment★∴ wholesale cheap the hottest Belt atwww.ecyaya.com

and mixtures of Asian and Latin letters (but not Asian and Latin
words) like:
இ◥இ◤ 2009 Prada handbags get low price wholesale at WEBSITE:www.fjrjtrade.com
<paypal payment>===<free shipping>

Both Greasemonkey and IE7Pro are using the script metadata, but they
are using slightly different installation mechanics, so I placed the
script to the relevant installation sites. The code is also pasted at
the bottom of this post.

for Greasemonkey (https://addons.mozilla.org/en-US/firefox/addon/748):http://userscripts.org/scripts/show/59377

for IE7Pro (http://www.ie7pro.com):http://www.iescripts.org/view-scripts-676p1.htm

script:

// ==UserScript==
// @name         ggNoSpam
// @namespace    http://www.geocities.com/schools_ring
// @description  Google Groups spam filter
// @include      http://groups.google.tld/*
// ==/UserScript==

window.addEventListener('load', function(e) {

 var msg = null;

 var div = document.getElementsByTagName('DIV');

 var i = 0;

 for (i=0; i<div.length; i++) {
  if (div.className == 'maincontoutboxatt') {
   msg = div.
             getElementsByTagName('TABLE')[0].
             tBodies[0].
             rows;
   break;
  }
 }

 for (var i=0; i<msg.length; i++) {
  if ((msg.textContent.toLowerCase()).indexOf('wholesale') != -1) {
   msg.style.display = 'none';
  }
 }

}, false);


Well done, very good idea.

I've tried out the GM version linked above, but it doesn't work on
domains other than .com and gives false positives too.

I've modified it, changing the include, adding a dictionary (it's
going to grow) and replacing the "hiding" with a different formatting
- that's too dangerous to completely hide them, false positives must
be spotted and fixed:
-------
// ==UserScript==
// @name ggNoSpam
// @namespace http://www.geocities.com/schools_ring
// @version 0.2.3 + mod ;-)
// @description Google Groups spam filter
// @include http://groups.google.tld/group/*/topics*
// ==/UserScript==

/*@cc_on
/*@if (@_jscript)
var IE = true;
@else @*/
var IE = false;
/*@end
@*/

var DICTIONARY = 'leather|wholesale|whoelsale|fjrjtrade|';
DICTIONARY += 'peng Selina|dotradenow.com|toptradea.com';

var FILTER = new RegExp(DICTIONARY,'i');

var CONTENT_DIV_CLASS = 'maincontoutboxatt';

var msg = null;

var tmp = '';

var i = 0;

var div = document.getElementsByTagName('DIV');

for (i=0; i<div.length; i++) {
if (div.className == CONTENT_DIV_CLASS) {
msg = div.getElementsByTagName('TABLE')[0].tBodies[0].rows;
break;
}
}

if (msg) {
for (i=0; i<msg.length; i++) {
tmp = IE? msg.innerText : msg.textContent;
if (FILTER.test(tmp)) {
msg.style.fontSize = '75%';
msg.style.background = '#999';
}
}
}
-------

I've had the same idea just today, but I'm too JS/DOM ignorant to do
it by myself, thanks a lot for posting it.

Cheers,
Francesco
 
V

VK

Francesco said:
I've tried out the GM version linked above, but it doesn't work on
domains other than .com and gives false positives too.

I've modified it, changing the include, adding a dictionary (it's
going to grow) and replacing the "hiding" with a different formatting
- that's too dangerous to completely hide them, false positives must
be spotted and fixed:
-------
// ==UserScript==
// @name            ggNoSpam
// @namespace  http://www.geocities.com/schools_ring
// @version        0.2.3 + mod ;-)
// @description  Google Groups spam filter
// @include        http://groups.google.tld/group/*/topics*
// ==/UserScript==

/*@cc_on
/*@if (@_jscript)
var IE = true;
  @else @*/
var IE = false;
/*@end
@*/

var DICTIONARY = 'leather|wholesale|whoelsale|fjrjtrade|';
   DICTIONARY += 'peng Selina|dotradenow.com|toptradea.com';

var FILTER = new RegExp(DICTIONARY,'i');

var CONTENT_DIV_CLASS = 'maincontoutboxatt';

var msg = null;

var tmp = '';

var i = 0;

var div = document.getElementsByTagName('DIV');

for (i=0; i<div.length; i++) {
 if (div.className == CONTENT_DIV_CLASS) {
  msg = div.getElementsByTagName('TABLE')[0].tBodies[0].rows;
  break;
 }

}

if (msg) {
 for (i=0; i<msg.length; i++) {
  tmp = IE? msg.innerText : msg.textContent;
  if (FILTER.test(tmp)) {
   msg.style.fontSize = '75%';
   msg.style.background = '#999';
  }
 }}


Thank you for your interest! It happened that your post just appeared
when I was uploading the new 0.2.4 version of the script, so it was
too late to update anything. Please be assured that I'll look trough
your code to include useful parts in the next update. I am also most
interested in the current way of removing spam and any comments are
welcome.

Who already installed the previous buggy version I am insistently
suggesting to update to the current beta 0.2.4

for Greasemonkey users ( https://addons.mozilla.org/en-US/firefox/addon/748
):
go to http://userscripts.org/scripts/show/59377

for IE7Pro users ( http://www.ie7pro.com ):
go to http://www.iescripts.org/view-scripts-676p1.htm

Who wants to play with the script locally and install it manually I am
reminding that in order to be recognized by the installer the scripts
have to be named as scriptname.user.js (Greasemonkey) and
scriptname.ieuser.js (IE7Pro) respectively. If named properly it is
enough to drag-drop updated version to the browser display area to
start the installation. I placed the current version in both name
versions to the Web as well:
http://JavaScript.MyPlus.org/greasespot/ggNoSpam/0.2.4/ggNoSpam.user.js
http://JavaScript.MyPlus.org/greasespot/ggNoSpam/0.2.4/ggNoSpam.ieuser.js
 
V

VK

Francesco said:
I've tried out the GM version linked above, but it doesn't work on
domains other than .com and gives false positives too.
I've modified it, changing the include, adding a dictionary (it's
going to grow) and replacing the "hiding" with a different formatting
- that's too dangerous to completely hide them, false positives must
be spotted and fixed:
-------
// ==UserScript==
// @name            ggNoSpam
// @namespace  http://www.geocities.com/schools_ring
// @version        0.2.3 + mod ;-)
// @description  Google Groups spam filter
// @include        http://groups.google.tld/group/*/topics*
// ==/UserScript==
/*@cc_on
/*@if (@_jscript)
var IE = true;
  @else @*/
var IE = false;
/*@end
@*/
var DICTIONARY = 'leather|wholesale|whoelsale|fjrjtrade|';
   DICTIONARY += 'peng Selina|dotradenow.com|toptradea.com';
var FILTER = new RegExp(DICTIONARY,'i');
var CONTENT_DIV_CLASS = 'maincontoutboxatt';
var msg = null;
var tmp = '';
var i = 0;
var div = document.getElementsByTagName('DIV');
for (i=0; i<div.length; i++) {
 if (div.className == CONTENT_DIV_CLASS) {
  msg = div.getElementsByTagName('TABLE')[0].tBodies[0].rows;
  break;
 }

if (msg) {
 for (i=0; i<msg.length; i++) {
  tmp = IE? msg.innerText : msg.textContent;
  if (FILTER.test(tmp)) {
   msg.style.fontSize = '75%';
   msg.style.background = '#999';
  }
 }}

I've had the same idea just today, but I'm too JS/DOM ignorant to do
it by myself, thanks a lot for posting it.


Thank you for your interest! It happened that your post just appeared
when I was uploading the new 0.2.4 version of the script, so it was
too late to update anything. Please be assured that I'll look trough
your code to include useful parts in the next update. I am also most
interested in the current way of removing spam and any comments are
welcome.

Who already installed the previous buggy version I am insistently
suggesting to update to the current beta 0.2.4

for Greasemonkey users (https://addons.mozilla.org/en-US/firefox/addon/748
):
 go tohttp://userscripts.org/scripts/show/59377

for IE7Pro users (http://www.ie7pro.com):
 go tohttp://www.iescripts.org/view-scripts-676p1.htm

Who wants to play with the script locally and install it manually I am
reminding that in order to be recognized by the installer the scripts
have to be named as scriptname.user.js (Greasemonkey) and
scriptname.ieuser.js (IE7Pro) respectively. If named properly it is
enough to drag-drop updated version to the browser display area to
start the installation. I placed the current version in both name
versions to the Web as well:
 http://JavaScript.MyPlus.org/greasespot/ggNoSpam/0.2.4/ggNoSpam.user.js
 http://JavaScript.MyPlus.org/greasespot/ggNoSpam/0.2.4/ggNoSpam.ieuse....


For one I can tell that our thoughts were going in parallels :) I
either was concerned about possible false positives so changed the
logic from removing to hiding with a quick check possibility.

What I am dreaming about now - besides regular improvement and filter
adjustment - is to make it not only a personal convenience but some
"good for society action".
Google Groups has spam report tool but it is click-consuming plus it
requires to open first the spam message even if it is obvious from the
header that it is a spam. One needs to open message > More options >
Report this message > This message is spam > Report Abuse so not
everyone does while anyone hates spam. So I am thinking to all to
"spam (hover to check)" a "report as spam" button to make it a one
click operation. It could be also "report all sorted out as spam" or
like button.
Any code block suggestions and variants are welcome.
 
F

Francesco S. Carta

VK said:
Francesco said:
I've tried out the GM version linked above, but it doesn't work on
domains other than .com and gives false positives too.
I've modified it, changing the include, adding a dictionary (it's
going to grow) and replacing the "hiding" with a different formatting
- that's too dangerous to completely hide them, false positives must
be spotted and fixed:
-------
// ==UserScript==
// @name            ggNoSpam
// @namespace  http://www.geocities.com/schools_ring
// @version        0.2.3 + mod ;-)
// @description  Google Groups spam filter
// @include        http://groups.google.tld/group/*/topics*
// ==/UserScript==
/*@cc_on
/*@if (@_jscript)
var IE = true;
  @else @*/
var IE = false;
/*@end
@*/
var DICTIONARY = 'leather|wholesale|whoelsale|fjrjtrade|';
   DICTIONARY += 'peng Selina|dotradenow.com|toptradea.com';
var FILTER = new RegExp(DICTIONARY,'i');
var CONTENT_DIV_CLASS = 'maincontoutboxatt';
var msg = null;
var tmp = '';
var i = 0;
var div = document.getElementsByTagName('DIV');
for (i=0; i<div.length; i++) {
 if (div.className == CONTENT_DIV_CLASS) {
  msg = div.getElementsByTagName('TABLE')[0].tBodies[0].rows;
  break;
 }
}
if (msg) {
 for (i=0; i<msg.length; i++) {
  tmp = IE? msg.innerText : msg.textContent;
  if (FILTER.test(tmp)) {
   msg.style.fontSize = '75%';
   msg.style.background = '#999';
  }
 }}

Thank you for your interest! It happened that your post just appeared
when I was uploading the new 0.2.4 version of the script, so it was
too late to update anything. Please be assured that I'll look trough
your code to include useful parts in the next update. I am also most
interested in the current way of removing spam and any comments are
welcome.
Who already installed the previous buggy version I am insistently
suggesting to update to the current beta 0.2.4
for Greasemonkey users (https://addons.mozilla.org/en-US/firefox/addon/748
):
 go tohttp://userscripts.org/scripts/show/59377
Who wants to play with the script locally and install it manually I am
reminding that in order to be recognized by the installer the scripts
have to be named as scriptname.user.js (Greasemonkey) and
scriptname.ieuser.js (IE7Pro) respectively. If named properly it is
enough to drag-drop updated version to the browser display area to
start the installation. I placed the current version in both name
versions to the Web as well:
 http://JavaScript.MyPlus.org/greasespot/ggNoSpam/0.2.4/ggNoSpam.user..js
 http://JavaScript.MyPlus.org/greasespot/ggNoSpam/0.2.4/ggNoSpam.ieuse...

For one I can tell that our thoughts were going in parallels :) I
either was concerned about possible false positives so changed the
logic from removing to hiding with a quick check possibility.


Yes, we both came to the same logical conclusions ;-)
What I am dreaming about now - besides regular improvement and filter
adjustment - is to make it not only a personal convenience but some
"good for society action".
Google Groups has spam report tool but it is click-consuming plus it
requires to open first the spam message even if it is obvious from the
header that it is a spam. One needs to open message > More options >
Report this message > This message is spam > Report Abuse so not
everyone does while anyone hates spam. So I am thinking to all to
"spam (hover to check)" a "report as spam" button to make it a one
click operation. It could be also "report all sorted out as spam" or
like button.

I suppose you aren't accustomed to view the topic list in "topic
summary" mode. You will notice that in that mode each post has a
"report as spam" link, also, you will notice that your script doesn't
work there - at least, not the version I posted above, I'm going to
check out your last version.

Anyway, it would be good to have those improvements you wrote about in
the "topic list" mode. But first of all you should check if it is
really worth it: I reported a lot of those messages as spam but I
didn't notice any of them disappearing :-(
Any code block suggestions and variants are welcome.

Uh, on my part, I'd have to understand the code as it is, first!

Wish you good continuation, I'll download and try out your new
versions as you'll release them, and I'll drop in again if I'll have
something interesting to say.

Cheers,
Francesco
 
F

Francesco S. Carta

I've just checked out version 0.2.5, nice work, I didn't spot any
false positive.

Currently, when checking them out, waiting for the tool-tip to pop-up
is too long.

It would be better to display the post title immediately when
hovering, directly in that cell - you could so that the cell spans
over all columns, and setting it at some fixed height with hidden
overflow, so that other content doesn't displace or flickers when
hovering - just a couple of things I'm bringing in from my CSS
experiences, that must be even more feasible with JS.

The script still doesn't work in "topic summary" mode, and you should
recall to replace ".com" with ".tld" in the "include" path.

I look forward for the next version.
 
F

Francesco S. Carta

I've fiddled a bit with your script, here is a screenshot of the
result:

http://fscode.altervista.org/gg_spam2.png

(the visible spam link is the one I was hovering when I took the shot)

The code is here below.

Sorry for having changed it that much, I'm just taking the chance to
practice and to learn something more about JS.

Please point out any bad thing I might have done - so far my changes
don't raise any error within the Firefox console (v. 3.5.3), but maybe
I've introduced some feature that isn't available in previous versions
of JS or in IE7Pro (I don't have it, I cannot test it), hence limiting
the "portability" - pass me the term, I come from a C++ background,
shall it matter.

(the actual regexpr isn't that important for me, the one I use here
below is enough for my needs, and the character-matching pattern I
omitted happened to give me false positives, for instance with foreign
quotation marks and with "inclined" single quotes, all of which are
perfectly reasonable in a non-spam post)

-------
// ==UserScript==
// @name ggNoSpam
// @namespace http://www.geocities.com/schools_ring
// @version 0.2.5 (FSC mod)
// @description Google Groups spam filter
// @include http://groups.google.tld/group/*/topics*
// ==/UserScript==

void((function(){

// Change the filter upon spammers' current tricks:
var spambuzz = 'paypal|discount|(hot |whole|whoel)sale|peng selina';
var spamfilter = new RegExp(spambuzz,'i');

/*@cc_on
/*@if (@_jscript)
var IE = true;
@else @*/
var IE = false;
/*@end
@*/

var cover = document.createElement('TR');
cover.appendChild(document.createElement('TD'));
cover.childNodes[0].setAttribute('colspan', '6');
cover.childNodes[0].style.fontSize = '80%';

var container = document.getElementsByClassName('maincontoutboxatt')
[0];
var table = container.getElementsByTagName('TABLE')[0].tBodies[0];
var messages = table.rows;

var spameven = false;
for (var i = 0; i < messages.length; ++i) {
var msgcontent = IE ? messages.innerText : messages
.textContent;
if (spamfilter.test(msgcontent)) {
var spamclass = spameven ? 'spameven' : 'spamodd';
spameven = !spameven;
var newmsg = cover.cloneNode(true);
newmsg.firstChild.setAttribute('class', spamclass);
newmsg.firstChild.innerHTML = messages.childNodes[3].innerHTML;
newmsg.firstChild.firstChild.innerHTML = msgcontent;
table.replaceChild(newmsg, messages);
}
}

var style = document.createElement('STYLE');
style.innerHTML = 'td.spameven { background: #DDD; } '
+ 'td.spameven * { color: #DDD; } '
+ 'td.spamodd { background: #EEE; } '
+ 'td.spamodd * { color: #EEE; } '
+ 'td.spameven:hover *, '
+ 'td.spamodd:hover * { color: #444; } '
+ 'td.spameven:before, td.spamodd:before '
+ '{ content: "(spam) "; color: #777; } ';
document.getElementsByTagName('BODY')[0].appendChild(style);

})())
-------

I look forward for any correction.

Cheers,
Francesco
 
V

VK

Francesco said:
Please point out any bad thing I might have done - so far my changes
don't raise any error within the Firefox console (v. 3.5.3), but maybe
I've introduced some feature that isn't available in previous versions
of JS or in IE7Pro (I don't have it, I cannot test it), hence limiting
the "portability" - pass me the term, I come from a C++ background,
shall it matter.

(the actual regexpr isn't that important for me, the one I use here
below is enough for my needs, and the character-matching pattern I
omitted happened to give me false positives, for instance with foreign
quotation marks and with "inclined" single quotes, all of which are
perfectly reasonable in a non-spam post)

-------
// ==UserScript==
// @name         ggNoSpam
// @namespace    http://www.geocities.com/schools_ring
// @version      0.2.5 (FSC mod)
// @description  Google Groups spam filter
// @include      http://groups.google.tld/group/*/topics*
// ==/UserScript==

void((function(){

// Change the filter upon spammers' current tricks:
var spambuzz = 'paypal|discount|(hot |whole|whoel)sale|peng selina';
var spamfilter = new RegExp(spambuzz,'i');

/*@cc_on
/*@if (@_jscript)
var IE = true;
@else @*/
var IE = false;
/*@end
@*/

var cover = document.createElement('TR');
cover.appendChild(document.createElement('TD'));
cover.childNodes[0].setAttribute('colspan', '6');
cover.childNodes[0].style.fontSize = '80%';

var container = document.getElementsByClassName('maincontoutboxatt')
[0];
var table = container.getElementsByTagName('TABLE')[0].tBodies[0];
var messages = table.rows;

var spameven = false;
for (var i = 0; i < messages.length; ++i) {
  var msgcontent = IE ? messages.innerText : messages
.textContent;
  if (spamfilter.test(msgcontent)) {
    var spamclass = spameven ? 'spameven' : 'spamodd';
    spameven = !spameven;
    var newmsg = cover.cloneNode(true);
    newmsg.firstChild.setAttribute('class', spamclass);
    newmsg.firstChild.innerHTML = messages.childNodes[3].innerHTML;
    newmsg.firstChild.firstChild.innerHTML = msgcontent;
    table.replaceChild(newmsg, messages);
  }

}

var style = document.createElement('STYLE');
style.innerHTML = 'td.spameven { background: #DDD; } '
                + 'td.spameven * { color: #DDD; } '
                + 'td.spamodd { background: #EEE; } '
                + 'td.spamodd * { color: #EEE; } '
                + 'td.spameven:hover *, '
                + 'td.spamodd:hover * { color: #444; } '
                + 'td.spameven:before, td.spamodd:before '
                + '{ content: "(spam) "; color: #777; } ';
document.getElementsByTagName('BODY')[0].appendChild(style);

})())


I am totally busy now on a project, sorry. Tomorrow I hope to mangle
an hour or two for gg. One question: are you sure you want to display
hidden content on hover? IMHO with a regular moused roaming top-down|
down-up by topics it creates a lot of "visual noise" with rows content
horizontally expanding|collapsing. Maybe it is better to leave it to
an explicit user action such as click|Enter on "show me"? It is
nothing but IMHO and a question to anyone.
 
F

Francesco S. Carta

[snip mod]
I am totally busy now on a project, sorry. Tomorrow I hope to mangle
an hour or two for gg. One question: are you sure you want to display
hidden content on hover? IMHO with a regular moused roaming top-down|
down-up by topics it creates a lot of "visual noise" with rows content
horizontally expanding|collapsing. Maybe it is better to leave it to
an explicit user action such as click|Enter on "show me"? It is
nothing but IMHO and a question to anyone.

On my part, I changed it in that way exactly because I wanted it to
display the hidden content immediately, but I understand that somebody
else could prefer otherwise.

(the most important thing I wanted to avoid, wrt my previous posts,
was content displacing on hover (assuming the hide/display was done
via JS by actually changing the TDs content); the code above does the
hide/display by changing the text color; I haven't been exactly clear
about what I wanted, sorry)

I suppose that such behaviors could be controlled by adding some kind
of sidebar to the page, with links like "show all spam", "hide all
spam", "show on click", "show on hover", "show as a tooltip" and so
on, up to you to add such features to the "official" script, if you
want to.

I'll gladly download the next versions - eventually, I'll mess with
them once more ;-)

Have fun with your projects,
cheers,
Francesco
 
J

Jorge

[snip mod]
I am totally busy now on a project, sorry. Tomorrow I hope to mangle
an hour or two for gg. One question: are you sure you want to display
hidden content on hover? IMHO with a regular moused roaming top-down|
down-up by topics it creates a lot of "visual noise" with rows content
horizontally expanding|collapsing. Maybe it is better to leave it to
an explicit user action such as click|Enter on "show me"? It is
nothing but IMHO and a question to anyone.

On my part, I changed it in that way exactly because I wanted it to
display the hidden content immediately, but I understand that somebody
else could prefer otherwise.

(the most important thing I wanted to avoid, wrt my previous posts,
was content displacing on hover (assuming the hide/display was done
via JS by actually changing the TDs content); the code above does the
hide/display by changing the text color; I haven't been exactly clear
about what I wanted, sorry)

I suppose that such behaviors could be controlled by adding some kind
of sidebar to the page, with links like "show all spam", "hide all
spam", "show on click", "show on hover", "show as a tooltip" and so
on, up to you to add such features to the "official" script, if you
want to.

I'll gladly download the next versions - eventually, I'll mess with
them once more ;-)

Have fun with your projects,
cheers,
Francesco

Slightly re-touched...

(function (f,cdc,div,msg,i) {
for (i=0; i<div.length; i++) {
if (div.className === cdc) {
msg = div.getElementsByTagName('TABLE')[0].tBodies[0].rows;
break;
}
}
if (msg) {
for (i=0; i<msg.length; i++) {
if (f.test(msg.textContent)) {
msg.style.opacity = 0.2;
}
}
}
})(/leather|wholesale|whoelsale|fjrjtrade|peng Selina|dotradenow.com|
toptradea.com/i,'maincontoutboxatt',document.getElementsByTagName
('div'))

....and minified it makes a nice bookmarklet :)

javascript:(function(f,cdc,div,msg,i){for(i=0;i<div.length;i++){if(div
.className===cdc){msg=div.getElementsByTagName('TABLE')
[0].tBodies[0].rows;break;}}if(msg){for(i=0;i<msg.length;i++){if(f.test
(msg.textContent)){msg.style.opacity=0.2;}}}})(/leather|
wholesale|whoelsale|fjrjtrade|peng Selina|dotradenow.com|toptradea.com/
i,'maincontoutboxatt',document.getElementsByTagName('div'))

(Tested in Safari & FF)
 
F

Francesco S. Carta

[snip mod]
-------
I look forward for any correction.
I am totally busy now on a project, sorry. Tomorrow I hope to mangle
an hour or two for gg. One question: are you sure you want to display
hidden content on hover? IMHO with a regular moused roaming top-down|
down-up by topics it creates a lot of "visual noise" with rows content
horizontally expanding|collapsing. Maybe it is better to leave it to
an explicit user action such as click|Enter on "show me"? It is
nothing but IMHO and a question to anyone.
On my part, I changed it in that way exactly because I wanted it to
display the hidden content immediately, but I understand that somebody
else could prefer otherwise.
(the most important thing I wanted to avoid, wrt my previous posts,
was content displacing on hover (assuming the hide/display was done
via JS by actually changing the TDs content); the code above does the
hide/display by changing the text color; I haven't been exactly clear
about what I wanted, sorry)
I suppose that such behaviors could be controlled by adding some kind
of sidebar to the page, with links like "show all spam", "hide all
spam", "show on click", "show on hover", "show as a tooltip" and so
on, up to you to add such features to the "official" script, if you
want to.
I'll gladly download the next versions - eventually, I'll mess with
them once more ;-)
Have fun with your projects,
cheers,
Francesco

Slightly re-touched...

(function (f,cdc,div,msg,i) {
 for (i=0; i<div.length; i++) {
  if (div.className === cdc) {
   msg = div.getElementsByTagName('TABLE')[0].tBodies[0].rows;
   break;
  }
 }
 if (msg) {
  for (i=0; i<msg.length; i++) {
   if (f.test(msg.textContent)) {
    msg.style.opacity = 0.2;
   }
  }
 }})(/leather|wholesale|whoelsale|fjrjtrade|peng Selina|dotradenow.com|

toptradea.com/i,'maincontoutboxatt',document.getElementsByTagName
('div'))

...and minified it makes a nice bookmarklet :)

javascript:(function(f,cdc,div,msg,i){for(i=0;i<div.length;i++){if(div
.className===cdc){msg=div.getElementsByTagName('TABLE')
[0].tBodies[0].rows;break;}}if(msg){for(i=0;i<msg.length;i++){if(f.test
(msg.textContent)){msg.style.opacity=0.2;}}}})(/leather|
wholesale|whoelsale|fjrjtrade|peng Selina|dotradenow.com|toptradea.com/
i,'maincontoutboxatt',document.getElementsByTagName('div'))

(Tested in Safari & FF)


Really nice, well done - but, ugh! that's a bit cryptic for me... I'll
study it, being able to "compress" scripts in this way should come
handy someday ;-)

Thanks a lot for posting it, it gives me something new to munch on.
 
V

VK

1) versions 0.2.6 - 0.3.9 died under terrible tortures during these
hours :) so remained as internal releases.
2) I tried to accommodate interface suggestions from Francesco
3) Extensive comments added
4) I added our standard localization block with BDO support: UN
languages (Arabic, Chinese, English, French, Russian, Spanish) + bonus
pack (German, Italian, Japanese, Dutch, Portuguese). Ones fluent in
any language from the list are welcome to correct the localization.
Extra languages are welcome.
5) IE8 is not a fully operational software (just like Vista itself) so
the version for IE is not released. The core problem is with table
manipulations, namely the luck of such in IE beyond the most primitive
operations. The version for IE with my comments until the point where
I dropped it for the luck of time can be obtained at
 http://javascript.myplus.org/greasespot/ggNoSpam/0.4.0/ggNoSpam.ieuse....
5) Spam filter is lesser aggressive now to decrease false positives.
6) INCLUDE changed from google.com to google.tld to accommodate
national domain versions

Comments and suggestions are welcome

7) last but not least: both "Topic list" and "Topic summary" views are
now supported.
 
V

VK

So I updated the script today to the version 0.5.1
http://userscripts.org/scripts/show/59377

1) Many minor interface improvements

2) In List topic view it now preserves zebra-style rows coloring

3) Hebrew interface version added

4) Now properly treats BDO tricks in spam headers so the sample header
content positions properly

5) Opera .tld bug workaroung added so now can be used on Opera.
Opera has Greasemonkey support by default, so no add-on needed.
a) in Opera installation folder create new folder; the name is not
important as long as it doesn't conflict with existing folders, here
"greasespot" name is used
b) Tools menu -> Preferences -> Advanced -> Content -> JavaScript
options… In the "User JavaScript files" field set the path to the
"greasespot" folder and hit OK
c) copy ggNoSpam.user.js to the "greasespot" folder
d) Opera's Greasemonkey implementation doesn't support .tld alias for
top-level domains, so you may need to change the default fix from
'.com' to what you need.
e) restart Opera and enjoy

6) A debugging period Easter egg added: now on alt-clicking "spam"
note it displays script name, version and applied spam filter.

7) misc

IE's version is put on hold because the current IE's table
manipulation model is not functional and a completely different
approach has to be found and implemented on time availability. Sorry
for that.

I do answer to letters sent to (e-mail address removed) yet this box is
used for years for my Usenet account so perpetually overloaded by spam
even with all filters on. So I'd rather prefer to be addressed on the
subject in this thread instead.
 
V

VK

Does your script also filter out your multiple posts about it? If so,
I will consider installing it...

Matt Kruse

Hah! Welcome back! Now the whole "beating corner" :) is set but Randy
Webb...

A single cross-posting with followup-to set to a single group is OK.
If I ever was noticed in the deadly sin of multi-posting then name
this case.
All subsequent ggNoSpam-related posts are made in the same thread.
 
J

Jorge

Does your script also filter out your multiple posts about it? If so,
I will consider installing it...

Edit the regExp:

javascript:(function(s,i,e){i=(e=document.querySelectorAll
('.maincontoutboxatt')[0].firstElementChild.tBodies
[0].rows).length;while(i--){s.test(e.textContent)&&(e
.style.opacity='0.2');}})(/leather|wholesale|whoelsale|fjrjtrade|
peng Selina|dotradenow.com|toptradea.com/i);

(FF & Safari)
 
A

Asen Bozhilov

Edit the regExp:

javascript:(function(s,i,e){i=(e=document.querySelectorAll
('.maincontoutboxatt')[0].firstElementChild.tBodies
[0].rows).length;while(i--){s.test(e.textContent)&&(e
.style.opacity='0.2');}})(/leather|wholesale|whoelsale|fjrjtrade|
peng Selina|dotradenow.com|toptradea.com/i);


I use similar approach, but instead querySelectorAll i use XPATH and
document.evaluate:

var dictionary = /leather|wholesale|whoelsale|fjrjtrade|peng Selina|
dotradenow.com|toptradea.com/i,
xpath_rows = document.evaluate(
'//div[@class="maincontoutboxatt"][1]//tr',
document,
null,
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
null
),
curr_tr;
for (var i = 2, j = 0; curr_tr = xpath_rows.snapshotItem(i++);)
{
if (dictionary.test(curr_tr.textContent))
{
curr_tr.parentNode.removeChild(curr_tr);
}
else {
curr_tr.bgColor = j++ % 2 == 0 ? '#f7f7f7' : '#ffffff';
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top