#!/bin/bash # #// Javascript Bookmarklet #// Opens all images linked from a given page on a new page. # cat $0 | sed 's@^#@@' | sed 's@//.*$@@' | sed 's@^[\t ]*$@@' | sed 's@^!/bin/bash@@' | sed 's@^cat .*@@' | sed '/^$/d' | sed 's@^[\t ]*@@' | tr '\n' ' ' && echo "" #javascript:(function(){ # #//Identify images #//Return true if an image #function I(u){ # //Split the URL in two # var t=u.split('.'); # # //The extension is stored in e # var e=t[t.length-1].toLowerCase(); # # //Return true if e is one of the following extensions # return {gif:1,jpg:1,jpeg:1,png:1,mng:1}[e] #} # #//HTML ESCAPE #//Replace special characters with HTML escape codes. #function hE(s){ # return s.replace(/&/g,'&').replace(/>/g,'>').replace(/Images linked to by '+hE(location.href)+':


'); # #//For all links on the page #for(i=0;q=document.links[i];++i){ # //Get the URL of the link # h=q.href; # # //If it's non-null and ends in the right extension # if(h&&I(h)) # //Write out the tag # z.write('

'+q.innerHTML+' ('+hE(h)+')
'); #} # #//Close the output stream #z.close(); # #})()