views:

115

answers:

1

I'm trying to make bookmarklet to

IF(url ends in .jpg || .png || .jpeg) dosomething(the url)

ELSE onhover of any image, put a 50% opacity red cover over it. And onclick something(this.src)

Catch, there might be a link already around it:

A: 

Use "javscript:" to create a bookmarklet. For example, here is the bookmarklet code to bookmark a page using Google Bookmarks:

javascript:(function(){var%20a=window,b=document,c=encodeURIComponent,d=a.open("http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk="+c(b.location)+"&title="+c(b.title),"bkmk_popup","left="+((a.screenX||a.screenLeft)+10)+",top="+((a.screenY||a.screenTop)+10)+",height=420px,width=550px,resizable=1,alwaysRaised=1");a.setTimeout(function(){d.focus()},300)})();

I think "window.location.href" will give you the URL of the page. Don't know about the opacity offhand

RMorrisey