From 1e72408bcf9904ec6c8b1e030874b8fe5fcced9e Mon Sep 17 00:00:00 2001 From: nobody42 <5514211-nobody42@users.noreply.gitlab.com> Date: Mon, 13 Apr 2020 07:03:21 +0200 Subject: [PATCH] Added jQuery Lazy Load v1.9.1 --- core/files.js | 3 +++ core/mappings.js | 1 + core/resources.js | 5 +++++ modules/internal/helpers.js | 4 ++++ pages/updates/updates.html | 1 + resources/jquery.lazyload/1.9.1/jquery.lazyload.min.jsm | 2 ++ 6 files changed, 16 insertions(+) create mode 100644 resources/jquery.lazyload/1.9.1/jquery.lazyload.min.jsm diff --git a/core/files.js b/core/files.js index ef2d49a7..39bb9c0e 100644 --- a/core/files.js +++ b/core/files.js @@ -121,6 +121,9 @@ var files = { // jQuery BlockUI 'resources/jquery.blockUI/2.70/jquery.blockUI.min.jsm': true, + // jQuery Lazy Load + 'resources/jquery.lazyload/1.9.1/jquery.lazyload.min.jsm': true, + // jQuery Migrate 'resources/jquery-migrate/1.4.1/jquery-migrate.min.jsm': true, 'resources/jquery-migrate/3.1.0/jquery-migrate.min.jsm': true, diff --git a/core/mappings.js b/core/mappings.js index 32e5e1ba..e090be77 100644 --- a/core/mappings.js +++ b/core/mappings.js @@ -94,6 +94,7 @@ var mappings = { 'jquery/{version}/jquery.': resources.jQuery, 'jquery/{version}/jquery.min.': resources.jQuery, 'jquery.blockUI/{version}/jquery.blockUI.min.js': resources.jQueryBlockUI, + 'jquery.lazyload/{version}/jquery.lazyload.min.js': resources.jQueryLazyLoad, 'jquery-migrate/{version}/jquery-migrate.min.js': resources.jQueryMigrate, 'jqueryui/{version}/jquery-ui.js': resources.jQueryUI, 'jqueryui/{version}/jquery-ui.min.js': resources.jQueryUI, diff --git a/core/resources.js b/core/resources.js index 4a19f376..fce7f0c7 100644 --- a/core/resources.js +++ b/core/resources.js @@ -174,6 +174,11 @@ var resources = { 'path': 'resources/jquery.blockUI/{version}/jquery.blockUI.min.jsm', 'type': 'application/javascript' }, + // jQuery Lazy Load + 'jQueryLazyLoad': { + 'path': 'resources/jquery.lazyload/{version}/jquery.lazyload.min.jsm', + 'type': 'application/javascript' + }, // jQuery Migrate 'jQueryMigrate': { 'path': 'resources/jquery-migrate/{version}/jquery-migrate.min.jsm', diff --git a/modules/internal/helpers.js b/modules/internal/helpers.js index d18ccf85..babb5658 100644 --- a/modules/internal/helpers.js +++ b/modules/internal/helpers.js @@ -269,6 +269,8 @@ helpers.determineResourceName = function (filename) { return 'jQuery UI'; case 'jquery.blockUI.min.jsm': return 'jQuery Block UI'; + case 'jquery.lazyload.min.jsm': + return 'jQuery Lazy Load'; case 'jquery-migrate.min.jsm': return 'jQuery Migrate'; case 'jquery.validate.min.jsm': @@ -464,6 +466,8 @@ helpers.setLastVersion = function (type, version) { version = '1.11.4'; } else if (type.includes('/jquery.blockUI/2.')) { version = '2.70'; + } else if (type.includes('/jquery.lazyload/1.')) { + version = '1.9.1'; } else if (type.includes('/jquery-migrate/1.')) { version = '1.4.1'; } else if (type.includes('/jquery-migrate/3.')) { diff --git a/pages/updates/updates.html b/pages/updates/updates.html index bd199d04..2ddf97d1 100644 --- a/pages/updates/updates.html +++ b/pages/updates/updates.html @@ -36,6 +36,7 @@
  • Added: Socket.IO v2.3.0
  • Subdirectories for Angular Animate added
  • Added angular-resource.min.js of AngularJS v1.7.9
  • +
  • Added: jQuery Lazy Load v1.9.1
  • Please update your uBlock/uMatrix rules diff --git a/resources/jquery.lazyload/1.9.1/jquery.lazyload.min.jsm b/resources/jquery.lazyload/1.9.1/jquery.lazyload.min.jsm new file mode 100644 index 00000000..35fb886d --- /dev/null +++ b/resources/jquery.lazyload/1.9.1/jquery.lazyload.min.jsm @@ -0,0 +1,2 @@ +/*! Lazy Load 1.9.1 - MIT license - Copyright 2010-2013 Mika Tuupola */ +!function(a,b,c,d){var e=a(b);a.fn.lazyload=function(f){function g(){var b=0;i.each(function(){var c=a(this);if(!j.skip_invisible||c.is(":visible"))if(a.abovethetop(this,j)||a.leftofbegin(this,j));else if(a.belowthefold(this,j)||a.rightoffold(this,j)){if(++b>j.failure_limit)return!1}else c.trigger("appear"),b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!0,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||c.attr("src")===!1)&&c.is("img")&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("").bind("load",function(){var d=c.attr("data-"+j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.attr("data-"+j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},a.belowthefold=function(c,f){var g;return g=f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return g=f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document);