Pagespeed insights insightful

making hte images suggested for compression easely identifyable

by Michael Dibbets

JavaScript

+function(){

  $('span.load-more').trigger('click');
  window.setTimeout(function() {
  var StorageObject = function(image,title) {
    this.image = image;
    this.title = title;
  }
  var ultimateStorage = sessionStorage.getItem('ultimate');
  if(typeof ultimateStorage !== 'string') {
     ultimateStorage = {};
  }
  else {
     try {
        ultimateStorage = JSON.parse(ultimateStorage);
     }
     catch(e) {
        ultimateStorage = {};
        console.log('storage erased!');
     }
  }
  var analyse = function(){
    $('.post-image-container').each(function(useless,postitem) {
       var $postitem = $(postitem);
       var identifier = $postitem.attr('id');
       var imagecontainer = $postitem.find('.post-image');
       var basicimage = imagecontainer.find('img');
       console.log(imagecontainer);
       if(basicimage.length > 0){
           
           var image = basicimage.attr('src');
       }
       else {
           var image = 'http://imgur.com/'+identifier+'.gifv';
       }
       var title = $postitem.find('.post-image-title').text();
       var source = document.location.href;
       if(typeof ultimateStorage[source] == 'undefined') {
          ultimateStorage[source] = {};
       }
       ultimateStorage[source][identifier] = new StorageObject(image,title);
    });
  }
  var runwithscroll = function() {
      height = document.body.getBoundingClientRect().bottom;
      start = 0;
      var counter = 0;
      var func = function(startx) {
          window.scrollBy(0,25);
          console.log(startx,' of ',height);
          analyse();
      }
      while(start < height) {
         window.setTimeout(function(){func(start)},counter*200);
         counter++;
         start += 25;
         
     }
  }
  runwithscroll();
  console.log(ultimateStorage);
  sessionStorage.setItem('ultimate',JSON.stringify(ultimateStorage));
  console.log('done');
  },2000);

}(jQuery)