Tag Archives: jquery

Extract All Images From a Webpage

I occasionally read through discussion boards that show off various artwork, but often find myself sifting through pages of text till I finally find the images I’m looking for.  So rather than continually sift by hand, I build this tool to ease the process.

DEMO

Here’s how it works. First off, rather than download all images to my server and sort them out there, we simply generate a new “lens” on the existing page, then let the client’s browser verify the images in javascript.  Once we have the images loaded, we can remove all images smaller than 120×120 pixels (avatars and such) and display the results in a easy to view format.  Lastly, we show the original size artwork scaled down, so that we can easily “right click to save.” The other feature I threw in was the ability to navigate by pages, so if the discussion board your reading supports paging, the extractor should figure it out and let you view pages by using the right and left arrows.

Check Browser Version in jQuery

Need to check if your users are using a “supported” browser for your site? Don’t like how jQuery handles browser version numbers and chrome. Here’s a bit of javascript to make your life easier by putting version numbers in human readable format. Just update the numbers to match what you consider “supportable” for your site.

 function is_supported_browser()
 {
 var userAgent = navigator.userAgent.toLowerCase();

// Is this a version of IE?
 if($j.browser.msie)
 {
 userAgent = $j.browser.version;
 version = userAgent.substring(0,userAgent.indexOf('.'));
 if ( version >= 8 ) return true;
 }

// Is this a version of Chrome?
 $j.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
 if($j.browser.chrome)
 {
 userAgent = userAgent.substring(userAgent.indexOf('chrome/') +7);
 version = userAgent.substring(0,userAgent.indexOf('.'));
 if (version >= 13) return true;
 }

// Is this a version of Safari?
 if($j.browser.safari)
 {
 userAgent = userAgent.substring(userAgent.indexOf('version/') +8);
 version = userAgent.substring(0,userAgent.indexOf('.'));
 if (version >= 5) return true;
 }

// Is this a version of firefox?
 if($j.browser.mozilla && navigator.userAgent.toLowerCase().indexOf('firefox') != -1)
 {
 userAgent = userAgent.substring(userAgent.indexOf('firefox/') +8);
 version = userAgent.substring(0,userAgent.indexOf('.'));
 if (version >= '3.6') return true;
 }
 return false;
 }