1
;(function (root, blazy) {
2
if (typeof define === 'function' && define.amd) {
3
define(blazy)
4
} else if (typeof exports === 'object') {
5
module.exports = blazy()
6
} else {
7
root.Blazy = blazy()
8
}
9
})(this, function () {
10
'use strict';
11
var _source, _viewport, _isRetina, _supportClosest, _attrSrc = 'src', _attrSrcset = 'srcset';
12
return function Blazy(options) {
13
if (!document.querySelectorAll) {
14
var s = document.createStyleSheet();
15
document.querySelectorAll = function (r, c, i, j, a) {
16
a = document.all, c = [], r = r.replace(/\[for\b/gi, '[htmlFor').split(',');
17
for (i = r.length; i--;) {
18
s.addRule(r[i], 'k:v');
19
for (j = a.length; j--;) a[j].currentStyle.k && c.push(a[j]);
20
s.removeRule(0)
21
}
22
return c
23
}
24
}
25
var scope = this;
26
var util = scope._util = {};
27
util.elements = [];
28
util.destroyed = true;
29
scope.options = options || {};
30
scope.options.error = scope.options.error || false;
31
scope.options.offset = scope.options.offset || 100;
32
scope.options.root = scope.options.root || document;
33
scope.options.success = scope.options.success || false;
34
scope.options.selector = scope.options.selector || '.b-lazy';
35
scope.options.separator = scope.options.separator || '|';
36
scope.options.containerClass = scope.options.container;
37
scope.options.container = scope.options.containerClass ? document.querySelectorAll(scope.options.containerClass) : false;
38
scope.options.errorClass = scope.options.errorClass || 'b-error';
39
scope.options.breakpoints = scope.options.breakpoints || false;
40
scope.options.loadInvisible = scope.options.loadInvisible || false;
...
</html>