src/grootify.js
//Handles all images on page with an interval of time
Handles all images on page with an interval of time
Handles all images on page with an interval of time
handleImages(lstImgs, time) {
        $.each($("img"), function(i, item) {
          if ($.inArray($(item).attr("src"), lstImgs) === -1) {
            var h = $(item).height();
            var w = $(item).width();
            if (h > 0 && w > 0) {
              self.handleImg(item, lstImgs);
            } else {
              $(item).load(function() {
                if ($.inArray($(item).attr("src"), lstImgs) == -1) {
                  self.handleImg(item, lstImgs);
                }
              });
            }
          }
        });
        if (time > 0) {
          setTimeout(function() {
            self.handleImages(lstImgs, time);
          }, time);
        }
      }
handleImages ( lstImgs , time ) { $ . each ( $ ( "img" ) , function ( i , item ) { if ( $ . inArray ( $ ( item ) . attr ( "src" ) , lstImgs ) === - 1 ) { var h = $ ( item ) . height ( ) ; var w = $ ( item ) . width ( ) ; if ( h > 0 && w > 0 ) { self . handleImg ( item , lstImgs ) ; } else { $ ( item ) . load ( function ( ) { if ( $ . inArray ( $ ( item ) . attr ( "src" ) , lstImgs ) == - 1 ) { self . handleImg ( item , lstImgs ) ; } } ) ; } } } ) ; if ( time > 0 ) { setTimeout ( function ( ) { self . handleImages ( lstImgs , time ) ; } , time ) ; } }
Handles all images on page with an interval of time
Handles all images on page with an interval of time
//Skip if image is already replaced //If image loaded //Replace when loaded //Prevent infinite loop //Keep replacing