mirror of
https://github.com/wahyd4/cdnjs.git
synced 2026-08-09 12:56:05 +10:00
testing npm update
This commit is contained in:
@@ -18,12 +18,14 @@
|
||||
"jquery": ">=1.6"
|
||||
},
|
||||
"npmName": "jquery-maskmoney",
|
||||
"npmFileMap": [{
|
||||
"basePath": "/dist/",
|
||||
"files": [
|
||||
"jquery.maskMoney.min.js"
|
||||
]
|
||||
}],
|
||||
"npmFileMap": [
|
||||
{
|
||||
"basePath": "/dist/",
|
||||
"files": [
|
||||
"jquery.maskMoney.min.js"
|
||||
]
|
||||
}
|
||||
],
|
||||
"devDependencies": {
|
||||
"amdefine": "latest",
|
||||
"grunt": "latest",
|
||||
@@ -41,7 +43,7 @@
|
||||
"url": "https://raw.github.com/plentz/jquery-maskmoney/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"scripts": {
|
||||
"test": "grunt test --verbose"
|
||||
}
|
||||
}
|
||||
"scripts": {
|
||||
"test": "grunt test --verbose"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
/*! Lazy Load XT v0.8.3 2013-12-10
|
||||
* https://github.com/ressio/lazy-load-xt
|
||||
* (C) 2013 RESS.io
|
||||
* Licensed under MIT */
|
||||
|
||||
(function ($, window) {
|
||||
// options
|
||||
var options = {
|
||||
autoInit: true,
|
||||
selector: 'img',
|
||||
srcAttr: 'data-src',
|
||||
classNojs: 'lazy',
|
||||
blankImage: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
|
||||
edgeX: 0,
|
||||
edgeY: 0,
|
||||
throttle: 99,
|
||||
visibleOnly: true,
|
||||
loadEvent: 'pageshow', // check AJAX-loaded content in jQueryMobile
|
||||
updateEvent: 'load orientationchange resize scroll', // page-modified events
|
||||
forceEvent: '', // force loading of all elements
|
||||
oninit: null, // init handler
|
||||
onshow: null, // start loading handler
|
||||
onload: null, // load success handler
|
||||
onerror: null // error handler
|
||||
},
|
||||
$window = $(window),
|
||||
elements = [],
|
||||
viewportTop,
|
||||
viewportBottom,
|
||||
viewportLeft,
|
||||
viewportRight,
|
||||
topLazy = 0,
|
||||
/*
|
||||
waitingMode=0 : no setTimeout
|
||||
waitingMode=1 : setTimeout, no deferred events
|
||||
waitingMode=2 : setTimeout, deferred events
|
||||
*/
|
||||
waitingMode = 0;
|
||||
|
||||
$.lazyLoadXT = $.extend(options, $.lazyLoadXT);
|
||||
|
||||
/**
|
||||
* Process function/object event handler
|
||||
* @param {string} event suffix
|
||||
* @param {jQuery} $el
|
||||
*/
|
||||
function triggerEvent(event, $el) {
|
||||
$el.trigger('lazy' + event);
|
||||
var handler = options['on' + event];
|
||||
if (handler) {
|
||||
if ($.isFunction(handler)) {
|
||||
handler.call($el[0]);
|
||||
} else {
|
||||
$el
|
||||
.addClass(handler.addClass)
|
||||
.removeClass(handler.removeClass);
|
||||
}
|
||||
}
|
||||
// queue next check as images may be resized after loading of actual file
|
||||
queueCheckLazyElements();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add element to lazy-load list
|
||||
* Call: addElement(idx, el) or addElement(el)
|
||||
* @param idx
|
||||
* @param {HTMLElement} [el]
|
||||
*/
|
||||
function addElement(idx, el) {
|
||||
var $el = $(el || idx);
|
||||
|
||||
// prevent duplicates
|
||||
if ($el.data('lazied')) {
|
||||
return;
|
||||
}
|
||||
$el
|
||||
.data('lazied', 1)
|
||||
.removeClass(options.classNojs);
|
||||
|
||||
if (options.blankImage && $el[0].tagName === 'IMG' && !$el.attr('src')) {
|
||||
$el.attr('src', options.blankImage);
|
||||
}
|
||||
|
||||
triggerEvent('init', $el);
|
||||
|
||||
elements.unshift($el); // push it in the first position as we iterate elements in reverse order
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save visible viewport boundary to viewportXXX variables
|
||||
*/
|
||||
function calcViewport() {
|
||||
var scrollTop = $window.scrollTop(),
|
||||
scrollLeft = window.pageXOffset || 0,
|
||||
edgeX = options.edgeX,
|
||||
edgeY = options.edgeY;
|
||||
|
||||
viewportTop = scrollTop - edgeY;
|
||||
viewportBottom = scrollTop + (window.innerHeight || $window.height()) + edgeY;
|
||||
viewportLeft = scrollLeft - edgeX;
|
||||
viewportRight = scrollLeft + (window.innerWidth || $window.width()) + edgeX;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trigger onload handler
|
||||
*/
|
||||
function triggerLoad() {
|
||||
triggerEvent('load', $(this));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trigger onerror handler
|
||||
*/
|
||||
function triggerError() {
|
||||
triggerEvent('error', $(this));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load visible elements
|
||||
* @param {bool} [force] loading of all elements
|
||||
*/
|
||||
function checkLazyElements(force) {
|
||||
if (!elements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
topLazy = Infinity;
|
||||
calcViewport();
|
||||
|
||||
var i = elements.length - 1,
|
||||
srcAttr = options.srcAttr,
|
||||
isFuncSrcAttr = $.isFunction(srcAttr);
|
||||
for (; i >= 0; i--) {
|
||||
var $el = elements[i],
|
||||
el = $el[0];
|
||||
|
||||
// remove items that are not in DOM
|
||||
if (!el.parentNode) {
|
||||
elements.splice(i, 1);
|
||||
} else if (force || !options.visibleOnly || el.offsetWidth > 0 || el.offsetHeight > 0) {
|
||||
var offset = $el.offset(),
|
||||
elTop = offset.top,
|
||||
elLeft = offset.left;
|
||||
|
||||
if (force ||
|
||||
((elTop < viewportBottom) && (elTop + $el.height() > viewportTop) &&
|
||||
(elLeft < viewportRight) && (elLeft + $el.width() > viewportLeft))) {
|
||||
|
||||
triggerEvent('show', $el);
|
||||
|
||||
var src = isFuncSrcAttr ? srcAttr($el) : $el.attr(srcAttr);
|
||||
if (src) {
|
||||
$el
|
||||
.on('load', triggerLoad)
|
||||
.on('error', triggerError)
|
||||
.attr('src', src);
|
||||
}
|
||||
|
||||
elements.splice(i, 1);
|
||||
} else {
|
||||
if (elTop < topLazy) {
|
||||
topLazy = elTop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run check of lazy elements after timeout
|
||||
*/
|
||||
function timeoutLazyElements() {
|
||||
if (waitingMode > 1) {
|
||||
waitingMode = 1;
|
||||
checkLazyElements();
|
||||
setTimeout(timeoutLazyElements, options.throttle);
|
||||
} else {
|
||||
waitingMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Queue check of lazy elements because of event e
|
||||
* @param {Event} [e]
|
||||
*/
|
||||
function queueCheckLazyElements(e) {
|
||||
if (!elements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
// fast check for scroll event without new visible elements
|
||||
if (e && e.type === 'scroll') {
|
||||
calcViewport();
|
||||
if (topLazy >= viewportBottom) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!waitingMode) {
|
||||
waitingMode = 2;
|
||||
timeoutLazyElements();
|
||||
} else {
|
||||
waitingMode = 2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add batch of new elements: $(container).lazyLoadXT([optional selector])
|
||||
* or single one: $(image).lazyLoadXT()
|
||||
*/
|
||||
$.fn.lazyLoadXT = function (selector) {
|
||||
selector = selector || options.selector;
|
||||
|
||||
// stop call of queueCheckLazyElements->timeoutLazyElements by triggerEvent('init')
|
||||
waitingMode = 2;
|
||||
|
||||
this.each(function () {
|
||||
if ('src' in this) {
|
||||
addElement(this);
|
||||
} else {
|
||||
if (this === window) {
|
||||
$(selector).each(addElement);
|
||||
} else {
|
||||
$(this)
|
||||
.find(selector)
|
||||
.each(addElement);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// run check of visibility
|
||||
waitingMode = 0;
|
||||
queueCheckLazyElements();
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Initialize list of hidden elements
|
||||
*/
|
||||
function initLazyElements() {
|
||||
$window.lazyLoadXT();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loading of all elements
|
||||
*/
|
||||
function forceLoadAll() {
|
||||
checkLazyElements(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
$window
|
||||
.on(options.loadEvent, initLazyElements)
|
||||
.on(options.updateEvent, queueCheckLazyElements)
|
||||
.on(options.forceEvent, forceLoadAll);
|
||||
|
||||
if (options.autoInit) {
|
||||
initLazyElements(); // standard initialization
|
||||
}
|
||||
});
|
||||
|
||||
}(window.jQuery || window.Zepto, window));
|
||||
|
||||
|
||||
(function ($) {
|
||||
$.lazyLoadXT.selector += ',video,iframe[data-src]';
|
||||
|
||||
$(document).on('lazyshow', 'video', function () {
|
||||
var $this = $(this);
|
||||
$this
|
||||
.attr('poster', $this.attr('data-poster'))
|
||||
.removeAttr('data-poster')
|
||||
.children()
|
||||
.each(function () {
|
||||
if (/source|track/i.test(this.tagName)) {
|
||||
var $child = $(this);
|
||||
$child
|
||||
.attr('src', $child.attr('data-src'))
|
||||
.removeAttr('data-src');
|
||||
}
|
||||
});
|
||||
// reload video
|
||||
this.load();
|
||||
});
|
||||
|
||||
}(window.jQuery || window.Zepto));
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Lazy Load XT 0.8.3 | MIT License */
|
||||
!function(a,b){function c(b,c){c.trigger("lazy"+b);var d=q["on"+b];d&&(a.isFunction(d)?d.call(c[0]):c.addClass(d.addClass).removeClass(d.removeClass)),j()}function d(b,d){var e=a(d||b);e.data("lazied")||(e.data("lazied",1).removeClass(q.classNojs),q.blankImage&&"IMG"===e[0].tagName&&!e.attr("src")&&e.attr("src",q.blankImage),c("init",e),s.unshift(e))}function e(){var a=r.scrollTop(),c=b.pageXOffset||0,d=q.edgeX,e=q.edgeY;m=a-e,n=a+(b.innerHeight||r.height())+e,o=c-d,p=c+(b.innerWidth||r.width())+d}function f(){c("load",a(this))}function g(){c("error",a(this))}function h(b){if(s.length){t=1/0,e();for(var d=s.length-1,h=q.srcAttr,i=a.isFunction(h);d>=0;d--){var j=s[d],k=j[0];if(k.parentNode){if(b||!q.visibleOnly||k.offsetWidth>0||k.offsetHeight>0){var l=j.offset(),r=l.top,u=l.left;if(b||n>r&&r+j.height()>m&&p>u&&u+j.width()>o){c("show",j);var v=i?h(j):j.attr(h);v&&j.on("load",f).on("error",g).attr("src",v),s.splice(d,1)}else t>r&&(t=r)}}else s.splice(d,1)}}}function i(){u>1?(u=1,h(),setTimeout(i,q.throttle)):u=0}function j(a){s.length&&(a&&"scroll"===a.type&&(e(),t>=n)||(u?u=2:(u=2,i())))}function k(){r.lazyLoadXT()}function l(){h(!0)}var m,n,o,p,q={autoInit:!0,selector:"img",srcAttr:"data-src",classNojs:"lazy",blankImage:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",edgeX:0,edgeY:0,throttle:99,visibleOnly:!0,loadEvent:"pageshow",updateEvent:"load orientationchange resize scroll",forceEvent:"",oninit:null,onshow:null,onload:null,onerror:null},r=a(b),s=[],t=0,u=0;a.lazyLoadXT=a.extend(q,a.lazyLoadXT),a.fn.lazyLoadXT=function(c){return c=c||q.selector,u=2,this.each(function(){"src"in this?d(this):this===b?a(c).each(d):a(this).find(c).each(d)}),u=0,j(),this},a(document).ready(function(){r.on(q.loadEvent,k).on(q.updateEvent,j).on(q.forceEvent,l),q.autoInit&&k()})}(window.jQuery||window.Zepto,window),function(a){a.lazyLoadXT.selector+=",video,iframe[data-src]",a(document).on("lazyshow","video",function(){var b=a(this);b.attr("poster",b.attr("data-poster")).removeAttr("data-poster").children().each(function(){if(/source|track/i.test(this.tagName)){var b=a(this);b.attr("src",b.attr("data-src")).removeAttr("data-src")}}),this.load()})}(window.jQuery||window.Zepto);
|
||||
@@ -0,0 +1,275 @@
|
||||
/*! Lazy Load XT v0.8.3 2013-12-10
|
||||
* https://github.com/ressio/lazy-load-xt
|
||||
* (C) 2013 RESS.io
|
||||
* Licensed under MIT */
|
||||
|
||||
(function ($, window) {
|
||||
// options
|
||||
var options = {
|
||||
autoInit: true,
|
||||
selector: 'img',
|
||||
srcAttr: 'data-src',
|
||||
classNojs: 'lazy',
|
||||
blankImage: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
|
||||
edgeX: 0,
|
||||
edgeY: 0,
|
||||
throttle: 99,
|
||||
visibleOnly: true,
|
||||
loadEvent: 'pageshow', // check AJAX-loaded content in jQueryMobile
|
||||
updateEvent: 'load orientationchange resize scroll', // page-modified events
|
||||
forceEvent: '', // force loading of all elements
|
||||
oninit: null, // init handler
|
||||
onshow: null, // start loading handler
|
||||
onload: null, // load success handler
|
||||
onerror: null // error handler
|
||||
},
|
||||
$window = $(window),
|
||||
elements = [],
|
||||
viewportTop,
|
||||
viewportBottom,
|
||||
viewportLeft,
|
||||
viewportRight,
|
||||
topLazy = 0,
|
||||
/*
|
||||
waitingMode=0 : no setTimeout
|
||||
waitingMode=1 : setTimeout, no deferred events
|
||||
waitingMode=2 : setTimeout, deferred events
|
||||
*/
|
||||
waitingMode = 0;
|
||||
|
||||
$.lazyLoadXT = $.extend(options, $.lazyLoadXT);
|
||||
|
||||
/**
|
||||
* Process function/object event handler
|
||||
* @param {string} event suffix
|
||||
* @param {jQuery} $el
|
||||
*/
|
||||
function triggerEvent(event, $el) {
|
||||
$el.trigger('lazy' + event);
|
||||
var handler = options['on' + event];
|
||||
if (handler) {
|
||||
if ($.isFunction(handler)) {
|
||||
handler.call($el[0]);
|
||||
} else {
|
||||
$el
|
||||
.addClass(handler.addClass)
|
||||
.removeClass(handler.removeClass);
|
||||
}
|
||||
}
|
||||
// queue next check as images may be resized after loading of actual file
|
||||
queueCheckLazyElements();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add element to lazy-load list
|
||||
* Call: addElement(idx, el) or addElement(el)
|
||||
* @param idx
|
||||
* @param {HTMLElement} [el]
|
||||
*/
|
||||
function addElement(idx, el) {
|
||||
var $el = $(el || idx);
|
||||
|
||||
// prevent duplicates
|
||||
if ($el.data('lazied')) {
|
||||
return;
|
||||
}
|
||||
$el
|
||||
.data('lazied', 1)
|
||||
.removeClass(options.classNojs);
|
||||
|
||||
if (options.blankImage && $el[0].tagName === 'IMG' && !$el.attr('src')) {
|
||||
$el.attr('src', options.blankImage);
|
||||
}
|
||||
|
||||
triggerEvent('init', $el);
|
||||
|
||||
elements.unshift($el); // push it in the first position as we iterate elements in reverse order
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save visible viewport boundary to viewportXXX variables
|
||||
*/
|
||||
function calcViewport() {
|
||||
var scrollTop = $window.scrollTop(),
|
||||
scrollLeft = window.pageXOffset || 0,
|
||||
edgeX = options.edgeX,
|
||||
edgeY = options.edgeY;
|
||||
|
||||
viewportTop = scrollTop - edgeY;
|
||||
viewportBottom = scrollTop + (window.innerHeight || $window.height()) + edgeY;
|
||||
viewportLeft = scrollLeft - edgeX;
|
||||
viewportRight = scrollLeft + (window.innerWidth || $window.width()) + edgeX;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trigger onload handler
|
||||
*/
|
||||
function triggerLoad() {
|
||||
triggerEvent('load', $(this));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trigger onerror handler
|
||||
*/
|
||||
function triggerError() {
|
||||
triggerEvent('error', $(this));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load visible elements
|
||||
* @param {bool} [force] loading of all elements
|
||||
*/
|
||||
function checkLazyElements(force) {
|
||||
if (!elements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
topLazy = Infinity;
|
||||
calcViewport();
|
||||
|
||||
var i = elements.length - 1,
|
||||
srcAttr = options.srcAttr,
|
||||
isFuncSrcAttr = $.isFunction(srcAttr);
|
||||
for (; i >= 0; i--) {
|
||||
var $el = elements[i],
|
||||
el = $el[0];
|
||||
|
||||
// remove items that are not in DOM
|
||||
if (!el.parentNode) {
|
||||
elements.splice(i, 1);
|
||||
} else if (force || !options.visibleOnly || el.offsetWidth > 0 || el.offsetHeight > 0) {
|
||||
var offset = $el.offset(),
|
||||
elTop = offset.top,
|
||||
elLeft = offset.left;
|
||||
|
||||
if (force ||
|
||||
((elTop < viewportBottom) && (elTop + $el.height() > viewportTop) &&
|
||||
(elLeft < viewportRight) && (elLeft + $el.width() > viewportLeft))) {
|
||||
|
||||
triggerEvent('show', $el);
|
||||
|
||||
var src = isFuncSrcAttr ? srcAttr($el) : $el.attr(srcAttr);
|
||||
if (src) {
|
||||
$el
|
||||
.on('load', triggerLoad)
|
||||
.on('error', triggerError)
|
||||
.attr('src', src);
|
||||
}
|
||||
|
||||
elements.splice(i, 1);
|
||||
} else {
|
||||
if (elTop < topLazy) {
|
||||
topLazy = elTop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run check of lazy elements after timeout
|
||||
*/
|
||||
function timeoutLazyElements() {
|
||||
if (waitingMode > 1) {
|
||||
waitingMode = 1;
|
||||
checkLazyElements();
|
||||
setTimeout(timeoutLazyElements, options.throttle);
|
||||
} else {
|
||||
waitingMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Queue check of lazy elements because of event e
|
||||
* @param {Event} [e]
|
||||
*/
|
||||
function queueCheckLazyElements(e) {
|
||||
if (!elements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
// fast check for scroll event without new visible elements
|
||||
if (e && e.type === 'scroll') {
|
||||
calcViewport();
|
||||
if (topLazy >= viewportBottom) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!waitingMode) {
|
||||
waitingMode = 2;
|
||||
timeoutLazyElements();
|
||||
} else {
|
||||
waitingMode = 2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add batch of new elements: $(container).lazyLoadXT([optional selector])
|
||||
* or single one: $(image).lazyLoadXT()
|
||||
*/
|
||||
$.fn.lazyLoadXT = function (selector) {
|
||||
selector = selector || options.selector;
|
||||
|
||||
// stop call of queueCheckLazyElements->timeoutLazyElements by triggerEvent('init')
|
||||
waitingMode = 2;
|
||||
|
||||
this.each(function () {
|
||||
if ('src' in this) {
|
||||
addElement(this);
|
||||
} else {
|
||||
if (this === window) {
|
||||
$(selector).each(addElement);
|
||||
} else {
|
||||
$(this)
|
||||
.find(selector)
|
||||
.each(addElement);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// run check of visibility
|
||||
waitingMode = 0;
|
||||
queueCheckLazyElements();
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Initialize list of hidden elements
|
||||
*/
|
||||
function initLazyElements() {
|
||||
$window.lazyLoadXT();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loading of all elements
|
||||
*/
|
||||
function forceLoadAll() {
|
||||
checkLazyElements(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
$window
|
||||
.on(options.loadEvent, initLazyElements)
|
||||
.on(options.updateEvent, queueCheckLazyElements)
|
||||
.on(options.forceEvent, forceLoadAll);
|
||||
|
||||
if (options.autoInit) {
|
||||
initLazyElements(); // standard initialization
|
||||
}
|
||||
});
|
||||
|
||||
}(window.jQuery || window.Zepto, window));
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Lazy Load XT 0.8.3 | MIT License */
|
||||
!function(a,b){function c(b,c){c.trigger("lazy"+b);var d=q["on"+b];d&&(a.isFunction(d)?d.call(c[0]):c.addClass(d.addClass).removeClass(d.removeClass)),j()}function d(b,d){var e=a(d||b);e.data("lazied")||(e.data("lazied",1).removeClass(q.classNojs),q.blankImage&&"IMG"===e[0].tagName&&!e.attr("src")&&e.attr("src",q.blankImage),c("init",e),s.unshift(e))}function e(){var a=r.scrollTop(),c=b.pageXOffset||0,d=q.edgeX,e=q.edgeY;m=a-e,n=a+(b.innerHeight||r.height())+e,o=c-d,p=c+(b.innerWidth||r.width())+d}function f(){c("load",a(this))}function g(){c("error",a(this))}function h(b){if(s.length){t=1/0,e();for(var d=s.length-1,h=q.srcAttr,i=a.isFunction(h);d>=0;d--){var j=s[d],k=j[0];if(k.parentNode){if(b||!q.visibleOnly||k.offsetWidth>0||k.offsetHeight>0){var l=j.offset(),r=l.top,u=l.left;if(b||n>r&&r+j.height()>m&&p>u&&u+j.width()>o){c("show",j);var v=i?h(j):j.attr(h);v&&j.on("load",f).on("error",g).attr("src",v),s.splice(d,1)}else t>r&&(t=r)}}else s.splice(d,1)}}}function i(){u>1?(u=1,h(),setTimeout(i,q.throttle)):u=0}function j(a){s.length&&(a&&"scroll"===a.type&&(e(),t>=n)||(u?u=2:(u=2,i())))}function k(){r.lazyLoadXT()}function l(){h(!0)}var m,n,o,p,q={autoInit:!0,selector:"img",srcAttr:"data-src",classNojs:"lazy",blankImage:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",edgeX:0,edgeY:0,throttle:99,visibleOnly:!0,loadEvent:"pageshow",updateEvent:"load orientationchange resize scroll",forceEvent:"",oninit:null,onshow:null,onload:null,onerror:null},r=a(b),s=[],t=0,u=0;a.lazyLoadXT=a.extend(q,a.lazyLoadXT),a.fn.lazyLoadXT=function(c){return c=c||q.selector,u=2,this.each(function(){"src"in this?d(this):this===b?a(c).each(d):a(this).find(c).each(d)}),u=0,j(),this},a(document).ready(function(){r.on(q.loadEvent,k).on(q.updateEvent,j).on(q.forceEvent,l),q.autoInit&&k()})}(window.jQuery||window.Zepto,window);
|
||||
@@ -0,0 +1,299 @@
|
||||
/*! Lazy Load XT v0.8.4 2013-12-12
|
||||
* https://github.com/ressio/lazy-load-xt
|
||||
* (C) 2013 RESS.io
|
||||
* Licensed under MIT */
|
||||
|
||||
(function ($, window, document) {
|
||||
// options
|
||||
var options = {
|
||||
autoInit: true,
|
||||
selector: 'img',
|
||||
srcAttr: 'data-src',
|
||||
classNojs: 'lazy',
|
||||
blankImage: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
|
||||
edgeX: 0,
|
||||
edgeY: 0,
|
||||
throttle: 99,
|
||||
visibleOnly: true,
|
||||
loadEvent: 'pageshow', // check AJAX-loaded content in jQueryMobile
|
||||
updateEvent: 'load orientationchange resize scroll', // page-modified events
|
||||
forceEvent: '', // force loading of all elements
|
||||
oninit: null, // init handler
|
||||
onshow: null, // start loading handler
|
||||
onload: null, // load success handler
|
||||
onerror: null // error handler
|
||||
},
|
||||
$window = $(window),
|
||||
elements = [],
|
||||
viewportTop,
|
||||
viewportBottom,
|
||||
viewportLeft,
|
||||
viewportRight,
|
||||
topLazy = 0,
|
||||
/*
|
||||
waitingMode=0 : no setTimeout
|
||||
waitingMode=1 : setTimeout, no deferred events
|
||||
waitingMode=2 : setTimeout, deferred events
|
||||
*/
|
||||
waitingMode = 0;
|
||||
|
||||
$.lazyLoadXT = $.extend(options, $.lazyLoadXT);
|
||||
|
||||
/**
|
||||
* Process function/object event handler
|
||||
* @param {string} event suffix
|
||||
* @param {jQuery} $el
|
||||
*/
|
||||
function triggerEvent(event, $el) {
|
||||
$el.trigger('lazy' + event);
|
||||
|
||||
var handler = options['on' + event];
|
||||
if (handler) {
|
||||
if ($.isFunction(handler)) {
|
||||
handler.call($el[0]);
|
||||
} else {
|
||||
$el
|
||||
.addClass(handler.addClass)
|
||||
.removeClass(handler.removeClass);
|
||||
}
|
||||
}
|
||||
|
||||
// queue next check as images may be resized after loading of actual file
|
||||
queueCheckLazyElements();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add element to lazy-load list
|
||||
* Call: addElement(idx, el) or addElement(el)
|
||||
* @param idx
|
||||
* @param {HTMLElement} [el]
|
||||
*/
|
||||
function addElement(idx, el) {
|
||||
var $el = $(el || idx);
|
||||
|
||||
// prevent duplicates
|
||||
if ($el.data('lazied')) {
|
||||
return;
|
||||
}
|
||||
$el
|
||||
.data('lazied', 1)
|
||||
.removeClass(options.classNojs);
|
||||
|
||||
if (options.blankImage && $el[0].tagName === 'IMG' && !$el.attr('src')) {
|
||||
$el.attr('src', options.blankImage);
|
||||
}
|
||||
|
||||
triggerEvent('init', $el);
|
||||
|
||||
elements.unshift($el); // push it in the first position as we iterate elements in reverse order
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save visible viewport boundary to viewportXXX variables
|
||||
*/
|
||||
function calcViewport() {
|
||||
var scrollTop = $window.scrollTop(),
|
||||
scrollLeft = window.pageXOffset || 0,
|
||||
edgeX = options.edgeX,
|
||||
edgeY = options.edgeY;
|
||||
|
||||
viewportTop = scrollTop - edgeY;
|
||||
viewportBottom = scrollTop + (window.innerHeight || $window.height()) + edgeY;
|
||||
viewportLeft = scrollLeft - edgeX;
|
||||
viewportRight = scrollLeft + (window.innerWidth || $window.width()) + edgeX;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trigger onload handler
|
||||
*/
|
||||
function triggerLoad() {
|
||||
triggerEvent('load', $(this));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trigger onerror handler
|
||||
*/
|
||||
function triggerError() {
|
||||
triggerEvent('error', $(this));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load visible elements
|
||||
* @param {bool} [force] loading of all elements
|
||||
*/
|
||||
function checkLazyElements(force) {
|
||||
if (!elements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
topLazy = Infinity;
|
||||
calcViewport();
|
||||
|
||||
var i = elements.length - 1,
|
||||
srcAttr = options.srcAttr,
|
||||
isFuncSrcAttr = $.isFunction(srcAttr);
|
||||
for (; i >= 0; i--) {
|
||||
var $el = elements[i],
|
||||
el = $el[0];
|
||||
|
||||
// remove items that are not in DOM
|
||||
if (!$.contains(document.body, el)) {
|
||||
elements.splice(i, 1);
|
||||
} else if (force || !options.visibleOnly || el.offsetWidth > 0 || el.offsetHeight > 0) {
|
||||
var offset = $el.offset(),
|
||||
elTop = offset.top,
|
||||
elLeft = offset.left;
|
||||
|
||||
if (force ||
|
||||
((elTop < viewportBottom) && (elTop + $el.height() > viewportTop) &&
|
||||
(elLeft < viewportRight) && (elLeft + $el.width() > viewportLeft))) {
|
||||
|
||||
triggerEvent('show', $el);
|
||||
|
||||
var src = isFuncSrcAttr ? srcAttr($el) : $el.attr(srcAttr);
|
||||
if (src) {
|
||||
$el
|
||||
.on('load', triggerLoad)
|
||||
.on('error', triggerError)
|
||||
.attr('src', src);
|
||||
}
|
||||
|
||||
elements.splice(i, 1);
|
||||
} else {
|
||||
if (elTop < topLazy) {
|
||||
topLazy = elTop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run check of lazy elements after timeout
|
||||
*/
|
||||
function timeoutLazyElements() {
|
||||
if (waitingMode > 1) {
|
||||
waitingMode = 1;
|
||||
checkLazyElements();
|
||||
setTimeout(timeoutLazyElements, options.throttle);
|
||||
} else {
|
||||
waitingMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Queue check of lazy elements because of event e
|
||||
* @param {Event} [e]
|
||||
*/
|
||||
function queueCheckLazyElements(e) {
|
||||
if (!elements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
// fast check for scroll event without new visible elements
|
||||
if (e && e.type === 'scroll') {
|
||||
calcViewport();
|
||||
if (topLazy >= viewportBottom) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!waitingMode) {
|
||||
waitingMode = 2;
|
||||
setTimeout(timeoutLazyElements, 0);
|
||||
} else {
|
||||
waitingMode = 2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add batch of new elements: $(container).lazyLoadXT([optional selector])
|
||||
* or single one: $(image).lazyLoadXT()
|
||||
*/
|
||||
$.fn.lazyLoadXT = function (selector) {
|
||||
selector = selector || options.selector;
|
||||
|
||||
this.each(function () {
|
||||
if ('src' in this) {
|
||||
addElement(this);
|
||||
} else {
|
||||
if (this === window) {
|
||||
$(selector).each(addElement);
|
||||
} else {
|
||||
$(this)
|
||||
.find(selector)
|
||||
.each(addElement);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
queueCheckLazyElements();
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Initialize list of hidden elements
|
||||
*/
|
||||
function initLazyElements() {
|
||||
$window.lazyLoadXT();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loading of all elements
|
||||
*/
|
||||
function forceLoadAll() {
|
||||
checkLazyElements(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
$window
|
||||
.on(options.loadEvent, initLazyElements)
|
||||
.on(options.updateEvent, queueCheckLazyElements)
|
||||
.on(options.forceEvent, forceLoadAll);
|
||||
|
||||
if (options.autoInit) {
|
||||
initLazyElements(); // standard initialization
|
||||
}
|
||||
});
|
||||
|
||||
}(window.jQuery || window.Zepto, window, document));
|
||||
|
||||
|
||||
(function ($) {
|
||||
$.lazyLoadXT.selector += ',video,iframe[data-src]';
|
||||
$.lazyLoadXT.videoPoster = 'data-poster';
|
||||
|
||||
$(document).on('lazyshow', 'video', function () {
|
||||
var $this = $(this),
|
||||
srcPoster = $.lazyLoadXT.videoPoster,
|
||||
srcAttr = $.lazyLoadXT.srcAttr,
|
||||
isFuncSrcAttr = $.isFunction(srcAttr);
|
||||
|
||||
$this
|
||||
.attr('poster', $this.attr(srcPoster))
|
||||
.children()
|
||||
.each(function () {
|
||||
if (/source|track/i.test(this.tagName)) {
|
||||
var $child = $(this);
|
||||
$child.attr('src', isFuncSrcAttr ? srcAttr($child) : $child.attr(srcAttr));
|
||||
}
|
||||
});
|
||||
|
||||
// reload video
|
||||
this.load();
|
||||
});
|
||||
|
||||
}(window.jQuery || window.Zepto));
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Lazy Load XT 0.8.4 | MIT License */
|
||||
!function(a,b,c){function d(b,c){c.trigger("lazy"+b);var d=r["on"+b];d&&(a.isFunction(d)?d.call(c[0]):c.addClass(d.addClass).removeClass(d.removeClass)),k()}function e(b,c){var e=a(c||b);e.data("lazied")||(e.data("lazied",1).removeClass(r.classNojs),r.blankImage&&"IMG"===e[0].tagName&&!e.attr("src")&&e.attr("src",r.blankImage),d("init",e),t.unshift(e))}function f(){var a=s.scrollTop(),c=b.pageXOffset||0,d=r.edgeX,e=r.edgeY;n=a-e,o=a+(b.innerHeight||s.height())+e,p=c-d,q=c+(b.innerWidth||s.width())+d}function g(){d("load",a(this))}function h(){d("error",a(this))}function i(b){if(t.length){u=1/0,f();for(var e=t.length-1,i=r.srcAttr,j=a.isFunction(i);e>=0;e--){var k=t[e],l=k[0];if(a.contains(c.body,l)){if(b||!r.visibleOnly||l.offsetWidth>0||l.offsetHeight>0){var m=k.offset(),s=m.top,v=m.left;if(b||o>s&&s+k.height()>n&&q>v&&v+k.width()>p){d("show",k);var w=j?i(k):k.attr(i);w&&k.on("load",g).on("error",h).attr("src",w),t.splice(e,1)}else u>s&&(u=s)}}else t.splice(e,1)}}}function j(){v>1?(v=1,i(),setTimeout(j,r.throttle)):v=0}function k(a){t.length&&(a&&"scroll"===a.type&&(f(),u>=o)||(v?v=2:(v=2,setTimeout(j,0))))}function l(){s.lazyLoadXT()}function m(){i(!0)}var n,o,p,q,r={autoInit:!0,selector:"img",srcAttr:"data-src",classNojs:"lazy",blankImage:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",edgeX:0,edgeY:0,throttle:99,visibleOnly:!0,loadEvent:"pageshow",updateEvent:"load orientationchange resize scroll",forceEvent:"",oninit:null,onshow:null,onload:null,onerror:null},s=a(b),t=[],u=0,v=0;a.lazyLoadXT=a.extend(r,a.lazyLoadXT),a.fn.lazyLoadXT=function(c){return c=c||r.selector,this.each(function(){"src"in this?e(this):this===b?a(c).each(e):a(this).find(c).each(e)}),k(),this},a(c).ready(function(){s.on(r.loadEvent,l).on(r.updateEvent,k).on(r.forceEvent,m),r.autoInit&&l()})}(window.jQuery||window.Zepto,window,document),function(a){a.lazyLoadXT.selector+=",video,iframe[data-src]",a.lazyLoadXT.videoPoster="data-poster",a(document).on("lazyshow","video",function(){var b=a(this),c=a.lazyLoadXT.videoPoster,d=a.lazyLoadXT.srcAttr,e=a.isFunction(d);b.attr("poster",b.attr(c)).children().each(function(){if(/source|track/i.test(this.tagName)){var b=a(this);b.attr("src",e?d(b):b.attr(d))}}),this.load()})}(window.jQuery||window.Zepto);
|
||||
@@ -0,0 +1,272 @@
|
||||
/*! Lazy Load XT v0.8.4 2013-12-12
|
||||
* https://github.com/ressio/lazy-load-xt
|
||||
* (C) 2013 RESS.io
|
||||
* Licensed under MIT */
|
||||
|
||||
(function ($, window, document) {
|
||||
// options
|
||||
var options = {
|
||||
autoInit: true,
|
||||
selector: 'img',
|
||||
srcAttr: 'data-src',
|
||||
classNojs: 'lazy',
|
||||
blankImage: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
|
||||
edgeX: 0,
|
||||
edgeY: 0,
|
||||
throttle: 99,
|
||||
visibleOnly: true,
|
||||
loadEvent: 'pageshow', // check AJAX-loaded content in jQueryMobile
|
||||
updateEvent: 'load orientationchange resize scroll', // page-modified events
|
||||
forceEvent: '', // force loading of all elements
|
||||
oninit: null, // init handler
|
||||
onshow: null, // start loading handler
|
||||
onload: null, // load success handler
|
||||
onerror: null // error handler
|
||||
},
|
||||
$window = $(window),
|
||||
elements = [],
|
||||
viewportTop,
|
||||
viewportBottom,
|
||||
viewportLeft,
|
||||
viewportRight,
|
||||
topLazy = 0,
|
||||
/*
|
||||
waitingMode=0 : no setTimeout
|
||||
waitingMode=1 : setTimeout, no deferred events
|
||||
waitingMode=2 : setTimeout, deferred events
|
||||
*/
|
||||
waitingMode = 0;
|
||||
|
||||
$.lazyLoadXT = $.extend(options, $.lazyLoadXT);
|
||||
|
||||
/**
|
||||
* Process function/object event handler
|
||||
* @param {string} event suffix
|
||||
* @param {jQuery} $el
|
||||
*/
|
||||
function triggerEvent(event, $el) {
|
||||
$el.trigger('lazy' + event);
|
||||
|
||||
var handler = options['on' + event];
|
||||
if (handler) {
|
||||
if ($.isFunction(handler)) {
|
||||
handler.call($el[0]);
|
||||
} else {
|
||||
$el
|
||||
.addClass(handler.addClass)
|
||||
.removeClass(handler.removeClass);
|
||||
}
|
||||
}
|
||||
|
||||
// queue next check as images may be resized after loading of actual file
|
||||
queueCheckLazyElements();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add element to lazy-load list
|
||||
* Call: addElement(idx, el) or addElement(el)
|
||||
* @param idx
|
||||
* @param {HTMLElement} [el]
|
||||
*/
|
||||
function addElement(idx, el) {
|
||||
var $el = $(el || idx);
|
||||
|
||||
// prevent duplicates
|
||||
if ($el.data('lazied')) {
|
||||
return;
|
||||
}
|
||||
$el
|
||||
.data('lazied', 1)
|
||||
.removeClass(options.classNojs);
|
||||
|
||||
if (options.blankImage && $el[0].tagName === 'IMG' && !$el.attr('src')) {
|
||||
$el.attr('src', options.blankImage);
|
||||
}
|
||||
|
||||
triggerEvent('init', $el);
|
||||
|
||||
elements.unshift($el); // push it in the first position as we iterate elements in reverse order
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save visible viewport boundary to viewportXXX variables
|
||||
*/
|
||||
function calcViewport() {
|
||||
var scrollTop = $window.scrollTop(),
|
||||
scrollLeft = window.pageXOffset || 0,
|
||||
edgeX = options.edgeX,
|
||||
edgeY = options.edgeY;
|
||||
|
||||
viewportTop = scrollTop - edgeY;
|
||||
viewportBottom = scrollTop + (window.innerHeight || $window.height()) + edgeY;
|
||||
viewportLeft = scrollLeft - edgeX;
|
||||
viewportRight = scrollLeft + (window.innerWidth || $window.width()) + edgeX;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trigger onload handler
|
||||
*/
|
||||
function triggerLoad() {
|
||||
triggerEvent('load', $(this));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trigger onerror handler
|
||||
*/
|
||||
function triggerError() {
|
||||
triggerEvent('error', $(this));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load visible elements
|
||||
* @param {bool} [force] loading of all elements
|
||||
*/
|
||||
function checkLazyElements(force) {
|
||||
if (!elements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
topLazy = Infinity;
|
||||
calcViewport();
|
||||
|
||||
var i = elements.length - 1,
|
||||
srcAttr = options.srcAttr,
|
||||
isFuncSrcAttr = $.isFunction(srcAttr);
|
||||
for (; i >= 0; i--) {
|
||||
var $el = elements[i],
|
||||
el = $el[0];
|
||||
|
||||
// remove items that are not in DOM
|
||||
if (!$.contains(document.body, el)) {
|
||||
elements.splice(i, 1);
|
||||
} else if (force || !options.visibleOnly || el.offsetWidth > 0 || el.offsetHeight > 0) {
|
||||
var offset = $el.offset(),
|
||||
elTop = offset.top,
|
||||
elLeft = offset.left;
|
||||
|
||||
if (force ||
|
||||
((elTop < viewportBottom) && (elTop + $el.height() > viewportTop) &&
|
||||
(elLeft < viewportRight) && (elLeft + $el.width() > viewportLeft))) {
|
||||
|
||||
triggerEvent('show', $el);
|
||||
|
||||
var src = isFuncSrcAttr ? srcAttr($el) : $el.attr(srcAttr);
|
||||
if (src) {
|
||||
$el
|
||||
.on('load', triggerLoad)
|
||||
.on('error', triggerError)
|
||||
.attr('src', src);
|
||||
}
|
||||
|
||||
elements.splice(i, 1);
|
||||
} else {
|
||||
if (elTop < topLazy) {
|
||||
topLazy = elTop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run check of lazy elements after timeout
|
||||
*/
|
||||
function timeoutLazyElements() {
|
||||
if (waitingMode > 1) {
|
||||
waitingMode = 1;
|
||||
checkLazyElements();
|
||||
setTimeout(timeoutLazyElements, options.throttle);
|
||||
} else {
|
||||
waitingMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Queue check of lazy elements because of event e
|
||||
* @param {Event} [e]
|
||||
*/
|
||||
function queueCheckLazyElements(e) {
|
||||
if (!elements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
// fast check for scroll event without new visible elements
|
||||
if (e && e.type === 'scroll') {
|
||||
calcViewport();
|
||||
if (topLazy >= viewportBottom) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!waitingMode) {
|
||||
waitingMode = 2;
|
||||
setTimeout(timeoutLazyElements, 0);
|
||||
} else {
|
||||
waitingMode = 2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add batch of new elements: $(container).lazyLoadXT([optional selector])
|
||||
* or single one: $(image).lazyLoadXT()
|
||||
*/
|
||||
$.fn.lazyLoadXT = function (selector) {
|
||||
selector = selector || options.selector;
|
||||
|
||||
this.each(function () {
|
||||
if ('src' in this) {
|
||||
addElement(this);
|
||||
} else {
|
||||
if (this === window) {
|
||||
$(selector).each(addElement);
|
||||
} else {
|
||||
$(this)
|
||||
.find(selector)
|
||||
.each(addElement);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
queueCheckLazyElements();
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Initialize list of hidden elements
|
||||
*/
|
||||
function initLazyElements() {
|
||||
$window.lazyLoadXT();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loading of all elements
|
||||
*/
|
||||
function forceLoadAll() {
|
||||
checkLazyElements(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
$window
|
||||
.on(options.loadEvent, initLazyElements)
|
||||
.on(options.updateEvent, queueCheckLazyElements)
|
||||
.on(options.forceEvent, forceLoadAll);
|
||||
|
||||
if (options.autoInit) {
|
||||
initLazyElements(); // standard initialization
|
||||
}
|
||||
});
|
||||
|
||||
}(window.jQuery || window.Zepto, window, document));
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Lazy Load XT 0.8.4 | MIT License */
|
||||
!function(a,b,c){function d(b,c){c.trigger("lazy"+b);var d=r["on"+b];d&&(a.isFunction(d)?d.call(c[0]):c.addClass(d.addClass).removeClass(d.removeClass)),k()}function e(b,c){var e=a(c||b);e.data("lazied")||(e.data("lazied",1).removeClass(r.classNojs),r.blankImage&&"IMG"===e[0].tagName&&!e.attr("src")&&e.attr("src",r.blankImage),d("init",e),t.unshift(e))}function f(){var a=s.scrollTop(),c=b.pageXOffset||0,d=r.edgeX,e=r.edgeY;n=a-e,o=a+(b.innerHeight||s.height())+e,p=c-d,q=c+(b.innerWidth||s.width())+d}function g(){d("load",a(this))}function h(){d("error",a(this))}function i(b){if(t.length){u=1/0,f();for(var e=t.length-1,i=r.srcAttr,j=a.isFunction(i);e>=0;e--){var k=t[e],l=k[0];if(a.contains(c.body,l)){if(b||!r.visibleOnly||l.offsetWidth>0||l.offsetHeight>0){var m=k.offset(),s=m.top,v=m.left;if(b||o>s&&s+k.height()>n&&q>v&&v+k.width()>p){d("show",k);var w=j?i(k):k.attr(i);w&&k.on("load",g).on("error",h).attr("src",w),t.splice(e,1)}else u>s&&(u=s)}}else t.splice(e,1)}}}function j(){v>1?(v=1,i(),setTimeout(j,r.throttle)):v=0}function k(a){t.length&&(a&&"scroll"===a.type&&(f(),u>=o)||(v?v=2:(v=2,setTimeout(j,0))))}function l(){s.lazyLoadXT()}function m(){i(!0)}var n,o,p,q,r={autoInit:!0,selector:"img",srcAttr:"data-src",classNojs:"lazy",blankImage:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",edgeX:0,edgeY:0,throttle:99,visibleOnly:!0,loadEvent:"pageshow",updateEvent:"load orientationchange resize scroll",forceEvent:"",oninit:null,onshow:null,onload:null,onerror:null},s=a(b),t=[],u=0,v=0;a.lazyLoadXT=a.extend(r,a.lazyLoadXT),a.fn.lazyLoadXT=function(c){return c=c||r.selector,this.each(function(){"src"in this?e(this):this===b?a(c).each(e):a(this).find(c).each(e)}),k(),this},a(c).ready(function(){s.on(r.loadEvent,l).on(r.updateEvent,k).on(r.forceEvent,m),r.autoInit&&l()})}(window.jQuery||window.Zepto,window,document);
|
||||
@@ -0,0 +1,18 @@
|
||||
/*! Lazy Load XT v0.8.6 2013-12-18
|
||||
* http://ressio.github.io/lazy-load-xt
|
||||
* (C) 2013 RESS.io
|
||||
* Licensed under MIT */
|
||||
|
||||
(function ($) {
|
||||
var options = $.lazyLoadXT;
|
||||
|
||||
options.forceEvent += ' lazyloadall';
|
||||
options.autoLoad = 50;
|
||||
|
||||
$(document).ready(function () {
|
||||
setTimeout(function () {
|
||||
$(window).trigger('lazyloadall');
|
||||
}, options.autoLoad);
|
||||
});
|
||||
|
||||
})(window.jQuery || window.Zepto);
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Lazy Load XT 0.8.6 | MIT License */
|
||||
!function(a){var b=a.lazyLoadXT;b.forceEvent+=" lazyloadall",b.autoLoad=50,a(document).ready(function(){setTimeout(function(){a(window).trigger("lazyloadall")},b.autoLoad)})}(window.jQuery||window.Zepto);
|
||||
@@ -0,0 +1,19 @@
|
||||
/*! Lazy Load XT v0.8.6 2013-12-18
|
||||
* http://ressio.github.io/lazy-load-xt
|
||||
* (C) 2013 RESS.io
|
||||
* Licensed under MIT */
|
||||
|
||||
(function ($) {
|
||||
var options = $.lazyLoadXT,
|
||||
bgAttr = options.bgAttr || 'data-bg';
|
||||
|
||||
options.selector += ',[' + bgAttr + ']';
|
||||
|
||||
$(document).on('lazyshow', function (e) {
|
||||
var $this = $(e.target);
|
||||
$this
|
||||
.css('background-image', "url('" + $this.attr(bgAttr) + "')")
|
||||
.removeAttr(bgAttr);
|
||||
});
|
||||
|
||||
})(window.jQuery || window.Zepto);
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Lazy Load XT 0.8.6 | MIT License */
|
||||
!function(a){var b=a.lazyLoadXT,c=b.bgAttr||"data-bg";b.selector+=",["+c+"]",a(document).on("lazyshow",function(b){var d=a(b.target);d.css("background-image","url('"+d.attr(c)+"')").removeAttr(c)})}(window.jQuery||window.Zepto);
|
||||
@@ -0,0 +1,295 @@
|
||||
/*! Lazy Load XT v0.8.6 2013-12-18
|
||||
* http://ressio.github.io/lazy-load-xt
|
||||
* (C) 2013 RESS.io
|
||||
* Licensed under MIT */
|
||||
|
||||
(function ($, window, document) {
|
||||
// options
|
||||
var options = {
|
||||
autoInit: true,
|
||||
selector: 'img',
|
||||
classNojs: 'lazy',
|
||||
blankImage: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
|
||||
throttle: 99,
|
||||
loadEvent: 'pageshow', // check AJAX-loaded content in jQueryMobile
|
||||
updateEvent: 'load orientationchange resize scroll', // page-modified events
|
||||
forceEvent: '', // force loading of all elements
|
||||
oninit: null, // init handler
|
||||
onshow: null, // start loading handler
|
||||
onload: null, // load success handler
|
||||
onerror: null // error handler
|
||||
},
|
||||
elementOptions = {
|
||||
srcAttr: 'data-src',
|
||||
edgeX: 0,
|
||||
edgeY: 0,
|
||||
visibleOnly: true
|
||||
},
|
||||
$window = $(window),
|
||||
elements = [],
|
||||
viewportTop,
|
||||
viewportBottom,
|
||||
viewportLeft,
|
||||
viewportRight,
|
||||
topLazy = 0,
|
||||
/*
|
||||
waitingMode=0 : no setTimeout
|
||||
waitingMode=1 : setTimeout, no deferred events
|
||||
waitingMode=2 : setTimeout, deferred events
|
||||
*/
|
||||
waitingMode = 0;
|
||||
|
||||
$.lazyLoadXT = $.extend(options, elementOptions, $.lazyLoadXT);
|
||||
|
||||
/**
|
||||
* Add new elements to lazy-load list:
|
||||
* $(elements).lazyLoadXT() or $(window).lazyLoadXT()
|
||||
*/
|
||||
$.fn.lazyLoadXT = function (overrides) {
|
||||
overrides = overrides || {};
|
||||
|
||||
var blankImage = overrides.blankImage || options.blankImage,
|
||||
classNojs = overrides.classNojs || options.classNojs;
|
||||
|
||||
return this.each(function () {
|
||||
if (this === window) {
|
||||
$(options.selector).lazyLoadXT();
|
||||
} else {
|
||||
var $el = $(this),
|
||||
objData,
|
||||
prop;
|
||||
|
||||
// prevent duplicates
|
||||
if ($el.data('lazied')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$el
|
||||
.data('lazied', 1)
|
||||
.removeClass(classNojs);
|
||||
|
||||
if (blankImage && $el[0].tagName === 'IMG' && !$el.attr('src')) {
|
||||
$el.attr('src', blankImage);
|
||||
}
|
||||
|
||||
triggerEvent('init', $el);
|
||||
|
||||
objData = {o: $el};
|
||||
for (prop in elementOptions) {
|
||||
objData[prop] = overrides[prop] || options[prop];
|
||||
}
|
||||
elements.unshift(objData); // push it in the first position as we iterate elements in reverse order
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Save visible viewport boundary to viewportXXX variables
|
||||
*/
|
||||
function calcViewport() {
|
||||
viewportTop = $window.scrollTop();
|
||||
viewportBottom = viewportTop + (window.innerHeight || $window.height());
|
||||
|
||||
viewportLeft = window.pageXOffset || 0;
|
||||
viewportRight = viewportLeft + (window.innerWidth || $window.width());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process function/object event handler
|
||||
* @param {string} event suffix
|
||||
* @param {jQuery} $el
|
||||
*/
|
||||
function triggerEvent(event, $el) {
|
||||
$el.trigger('lazy' + event);
|
||||
|
||||
var handler = options['on' + event];
|
||||
if (handler) {
|
||||
if ($.isFunction(handler)) {
|
||||
handler.call($el[0]);
|
||||
} else {
|
||||
$el
|
||||
.addClass(handler.addClass)
|
||||
.removeClass(handler.removeClass);
|
||||
}
|
||||
}
|
||||
|
||||
// queue next check as images may be resized after loading of actual file
|
||||
queueCheckLazyElements();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trigger onload handler
|
||||
*/
|
||||
function triggerLoad() {
|
||||
triggerEvent('load', $(this));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trigger onerror handler
|
||||
*/
|
||||
function triggerError() {
|
||||
triggerEvent('error', $(this));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load visible elements
|
||||
* @param {bool} [force] loading of all elements
|
||||
*/
|
||||
function checkLazyElements(force) {
|
||||
if (!elements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
topLazy = Infinity;
|
||||
calcViewport();
|
||||
|
||||
for (var i = elements.length - 1; i >= 0; i--) {
|
||||
var objData = elements[i],
|
||||
$el = objData.o,
|
||||
el = $el[0];
|
||||
|
||||
// remove items that are not in DOM
|
||||
if (!$.contains(document.body, el)) {
|
||||
elements.splice(i, 1);
|
||||
} else if (force || !objData.visibleOnly || el.offsetWidth > 0 || el.offsetHeight > 0) {
|
||||
var offset = $el.offset(),
|
||||
elTop = offset.top,
|
||||
elLeft = offset.left,
|
||||
edgeX = objData.edgeX,
|
||||
edgeY = objData.edgeY,
|
||||
topEdge = elTop - edgeY;
|
||||
|
||||
if (force ||
|
||||
((topEdge < viewportBottom) && (elTop + $el.height() > viewportTop - edgeY) &&
|
||||
(elLeft < viewportRight + edgeX) && (elLeft + $el.width() > viewportLeft - edgeX))) {
|
||||
|
||||
triggerEvent('show', $el);
|
||||
|
||||
var srcAttr = objData.srcAttr,
|
||||
src = $.isFunction(srcAttr) ? srcAttr($el) : $el.attr(srcAttr);
|
||||
if (src) {
|
||||
$el
|
||||
.on('load', triggerLoad)
|
||||
.on('error', triggerError)
|
||||
.attr('src', src);
|
||||
}
|
||||
|
||||
elements.splice(i, 1);
|
||||
} else {
|
||||
if (topEdge < topLazy) {
|
||||
topLazy = topEdge;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!elements.length) {
|
||||
$(document).trigger('lazyloadall');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run check of lazy elements after timeout
|
||||
*/
|
||||
function timeoutLazyElements() {
|
||||
if (waitingMode > 1) {
|
||||
waitingMode = 1;
|
||||
checkLazyElements();
|
||||
setTimeout(timeoutLazyElements, options.throttle);
|
||||
} else {
|
||||
waitingMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Queue check of lazy elements because of event e
|
||||
* @param {Event} [e]
|
||||
*/
|
||||
function queueCheckLazyElements(e) {
|
||||
if (!elements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
// fast check for scroll event without new visible elements
|
||||
if (e && e.type === 'scroll') {
|
||||
calcViewport();
|
||||
if (topLazy >= viewportBottom) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!waitingMode) {
|
||||
setTimeout(timeoutLazyElements, 0);
|
||||
}
|
||||
|
||||
waitingMode = 2;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize list of hidden elements
|
||||
*/
|
||||
function initLazyElements() {
|
||||
$(window).lazyLoadXT();
|
||||
queueCheckLazyElements();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loading of all elements
|
||||
*/
|
||||
function forceLoadAll() {
|
||||
checkLazyElements(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
$window
|
||||
.on(options.loadEvent, initLazyElements)
|
||||
.on(options.updateEvent, queueCheckLazyElements)
|
||||
.on(options.forceEvent, forceLoadAll);
|
||||
|
||||
if (options.autoInit) {
|
||||
initLazyElements(); // standard initialization
|
||||
}
|
||||
});
|
||||
|
||||
})(window.jQuery || window.Zepto, window, document);
|
||||
|
||||
|
||||
(function ($) {
|
||||
var options = $.lazyLoadXT;
|
||||
|
||||
options.selector += ',video,iframe[data-src]';
|
||||
options.videoPoster = 'data-poster';
|
||||
|
||||
$(document).on('lazyshow', 'video', function () {
|
||||
var $this = $(this),
|
||||
srcAttr = options.srcAttr,
|
||||
isFuncSrcAttr = $.isFunction(srcAttr);
|
||||
|
||||
$this
|
||||
.attr('poster', $this.attr(options.videoPoster))
|
||||
.children()
|
||||
.each(function () {
|
||||
if (/source|track/i.test(this.tagName)) {
|
||||
var $child = $(this);
|
||||
$child.attr('src', isFuncSrcAttr ? srcAttr($child) : $child.attr(srcAttr));
|
||||
}
|
||||
});
|
||||
|
||||
// reload video
|
||||
this.load();
|
||||
});
|
||||
|
||||
})(window.jQuery || window.Zepto);
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Lazy Load XT 0.8.6 | MIT License */
|
||||
!function(a,b,c){function d(){m=s.scrollTop(),n=m+(b.innerHeight||s.height()),o=b.pageXOffset||0,p=o+(b.innerWidth||s.width())}function e(b,c){c.trigger("lazy"+b);var d=q["on"+b];d&&(a.isFunction(d)?d.call(c[0]):c.addClass(d.addClass).removeClass(d.removeClass)),j()}function f(){e("load",a(this))}function g(){e("error",a(this))}function h(b){if(t.length){u=1/0,d();for(var h=t.length-1;h>=0;h--){var i=t[h],j=i.o,k=j[0];if(a.contains(c.body,k)){if(b||!i.visibleOnly||k.offsetWidth>0||k.offsetHeight>0){var l=j.offset(),q=l.top,r=l.left,s=i.edgeX,v=i.edgeY,w=q-v;if(b||n>w&&q+j.height()>m-v&&p+s>r&&r+j.width()>o-s){e("show",j);var x=i.srcAttr,y=a.isFunction(x)?x(j):j.attr(x);y&&j.on("load",f).on("error",g).attr("src",y),t.splice(h,1)}else u>w&&(u=w)}}else t.splice(h,1)}t.length||a(c).trigger("lazyloadall")}}function i(){v>1?(v=1,h(),setTimeout(i,q.throttle)):v=0}function j(a){t.length&&(a&&"scroll"===a.type&&(d(),u>=n)||(v||setTimeout(i,0),v=2))}function k(){a(b).lazyLoadXT(),j()}function l(){h(!0)}var m,n,o,p,q={autoInit:!0,selector:"img",classNojs:"lazy",blankImage:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",throttle:99,loadEvent:"pageshow",updateEvent:"load orientationchange resize scroll",forceEvent:"",oninit:null,onshow:null,onload:null,onerror:null},r={srcAttr:"data-src",edgeX:0,edgeY:0,visibleOnly:!0},s=a(b),t=[],u=0,v=0;a.lazyLoadXT=a.extend(q,r,a.lazyLoadXT),a.fn.lazyLoadXT=function(c){c=c||{};var d=c.blankImage||q.blankImage,f=c.classNojs||q.classNojs;return this.each(function(){if(this===b)a(q.selector).lazyLoadXT();else{var g,h,i=a(this);if(i.data("lazied"))return;i.data("lazied",1).removeClass(f),d&&"IMG"===i[0].tagName&&!i.attr("src")&&i.attr("src",d),e("init",i),g={o:i};for(h in r)g[h]=c[h]||q[h];t.unshift(g)}})},a(c).ready(function(){s.on(q.loadEvent,k).on(q.updateEvent,j).on(q.forceEvent,l),q.autoInit&&k()})}(window.jQuery||window.Zepto,window,document),function(a){var b=a.lazyLoadXT;b.selector+=",video,iframe[data-src]",b.videoPoster="data-poster",a(document).on("lazyshow","video",function(){var c=a(this),d=b.srcAttr,e=a.isFunction(d);c.attr("poster",c.attr(b.videoPoster)).children().each(function(){if(/source|track/i.test(this.tagName)){var b=a(this);b.attr("src",e?d(b):b.attr(d))}}),this.load()})}(window.jQuery||window.Zepto);
|
||||
@@ -0,0 +1,267 @@
|
||||
/*! Lazy Load XT v0.8.6 2013-12-18
|
||||
* http://ressio.github.io/lazy-load-xt
|
||||
* (C) 2013 RESS.io
|
||||
* Licensed under MIT */
|
||||
|
||||
(function ($, window, document) {
|
||||
// options
|
||||
var options = {
|
||||
autoInit: true,
|
||||
selector: 'img',
|
||||
classNojs: 'lazy',
|
||||
blankImage: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
|
||||
throttle: 99,
|
||||
loadEvent: 'pageshow', // check AJAX-loaded content in jQueryMobile
|
||||
updateEvent: 'load orientationchange resize scroll', // page-modified events
|
||||
forceEvent: '', // force loading of all elements
|
||||
oninit: null, // init handler
|
||||
onshow: null, // start loading handler
|
||||
onload: null, // load success handler
|
||||
onerror: null // error handler
|
||||
},
|
||||
elementOptions = {
|
||||
srcAttr: 'data-src',
|
||||
edgeX: 0,
|
||||
edgeY: 0,
|
||||
visibleOnly: true
|
||||
},
|
||||
$window = $(window),
|
||||
elements = [],
|
||||
viewportTop,
|
||||
viewportBottom,
|
||||
viewportLeft,
|
||||
viewportRight,
|
||||
topLazy = 0,
|
||||
/*
|
||||
waitingMode=0 : no setTimeout
|
||||
waitingMode=1 : setTimeout, no deferred events
|
||||
waitingMode=2 : setTimeout, deferred events
|
||||
*/
|
||||
waitingMode = 0;
|
||||
|
||||
$.lazyLoadXT = $.extend(options, elementOptions, $.lazyLoadXT);
|
||||
|
||||
/**
|
||||
* Add new elements to lazy-load list:
|
||||
* $(elements).lazyLoadXT() or $(window).lazyLoadXT()
|
||||
*/
|
||||
$.fn.lazyLoadXT = function (overrides) {
|
||||
overrides = overrides || {};
|
||||
|
||||
var blankImage = overrides.blankImage || options.blankImage,
|
||||
classNojs = overrides.classNojs || options.classNojs;
|
||||
|
||||
return this.each(function () {
|
||||
if (this === window) {
|
||||
$(options.selector).lazyLoadXT();
|
||||
} else {
|
||||
var $el = $(this),
|
||||
objData,
|
||||
prop;
|
||||
|
||||
// prevent duplicates
|
||||
if ($el.data('lazied')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$el
|
||||
.data('lazied', 1)
|
||||
.removeClass(classNojs);
|
||||
|
||||
if (blankImage && $el[0].tagName === 'IMG' && !$el.attr('src')) {
|
||||
$el.attr('src', blankImage);
|
||||
}
|
||||
|
||||
triggerEvent('init', $el);
|
||||
|
||||
objData = {o: $el};
|
||||
for (prop in elementOptions) {
|
||||
objData[prop] = overrides[prop] || options[prop];
|
||||
}
|
||||
elements.unshift(objData); // push it in the first position as we iterate elements in reverse order
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Save visible viewport boundary to viewportXXX variables
|
||||
*/
|
||||
function calcViewport() {
|
||||
viewportTop = $window.scrollTop();
|
||||
viewportBottom = viewportTop + (window.innerHeight || $window.height());
|
||||
|
||||
viewportLeft = window.pageXOffset || 0;
|
||||
viewportRight = viewportLeft + (window.innerWidth || $window.width());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process function/object event handler
|
||||
* @param {string} event suffix
|
||||
* @param {jQuery} $el
|
||||
*/
|
||||
function triggerEvent(event, $el) {
|
||||
$el.trigger('lazy' + event);
|
||||
|
||||
var handler = options['on' + event];
|
||||
if (handler) {
|
||||
if ($.isFunction(handler)) {
|
||||
handler.call($el[0]);
|
||||
} else {
|
||||
$el
|
||||
.addClass(handler.addClass)
|
||||
.removeClass(handler.removeClass);
|
||||
}
|
||||
}
|
||||
|
||||
// queue next check as images may be resized after loading of actual file
|
||||
queueCheckLazyElements();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trigger onload handler
|
||||
*/
|
||||
function triggerLoad() {
|
||||
triggerEvent('load', $(this));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trigger onerror handler
|
||||
*/
|
||||
function triggerError() {
|
||||
triggerEvent('error', $(this));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load visible elements
|
||||
* @param {bool} [force] loading of all elements
|
||||
*/
|
||||
function checkLazyElements(force) {
|
||||
if (!elements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
topLazy = Infinity;
|
||||
calcViewport();
|
||||
|
||||
for (var i = elements.length - 1; i >= 0; i--) {
|
||||
var objData = elements[i],
|
||||
$el = objData.o,
|
||||
el = $el[0];
|
||||
|
||||
// remove items that are not in DOM
|
||||
if (!$.contains(document.body, el)) {
|
||||
elements.splice(i, 1);
|
||||
} else if (force || !objData.visibleOnly || el.offsetWidth > 0 || el.offsetHeight > 0) {
|
||||
var offset = $el.offset(),
|
||||
elTop = offset.top,
|
||||
elLeft = offset.left,
|
||||
edgeX = objData.edgeX,
|
||||
edgeY = objData.edgeY,
|
||||
topEdge = elTop - edgeY;
|
||||
|
||||
if (force ||
|
||||
((topEdge < viewportBottom) && (elTop + $el.height() > viewportTop - edgeY) &&
|
||||
(elLeft < viewportRight + edgeX) && (elLeft + $el.width() > viewportLeft - edgeX))) {
|
||||
|
||||
triggerEvent('show', $el);
|
||||
|
||||
var srcAttr = objData.srcAttr,
|
||||
src = $.isFunction(srcAttr) ? srcAttr($el) : $el.attr(srcAttr);
|
||||
if (src) {
|
||||
$el
|
||||
.on('load', triggerLoad)
|
||||
.on('error', triggerError)
|
||||
.attr('src', src);
|
||||
}
|
||||
|
||||
elements.splice(i, 1);
|
||||
} else {
|
||||
if (topEdge < topLazy) {
|
||||
topLazy = topEdge;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!elements.length) {
|
||||
$(document).trigger('lazyloadall');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run check of lazy elements after timeout
|
||||
*/
|
||||
function timeoutLazyElements() {
|
||||
if (waitingMode > 1) {
|
||||
waitingMode = 1;
|
||||
checkLazyElements();
|
||||
setTimeout(timeoutLazyElements, options.throttle);
|
||||
} else {
|
||||
waitingMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Queue check of lazy elements because of event e
|
||||
* @param {Event} [e]
|
||||
*/
|
||||
function queueCheckLazyElements(e) {
|
||||
if (!elements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
// fast check for scroll event without new visible elements
|
||||
if (e && e.type === 'scroll') {
|
||||
calcViewport();
|
||||
if (topLazy >= viewportBottom) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!waitingMode) {
|
||||
setTimeout(timeoutLazyElements, 0);
|
||||
}
|
||||
|
||||
waitingMode = 2;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize list of hidden elements
|
||||
*/
|
||||
function initLazyElements() {
|
||||
$(window).lazyLoadXT();
|
||||
queueCheckLazyElements();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loading of all elements
|
||||
*/
|
||||
function forceLoadAll() {
|
||||
checkLazyElements(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
$window
|
||||
.on(options.loadEvent, initLazyElements)
|
||||
.on(options.updateEvent, queueCheckLazyElements)
|
||||
.on(options.forceEvent, forceLoadAll);
|
||||
|
||||
if (options.autoInit) {
|
||||
initLazyElements(); // standard initialization
|
||||
}
|
||||
});
|
||||
|
||||
})(window.jQuery || window.Zepto, window, document);
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Lazy Load XT 0.8.6 | MIT License */
|
||||
!function(a,b,c){function d(){m=s.scrollTop(),n=m+(b.innerHeight||s.height()),o=b.pageXOffset||0,p=o+(b.innerWidth||s.width())}function e(b,c){c.trigger("lazy"+b);var d=q["on"+b];d&&(a.isFunction(d)?d.call(c[0]):c.addClass(d.addClass).removeClass(d.removeClass)),j()}function f(){e("load",a(this))}function g(){e("error",a(this))}function h(b){if(t.length){u=1/0,d();for(var h=t.length-1;h>=0;h--){var i=t[h],j=i.o,k=j[0];if(a.contains(c.body,k)){if(b||!i.visibleOnly||k.offsetWidth>0||k.offsetHeight>0){var l=j.offset(),q=l.top,r=l.left,s=i.edgeX,v=i.edgeY,w=q-v;if(b||n>w&&q+j.height()>m-v&&p+s>r&&r+j.width()>o-s){e("show",j);var x=i.srcAttr,y=a.isFunction(x)?x(j):j.attr(x);y&&j.on("load",f).on("error",g).attr("src",y),t.splice(h,1)}else u>w&&(u=w)}}else t.splice(h,1)}t.length||a(c).trigger("lazyloadall")}}function i(){v>1?(v=1,h(),setTimeout(i,q.throttle)):v=0}function j(a){t.length&&(a&&"scroll"===a.type&&(d(),u>=n)||(v||setTimeout(i,0),v=2))}function k(){a(b).lazyLoadXT(),j()}function l(){h(!0)}var m,n,o,p,q={autoInit:!0,selector:"img",classNojs:"lazy",blankImage:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",throttle:99,loadEvent:"pageshow",updateEvent:"load orientationchange resize scroll",forceEvent:"",oninit:null,onshow:null,onload:null,onerror:null},r={srcAttr:"data-src",edgeX:0,edgeY:0,visibleOnly:!0},s=a(b),t=[],u=0,v=0;a.lazyLoadXT=a.extend(q,r,a.lazyLoadXT),a.fn.lazyLoadXT=function(c){c=c||{};var d=c.blankImage||q.blankImage,f=c.classNojs||q.classNojs;return this.each(function(){if(this===b)a(q.selector).lazyLoadXT();else{var g,h,i=a(this);if(i.data("lazied"))return;i.data("lazied",1).removeClass(f),d&&"IMG"===i[0].tagName&&!i.attr("src")&&i.attr("src",d),e("init",i),g={o:i};for(h in r)g[h]=c[h]||q[h];t.unshift(g)}})},a(c).ready(function(){s.on(q.loadEvent,k).on(q.updateEvent,j).on(q.forceEvent,l),q.autoInit&&k()})}(window.jQuery||window.Zepto,window,document);
|
||||
@@ -0,0 +1,19 @@
|
||||
/*! Lazy Load XT v0.8.6 2013-12-18
|
||||
* http://ressio.github.io/lazy-load-xt
|
||||
* (C) 2013 RESS.io
|
||||
* Licensed under MIT */
|
||||
|
||||
(function ($, window) {
|
||||
$.lazyLoadXT.forceEvent += ' beforeprint';
|
||||
|
||||
if (window.matchMedia) {
|
||||
window
|
||||
.matchMedia('print')
|
||||
.addListener(function (mql) {
|
||||
if (mql.matches) {
|
||||
$(window).trigger('beforeprint');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})(window.jQuery || window.Zepto, window);
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Lazy Load XT 0.8.6 | MIT License */
|
||||
!function(a,b){a.lazyLoadXT.forceEvent+=" beforeprint",b.matchMedia&&b.matchMedia("print").addListener(function(c){c.matches&&a(b).trigger("beforeprint")})}(window.jQuery||window.Zepto,window);
|
||||
@@ -0,0 +1,58 @@
|
||||
/*! Lazy Load XT v0.8.6 2013-12-18
|
||||
* http://ressio.github.io/lazy-load-xt
|
||||
* (C) 2013 RESS.io
|
||||
* Licensed under MIT */
|
||||
/*jslint browser:true, plusplus:true, vars:true */
|
||||
/*jshint browser:true, jquery:true */
|
||||
/*jshint -W060:false */ /* we use document.write */
|
||||
|
||||
(function ($, window, document) {
|
||||
var dataLazyTag = $.lazyLoadXT.dataLazyTag || 'data-lazy-tag';
|
||||
|
||||
window.L = function (tag) {
|
||||
document.write('<br ' + dataLazyTag + '="' + (tag || 'img') + '" ');
|
||||
};
|
||||
|
||||
window.Lb = function (tag) {
|
||||
document.write('<span ' + dataLazyTag + '="' + (tag || 'video') + '" ');
|
||||
};
|
||||
|
||||
window.Le = function () {
|
||||
document.write('</span>');
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
var srcAttr = $.lazyLoadXT.srcAttr;
|
||||
|
||||
$('br[' + dataLazyTag + '],span[' + dataLazyTag + ']').each(function () {
|
||||
var attrs = this.attributes,
|
||||
el = document.createElement($(this).attr(dataLazyTag)),
|
||||
i;
|
||||
|
||||
for (i = 0; i < attrs.length; i++) {
|
||||
var attr = attrs[i];
|
||||
if (attr.specified) {
|
||||
var attrName = attr.nodeName,
|
||||
attrValue = attr.nodeValue;
|
||||
if (attrName.charAt(0) !== '<') {
|
||||
if (attrName === 'src') {
|
||||
el.setAttribute(srcAttr, attrValue);
|
||||
} else {
|
||||
el.setAttribute(attrName, attrValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (this.hasChildNodes()) {
|
||||
var child = this.removeChild(this.firstChild);
|
||||
el.appendChild(child);
|
||||
}
|
||||
|
||||
this.parentNode.replaceChild(el, this);
|
||||
});
|
||||
|
||||
$(window).lazyLoadXT();
|
||||
});
|
||||
|
||||
})(window.jQuery || window.Zepto, window, document);
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Lazy Load XT 0.8.6 | MIT License */
|
||||
!function(a,b,c){var d=a.lazyLoadXT.dataLazyTag||"data-lazy-tag";b.L=function(a){c.write("<br "+d+'="'+(a||"img")+'" ')},b.Lb=function(a){c.write("<span "+d+'="'+(a||"video")+'" ')},b.Le=function(){c.write("</span>")},a(c).ready(function(){var e=a.lazyLoadXT.srcAttr;a("br["+d+"],span["+d+"]").each(function(){var b,f=this.attributes,g=c.createElement(a(this).attr(d));for(b=0;b<f.length;b++){var h=f[b];if(h.specified){var i=h.nodeName,j=h.nodeValue;"<"!==i.charAt(0)&&("src"===i?g.setAttribute(e,j):g.setAttribute(i,j))}}for(;this.hasChildNodes();){var k=this.removeChild(this.firstChild);g.appendChild(k)}this.parentNode.replaceChild(g,this)}),a(b).lazyLoadXT()})}(window.jQuery||window.Zepto,window,document);
|
||||
@@ -0,0 +1,187 @@
|
||||
/*! Lazy Load XT v0.8.6 2013-12-18
|
||||
* http://ressio.github.io/lazy-load-xt
|
||||
* (C) 2013 RESS.io
|
||||
* Licensed under MIT */
|
||||
/*jslint browser:true, plusplus:true, vars:true */
|
||||
/*jshint browser:true, jquery:true */
|
||||
|
||||
(function ($, window, document) {
|
||||
// options
|
||||
var options = {
|
||||
selector: 'img',
|
||||
srcAttr: 'data-src',
|
||||
classNojs: 'lazy',
|
||||
edgeX: 0,
|
||||
edgeY: 0,
|
||||
throttle: 99,
|
||||
visibleOnly: true,
|
||||
loadEvent: 'pageshow', // check AJAX-loaded content in jQueryMobile
|
||||
updateEvent: 'load orientationchange resize scroll' // page-modified events
|
||||
},
|
||||
$window = $(window),
|
||||
elements = [],
|
||||
viewportTop,
|
||||
viewportBottom,
|
||||
viewportLeft,
|
||||
viewportRight,
|
||||
topLazy = 0,
|
||||
/*
|
||||
waitingMode=0 : no setTimeout
|
||||
waitingMode=1 : setTimeout, no deferred events
|
||||
waitingMode=2 : setTimeout, deferred events
|
||||
*/
|
||||
waitingMode = 0;
|
||||
|
||||
$.lazyLoadXT = $.extend(options, $.lazyLoadXT);
|
||||
|
||||
/**
|
||||
* Add new elements to lazy-load list:
|
||||
* $(elements).lazyLoadXT() or $(window).lazyLoadXT()
|
||||
*/
|
||||
$.fn.lazyLoadXT = function () {
|
||||
this.each(function () {
|
||||
if (this === window) {
|
||||
$(options.selector).lazyLoadXT();
|
||||
return;
|
||||
}
|
||||
|
||||
var $el = $(this);
|
||||
|
||||
// prevent duplicates
|
||||
if ($el.data('lazied')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$el
|
||||
.data('lazied', 1)
|
||||
.removeClass(options.classNojs);
|
||||
|
||||
elements.unshift($el); // push it in the first position as we iterate elements in reverse order
|
||||
});
|
||||
|
||||
// queue next check as images may be resized after loading of actual file
|
||||
queueCheckLazyElements();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Save visible viewport boundary to viewportXXX variables
|
||||
*/
|
||||
function calcViewport() {
|
||||
var scrollTop = $window.scrollTop(),
|
||||
scrollLeft = window.pageXOffset || 0,
|
||||
edgeX = options.edgeX,
|
||||
edgeY = options.edgeY;
|
||||
|
||||
viewportTop = scrollTop - edgeY;
|
||||
viewportBottom = scrollTop + (window.innerHeight || $window.height()) + edgeY;
|
||||
viewportLeft = scrollLeft - edgeX;
|
||||
viewportRight = scrollLeft + (window.innerWidth || $window.width()) + edgeX;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load visible elements
|
||||
*/
|
||||
function checkLazyElements() {
|
||||
if (!elements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
topLazy = Infinity;
|
||||
calcViewport();
|
||||
|
||||
var i = elements.length - 1,
|
||||
srcAttr = options.srcAttr;
|
||||
for (; i >= 0; i--) {
|
||||
var $el = elements[i],
|
||||
el = $el[0];
|
||||
|
||||
// remove items that are not in DOM
|
||||
if (!$.contains(document.body, el)) {
|
||||
elements.splice(i, 1);
|
||||
} else if (!options.visibleOnly || el.offsetWidth > 0 || el.offsetHeight > 0) {
|
||||
var offset = $el.offset(),
|
||||
elTop = offset.top,
|
||||
elLeft = offset.left;
|
||||
|
||||
if ((elTop < viewportBottom) && (elTop + $el.height() > viewportTop) &&
|
||||
(elLeft < viewportRight) && (elLeft + $el.width() > viewportLeft)) {
|
||||
|
||||
var src = $el.attr(srcAttr);
|
||||
if (src) {
|
||||
$el.attr('src', src);
|
||||
}
|
||||
|
||||
elements.splice(i, 1);
|
||||
} else {
|
||||
if (elTop < topLazy) {
|
||||
topLazy = elTop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run check of lazy elements after timeout
|
||||
*/
|
||||
function timeoutLazyElements() {
|
||||
if (waitingMode > 1) {
|
||||
waitingMode = 1;
|
||||
checkLazyElements();
|
||||
setTimeout(timeoutLazyElements, options.throttle);
|
||||
} else {
|
||||
waitingMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Queue check of lazy elements because of event e
|
||||
* @param {Event} [e]
|
||||
*/
|
||||
function queueCheckLazyElements(e) {
|
||||
if (!elements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
// fast check for scroll event without new visible elements
|
||||
if (e && e.type === 'scroll') {
|
||||
calcViewport();
|
||||
if (topLazy >= viewportBottom) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!waitingMode) {
|
||||
setTimeout(timeoutLazyElements, 0);
|
||||
}
|
||||
|
||||
waitingMode = 2;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize list of hidden elements
|
||||
*/
|
||||
function initLazyElements() {
|
||||
$(window).lazyLoadXT();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
$window
|
||||
.on(options.loadEvent, initLazyElements)
|
||||
.on(options.updateEvent, queueCheckLazyElements);
|
||||
|
||||
initLazyElements(); // standard initialization
|
||||
});
|
||||
|
||||
})(window.jQuery || window.Zepto, window, document);
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Lazy Load XT 0.8.6 | MIT License */
|
||||
!function(a,b,c){function d(){var a=n.scrollTop(),c=b.pageXOffset||0,d=m.edgeX,e=m.edgeY;i=a-e,j=a+(b.innerHeight||n.height())+e,k=c-d,l=c+(b.innerWidth||n.width())+d}function e(){if(o.length){p=1/0,d();for(var b=o.length-1,e=m.srcAttr;b>=0;b--){var f=o[b],g=f[0];if(a.contains(c.body,g)){if(!m.visibleOnly||g.offsetWidth>0||g.offsetHeight>0){var h=f.offset(),n=h.top,q=h.left;if(j>n&&n+f.height()>i&&l>q&&q+f.width()>k){var r=f.attr(e);r&&f.attr("src",r),o.splice(b,1)}else p>n&&(p=n)}}else o.splice(b,1)}}}function f(){q>1?(q=1,e(),setTimeout(f,m.throttle)):q=0}function g(a){o.length&&(a&&"scroll"===a.type&&(d(),p>=j)||(q||setTimeout(f,0),q=2))}function h(){a(b).lazyLoadXT()}var i,j,k,l,m={selector:"img",srcAttr:"data-src",classNojs:"lazy",edgeX:0,edgeY:0,throttle:99,visibleOnly:!0,loadEvent:"pageshow",updateEvent:"load orientationchange resize scroll"},n=a(b),o=[],p=0,q=0;a.lazyLoadXT=a.extend(m,a.lazyLoadXT),a.fn.lazyLoadXT=function(){return this.each(function(){if(this===b)return a(m.selector).lazyLoadXT(),void 0;var c=a(this);c.data("lazied")||(c.data("lazied",1).removeClass(m.classNojs),o.unshift(c))}),g(),this},a(c).ready(function(){n.on(m.loadEvent,h).on(m.updateEvent,g),h()})}(window.jQuery||window.Zepto,window,document);
|
||||
@@ -0,0 +1,91 @@
|
||||
/*! Lazy Load XT v0.8.6 2013-12-18
|
||||
* http://ressio.github.io/lazy-load-xt
|
||||
* (C) 2013 RESS.io
|
||||
* Licensed under MIT */
|
||||
|
||||
(function ($, window, document) {
|
||||
var options = $.lazyLoadXT,
|
||||
reUrl = /^\s*([^\s]*)/,
|
||||
reWidth = /[^\s]\s+(\d+)w/,
|
||||
reHeight = /[^\s]\s+(\d+)h/,
|
||||
reDpr = /[^\s]\s+([\d\.]+)x/,
|
||||
infty = [0, Infinity],
|
||||
one = [0, 1];
|
||||
|
||||
options.srcsetAttr = 'data-srcset';
|
||||
options.srcsetBaseAttr = 'data-srcset-base';
|
||||
options.srcsetExtAttr = 'data-srcset-ext';
|
||||
|
||||
function max(array, property) {
|
||||
return Math.max.apply(null, $.map(array, function (item) {
|
||||
return item[property];
|
||||
}));
|
||||
}
|
||||
|
||||
function min(array, property) {
|
||||
return Math.min.apply(null, $.map(array, function (item) {
|
||||
return item[property];
|
||||
}));
|
||||
}
|
||||
|
||||
// based on http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content-1.html#processing-the-image-candidates
|
||||
$(document).on('lazyshow', function (e) {
|
||||
var $this = $(e.target),
|
||||
srcset = $this.attr(options.srcsetAttr);
|
||||
|
||||
if (!srcset) {
|
||||
return;
|
||||
}
|
||||
|
||||
var list = srcset.split(',').map(function (item) {
|
||||
return {
|
||||
url: reUrl.exec(item)[1],
|
||||
width: (reWidth.exec(item) || infty)[1],
|
||||
height: (reHeight.exec(item) || infty)[1],
|
||||
dpr: (reDpr.exec(item) || one)[1]
|
||||
};
|
||||
});
|
||||
|
||||
if (!list.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var srcsetBase = $this.attr(options.srcsetBaseAttr) || '',
|
||||
srcsetExt = $this.attr(options.srcsetExtAttr) || '',
|
||||
viewport = {
|
||||
width: window.innerWidth || document.documentElement.clientWidth,
|
||||
height: window.innerHeight || document.documentElement.clientHeight,
|
||||
dpr: window.devicePixelRatio || 1
|
||||
},
|
||||
limit;
|
||||
|
||||
limit = max(list, 'width');
|
||||
list = $.grep(list, function (item) {
|
||||
return item.width >= viewport.width || item.width === limit;
|
||||
});
|
||||
limit = max(list, 'height');
|
||||
list = $.grep(list, function (item) {
|
||||
return item.height >= viewport.height || item.height === limit;
|
||||
});
|
||||
limit = max(list, 'dpr');
|
||||
list = $.grep(list, function (item) {
|
||||
return item.dpr >= viewport.dpr || item.dpr === limit;
|
||||
});
|
||||
|
||||
limit = min(list, 'width');
|
||||
list = $.grep(list, function (item) {
|
||||
return item.width === limit;
|
||||
});
|
||||
limit = min(list, 'height');
|
||||
list = $.grep(list, function (item) {
|
||||
return item.height === limit;
|
||||
});
|
||||
limit = min(list, 'dpr');
|
||||
list = $.grep(list, function (item) {
|
||||
return item.dpr === limit;
|
||||
});
|
||||
|
||||
$this.attr('src', srcsetBase + list[0].url + srcsetExt);
|
||||
});
|
||||
|
||||
})(window.jQuery || window.Zepto, window, document);
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Lazy Load XT 0.8.6 | MIT License */
|
||||
!function(a,b,c){function d(b,c){return Math.max.apply(null,a.map(b,function(a){return a[c]}))}function e(b,c){return Math.min.apply(null,a.map(b,function(a){return a[c]}))}var f=a.lazyLoadXT,g=/^\s*([^\s]*)/,h=/[^\s]\s+(\d+)w/,i=/[^\s]\s+(\d+)h/,j=/[^\s]\s+([\d\.]+)x/,k=[0,1/0],l=[0,1];f.srcsetAttr="data-srcset",f.srcsetBaseAttr="data-srcset-base",f.srcsetExtAttr="data-srcset-ext",a(c).on("lazyshow",function(m){var n=a(m.target),o=n.attr(f.srcsetAttr);if(o){var p=o.split(",").map(function(a){return{url:g.exec(a)[1],width:(h.exec(a)||k)[1],height:(i.exec(a)||k)[1],dpr:(j.exec(a)||l)[1]}});if(p.length){var q,r=n.attr(f.srcsetBaseAttr)||"",s=n.attr(f.srcsetExtAttr)||"",t={width:b.innerWidth||c.documentElement.clientWidth,height:b.innerHeight||c.documentElement.clientHeight,dpr:b.devicePixelRatio||1};q=d(p,"width"),p=a.grep(p,function(a){return a.width>=t.width||a.width===q}),q=d(p,"height"),p=a.grep(p,function(a){return a.height>=t.height||a.height===q}),q=d(p,"dpr"),p=a.grep(p,function(a){return a.dpr>=t.dpr||a.dpr===q}),q=e(p,"width"),p=a.grep(p,function(a){return a.width===q}),q=e(p,"height"),p=a.grep(p,function(a){return a.height===q}),q=e(p,"dpr"),p=a.grep(p,function(a){return a.dpr===q}),n.attr("src",r+p[0].url+s)}}})}(window.jQuery||window.Zepto,window,document);
|
||||
@@ -0,0 +1,31 @@
|
||||
/*! Lazy Load XT v0.8.6 2013-12-18
|
||||
* http://ressio.github.io/lazy-load-xt
|
||||
* (C) 2013 RESS.io
|
||||
* Licensed under MIT */
|
||||
|
||||
(function ($) {
|
||||
var options = $.lazyLoadXT;
|
||||
|
||||
options.selector += ',video,iframe[data-src]';
|
||||
options.videoPoster = 'data-poster';
|
||||
|
||||
$(document).on('lazyshow', 'video', function () {
|
||||
var $this = $(this),
|
||||
srcAttr = options.srcAttr,
|
||||
isFuncSrcAttr = $.isFunction(srcAttr);
|
||||
|
||||
$this
|
||||
.attr('poster', $this.attr(options.videoPoster))
|
||||
.children()
|
||||
.each(function () {
|
||||
if (/source|track/i.test(this.tagName)) {
|
||||
var $child = $(this);
|
||||
$child.attr('src', isFuncSrcAttr ? srcAttr($child) : $child.attr(srcAttr));
|
||||
}
|
||||
});
|
||||
|
||||
// reload video
|
||||
this.load();
|
||||
});
|
||||
|
||||
})(window.jQuery || window.Zepto);
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Lazy Load XT 0.8.6 | MIT License */
|
||||
!function(a){var b=a.lazyLoadXT;b.selector+=",video,iframe[data-src]",b.videoPoster="data-poster",a(document).on("lazyshow","video",function(){var c=a(this),d=b.srcAttr,e=a.isFunction(d);c.attr("poster",c.attr(b.videoPoster)).children().each(function(){if(/source|track/i.test(this.tagName)){var b=a(this);b.attr("src",e?d(b):b.attr(d))}}),this.load()})}(window.jQuery||window.Zepto);
|
||||
@@ -0,0 +1,26 @@
|
||||
/*! Lazy Load XT v0.8.6 2013-12-18
|
||||
* http://ressio.github.io/lazy-load-xt
|
||||
* (C) 2013 RESS.io
|
||||
* Licensed under MIT */
|
||||
/*jslint browser:true */
|
||||
/*jshint browser:true, jquery:true */
|
||||
|
||||
(function ($) {
|
||||
var options = $.lazyLoadXT,
|
||||
widgetAttr = options.widgetAttr || 'data-lazy-widget',
|
||||
reComment = /<!--([\s\S]*)-->/;
|
||||
|
||||
options.selector += ',[' + widgetAttr + ']';
|
||||
|
||||
$(document).on('lazyshow', '[' + widgetAttr + ']', function () {
|
||||
var $div = $('#' + $(this).attr(widgetAttr)),
|
||||
match;
|
||||
if ($div.length) {
|
||||
match = reComment.exec($div.html());
|
||||
if (match) {
|
||||
$div.replaceWith($.trim(match[1]));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(window.jQuery || window.Zepto);
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Lazy Load XT 0.8.6 | MIT License */
|
||||
!function(a){var b=a.lazyLoadXT,c=b.widgetAttr||"data-lazy-widget",d=/<!--([\s\S]*)-->/;b.selector+=",["+c+"]",a(document).on("lazyshow","["+c+"]",function(){var b,e=a("#"+a(this).attr(c));e.length&&(b=d.exec(e.html()),b&&e.replaceWith(a.trim(b[1])))})}(window.jQuery||window.Zepto);
|
||||
@@ -1,22 +1,46 @@
|
||||
{
|
||||
"name": "jquery.lazyloadxt",
|
||||
"filename": "jquery.lazyloadxt.min.js",
|
||||
"version": "0.8.11",
|
||||
"description": "Lazy Load XT is mobile-oriented, fast and extensible jQuery plugin for lazy loading of images, videos and other media with built-in support of jQueryMobile framework. It improves performance of website by loading visible media elements only, and elements below the fold are loaded after page scroll. The plugin has many options, supports callbacks and special lazy events, that allows to have different loading effects (e.g. fade in and spinner effects). Examples of plugin and its addons include ajax, background images, infinite scroll, horizontal scroll, iframe-based widgets (YouTube, Vimeo, Google Maps Engine Lite, Facebook recommend button, Google+ profile), html5 video, responsive images with retina support (srcset and picture polyfills), social widgets (embedded tweet, Twitter share button, Google Plus badge and share button, Facebook like and recommend buttons, Facebook post comments), load all images before print, etc. Tested in IE 6-11, Chrome 1-31, Firefox 1.5-27.0, Safari 3-7, Opera 10.6-18.0, iOS 5-7, Android 2.3-4.4, and WP8. Requires jQuery 1.7+ or Zepto 1.0+.",
|
||||
"license": "MIT",
|
||||
"homepage": "http://ressio.github.io/lazy-load-xt",
|
||||
"keywords": ["image", "images", "jquery", "jquerymobile", "lazy", "lazyload", "load", "media", "mobile", "performance", "responsive", "speed", "video", "vimeo", "youtube"],
|
||||
"maintainers": [{
|
||||
"name": "RESS.io",
|
||||
"web": "http://ress.io/"
|
||||
}],
|
||||
"repositories": [{
|
||||
"type": "git",
|
||||
"url": "https://github.com/ressio/lazy-load-xt.git"
|
||||
}],
|
||||
"npmName": "lazyloadxt",
|
||||
"npmFileMap": [{
|
||||
"basePath": "/dist/",
|
||||
"files": ["*"]
|
||||
}]
|
||||
}
|
||||
"name": "jquery.lazyloadxt",
|
||||
"filename": "jquery.lazyloadxt.min.js",
|
||||
"version": "0.8.12",
|
||||
"description": "Lazy Load XT is mobile-oriented, fast and extensible jQuery plugin for lazy loading of images, videos and other media with built-in support of jQueryMobile framework. It improves performance of website by loading visible media elements only, and elements below the fold are loaded after page scroll. The plugin has many options, supports callbacks and special lazy events, that allows to have different loading effects (e.g. fade in and spinner effects). Examples of plugin and its addons include ajax, background images, infinite scroll, horizontal scroll, iframe-based widgets (YouTube, Vimeo, Google Maps Engine Lite, Facebook recommend button, Google+ profile), html5 video, responsive images with retina support (srcset and picture polyfills), social widgets (embedded tweet, Twitter share button, Google Plus badge and share button, Facebook like and recommend buttons, Facebook post comments), load all images before print, etc. Tested in IE 6-11, Chrome 1-31, Firefox 1.5-27.0, Safari 3-7, Opera 10.6-18.0, iOS 5-7, Android 2.3-4.4, and WP8. Requires jQuery 1.7+ or Zepto 1.0+.",
|
||||
"license": "MIT",
|
||||
"homepage": "http://ressio.github.io/lazy-load-xt",
|
||||
"keywords": [
|
||||
"image",
|
||||
"images",
|
||||
"jquery",
|
||||
"jquerymobile",
|
||||
"lazy",
|
||||
"lazyload",
|
||||
"load",
|
||||
"media",
|
||||
"mobile",
|
||||
"performance",
|
||||
"responsive",
|
||||
"speed",
|
||||
"video",
|
||||
"vimeo",
|
||||
"youtube"
|
||||
],
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "RESS.io",
|
||||
"web": "http://ress.io/"
|
||||
}
|
||||
],
|
||||
"repositories": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/ressio/lazy-load-xt.git"
|
||||
}
|
||||
],
|
||||
"npmName": "lazyloadxt",
|
||||
"npmFileMap": [
|
||||
{
|
||||
"basePath": "/dist/",
|
||||
"files": [
|
||||
"*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
}
|
||||
],
|
||||
"filename": "string.min.js",
|
||||
"version": "1.7.0",
|
||||
"version": "1.8.0",
|
||||
"description": "string.js contains methods that aren't included in the vanilla JavaScript string such as escaping HTML, decoding HTML entities, stripping tags, etc.",
|
||||
"homepage": "http://stringjs.com",
|
||||
"keywords": [
|
||||
|
||||
Reference in New Issue
Block a user