-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:

steven
  • 13,147
  • 16
  • 39
  • 39
  • 4
    This is not a question, but a request for people to do the job for you. It would be better if you could break this task into several problems (fundamentals of a bookmarklet, testing current URL, adding an overlay to an existing image, etc.) that you can ask as individual, digestible questions, both for your own sake and for the content at SO. – Ates Goral Sep 17 '09 at 04:20

1 Answers1

0

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
  • 7,637
  • 9
  • 53
  • 71