From bbeb5b7f392be8cdd96c5af3efdf732b5d41c5db Mon Sep 17 00:00:00 2001 From: Eisbehr Date: Mon, 18 Jan 2016 08:44:56 +0100 Subject: [PATCH] 1.6.5 - change dates to 2016 - some readme cleanup --- README.md | 56 +++++++++++++++++++++++----------------------- bower.json | 2 +- jquery.lazy.js | 4 ++-- jquery.lazy.min.js | 2 +- package.json | 2 +- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index ab8f97f..f18c173 100644 --- a/README.md +++ b/README.md @@ -53,10 +53,10 @@ First of all, you will need a copy of [jQuery](http://jquery.com) to use Lazy su Lazy is available over [cdnjs](http://cdnjs.com) and [jsDelivr](http://jsdelivr.com) CDN and can directly included to every page. ```HTML - + - + ``` #### Self-Hosted @@ -140,7 +140,7 @@ To use this just define a loader function inside the Lazy initialisation and pas
``` ```JS -$(".lazy").lazy({ +$(".lazy").Lazy({ // callback beforeLoad: function(element) { console.log("start loading " + element.prop("tagName")); @@ -165,35 +165,35 @@ The following configurations is available by default: Name | Type | Default | Description --------------- | ---------- | ------------- | ----------- -chainable | *boolean* | *true* | By default Lazy is chainable and will return all elements. If set to `false` Lazy will return the created plugin instance itself for further use. -autoDestroy | *boolean* | *true* | Will automatically destroy the instance when no further elements are available to handle. -bind | *string* | *load* | If set to `load`' Lazy starts working directly after page load. If you want to use Lazy on own events set it to `event`'. -threshold | *integer* | *500* | Amount of pixels below the viewport, in which all images gets loaded before the user sees them. -visibleOnly | *boolean* | *false* | Determine if only visible elements should be load. -appendScroll | *integer* | *window* | An element to listen on for scroll events, useful when images are stored in a container. -scrollDirection | *string* | *both* | Determines the handles scroll direction. Possible values are `both`, `vertical` and `horizontal`. -imageBase | *string* | *null* | If defined this will be used as base path for all images loaded by this instance. -defaultImage | *string* | *blank image* | Base64 image string, set as default image source for every image without a predefined source attribute. -placeholder | *string* | *null* | Base64 image string, set a background on every element as loading placeholder. -delay | *integer* | *-1* | If you want to load all elements at once after page load, then you can specify a delay time in milliseconds. -combined | *boolean* | *false* | With this parameter, Lazy will combine the event driven and delayed element loading. +chainable | *boolean* | *true* | By default Lazy is chainable and will return all elements. If set to `false` Lazy will return the created plugin instance itself for further use. +autoDestroy | *boolean* | *true* | Will automatically destroy the instance when no further elements are available to handle. +bind | *string* | *load* | If set to `load`' Lazy starts working directly after page load. If you want to use Lazy on own events set it to `event`'. +threshold | *integer* | *500* | Amount of pixels below the viewport, in which all images gets loaded before the user sees them. +visibleOnly | *boolean* | *false* | Determine if only visible elements should be load. +appendScroll | *integer* | *window* | An element to listen on for scroll events, useful when images are stored in a container. +scrollDirection | *string* | *both* | Determines the handles scroll direction. Possible values are `both`, `vertical` and `horizontal`. +imageBase | *string* | *null* | If defined this will be used as base path for all images loaded by this instance. +defaultImage | *string* | *blank image* | Base64 image string, set as default image source for every image without a predefined source attribute. +placeholder | *string* | *null* | Base64 image string, set a background on every element as loading placeholder. +delay | *integer* | *-1* | If you want to load all elements at once after page load, then you can specify a delay time in milliseconds. +combined | *boolean* | *false* | With this parameter, Lazy will combine the event driven and delayed element loading. **attributes** | | | -attribute | *string* | *data-src* | Name of the image tag attribute, where the image path is stored. -retinaAttribute | *string* | *data-retina* | Name of the image tag attribute, where the path for optional retina image is stored. -loaderAttribute | *string* | *data-loader* | Name or the element attribute, where the identifier of the customer loader is sored. -removeAttribute | *boolean* | *true* | Determine if the attribute should be removed from the element after loading. -handledName | *string* | *handled* | Name of the element tag data attribute, to determine if element is already handled. +attribute | *string* | *data-src* | Name of the image tag attribute, where the image path is stored. +retinaAttribute | *string* | *data-retina* | Name of the image tag attribute, where the path for optional retina image is stored. +loaderAttribute | *string* | *data-loader* | Name or the element attribute, where the identifier of the customer loader is sored. +removeAttribute | *boolean* | *true* | Determine if the attribute should be removed from the element after loading. +handledName | *string* | *handled* | Name of the element tag data attribute, to determine if element is already handled. **effect** | | | -effect | *string* | *show* | Function name of the effect you want to use to show the loaded images, like `show` or `fadein`. -effectTime | *integer* | *0* | Time in milliseconds the effect should use to view the image. +effect | *string* | *show* | Function name of the effect you want to use to show the loaded images, like `show` or `fadein`. +effectTime | *integer* | *0* | Time in milliseconds the effect should use to view the image. **throttle** | | | -enableThrottle | *boolean* | *true* | Throttle down the loading calls on scrolling event. -throttle | *integer* | *250* | Time in milliseconds the throttle will use to limit the loading calls. +enableThrottle | *boolean* | *true* | Throttle down the loading calls on scrolling event. +throttle | *integer* | *250* | Time in milliseconds the throttle will use to limit the loading calls. **callbacks** | | | -beforeLoad | *function* | *null* | Callback function, which will be called before the element gets loaded. Has current element as parameter. -afterLoad | *function* | *null* | Callback function, which will be called after the element was loaded. Has current element as parameter. -onError | *function* | *null* | Callback function, which will be called if the element could not be loaded. Has current element as parameter. -onFinishedAll | *function* | *null* | Callback function, which will be called after all elements was loaded or returned an error. This callback has no parameter. +beforeLoad | *function* | *null* | Callback function, which will be called before the element gets loaded. Has current element as parameter. +afterLoad | *function* | *null* | Callback function, which will be called after the element was loaded. Has current element as parameter. +onError | *function* | *null* | Callback function, which will be called if the element could not be loaded. Has current element as parameter. +onFinishedAll | *function* | *null* | Callback function, which will be called after all elements was loaded or returned an error. This callback has no parameter. ## Bugs / Feature request diff --git a/bower.json b/bower.json index fcae530..a40c561 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "jquery-lazy", "description": "Lazy is a fast, feature-rich and lightweight delayed content loading plugin for jQuery. It's designed to speed up page loading times and decrease traffic to your users by only loading the content in view. You can use Lazy in all vertical and horizontal scroll ways. It supports images in 'img' tags and backgrounds, supplied with css like 'background-image', by default or any other content by custom loaders. On images Lazy can set an default image or a placeholder while loading and supports retina displays as well.", - "version": "0.6.4", + "version": "1.6.5", "main": "jquery.lazy.min.js", "license": [ "MIT", diff --git a/jquery.lazy.js b/jquery.lazy.js index 08c1be1..d04ad59 100644 --- a/jquery.lazy.js +++ b/jquery.lazy.js @@ -1,8 +1,8 @@ /*! - * jQuery Lazy - v0.6.4 + * jQuery Lazy - v1.6.5 * http://jquery.eisbehr.de/lazy/ * - * Copyright 2012 - 2015, Daniel 'Eisbehr' Kern + * Copyright 2012 - 2016, Daniel 'Eisbehr' Kern * * Dual licensed under the MIT and GPL-2.0 licenses: * http://www.opensource.org/licenses/mit-license.php diff --git a/jquery.lazy.min.js b/jquery.lazy.min.js index ac504e3..96bd1af 100644 --- a/jquery.lazy.min.js +++ b/jquery.lazy.min.js @@ -1,2 +1,2 @@ -/*! jQuery Lazy 0.6.4 - MIT & GPL-2.0 license - Copyright 2012-2015 Daniel 'Eisbehr' Kern */ +/*! jQuery Lazy 1.6.5 - MIT & GPL-2.0 license - Copyright 2012-2016 Daniel 'Eisbehr' Kern */ !function(t,e,r,n){"use strict";function a(r,n,a,o){function i(){p=e.devicePixelRatio>1,l(a),n("delay")>=0&&setTimeout(function(){u(!0)},n("delay")),(n("delay")<0||n("combined"))&&(o.e=m(n("throttle"),function(t){"resize"===t.type&&(b=v=-1),u(t.all)}),o.a=function(t){l(t),a.push.apply(a,t)},o.g=function(){return a},u(),t(n("appendScroll")).on("scroll."+r.name+" resize."+r.name,o.e))}function l(e){if(e=t(e).filter(function(){return!t(this).data(n("handledName"))&&(t(this).attr(n("attribute"))||t(this).attr(n("loaderAttribute")))}).data("plugin_"+r.name,r),n("defaultImage")||n("placeholder"))for(var a=0;ae.top&&-ae.left&&-a=0?b:b=t(e).width()}function s(){return v>=0?v:v=t(e).height()}function m(t,e){var a,o=0;return function(i,l){function u(){o=+new Date,e.call(r,i)}var c=+new Date-o;a&&clearTimeout(a),c>t||!n("enableThrottle")||l?u():a=setTimeout(u,t-c)}}function A(){--h,a.size()||h||g("onFinishedAll")}function g(t,e,a){return(t=n(t))?(t.apply(r,[].slice.call(arguments,1)),!0):!1}var h=0,b=-1,v=-1,p=!1;!function(){"event"==n("bind")?i():t(e).load(i)}()}function o(e,r){var o=this,i=t.extend({},o.configuration,r),l={};return o.config=function(t,e){return e===n?i[t]:(i[t]=e,o)},o.addItems=function(e){return l.a&&l.a("string"===t.type(e)?t(e):e),o},o.getItems=function(){return l.g?l.g():{}},o.update=function(t){return l.e&&l.e({},!t),o},o.loadAll=function(){return l.e&&l.e({all:!0},!0),o},o.destroy=function(){return t(o.config("appendScroll")).off("."+o.name,l.e),l={},n},a(o,o.config,e,l),o.config("chainable")?e:o}t.fn.Lazy=t.fn.lazy=function(t){return new o(this,t)},t.extend(o.prototype,{name:"lazy",configuration:{chainable:!0,autoDestroy:!0,bind:"load",threshold:500,visibleOnly:!1,appendScroll:e,scrollDirection:"both",imageBase:null,defaultImage:"data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",placeholder:null,delay:-1,combined:!1,attribute:"data-src",retinaAttribute:"data-retina",loaderAttribute:"data-loader",removeAttribute:!0,handledName:"handled",effect:"show",effectTime:0,enableThrottle:!0,throttle:250,beforeLoad:null,afterLoad:null,onError:null,onFinishedAll:null}})}(jQuery,window,document); \ No newline at end of file diff --git a/package.json b/package.json index d01477b..a4ea114 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jquery-lazy", "title": "jQuery Lazy - Delayed Content, Image and Background Loader", - "version": "0.6.4", + "version": "1.6.5", "description": "Lazy is a fast, feature-rich and lightweight delayed content loading plugin for jQuery. It's designed to speed up page loading times and decrease traffic to your users by only loading the content in view.", "homepage": "http://jquery.eisbehr.de/lazy/", "bugs": "http://github.com/eisbehr-/jquery.lazy/issues",