Wednesday, January 5, 2011

Google Buzz - let's mark some comments as not spam ;-) or how to unhide "hidden" comments ;-)

[this is translation from my blog post in Polish, so sorry for strange language ;-)]

I think Google Buzz is the best social network/system. FB is way too boring, Twitter with 140 characters is too cryptic for me, but Google Buzz is perfect.

But Google Buzz has some problems ;-) It can hide some comments......

After my investigation I think I found solution for this problem ;-) It will require some effort, but if you like your followers you may do some work for them ;-)

Lets start from some observation. All comments to your Buzz posts are visible in your stream when you are using API, but in web interface some comments disappear. You cannot see some comments on your profile (here is my profile ;-)).
But if you will go to your stream in GMAIL (by click on your profile in Buzz in GMAIL), what looks like this:



and will inspect comments with DOM Inspector or something similar (I was using Chrome developers tools) you will see that in DOM you have those invisible comments....

Here such post, on the first sight it looks that it has only 2 comments (sorry, it is in Polish, but we are interested only in this that here we can see only 2 comments):



But when we will inspect this with DOM inspector, we will see that one comment is hidden:



This hidden comment is differ from the rest of comments, it has additional class "zl", deleting of this class will cause that we will see this "invisible" comment:



How you can see this comment is crossed out, but visible.
But it isn't end yet.
If you will look into DOM, you will see that one of child nodes of node with this comment is:



So it has some "buttons", but those "buttons" aren't visible.
Inspecting other nodes we will find that one of those "buttons", exactly "Not Spam" is visible when we will add to this node class "xq":



When we will add this class, comment will look like this:



Now you may click Not Spam, and if you will do it, GMAIL will send request to URL
https://mail.google.com/mail/?ui=2&ik=<user_ID?>&rid=mail%3Ara.14bf.5.0&at=<some other user_ID?>&view=up&act=ra&rai=<post_ID>&raat=NOT_SPAM&_reqid=1783035&pcd=1&mb=0&rt=j

After click, this comment will change to:



And now the best part ;-) It will be visible for everyone who is able to see this buzz.

Now some code ;-)

If you have problems with Google Buzz and you want to be able to "restore" comments in way as I shown, here you will find some code.
You need to put it in address bar, or add it as bookmark and use this bookmark, when you will be on your stream view in GMAIL (my stream is visible on first image, to see your stream go to Buzz in GMAIL and click on your name :-)):
javascript:{var z=document.getElementById("canvas_frame").contentDocument.getElementsByClassName("zl"); for (var i=0; i<z.length; i++) z[i].className=z[i].className.replace("zl",""); alert("unhide "+z.length+" items."); var z2=document.getElementById("canvas_frame").contentDocument.getElementsByClassName("I0 Yc"); for (var i=0; i<z2.length; i++) z2[i].className=z2[i].className+" xq"; alert("added Not Spam to "+z.length+" items.");}

This is "delicate" or "subtle" version, which may don't work sometimes. In this case here you have more brutal way:
javascript:{var z=document.getElementById("canvas_frame").contentDocument.getElementsByClassName("zl"); for (var i=0; i<z.length; i++) z[i].className=z[i].className.replace("zl",""); alert("unhide "+z.length+" items."); var z2=document.getElementById("canvas_frame").contentDocument.getElementsByClassName("I0 Yc"); for (var i=0; i<z2.length; i++) z2[i].className=z2[i].className+" xq"; var z3=document.getElementById("canvas_frame").contentDocument.getElementsByClassName("nH Yi"); for (var i=0; i<z3.length; i++) z3[i].className=z3[i].className.replace("Yi","Yf"); alert("unhide "+z3.length+" items."); alert("added Not Spam to "+z.length+" items.");}


Because GMAIL is dynamic, you should run this code several times, till you will not see 0 in each alert message :-)

Now you may click on Not Spam and mark comments as not spam :-)

Hope it will help somebody ;-)

Similar postsbeta
Buzz Troll Remover v0.3.2
How to get negative number from size() in LinkedList in Java? ;-)
OOo2GD - surveys results
I want my Android back!!!!
Programmers love to over complicate...

No comments:

Post a Comment