lib/defaults/index.js
function scrapImage(window){
   var $ = window.$;
   var url = window.url;

   var thumbs = [];
   var thumbsRejected = [];
   var title = scrapTitle(window);
   var addToThumbs = function(image,beginning){
      var src = $(image).attr('src');
      if(src && isValidExtension(src) ){
         src = utils.toURL(src,url);
         if(beginning){
            thumbs.unshift(src);
         }else{
            thumbs.push(src);
         }
      }else if(src){
         thumbsRejected.push(src);
      }
   };
   // Open Graph protocol by Facebook: <meta property="og:image" content="(*)"/>
   $('meta[property="og:image"]').each(function(){
      var content = $(this).attr('content');
      if(content) thumbs.push(utils.toURL(content));
   });

   // Schema.org: <img itemprop="image" src="(*)"/>
   $('img[itemprop="image"]').each(function(){
      addToThumbs(this);
   });

   // Oriented product informations
   if(thumbs.length < 1){
      $('img[id*="product"]').each(function(){
          addToThumbs(this);
      });

      $('img[class*="product"]').each(function(){
          addToThumbs(this);
      });
   }

   // Grab all images
   if(thumbs.length < 10){
      $('img').each(function(){
         if($(this).attr('itemprop') === 'image') return;
         var alt = $(this).attr('alt');
         // Leave this test alone
         // the selector 'img[alt="title"]' will not work if the title is like LG 42PT35342" PLASMA TV. Escaping issues.
         // Image where the title of the page is equal to the content of the alt attribute of the image tag.
         if(alt === title){
            addToThumbs(this,true);
         }else{
            addToThumbs(this);
         }
      });
   }

   if(thumbs.length === 0){
      thumbs = thumbsRejected;
   }

   return thumbs;
}
function scrapImage(window){
   var $ = window.$;
   var url = window.url;

   var thumbs = [];
   var thumbsRejected = [];
   var title = scrapTitle(window);
   var addToThumbs = function(image,beginning){
      var src = $(image).attr('src');
      if(src && isValidExtension(src) ){
         src = utils.toURL(src,url);
         if(beginning){
            thumbs.unshift(src);
         }else{
            thumbs.push(src);
         }
      }else if(src){
         thumbsRejected.push(src);
      }
   };
   // Open Graph protocol by Facebook: <meta property="og:image" content="(*)"/>
   $('meta[property="og:image"]').each(function(){
      var content = $(this).attr('content');
      if(content) thumbs.push(utils.toURL(content));
   });

   // Schema.org: <img itemprop="image" src="(*)"/>
   $('img[itemprop="image"]').each(function(){
      addToThumbs(this);
   });

   // Oriented product informations
   if(thumbs.length < 1){
      $('img[id*="product"]').each(function(){
          addToThumbs(this);
      });

      $('img[class*="product"]').each(function(){
          addToThumbs(this);
      });
   }

   // Grab all images
   if(thumbs.length < 10){
      $('img').each(function(){
         if($(this).attr('itemprop') === 'image') return;
         var alt = $(this).attr('alt');
         // Leave this test alone
         // the selector 'img[alt="title"]' will not work if the title is like LG 42PT35342" PLASMA TV. Escaping issues.
         // Image where the title of the page is equal to the content of the alt attribute of the image tag.
         if(alt === title){
            addToThumbs(this,true);
         }else{
            addToThumbs(this);
         }
      });
   }

   if(thumbs.length === 0){
      thumbs = thumbsRejected;
   }

   return thumbs;
}
function scrapImage ( window ) { var $ = window . $ ; var url = window . url ; var thumbs = [ ] ; var thumbsRejected = [ ] ; var title = scrapTitle ( window ) ; var addToThumbs = function ( image , beginning ) { var src = $ ( image ) . attr ( 'src' ) ; if ( src && isValidExtension ( src ) ) { src = utils . toURL ( src , url ) ; if ( beginning ) { thumbs . unshift ( src ) ; } else { thumbs . push ( src ) ; } } else if ( src ) { thumbsRejected . push ( src ) ; } } ; // Open Graph protocol by Facebook: <meta property="og:image" content="(*)"/> $ ( 'meta[property="og:image"]' ) . each ( function ( ) { var content = $ ( this ) . attr ( 'content' ) ; if ( content ) thumbs . push ( utils . toURL ( content ) ) ; } ) ; // Schema.org: <img itemprop="image" src="(*)"/> $ ( 'img[itemprop="image"]' ) . each ( function ( ) { addToThumbs ( this ) ; } ) ; // Oriented product informations if ( thumbs . length < 1 ) { $ ( 'img[id*="product"]' ) . each ( function ( ) { addToThumbs ( this ) ; } ) ; $ ( 'img[class*="product"]' ) . each ( function ( ) { addToThumbs ( this ) ; } ) ; } // Grab all images if ( thumbs . length < 10 ) { $ ( 'img' ) . each ( function ( ) { if ( $ ( this ) . attr ( 'itemprop' ) === 'image' ) return ; var alt = $ ( this ) . attr ( 'alt' ) ; // Leave this test alone // the selector 'img[alt="title"]' will not work if the title is like LG 42PT35342" PLASMA TV. Escaping issues. // Image where the title of the page is equal to the content of the alt attribute of the image tag. if ( alt === title ) { addToThumbs ( this , true ) ; } else { addToThumbs ( this ) ; } } ) ; } if ( thumbs . length === 0 ) { thumbs = thumbsRejected ; } return thumbs ; }
Retrieve image urls on the page

@param  {Object} window -
@return {Array}
@api public
Retrieve image urls on the page