Skip to content

Instantly share code, notes, and snippets.

@pix0r
Created July 15, 2012 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pix0r/3114629 to your computer and use it in GitHub Desktop.
Save pix0r/3114629 to your computer and use it in GitHub Desktop.
Open largest image on current page using jQuery $('img')

[Show Largest Image] [1] (click link or drag to your bookmarks bar)

[1]: javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.3.2",function($,L){var max_area = 0, src = ""; $('img').each(function(idx, img) { var a = $(img).height() * $(img).width(); if (a > max_area) { src = img.src; max_area = a; } } ); if (src) document.location = src;});

<a href="javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g&gt;f.fn.jquery||h(f)){c=a.createElement(&quot;script&quot;);c.type=&quot;text/javascript&quot;;c.src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/&quot;+g+&quot;/jquery.min.js&quot;;c.onload=c.onreadystatechange=function(){if(!b&amp;&amp;(!(d=this.readyState)||d==&quot;loaded&quot;||d==&quot;complete&quot;)){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,&quot;1.3.2&quot;,function($,L){var max_area = 0, src = &quot;&quot;; $('img').each(function(idx, img) { var a = $(img).height() * $(img).width(); if (a &gt; max_area) { src = img.src; max_area = a; } } ); if (src) document.location = src;});">Show Largest Image</a> (click link or drag to your bookmarks bar)
var max_area = 0, src = ""; $('img').each(function(idx, img) { var a = $(img).height() * $(img).width(); if (a > max_area) { src = img.src; max_area = a; } } ); if (src) document.location = src;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment