Saturday, January 3, 2009

Flickr email checkbox ticker bookmarklet

One slightly annoying feature of Flickr is that there is no way of filtering your email. In particular I get a lot of group invites and emails telling me someone added me as a contact. Frequently there is no need for me to open these emails and to delete them means individual checkboxes have to be ticked. Here's a bookmarklet that you can drop into your bookmarks that does exactly that.

Within the javascript there is a "filter" variable that you can set to any text you want (at the moment it matches emails with the words 'Invite to' or 'You are' in the subject). Here's the javascript source:
javascript:(function(){
var anchors=document.getElementsByTagName('A'),
checkboxes=document.getElementsByTagName('INPUT'),
filter=/Invite to|You are/, i, j;
for(i=0;i<anchors.length;i++){
if(anchors[i].innerHTML.search(filter)>=0){
for(j=0;j<checkboxes.length;j++){
if(anchors[i].href.slice(-16)==checkboxes[j].name.slice(-16)){
checkboxes[j].checked=1
}
}
}
}
})()

No comments: