The Un-Official Proxomitron Forum

Full Version: [Req] Remove user posted comments
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Guest

Remove the comments that are posted in web pages these days.

For example http://www.slashfilm.com/2008/08/06/shan...-in-talks/ has some user comments that are of no interest.
Which one do you want to remove? Or do you want to remove all?

Guest

remove them all!

Now pirate bay just made any announcement http://thepiratebay.org/blog/123. As you can see the announcement is innteresting, however the comments are all just rubbish.

It would be nice to either completely removes or toggle comments from blogs/new article etc etc
Code:
[Patterns]
Name = "Remove Comments"
Active = TRUE
URL = "$TYPE(htm)"
Limit = 40
Match = "(<((d|u|o)l)\0([^>]++)\2>)\3$SET(flags=f$GET(flags))"
        "($TST(\2=*(id|class)=$AV(([a-z_-]++|)comment(s|list))*)"
        "$SET(1=<br />\r\nComments: <a href="javascript:;" onclick="document.getElementById('prx_hide_comments').style.display='block';">Show</a> | "
        "<a href="javascript:;" onclick="document.getElementById('prx_hide_comments').style.display='none';">Hide</a><br /><br />\r\n"
        "<div id="prx_hide_comments" style="display: none;">\r\n\3)$SET(match=\0)"
        "|$SET(1=\3))"
        "|</($TST(match))\9 >"
        "($TST(flags=ff(?*)\0&$SET(flags=\0))$SET(1=</\9>)"
        "|$TST(flags=f&$SET(flags=))$SET(1=</\9>\r\n</div>)$SET(match=))"
Replace = "\1"

Here you go!

In this filter I use Mizz Mona's technique on flagging tags, and how it matches comment containers is by comparing the ID or CLASS attribute value to a list of specific "comment" names. It allows you to toggle comments (Show/Hide).

If you find that it doesn't work on a specific site, view the source code, identify the name for the comments container, change the following expression in the filter:

Quote:$AV(([a-z_-]++|)comments)

To:

Quote:$AV(([a-z_-]++|)comments|containername)

Guest

Thankyou first!

I was trying to remove the comments from blogspot. The comments are "comment-body". So I added "-body" to produce

Quote:$AV(([a-z_-]++|)comment(s|list|-body))*)

However the blogspot comment is not filter.

[Image: commentsrj7.png]
Try this filter (all I did was just add div to the list of tags to be matched; now it matches dl, ul, ol and div):

Code:
[Patterns]
Name = "Remove Comments"
Active = TRUE
URL = "$TYPE(htm)"
Limit = 50
Match = "(<((d|u|o)l|div)\0([^>]++)\2>)\3$SET(flags=f$GET(flags))"
        "($TST(\2=*(id|class)=$AV(([a-z_-]++|)comment(s|list))*)"
        "$SET(1=<br />\r\nComments: <a href="javascript:;" onclick="document.getElementById('prx_hide_comments').style.display='block';">Show</a> | "
        "<a href="javascript:;" onclick="document.getElementById('prx_hide_comments').style.display='none';">Hide</a><br /><br />\r\n"
        "<div id="prx_hide_comments" style="display: none;">\r\n\3)$SET(match=\0)"
        "|$SET(1=\3))"
        "|</($TST(match))\9 >"
        "($TST(flags=ff(?*)\0&$SET(flags=\0))$SET(1=</\9>)"
        "|$TST(flags=f&$SET(flags=))$SET(1=</\9>\r\n</div>)$SET(match=))"
Replace = "\1"

I'm not sure if it'll break any page; let me know if it does!

Guest

Slashdot.org Breaks.
Reference URL's