Skip to content

Instantly share code, notes, and snippets.

@cecil
Created September 5, 2014 23:26
Show Gist options
  • Save cecil/640f61addf8db69f878f to your computer and use it in GitHub Desktop.
Save cecil/640f61addf8db69f878f to your computer and use it in GitHub Desktop.
ENTERPRISE LINKED IMAGES BOOKMARKLET V2
javascript:(function(){function I(u){var t=u.split('.'),e=t[t.length-1].toLowerCase();return {gif:1,jpg:1,jpeg:1,png:1,mng:1}[e]}function hE(s){return s.replace(/&/g,'&amp;').replace(/>/g,'&gt;').replace(/</g,'&lt;').replace(/"/g,'&quot;');}function U(a){var r=[];o:for(var i=0,n=a.length;i<n;i++){for(var x=0,y=r.length;x<y;x++){if(r[x][0]==a[i][0])continue o;}r[r.length]=a[i];}return r;}var q,h,i,z=open().document;var a=[];z.write('<style type="text/css">img{max-width:100%}</style>'/*+'<p>Images linked to by '+hE(location.href)+':</p><hr>'*/);for(i=0;q=document.links[i];++i){h=q.href;if(h&&I(h))a.push([hE(h),q.innerHTML]);}a=U(a);for(i=0;q=a[i];++i){z.write('<p>'/*+q[1] --dangerous innerhtml-- +' ('+q[0]+')<br>'*/+'<img src="'+q[0]+'">');}z.close();})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment