Skip to content

Greasmonkey goodies; embrace and extend

Wed Jun 15 2005

Thanks to Alex, I checked out a great application of Greasemonkey - the Gmail Delete Button.

Of course, I had to look at the script since it's just javascript and play with it to see if I could extend it a little bit.

As with most of my "embrace and extend" forays, it was just a simple change - I use a lot of labels in gmail, so when I'm reading via the web interface, I have some organization to the 50+ email lists I'm a member of. Every screen that has conversations listed on it has a delete button, including the search view, except for labels (until you hit the search mail button, but then the number of visible conversations goes from 50 to 20).

So, I popped open the "view frame info" context menu item from gmail and saw that the view querystring parameter for a label was tl. With that in mind:

if (document.location.search) {
	if (document.location.search.match(/search=inbox/)
		||
		document.location.search.match(/search=query/)
		||
		document.location.search.match(/view=tl/) &&
		!document.location.search.match(/search=trash/)
		||
		document.location.search.match(/view=cv/) && 
		!document.location.search.match(/search=trash/)
	) {
		setInterval('try{window._gd_place_delete_buttons();}catch(e){}', 25);
	}
}

I'm not sure if the  && !document.location... part that I added is necessary, but it doesn't hurt anything. Now I can delete posts in all of the views that I would want to in gmail.

💾 May the source be with you. v3.2.1220