Showing posts with label bookmarklet. Show all posts
Showing posts with label bookmarklet. Show all posts

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
}
}
}
}
})()

Thursday, December 18, 2008

Bookmarklet to find cheapest service to call a mobile from a fixed line for the current time and day

Callchecker (UK) has a great service to lookup the best 0845/0870 service to call a UK mobile from your fixed line telephone. This varies by weekday, evening or weekend rate. The following bookmarklet looks up the right page based on the time on your computer.
javascript:(function(){
var t='weekday',d=new Date();
if(d.getDay()==0||d.getDay()==6){t='weekend'}else{
if(d.getHours()>17||d.getHours<8){t='evening'}};
window.location='http://callchecker.moneysavingexpert.com/\
ukcallchecker/mobile-numbers/'+t
})()

Here it is as a bookmark that you can test out or drag and drop into your browser Bookmarks.

Thursday, December 11, 2008

Bookmarklet to add recycle comment in GreenMetropolis

I'm selling a fair number of my old paperbacks on GreenMetropolis.com. When listing a book I invariably want to note that I will send in recycled packaging in the comments field. I was using iMacro to speed this up but I've finally got around to creating a simple bookmarklet to do the same thing. Here it is:

javascript:(
function(){
var cmts=document.getElementsByTagName('TEXTAREA');
for(var ic=0;ic<cmts.length;ic++){
if(cmts[ic].name=='comment'){
cmts[ic].value+='I will send with reused or recycled packaging.'
}
}
}
)()

And here it is as a link you can drag and drop into your own bookmarks or try it out by clicking on it here: Add note to TextArea



Reset text area

This would be fairly easy to customize for your own text or to adapt to a different form that you use regularly and get tired of typing in the same old text or if you are familiar with RegEx tweaking the text you already have in the text box. For example changing the text in the text box to Title Case or Shout.

Tuesday, December 9, 2008

Creating an intelligent shortcut (bookmarklet) in Firefox

On of the frequent address shortcuts I use in Firefox is to redirect "w sometext" in the address bar to lookup a term (sometext) in Wikipedia. As I frequently go to my "Watchlist" in Wikipedia I though it would be neat to default to that page if I had not specified a term. A little research and I'd worked out how to get this to work as a bookmarklet. In the address bar any text added to the shortcut is referenced as "%s".

Using this basic structure it would be pretty easy to add a more complex set of conditions to make the same shortcut do many more things, such as looking up a book and working out if the text you put in was an ISBN or a title.

Here's my example formatted so you can read it:


javascript:(
function(){
  if("%s".length==0){
     // Default
    window.location="http://en.wikipedia.org/wiki/Special:Watchlist"
  }else{
     // Wikipedia lookup
    window.location="http://en.wikipedia.org/wiki/%s"
  }
}
)()


And here it is formatted as a link you can drop into your bookmarks, don't forget to edit it so that it has "w" as a keyword/shortcut:
Wikipedia lookup