Bundle update
This commit is contained in:
parent
08eea24b21
commit
8fed58c387
42
Gemfile.lock
42
Gemfile.lock
@ -1,6 +1,6 @@
|
||||
GIT
|
||||
remote: git://github.com/activeadmin/activeadmin.git
|
||||
revision: 7aef260921d418d904d2dba9b1a97eed893e9019
|
||||
revision: 9fac1106ca013c4cd76ee6b231ec5dd1fcfd0790
|
||||
specs:
|
||||
activeadmin (1.0.0.pre)
|
||||
arbre (~> 1.0, >= 1.0.2)
|
||||
@ -85,14 +85,14 @@ GEM
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
addressable (2.3.6)
|
||||
arbre (1.0.2)
|
||||
arbre (1.0.3)
|
||||
activesupport (>= 3.0.0)
|
||||
arel (6.0.0)
|
||||
ast (2.0.0)
|
||||
astrolabe (1.3.0)
|
||||
parser (>= 2.2.0.pre.3, < 3.0)
|
||||
bcrypt (3.1.9)
|
||||
bourbon (4.1.0)
|
||||
bourbon (4.1.1)
|
||||
sass (~> 3.3)
|
||||
thor
|
||||
brakeman (3.0.0)
|
||||
@ -119,14 +119,14 @@ GEM
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.8.0)
|
||||
compass (1.0.1)
|
||||
compass (1.0.3)
|
||||
chunky_png (~> 1.2)
|
||||
compass-core (~> 1.0.1)
|
||||
compass-core (~> 1.0.2)
|
||||
compass-import-once (~> 1.0.5)
|
||||
rb-fsevent (>= 0.9.3)
|
||||
rb-inotify (>= 0.9)
|
||||
sass (>= 3.3.13, < 3.5)
|
||||
compass-core (1.0.1)
|
||||
compass-core (1.0.3)
|
||||
multi_json (~> 1.0)
|
||||
sass (>= 3.3.0, < 3.5)
|
||||
compass-import-once (1.0.5)
|
||||
@ -183,7 +183,7 @@ GEM
|
||||
bundler (~> 1.0)
|
||||
guard (~> 2.2)
|
||||
guard-compat (~> 1.1)
|
||||
guard-compat (1.2.0)
|
||||
guard-compat (1.2.1)
|
||||
guard-livereload (2.4.0)
|
||||
em-websocket (~> 0.5)
|
||||
guard (~> 2.8)
|
||||
@ -192,22 +192,23 @@ GEM
|
||||
activerecord (>= 4.1.0)
|
||||
guard (~> 2.3)
|
||||
guard-compat (~> 1.1)
|
||||
guard-minitest (2.3.2)
|
||||
guard (~> 2.0)
|
||||
guard-minitest (2.4.2)
|
||||
guard-compat (~> 1.2)
|
||||
minitest (>= 3.0)
|
||||
guard-rubocop (1.2.0)
|
||||
guard (~> 2.0)
|
||||
rubocop (~> 0.20)
|
||||
haml (4.0.6)
|
||||
tilt
|
||||
haml-lint (0.10.0)
|
||||
haml-lint (0.11.0)
|
||||
haml (~> 4.0)
|
||||
rubocop (>= 0.25.0)
|
||||
sysexits (~> 1.1)
|
||||
haml-rails (0.5.3)
|
||||
haml-rails (0.7.0)
|
||||
actionpack (>= 4.0.1)
|
||||
activesupport (>= 4.0.1)
|
||||
haml (>= 3.1, < 5.0)
|
||||
html2haml (>= 1.0.1)
|
||||
railties (>= 4.0.1)
|
||||
has_scope (0.6.0.rc)
|
||||
actionpack (>= 3.2, < 5)
|
||||
@ -215,6 +216,11 @@ GEM
|
||||
highline (1.6.21)
|
||||
hike (1.2.3)
|
||||
hitimes (1.2.2)
|
||||
html2haml (2.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
haml (~> 4.0.0)
|
||||
nokogiri (~> 1.6.0)
|
||||
ruby_parser (~> 3.5)
|
||||
http (0.6.3)
|
||||
http_parser.rb (~> 0.6.0)
|
||||
http_accept_language (2.0.2)
|
||||
@ -233,7 +239,7 @@ GEM
|
||||
jquery-ui-rails (5.0.3)
|
||||
railties (>= 3.2.16)
|
||||
json (1.8.2)
|
||||
kaminari (0.16.1)
|
||||
kaminari (0.16.2)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
leaflet-markercluster-rails (0.7.0)
|
||||
@ -262,7 +268,7 @@ GEM
|
||||
multipart-post (2.0.0)
|
||||
mysql2 (0.3.17)
|
||||
naught (1.0.0)
|
||||
nenv (0.1.1)
|
||||
nenv (0.2.0)
|
||||
nokogiri (1.6.5)
|
||||
mini_portile (~> 0.6.0)
|
||||
notiffany (0.0.3)
|
||||
@ -312,7 +318,7 @@ GEM
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rainbow (2.0.0)
|
||||
rake (10.4.2)
|
||||
ransack (1.5.1)
|
||||
ransack (1.6.2)
|
||||
actionpack (>= 3.0)
|
||||
activerecord (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
@ -339,7 +345,7 @@ GEM
|
||||
sexp_processor (~> 4.0)
|
||||
ruby_parser (3.5.0)
|
||||
sexp_processor (~> 4.1)
|
||||
sass (3.4.9)
|
||||
sass (3.4.10)
|
||||
sass-rails (5.0.1)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
sass (~> 3.1)
|
||||
@ -349,9 +355,9 @@ GEM
|
||||
sdoc (0.4.1)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
rdoc (~> 4.0)
|
||||
select2-rails (3.5.9.1)
|
||||
select2-rails (3.5.9.2)
|
||||
thor (~> 0.14)
|
||||
sexp_processor (4.4.4)
|
||||
sexp_processor (4.4.5)
|
||||
shellany (0.0.1)
|
||||
simple_calendar (1.1.9)
|
||||
rails (>= 3.0)
|
||||
@ -414,7 +420,7 @@ GEM
|
||||
warden (1.2.3)
|
||||
rack (>= 1.0)
|
||||
webrick (1.3.1)
|
||||
webshims-rails (1.15.5)
|
||||
webshims-rails (1.15.6.2)
|
||||
rails (> 3.1.0)
|
||||
|
||||
PLATFORMS
|
||||
|
@ -137,7 +137,7 @@
|
||||
}
|
||||
|
||||
$.extend(webshims, {
|
||||
version: '1.15.5',
|
||||
version: '1.15.6',
|
||||
|
||||
cfg: {
|
||||
enhanceAuto: window.Audio && (!window.matchMedia || matchMedia('(min-device-width: 721px)').matches),
|
||||
|
@ -1234,7 +1234,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
||||
|
||||
})();
|
||||
});
|
||||
;(function($){
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
var isNumber = function(string){
|
||||
@ -1854,7 +1854,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
||||
webshims.isReady('range-ui', true);
|
||||
}
|
||||
})(window.webshims ? webshims.$ : jQuery);
|
||||
;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
|
||||
webshims.register('form-number-date-ui', function ($, webshims, window, document, undefined, options) {
|
||||
"use strict";
|
||||
var curCfg;
|
||||
var formcfg = webshims.formcfg;
|
||||
@ -2419,9 +2419,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
||||
return val;
|
||||
},
|
||||
month: function(val, opts, noCorrect){
|
||||
|
||||
var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
|
||||
|
||||
var regSplit = opts.monthNames == 'monthNamesShort' ? /[\s-\/\\]+/ : /[\.\s-\/\\]+/;
|
||||
var p = (!opts.splitInput) ? val.trim().split(regSplit) : val;
|
||||
|
||||
if(p.length == 2 && p[0] && p[1]){
|
||||
p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0];
|
||||
p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1];
|
||||
@ -2893,34 +2893,35 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
||||
var isValue = name == 'value';
|
||||
spinBtnProto[name] = function(val, force, isLive){
|
||||
var selectionEnd;
|
||||
if(isValue){
|
||||
this._beforeValue(val);
|
||||
} else {
|
||||
this.elemHelper.prop(name, val);
|
||||
}
|
||||
if(!this._init || force || val || this.options[name] !== val){
|
||||
if(isValue){
|
||||
this._beforeValue(val);
|
||||
} else {
|
||||
this.elemHelper.prop(name, val);
|
||||
}
|
||||
|
||||
val = formatVal[this.type](val, this.options);
|
||||
if(this.options.splitInput){
|
||||
$.each(this.splits, function(i, elem){
|
||||
var setOption;
|
||||
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
||||
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
||||
} else {
|
||||
$.prop(elem, name, val[i]);
|
||||
val = formatVal[this.type](val, this.options);
|
||||
if(this.options.splitInput){
|
||||
$.each(this.splits, function(i, elem){
|
||||
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
||||
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
||||
} else {
|
||||
$.prop(elem, name, val[i]);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
val = this.toFixed(val);
|
||||
if(isLive && this._getSelectionEnd){
|
||||
selectionEnd = this._getSelectionEnd(val);
|
||||
}
|
||||
this.element.prop(name, val);
|
||||
if(selectionEnd != null){
|
||||
this.element.prop('selectionEnd', selectionEnd);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
val = this.toFixed(val);
|
||||
if(isLive && this._getSelectionEnd){
|
||||
selectionEnd = this._getSelectionEnd(val);
|
||||
}
|
||||
this.element.prop(name, val);
|
||||
if(selectionEnd != null){
|
||||
this.element.prop('selectionEnd', selectionEnd);
|
||||
}
|
||||
this._propertyChange(name);
|
||||
this.mirrorValidity();
|
||||
}
|
||||
this._propertyChange(name);
|
||||
this.mirrorValidity();
|
||||
};
|
||||
});
|
||||
|
||||
@ -3270,7 +3271,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
||||
} else {
|
||||
popover.hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
options.containerElements.push(popover.element[0]);
|
||||
@ -3376,7 +3377,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
||||
popover.activeElement.focus();
|
||||
}, 4);
|
||||
}
|
||||
if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
|
||||
if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
|
||||
popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
|
||||
show();
|
||||
}
|
||||
@ -3693,7 +3694,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
||||
$(data.shim.options.containerElements)
|
||||
.on({
|
||||
'focusin focus focusout blur': function(e){
|
||||
e.stopImmediatePropagation();
|
||||
if(e.type == 'focus'){
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
hasFocus = has[e.type];
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function(){
|
||||
|
@ -618,7 +618,7 @@
|
||||
webshims.isReady('range-ui', true);
|
||||
}
|
||||
})(window.webshims ? webshims.$ : jQuery);
|
||||
;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
|
||||
webshims.register('form-number-date-ui', function ($, webshims, window, document, undefined, options) {
|
||||
"use strict";
|
||||
var curCfg;
|
||||
var formcfg = webshims.formcfg;
|
||||
@ -1183,9 +1183,9 @@
|
||||
return val;
|
||||
},
|
||||
month: function(val, opts, noCorrect){
|
||||
|
||||
var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
|
||||
|
||||
var regSplit = opts.monthNames == 'monthNamesShort' ? /[\s-\/\\]+/ : /[\.\s-\/\\]+/;
|
||||
var p = (!opts.splitInput) ? val.trim().split(regSplit) : val;
|
||||
|
||||
if(p.length == 2 && p[0] && p[1]){
|
||||
p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0];
|
||||
p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1];
|
||||
@ -1657,34 +1657,35 @@
|
||||
var isValue = name == 'value';
|
||||
spinBtnProto[name] = function(val, force, isLive){
|
||||
var selectionEnd;
|
||||
if(isValue){
|
||||
this._beforeValue(val);
|
||||
} else {
|
||||
this.elemHelper.prop(name, val);
|
||||
}
|
||||
if(!this._init || force || val || this.options[name] !== val){
|
||||
if(isValue){
|
||||
this._beforeValue(val);
|
||||
} else {
|
||||
this.elemHelper.prop(name, val);
|
||||
}
|
||||
|
||||
val = formatVal[this.type](val, this.options);
|
||||
if(this.options.splitInput){
|
||||
$.each(this.splits, function(i, elem){
|
||||
var setOption;
|
||||
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
||||
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
||||
} else {
|
||||
$.prop(elem, name, val[i]);
|
||||
val = formatVal[this.type](val, this.options);
|
||||
if(this.options.splitInput){
|
||||
$.each(this.splits, function(i, elem){
|
||||
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
||||
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
||||
} else {
|
||||
$.prop(elem, name, val[i]);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
val = this.toFixed(val);
|
||||
if(isLive && this._getSelectionEnd){
|
||||
selectionEnd = this._getSelectionEnd(val);
|
||||
}
|
||||
this.element.prop(name, val);
|
||||
if(selectionEnd != null){
|
||||
this.element.prop('selectionEnd', selectionEnd);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
val = this.toFixed(val);
|
||||
if(isLive && this._getSelectionEnd){
|
||||
selectionEnd = this._getSelectionEnd(val);
|
||||
}
|
||||
this.element.prop(name, val);
|
||||
if(selectionEnd != null){
|
||||
this.element.prop('selectionEnd', selectionEnd);
|
||||
}
|
||||
this._propertyChange(name);
|
||||
this.mirrorValidity();
|
||||
}
|
||||
this._propertyChange(name);
|
||||
this.mirrorValidity();
|
||||
};
|
||||
});
|
||||
|
||||
@ -2034,7 +2035,7 @@
|
||||
} else {
|
||||
popover.hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
options.containerElements.push(popover.element[0]);
|
||||
@ -2140,7 +2141,7 @@
|
||||
popover.activeElement.focus();
|
||||
}, 4);
|
||||
}
|
||||
if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
|
||||
if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
|
||||
popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
|
||||
show();
|
||||
}
|
||||
@ -2457,7 +2458,11 @@
|
||||
$(data.shim.options.containerElements)
|
||||
.on({
|
||||
'focusin focus focusout blur': function(e){
|
||||
e.stopImmediatePropagation();
|
||||
if(e.type == 'focus'){
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
hasFocus = has[e.type];
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function(){
|
||||
|
@ -614,7 +614,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
||||
}
|
||||
|
||||
});
|
||||
;(function($){
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
var isNumber = function(string){
|
||||
@ -1234,7 +1234,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
||||
webshims.isReady('range-ui', true);
|
||||
}
|
||||
})(window.webshims ? webshims.$ : jQuery);
|
||||
;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
|
||||
webshims.register('form-number-date-ui', function ($, webshims, window, document, undefined, options) {
|
||||
"use strict";
|
||||
var curCfg;
|
||||
var formcfg = webshims.formcfg;
|
||||
@ -1799,9 +1799,9 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
||||
return val;
|
||||
},
|
||||
month: function(val, opts, noCorrect){
|
||||
|
||||
var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
|
||||
|
||||
var regSplit = opts.monthNames == 'monthNamesShort' ? /[\s-\/\\]+/ : /[\.\s-\/\\]+/;
|
||||
var p = (!opts.splitInput) ? val.trim().split(regSplit) : val;
|
||||
|
||||
if(p.length == 2 && p[0] && p[1]){
|
||||
p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0];
|
||||
p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1];
|
||||
@ -2273,34 +2273,35 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
||||
var isValue = name == 'value';
|
||||
spinBtnProto[name] = function(val, force, isLive){
|
||||
var selectionEnd;
|
||||
if(isValue){
|
||||
this._beforeValue(val);
|
||||
} else {
|
||||
this.elemHelper.prop(name, val);
|
||||
}
|
||||
if(!this._init || force || val || this.options[name] !== val){
|
||||
if(isValue){
|
||||
this._beforeValue(val);
|
||||
} else {
|
||||
this.elemHelper.prop(name, val);
|
||||
}
|
||||
|
||||
val = formatVal[this.type](val, this.options);
|
||||
if(this.options.splitInput){
|
||||
$.each(this.splits, function(i, elem){
|
||||
var setOption;
|
||||
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
||||
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
||||
} else {
|
||||
$.prop(elem, name, val[i]);
|
||||
val = formatVal[this.type](val, this.options);
|
||||
if(this.options.splitInput){
|
||||
$.each(this.splits, function(i, elem){
|
||||
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
||||
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
||||
} else {
|
||||
$.prop(elem, name, val[i]);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
val = this.toFixed(val);
|
||||
if(isLive && this._getSelectionEnd){
|
||||
selectionEnd = this._getSelectionEnd(val);
|
||||
}
|
||||
this.element.prop(name, val);
|
||||
if(selectionEnd != null){
|
||||
this.element.prop('selectionEnd', selectionEnd);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
val = this.toFixed(val);
|
||||
if(isLive && this._getSelectionEnd){
|
||||
selectionEnd = this._getSelectionEnd(val);
|
||||
}
|
||||
this.element.prop(name, val);
|
||||
if(selectionEnd != null){
|
||||
this.element.prop('selectionEnd', selectionEnd);
|
||||
}
|
||||
this._propertyChange(name);
|
||||
this.mirrorValidity();
|
||||
}
|
||||
this._propertyChange(name);
|
||||
this.mirrorValidity();
|
||||
};
|
||||
});
|
||||
|
||||
@ -2650,7 +2651,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
||||
} else {
|
||||
popover.hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
options.containerElements.push(popover.element[0]);
|
||||
@ -2756,7 +2757,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
||||
popover.activeElement.focus();
|
||||
}, 4);
|
||||
}
|
||||
if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
|
||||
if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
|
||||
popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
|
||||
show();
|
||||
}
|
||||
@ -3073,7 +3074,11 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
||||
$(data.shim.options.containerElements)
|
||||
.on({
|
||||
'focusin focus focusout blur': function(e){
|
||||
e.stopImmediatePropagation();
|
||||
if(e.type == 'focus'){
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
hasFocus = has[e.type];
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function(){
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*! respimage - v1.1.6 - 2014-11-20
|
||||
/*! respimage - v1.2.1 - 2014-12-23
|
||||
Licensed MIT */
|
||||
!function(window, document, undefined) {
|
||||
"use strict";
|
||||
@ -7,31 +7,18 @@
|
||||
}
|
||||
function updateMetrics() {
|
||||
var dprM;
|
||||
(isVwDirty || DPR != window.devicePixelRatio) && (isVwDirty = !1, DPR = window.devicePixelRatio,
|
||||
cssCache = {}, sizeLengthCache = {}, dprM = (DPR || 1) * cfg.xQuant, cfg.uT || (dprM = Math.min(dprM, 3),
|
||||
dprM > 1.4 && (dprM = Math.round(dprM / (1 + (dprM - 1.4) / 12) * 100) / 100), ri.DPR = dprM),
|
||||
tLow = cfg.tLow * dprM, greed = cfg.greed / 2, greed += greed * dprM, tHigh = cfg.tHigh,
|
||||
tMemory = 2 + dprM, units.width = Math.max(window.innerWidth || 0, docElem.clientWidth),
|
||||
units.height = Math.max(window.innerHeight || 0, docElem.clientHeight), isLandscape = units.width > units.height,
|
||||
units.vw = units.width / 100, units.vh = units.height / 100, units.em = ri.getEmValue(),
|
||||
units.rem = units.em);
|
||||
}
|
||||
function parseDescriptor(descriptor) {
|
||||
if (!(descriptor in memDescriptor)) {
|
||||
var descriptorObj = {
|
||||
val: 1,
|
||||
type: "x"
|
||||
}, parsedDescriptor = trim(descriptor || "");
|
||||
parsedDescriptor && (parsedDescriptor = parsedDescriptor.replace(regHDesc, ""),
|
||||
parsedDescriptor.match(regDescriptor) ? (descriptorObj.val = 1 * RegExp.$1, descriptorObj.type = RegExp.$2) : descriptorObj = !1),
|
||||
memDescriptor[descriptor] = descriptorObj;
|
||||
}
|
||||
return memDescriptor[descriptor];
|
||||
isVwDirty = !1, DPR = window.devicePixelRatio, cssCache = {}, sizeLengthCache = {},
|
||||
dprM = (DPR || 1) * cfg.xQuant, cfg.uT || (cfg.maxX = Math.max(1.3, cfg.maxX), dprM = Math.min(dprM, cfg.maxX),
|
||||
ri.DPR = dprM), units.width = Math.max(window.innerWidth || 0, docElem.clientWidth),
|
||||
units.height = Math.max(window.innerHeight || 0, docElem.clientHeight), units.vw = units.width / 100,
|
||||
units.vh = units.height / 100, units.em = ri.getEmValue(), units.rem = units.em,
|
||||
lazyFactor = cfg.lazyFactor / 2, lazyFactor = lazyFactor * dprM + lazyFactor, substractCurRes = .1 * dprM,
|
||||
lowTreshHold = .5 + .2 * dprM, partialLowTreshHold = .5 + .25 * dprM, tMemory = dprM + 1.3,
|
||||
(isLandscape = units.width > units.height) || (lazyFactor *= .9), supportAbort && (lazyFactor *= .9);
|
||||
}
|
||||
function chooseLowRes(lowRes, diff, dpr) {
|
||||
var add = diff * greed * lowRes;
|
||||
return isLandscape || (add /= 1.5), lowRes += add, diff > tHigh && (lowRes += tLow),
|
||||
lowRes > dpr;
|
||||
var add = diff * Math.pow(lowRes, 2);
|
||||
return isLandscape || (add /= 1.3), lowRes += add, lowRes > dpr;
|
||||
}
|
||||
function inView(el) {
|
||||
if (!el.getBoundingClientRect) return !0;
|
||||
@ -61,20 +48,6 @@
|
||||
}
|
||||
return candidate;
|
||||
}
|
||||
function hasOneX(set) {
|
||||
var i, ret, candidates, desc;
|
||||
if (set) for (candidates = ri.parseSet(set), i = 0; i < candidates.length; i++) if (desc = candidates[i].desc,
|
||||
"x" == desc.type && 1 == desc.val) {
|
||||
ret = !0;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function hasWDescripor(set) {
|
||||
if (!set) return !1;
|
||||
var candidates = ri.parseSet(set);
|
||||
return candidates[0] && "w" == candidates[0].desc.type;
|
||||
}
|
||||
function getAllSourceElements(picture, candidates) {
|
||||
var i, len, source, srcset, sources = picture.getElementsByTagName("source");
|
||||
for (i = 0, len = sources.length; len > i; i++) source = sources[i], source[ri.ns] = !0,
|
||||
@ -85,57 +58,31 @@
|
||||
sizes: source.getAttribute("sizes")
|
||||
});
|
||||
}
|
||||
function setResolution(candidate, sizesattr) {
|
||||
var descriptor = candidate.desc;
|
||||
return "w" == descriptor.type ? (candidate.cWidth = ri.calcListLength(sizesattr || "100vw"),
|
||||
candidate.res = descriptor.val / candidate.cWidth) : candidate.res = descriptor.val,
|
||||
candidate;
|
||||
}
|
||||
document.createElement("picture");
|
||||
var ri = {}, noop = function() {}, image = document.createElement("img"), getImgAttr = image.getAttribute, setImgAttr = image.setAttribute, removeImgAttr = image.removeAttribute, docElem = document.documentElement, types = {}, cfg = {
|
||||
var lowTreshHold, partialLowTreshHold, isLandscape, lazyFactor, tMemory, substractCurRes, eminpx, alwaysCheckWDescriptor, resizeThrottle, ri = {}, noop = function() {}, image = document.createElement("img"), getImgAttr = image.getAttribute, setImgAttr = image.setAttribute, removeImgAttr = image.removeAttribute, docElem = document.documentElement, types = {}, cfg = {
|
||||
xQuant: 1,
|
||||
tLow: .1,
|
||||
tHigh: .6,
|
||||
tLazy: .33,
|
||||
greed: .5
|
||||
}, srcAttr = "data-risrc", srcsetAttr = srcAttr + "set", supportAbort = /rident/.test(navigator.userAgent), curSrcProp = "currentSrc";
|
||||
ri.ns = ("ri" + new Date().getTime()).substr(0, 9), curSrcProp in image || (curSrcProp = "src"),
|
||||
ri.supSrcset = "srcset" in image, ri.supSizes = "sizes" in image, ri.selShort = "picture>img,img[srcset]",
|
||||
ri.sel = ri.selShort, ri.cfg = cfg, ri.supSrcset && (ri.sel += ",img[" + srcsetAttr + "]");
|
||||
var anchor = document.createElement("a");
|
||||
ri.makeUrl = function(src) {
|
||||
return anchor.href = src, anchor.href;
|
||||
}, ri.qsa = function(context, sel) {
|
||||
return context.querySelectorAll(sel);
|
||||
};
|
||||
{
|
||||
var on = function(obj, evt, fn, capture) {
|
||||
obj.addEventListener ? obj.addEventListener(evt, fn, capture || !1) : obj.attachEvent && obj.attachEvent("on" + evt, fn);
|
||||
}, off = function(obj, evt, fn, capture) {
|
||||
obj.removeEventListener ? obj.removeEventListener(evt, fn, capture || !1) : obj.detachEvent && obj.detachEvent("on" + evt, fn);
|
||||
};
|
||||
"https:" == location.protocol;
|
||||
}
|
||||
ri.matchesMedia = function() {
|
||||
return ri.matchesMedia = window.matchMedia && (matchMedia("(min-width: 0.1em)") || {}).matches ? function(media) {
|
||||
return !media || matchMedia(media).matches;
|
||||
} : ri.mMQ, ri.matchesMedia.apply(this, arguments);
|
||||
};
|
||||
var tLow, greed, tHigh, tMemory, isWinComplete, isLandscape, isVwDirty = !0, cssCache = {}, sizeLengthCache = {}, DPR = window.devicePixelRatio, units = {
|
||||
lazyFactor: .4,
|
||||
maxX: 2
|
||||
}, srcAttr = "data-risrc", srcsetAttr = srcAttr + "set", reflowBug = "webkitBackfaceVisibility" in docElem.style, ua = navigator.userAgent, supportNativeLQIP = /AppleWebKit/i.test(ua), supportAbort = /rident/.test(ua) || /ecko/.test(ua) && ua.match(/rv\:(\d+)/) && RegExp.$1 > 35, imgAbortCount = 0, curSrcProp = "currentSrc", regWDesc = /\s+\+?\d+(e\d+)?w/, regSize = /(\([^)]+\))?\s*(.+)/, regDescriptor = /^([\+eE\d\.]+)(w|x)$/, regHDesc = /\s*\d+h\s*/, setOptions = window.respimgCFG, baseStyle = ("https:" == location.protocol,
|
||||
"position:absolute;left:0;visibility:hidden;display:block;padding:0;border:none;font-size:1em;width:1em;overflow:hidden;clip:rect(0px, 0px, 0px, 0px)"), fsCss = "font-size:100%!important;", isVwDirty = !0, cssCache = {}, sizeLengthCache = {}, DPR = window.devicePixelRatio, units = {
|
||||
px: 1,
|
||||
"in": 96
|
||||
};
|
||||
ri.DPR = DPR || 1, ri.u = units, ri.mMQ = function(media) {
|
||||
return media ? evalCSS(media) : !0;
|
||||
};
|
||||
var evalCSS = function() {
|
||||
var cache = {}, regLength = /^([\d\.]+)(em|vw|px)$/, replace = function() {
|
||||
}, anchor = document.createElement("a"), alreadyRun = !1, on = function(obj, evt, fn, capture) {
|
||||
obj.addEventListener ? obj.addEventListener(evt, fn, capture || !1) : obj.attachEvent && obj.attachEvent("on" + evt, fn);
|
||||
}, off = function(obj, evt, fn, capture) {
|
||||
obj.removeEventListener ? obj.removeEventListener(evt, fn, capture || !1) : obj.detachEvent && obj.detachEvent("on" + evt, fn);
|
||||
}, memoize = function(fn) {
|
||||
var cache = {};
|
||||
return function(input) {
|
||||
return input in cache || (cache[input] = fn(input)), cache[input];
|
||||
};
|
||||
}, evalCSS = function() {
|
||||
var regLength = /^([\d\.]+)(em|vw|px)$/, replace = function() {
|
||||
for (var args = arguments, index = 0, string = args[0]; ++index in args; ) string = string.replace(args[index], args[++index]);
|
||||
return string;
|
||||
}, buidlStr = function(css) {
|
||||
return cache[css] || (cache[css] = "return " + replace((css || "").toLowerCase(), /\band\b/g, "&&", /,/g, "||", /min-([a-z-\s]+):/g, "e.$1>=", /max-([a-z-\s]+):/g, "e.$1<=", /calc([^)]+)/g, "($1)", /(\d+[\.]*[\d]*)([a-z]+)/g, "($1 * e.$2)", /^(?!(e.[a-z]|[0-9\.&=|><\+\-\*\(\)\/])).*/gi, "") + ";"),
|
||||
cache[css];
|
||||
};
|
||||
}, buidlStr = memoize(function(css) {
|
||||
return "return " + replace((css || "").toLowerCase(), /\band\b/g, "&&", /,/g, "||", /min-([a-z-\s]+):/g, "e.$1>=", /max-([a-z-\s]+):/g, "e.$1<=", /calc([^)]+)/g, "($1)", /(\d+[\.]*[\d]*)([a-z]+)/g, "($1 * e.$2)", /^(?!(e.[a-z]|[0-9\.&=|><\+\-\*\(\)\/])).*/gi, "");
|
||||
});
|
||||
return function(css, length) {
|
||||
var parsedLength;
|
||||
if (!(css in cssCache)) if (cssCache[css] = !1, length && (parsedLength = css.match(regLength))) cssCache[css] = parsedLength[1] * units[parsedLength[2]]; else try {
|
||||
@ -143,41 +90,76 @@
|
||||
} catch (e) {}
|
||||
return cssCache[css];
|
||||
};
|
||||
}();
|
||||
ri.calcLength = function(sourceSizeValue) {
|
||||
}(), setResolution = function(candidate, sizesattr) {
|
||||
return candidate.w ? (candidate.cWidth = ri.calcListLength(sizesattr || "100vw"),
|
||||
candidate.res = candidate.w / candidate.cWidth) : candidate.res = candidate.x, candidate;
|
||||
}, respimage = function(opt) {
|
||||
var elements, i, plen, options = opt || {};
|
||||
if (options.elements && 1 == options.elements.nodeType && ("IMG" == options.elements.nodeName.toUpperCase() ? options.elements = [ options.elements ] : (options.context = options.elements,
|
||||
options.elements = null)), elements = options.elements || ri.qsa(options.context || document, options.reevaluate || options.reparse ? ri.sel : ri.selShort),
|
||||
plen = elements.length) {
|
||||
for (ri.setupRun(options), alreadyRun = !0, i = 0; plen > i; i++) imgAbortCount++,
|
||||
6 > imgAbortCount && !elements[i].complete && imgAbortCount++, ri.fillImg(elements[i], options);
|
||||
ri.teardownRun(options), imgAbortCount++;
|
||||
}
|
||||
}, reevaluateAfterLoad = function() {
|
||||
var onload = function() {
|
||||
off(this, "load", onload), off(this, "error", onload), ri.fillImgs({
|
||||
elements: [ this ]
|
||||
});
|
||||
};
|
||||
return function(img) {
|
||||
off(img, "load", onload), off(img, "error", onload), on(img, "error", onload), on(img, "load", onload);
|
||||
};
|
||||
}(), parseDescriptor = memoize(function(descriptor) {
|
||||
var descriptorObj = [ 1, "x" ], parsedDescriptor = trim(descriptor || "");
|
||||
return parsedDescriptor && (parsedDescriptor = parsedDescriptor.replace(regHDesc, ""),
|
||||
descriptorObj = parsedDescriptor.match(regDescriptor) ? [ 1 * RegExp.$1, RegExp.$2 ] : !1),
|
||||
descriptorObj;
|
||||
});
|
||||
curSrcProp in image || (curSrcProp = "src"), types["image/jpeg"] = !0, types["image/gif"] = !0,
|
||||
types["image/png"] = !0, types["image/svg+xml"] = document.implementation.hasFeature("http://wwwindow.w3.org/TR/SVG11/feature#Image", "1.1"),
|
||||
ri.ns = ("ri" + new Date().getTime()).substr(0, 9), ri.supSrcset = "srcset" in image,
|
||||
ri.supSizes = "sizes" in image, ri.selShort = "picture>img,img[srcset]", ri.sel = ri.selShort,
|
||||
ri.cfg = cfg, ri.supSrcset && (ri.sel += ",img[" + srcsetAttr + "]"), ri.DPR = DPR || 1,
|
||||
ri.u = units, ri.types = types, alwaysCheckWDescriptor = ri.supSrcset && !ri.supSizes,
|
||||
ri.setSize = noop, ri.makeUrl = memoize(function(src) {
|
||||
return anchor.href = src, anchor.href;
|
||||
}), ri.qsa = function(context, sel) {
|
||||
return context.querySelectorAll(sel);
|
||||
}, ri.matchesMedia = function() {
|
||||
return ri.matchesMedia = window.matchMedia && (matchMedia("(min-width: 0.1em)") || {}).matches ? function(media) {
|
||||
return !media || matchMedia(media).matches;
|
||||
} : ri.mMQ, ri.matchesMedia.apply(this, arguments);
|
||||
}, ri.mMQ = function(media) {
|
||||
return media ? evalCSS(media) : !0;
|
||||
}, ri.calcLength = function(sourceSizeValue) {
|
||||
var value = evalCSS(sourceSizeValue, !0) || !1;
|
||||
return 0 > value && (value = !1), value;
|
||||
}, ri.types = types, types["image/jpeg"] = !0, types["image/gif"] = !0, types["image/png"] = !0,
|
||||
types["image/svg+xml"] = document.implementation.hasFeature("http://wwwindow.w3.org/TR/SVG11/feature#Image", "1.1"),
|
||||
ri.supportsType = function(type) {
|
||||
return type ? types[type] : !0;
|
||||
}, ri.supportsType = function(type) {
|
||||
return type ? types[type] : !0;
|
||||
}, ri.parseSize = memoize(function(sourceSizeStr) {
|
||||
var match = (sourceSizeStr || "").match(regSize);
|
||||
return {
|
||||
media: match && match[1],
|
||||
length: match && match[2]
|
||||
};
|
||||
var regSize = /(\([^)]+\))?\s*(.+)/, memSize = {};
|
||||
ri.parseSize = function(sourceSizeStr) {
|
||||
var match;
|
||||
return memSize[sourceSizeStr] || (match = (sourceSizeStr || "").match(regSize),
|
||||
memSize[sourceSizeStr] = {
|
||||
media: match && match[1],
|
||||
length: match && match[2]
|
||||
}), memSize[sourceSizeStr];
|
||||
}, ri.parseSet = function(set) {
|
||||
}), ri.parseSet = function(set) {
|
||||
if (!set.cands) {
|
||||
var pos, url, descriptor, last, descpos, srcset = set.srcset;
|
||||
var pos, url, descriptor, last, descpos, can, srcset = set.srcset;
|
||||
for (set.cands = []; srcset; ) srcset = srcset.replace(/^\s+/g, ""), pos = srcset.search(/\s/g),
|
||||
descriptor = null, -1 != pos ? (url = srcset.slice(0, pos), last = url.charAt(url.length - 1),
|
||||
"," != last && url || (url = url.replace(/,+$/, ""), descriptor = ""), srcset = srcset.slice(pos + 1),
|
||||
null == descriptor && (descpos = srcset.indexOf(","), -1 != descpos ? (descriptor = srcset.slice(0, descpos),
|
||||
srcset = srcset.slice(descpos + 1)) : (descriptor = srcset, srcset = ""))) : (url = srcset,
|
||||
srcset = ""), url && (descriptor = parseDescriptor(descriptor)) && set.cands.push({
|
||||
srcset = ""), url && (descriptor = parseDescriptor(descriptor)) && (can = {
|
||||
url: url.replace(/^,+/, ""),
|
||||
desc: descriptor,
|
||||
set: set
|
||||
});
|
||||
}, can[descriptor[1]] = descriptor[0], "x" == descriptor[1] && 1 == descriptor[0] && (set.has1x = !0),
|
||||
set.cands.push(can));
|
||||
}
|
||||
return set.cands;
|
||||
};
|
||||
var eminpx, memDescriptor = {}, regDescriptor = /^([\+eE\d\.]+)(w|x)$/, regHDesc = /\s*\d+h\s*/, baseStyle = "position:absolute;left:0;visibility:hidden;display:block;padding:0;border:none;font-size:1em;width:1em;overflow:hidden;clip:rect(0px, 0px, 0px, 0px)", fsCss = "font-size:100%!important;";
|
||||
ri.getEmValue = function() {
|
||||
}, ri.getEmValue = function() {
|
||||
var body;
|
||||
if (!eminpx && (body = document.body)) {
|
||||
var div = document.createElement("div"), originalHTMLCSS = docElem.style.cssText, originalBodyCSS = body.style.cssText;
|
||||
@ -196,75 +178,64 @@
|
||||
}
|
||||
return sizeLengthCache[sourceSizeListStr];
|
||||
}, ri.setRes = function(set) {
|
||||
var candidates, candidate;
|
||||
var candidates;
|
||||
if (set) {
|
||||
candidates = ri.parseSet(set);
|
||||
for (var i = 0, len = candidates.length; len > i; i++) candidate = candidates[i],
|
||||
candidate.descriptor || setResolution(candidate, set.sizes);
|
||||
for (var i = 0, len = candidates.length; len > i; i++) setResolution(candidates[i], set.sizes);
|
||||
}
|
||||
return candidates;
|
||||
}, ri.applySetCandidate = function(candidates, img) {
|
||||
}, ri.setRes.res = setResolution, ri.applySetCandidate = function(candidates, img) {
|
||||
if (candidates.length) {
|
||||
var candidate, dpr, i, j, diff, length, bestCandidate, curSrc, curCan, isSameSet, candidateSrc, oldRes, imageData = img[ri.ns], evaled = !0;
|
||||
var candidate, dpr, i, j, diff, length, bestCandidate, curSrc, curCan, isSameSet, candidateSrc, abortCurSrc, oldRes, imageData = img[ri.ns], evaled = !0, lazyF = lazyFactor, sub = substractCurRes;
|
||||
if (curSrc = imageData.curSrc || img[curSrcProp], curCan = imageData.curCan || setSrcToCur(img, curSrc, candidates[0].set),
|
||||
dpr = ri.DPR, curSrc && (curCan && curCan.res < dpr && (oldRes = curCan.res, curCan.res += cfg.tLazy * Math.pow(curCan.res - .1, isLandscape ? 2.2 : 1.9)),
|
||||
isSameSet = !imageData.pic || curCan && curCan.set == candidates[0].set, curCan && isSameSet && curCan.res >= dpr && (oldRes || tMemory > curCan.res) ? bestCandidate = curCan : supportAbort || img.complete || !getImgAttr.call(img, "src") || img.lazyload || (isSameSet || !inView(img)) && (bestCandidate = curCan,
|
||||
candidateSrc = curSrc, evaled = "L", isWinComplete && reevaluateAfterLoad(img))),
|
||||
!bestCandidate) for (oldRes && (curCan.res = curCan.res - (curCan.res - oldRes) / 2),
|
||||
candidates.sort(ascendingSort), length = candidates.length, bestCandidate = candidates[length - 1],
|
||||
i = 0; length > i; i++) if (candidate = candidates[i], candidate.res >= dpr) {
|
||||
j = i - 1, bestCandidate = candidates[j] && (diff = candidate.res - dpr) && curSrc != ri.makeUrl(candidate.url) && chooseLowRes(candidates[j].res, diff, dpr) ? candidates[j] : candidate;
|
||||
dpr = ri.DPR, oldRes = curCan && curCan.res, !bestCandidate && curSrc && (abortCurSrc = supportAbort && !img.complete && curCan && oldRes > dpr,
|
||||
abortCurSrc || curCan && !(tMemory > oldRes) || (curCan && dpr > oldRes && oldRes > lowTreshHold && (partialLowTreshHold > oldRes && (lazyF *= .87,
|
||||
sub += .04 * dpr), curCan.res += lazyF * Math.pow(oldRes - sub, 2)), isSameSet = !imageData.pic || curCan && curCan.set == candidates[0].set,
|
||||
curCan && isSameSet && curCan.res >= dpr ? bestCandidate = curCan : supportNativeLQIP || img.complete || !getImgAttr.call(img, "src") || img.lazyload || supportAbort && !(5 > imgAbortCount) || !isSameSet && inView(img) || (bestCandidate = curCan,
|
||||
candidateSrc = curSrc, evaled = "L", reevaluateAfterLoad(img)))), !bestCandidate) for (oldRes && (curCan.res = curCan.res - (curCan.res - oldRes) / 2),
|
||||
candidates.sort(ascendingSort), length = candidates.length, bestCandidate = candidates[length - 1],
|
||||
i = 0; length > i; i++) if (candidate = candidates[i], candidate.res >= dpr) {
|
||||
j = i - 1, bestCandidate = candidates[j] && (diff = candidate.res - dpr) && (abortCurSrc || curSrc != ri.makeUrl(candidate.url)) && chooseLowRes(candidates[j].res, diff, dpr) ? candidates[j] : candidate;
|
||||
break;
|
||||
}
|
||||
return oldRes && (curCan.res = oldRes), bestCandidate && (candidateSrc = ri.makeUrl(bestCandidate.url),
|
||||
imageData.curSrc = candidateSrc, imageData.curCan = bestCandidate, candidateSrc != curSrc ? ri.setSrc(img, bestCandidate) : ri.setSize(img)),
|
||||
evaled;
|
||||
imageData.curSrc = candidateSrc, imageData.curCan = bestCandidate, candidateSrc != curSrc && ri.setSrc(img, bestCandidate),
|
||||
ri.setSize(img)), evaled;
|
||||
}
|
||||
};
|
||||
ri.setSrc = function(img, bestCandidate) {
|
||||
var origWidth;
|
||||
img.src = bestCandidate.url, "image/svg+xml" == bestCandidate.set.type && (origWidth = img.style.width,
|
||||
img.style.width = img.offsetWidth + 1 + "px", img.offsetWidth + 1 && (img.style.width = origWidth)),
|
||||
ri.setSize(img);
|
||||
}, ri.setSize = noop, ri.getSet = function(img) {
|
||||
}, ri.setSrc = function(img, bestCandidate) {
|
||||
var origStyle;
|
||||
img.src = bestCandidate.url, reflowBug && (origStyle = img.style.zoom, img.style.zoom = "0.999",
|
||||
img.style.zoom = origStyle);
|
||||
}, ri.getSet = function(img) {
|
||||
var i, set, supportsType, match = !1, sets = img[ri.ns].sets;
|
||||
for (i = 0; i < sets.length && !match; i++) if (set = sets[i], set.srcset && ri.matchesMedia(set.media) && (supportsType = ri.supportsType(set.type))) {
|
||||
"pending" == supportsType && (set = supportsType), match = set;
|
||||
break;
|
||||
}
|
||||
return match;
|
||||
};
|
||||
var alwaysCheckWDescriptor = ri.supSrcset && !ri.supSizes;
|
||||
ri.parseSets = function(element, parent) {
|
||||
var srcsetAttribute, fallbackCandidate, isWDescripor, srcsetParsed, hasPicture = "PICTURE" == parent.nodeName.toUpperCase(), imageData = element[ri.ns];
|
||||
}, ri.parseSets = function(element, parent) {
|
||||
var srcsetAttribute, imageSet, isWDescripor, srcsetParsed, hasPicture = "PICTURE" == parent.nodeName.toUpperCase(), imageData = element[ri.ns];
|
||||
imageData.src === undefined && (imageData.src = getImgAttr.call(element, "src"),
|
||||
imageData.src ? setImgAttr.call(element, srcAttr, imageData.src) : removeImgAttr.call(element, srcAttr)),
|
||||
imageData.srcset === undefined && (srcsetAttribute = getImgAttr.call(element, "srcset"),
|
||||
imageData.srcset = srcsetAttribute, srcsetParsed = !0), imageData.sets = [], hasPicture && (imageData.pic = !0,
|
||||
getAllSourceElements(parent, imageData.sets)), imageData.srcset ? (fallbackCandidate = {
|
||||
getAllSourceElements(parent, imageData.sets)), imageData.srcset ? (imageSet = {
|
||||
srcset: imageData.srcset,
|
||||
sizes: getImgAttr.call(element, "sizes")
|
||||
}, imageData.sets.push(fallbackCandidate), isWDescripor = alwaysCheckWDescriptor || imageData.src ? hasWDescripor(fallbackCandidate) : !1,
|
||||
isWDescripor || !imageData.src || getCandidateForSrc(imageData.src, fallbackCandidate) || hasOneX(fallbackCandidate) || (fallbackCandidate.srcset += ", " + imageData.src,
|
||||
fallbackCandidate.cands = !1)) : imageData.src && imageData.sets.push({
|
||||
}, imageData.sets.push(imageSet), isWDescripor = (alwaysCheckWDescriptor || imageData.src) && regWDesc.test(imageData.srcset || ""),
|
||||
isWDescripor || !imageData.src || getCandidateForSrc(imageData.src, imageSet) || imageSet.has1x || (imageSet.srcset += ", " + imageData.src,
|
||||
imageSet.cands.push({
|
||||
url: imageData.src,
|
||||
x: 1,
|
||||
set: imageSet
|
||||
}))) : imageData.src && imageData.sets.push({
|
||||
srcset: imageData.src,
|
||||
sizes: null
|
||||
}), imageData.curCan = null, imageData.supported = !(hasPicture || fallbackCandidate && !ri.supSrcset || isWDescripor),
|
||||
}), imageData.curCan = null, imageData.supported = !(hasPicture || imageSet && !ri.supSrcset || isWDescripor),
|
||||
srcsetParsed && ri.supSrcset && !imageData.supported && (srcsetAttribute ? (setImgAttr.call(element, srcsetAttr, srcsetAttribute),
|
||||
element.srcset = "") : removeImgAttr.call(element, srcsetAttr)), imageData.supported && !imageData.srcset && (!imageData.src && element.src || element.src != ri.makeUrl(imageData.src)) && (null == imageData.src ? element.removeAttribute("src") : element.src = imageData.src),
|
||||
imageData.parsed = !0;
|
||||
};
|
||||
var reevaluateAfterLoad = function() {
|
||||
var onload = function() {
|
||||
off(this, "load", onload), off(this, "error", onload), ri.fillImgs({
|
||||
elements: [ this ]
|
||||
});
|
||||
};
|
||||
return function(img) {
|
||||
off(img, "load", onload), off(img, "error", onload), on(img, "error", onload), on(img, "load", onload);
|
||||
};
|
||||
}();
|
||||
ri.fillImg = function(element, options) {
|
||||
}, ri.fillImg = function(element, options) {
|
||||
var parent, imageData, extreme = options.reparse || options.reevaluate;
|
||||
if (element[ri.ns] || (element[ri.ns] = {}), imageData = element[ri.ns], "L" == imageData.evaled && element.complete && (imageData.evaled = !1),
|
||||
extreme || !imageData.evaled) {
|
||||
@ -274,28 +245,13 @@
|
||||
}
|
||||
imageData.supported ? imageData.evaled = !0 : applyBestCandidate(element);
|
||||
}
|
||||
};
|
||||
var resizeThrottle;
|
||||
ri.setupRun = function(options) {
|
||||
}, ri.setupRun = function(options) {
|
||||
(!alreadyRun || options.reevaluate || isVwDirty) && (updateMetrics(), options.elements || options.context || clearTimeout(resizeThrottle));
|
||||
}, ri.teardownRun = noop;
|
||||
var alreadyRun = !1, respimage = function(opt) {
|
||||
var elements, i, plen, options = opt || {};
|
||||
if (options.elements && 1 == options.elements.nodeType && ("IMG" == options.elements.nodeName.toUpperCase() ? options.elements = [ options.elements ] : (options.context = options.elements,
|
||||
options.elements = null)), elements = options.elements || ri.qsa(options.context || document, options.reevaluate || options.reparse ? ri.sel : ri.selShort),
|
||||
plen = elements.length) {
|
||||
for (ri.setupRun(options), alreadyRun = !0, i = 0; plen > i; i++) ri.fillImg(elements[i], options);
|
||||
ri.teardownRun(options);
|
||||
}
|
||||
};
|
||||
ri.fillImgs = respimage, window.HTMLPictureElement ? (respimage = noop, ri.fillImg = noop) : !function() {
|
||||
var lDelay;
|
||||
lDelay = supportAbort ? 180 : 400;
|
||||
var run = function() {
|
||||
}, window.HTMLPictureElement ? (respimage = noop, ri.fillImg = noop) : !function() {
|
||||
var isDomReady, regReady = window.attachEvent ? /d$|^c/ : /d$|^c|^i/, run = function() {
|
||||
var readyState = document.readyState || "";
|
||||
clearTimeout(timerId), timerId = setTimeout(run, "loading" == readyState ? lDelay : 2e3),
|
||||
document.body && (/d$|^c/.test(readyState) && (isWinComplete = !0, clearTimeout(timerId),
|
||||
off(document, "readystatechange", run)), ri.fillImgs());
|
||||
timerId = setTimeout(run, "loading" == readyState ? 200 : 999), document.body && (isDomReady = isDomReady || regReady.test(readyState),
|
||||
ri.fillImgs(), isDomReady && (imgAbortCount += 6, clearTimeout(timerId)));
|
||||
}, resizeEval = function() {
|
||||
ri.fillImgs({
|
||||
reevaluate: !0
|
||||
@ -304,134 +260,19 @@
|
||||
clearTimeout(resizeThrottle), isVwDirty = !0, resizeThrottle = setTimeout(resizeEval, 99);
|
||||
}, timerId = setTimeout(run, document.body ? 9 : 99);
|
||||
on(window, "resize", onResize), on(document, "readystatechange", run);
|
||||
}(), respimage._ = ri, respimage.config = function(name, value, value2) {
|
||||
if ("addType" == name) {
|
||||
if (types[value] = value2, "pending" == value2) return;
|
||||
} else cfg[name] = value;
|
||||
alreadyRun && ri.fillImgs({
|
||||
reevaluate: !0
|
||||
});
|
||||
}, window.respimage = respimage;
|
||||
}(), ri.respimage = respimage, ri.fillImgs = respimage, ri.teardownRun = noop, respimage._ = ri,
|
||||
window.respimage = respimage, window.respimgCFG = {
|
||||
ri: ri,
|
||||
push: function(args) {
|
||||
var name = args.shift();
|
||||
"function" == typeof ri[name] ? ri[name].apply(ri, args) : (cfg[name] = args[0],
|
||||
alreadyRun && ri.fillImgs({
|
||||
reevaluate: !0
|
||||
}));
|
||||
}
|
||||
};
|
||||
for (;setOptions && setOptions.length; ) window.respimgCFG.push(setOptions.shift());
|
||||
}(window, document);
|
||||
|
||||
(function( factory ) {
|
||||
"use strict";
|
||||
var interValId;
|
||||
var intervalIndex = 0;
|
||||
var run = function(){
|
||||
if ( window.respimage ) {
|
||||
factory( window.respimage );
|
||||
}
|
||||
if(window.respimage || intervalIndex > 9999){
|
||||
clearInterval(interValId);
|
||||
}
|
||||
intervalIndex++;
|
||||
};
|
||||
interValId = setInterval(run, 8);
|
||||
|
||||
run();
|
||||
|
||||
}( function( respimage, undefined ) {
|
||||
"use strict";
|
||||
|
||||
var ri = respimage._;
|
||||
var knownWidths = {};
|
||||
var cfg = ri.cfg;
|
||||
var curSrcProp = "currentSrc";
|
||||
var setSize = function(width, img, data){
|
||||
var curCandidate = data.curCan;
|
||||
|
||||
if ( width ) {
|
||||
if ( curCandidate.desc.type == "x" ) {
|
||||
img.setAttribute( "width", parseInt( (width / curCandidate.res) / cfg.xQuant, 10) );
|
||||
} else if ( curCandidate.desc.type == "w" ) {
|
||||
img.setAttribute( "width", parseInt( curCandidate.cWidth * (width / curCandidate.desc.val), 10) );
|
||||
}
|
||||
}
|
||||
};
|
||||
var loadBg = function(url, img, data){
|
||||
var bgImg;
|
||||
var curCandidate;
|
||||
if(knownWidths[url]){
|
||||
setSize(knownWidths[url], img, data);
|
||||
} else {
|
||||
curCandidate = data.curCan;
|
||||
if(curCandidate.desc.type == 'w'){
|
||||
setSize(curCandidate.desc.val, img, data);
|
||||
}
|
||||
|
||||
bgImg = document.createElement('img');
|
||||
bgImg.onload = function(){
|
||||
knownWidths[url] = bgImg.naturalWidth || bgImg.width;
|
||||
if(url == img[curSrcProp]){
|
||||
setSize(knownWidths[url], img, data);
|
||||
}
|
||||
bgImg.onload = null;
|
||||
bgImg.onerror = null;
|
||||
img = null;
|
||||
bgImg = null;
|
||||
};
|
||||
bgImg.onerror = function(){
|
||||
img = null;
|
||||
bgImg.onload = null;
|
||||
bgImg.onerror = null;
|
||||
bgImg = null;
|
||||
};
|
||||
bgImg.src = url;
|
||||
|
||||
if(bgImg && bgImg.complete){
|
||||
bgImg.onload();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
var reeval = (function(){
|
||||
var running, timer;
|
||||
var run = function(){
|
||||
running = false;
|
||||
clearTimeout(timer);
|
||||
respimage({reevaluate: true});
|
||||
};
|
||||
|
||||
return function(){
|
||||
if(!running && cfg.addSize){
|
||||
running = true;
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(run, 33);
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
if( !(curSrcProp in document.createElement("img")) ){
|
||||
curSrcProp = "src";
|
||||
}
|
||||
|
||||
cfg.addSize = true;
|
||||
|
||||
ri.setSize = function( img ) {
|
||||
var url;
|
||||
var data = img[ ri.ns ];
|
||||
var curCandidate = data.curCan;
|
||||
|
||||
if ( data.dims === undefined ) {
|
||||
data.dims = img.getAttribute( "height" ) && img.getAttribute( "width" );
|
||||
}
|
||||
|
||||
if ( !cfg.addSize || !curCandidate || data.dims ) {return;}
|
||||
url = ri.makeUrl(curCandidate.url);
|
||||
if(url == img[curSrcProp]){
|
||||
loadBg(url, img, data);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if(window.addEventListener){
|
||||
addEventListener('resize', reeval, false);
|
||||
}
|
||||
respimage({reevaluate: true});
|
||||
}));
|
||||
|
||||
(function( factory ) {
|
||||
"use strict";
|
||||
var interValId;
|
||||
@ -524,6 +365,148 @@
|
||||
|
||||
}));
|
||||
|
||||
(function( factory ) {
|
||||
"use strict";
|
||||
var interValId;
|
||||
var intervalIndex = 0;
|
||||
var run = function(){
|
||||
if ( window.respimage ) {
|
||||
factory( window.respimage );
|
||||
}
|
||||
if(window.respimage || intervalIndex > 9999){
|
||||
clearInterval(interValId);
|
||||
}
|
||||
intervalIndex++;
|
||||
};
|
||||
interValId = setInterval(run, 8);
|
||||
|
||||
run();
|
||||
|
||||
}( function( respimage, undefined ) {
|
||||
"use strict";
|
||||
|
||||
var ri = respimage._;
|
||||
var knownWidths = {};
|
||||
var cfg = ri.cfg;
|
||||
var curSrcProp = "currentSrc";
|
||||
var setSize = function(width, img, data){
|
||||
var curCandidate = data.curCan;
|
||||
|
||||
if ( width ) {
|
||||
img.setAttribute( "width", parseInt(width / curCandidate.res, 10) );
|
||||
}
|
||||
};
|
||||
var loadBg = function(url, img, data){
|
||||
var bgImg, curCandidate, clear;
|
||||
|
||||
|
||||
if(knownWidths[url]){
|
||||
setSize(knownWidths[url], img, data);
|
||||
} else {
|
||||
clear = function(){
|
||||
data.pendingURLSize = null;
|
||||
bgImg.onload = null;
|
||||
bgImg.onerror = null;
|
||||
img = null;
|
||||
bgImg = null;
|
||||
};
|
||||
|
||||
data.pendingURLSize = url;
|
||||
curCandidate = data.curCan;
|
||||
|
||||
if(curCandidate.w){
|
||||
setSize(curCandidate.w, img, data);
|
||||
}
|
||||
|
||||
bgImg = document.createElement('img');
|
||||
|
||||
bgImg.onload = function(){
|
||||
knownWidths[url] = bgImg.naturalWidth || bgImg.width;
|
||||
if(url == img[curSrcProp]){
|
||||
setSize(knownWidths[url], img, data);
|
||||
}
|
||||
clear();
|
||||
};
|
||||
bgImg.onerror = clear;
|
||||
|
||||
bgImg.src = url;
|
||||
|
||||
if(bgImg && bgImg.complete){
|
||||
bgImg.onload();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
var reeval = (function(){
|
||||
var running, timer;
|
||||
|
||||
var run = function(){
|
||||
var i, len, imgData;
|
||||
var imgs = document.getElementsByTagName('img');
|
||||
var options = {elements: []};
|
||||
|
||||
ri.setupRun(options);
|
||||
|
||||
running = false;
|
||||
clearTimeout(timer);
|
||||
|
||||
for(i = 0, len = imgs.length; i < len; i++){
|
||||
imgData = imgs[i][ri.ns];
|
||||
|
||||
if(imgData && imgData.curCan){
|
||||
ri.setRes.res(imgData.curCan, imgData.curCan.set.sizes);
|
||||
ri.setSize(imgs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
ri.teardownRun( options );
|
||||
};
|
||||
|
||||
return function(){
|
||||
if(!running && cfg.addSize){
|
||||
running = true;
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(run);
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
if( !(curSrcProp in document.createElement("img")) ){
|
||||
curSrcProp = "src";
|
||||
}
|
||||
|
||||
ri.setSize = function( img ) {
|
||||
var url;
|
||||
var data = img[ ri.ns ];
|
||||
var curCandidate = data.curCan;
|
||||
|
||||
if ( data.dims === undefined ) {
|
||||
data.dims = img.getAttribute( "height" ) && img.getAttribute( "width" );
|
||||
}
|
||||
|
||||
if ( !cfg.addSize || !curCandidate || data.dims ) {return;}
|
||||
url = ri.makeUrl(curCandidate.url);
|
||||
|
||||
if(url == img[curSrcProp] && url !== data.pendingURLSize){
|
||||
loadBg(url, img, data);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if(window.addEventListener){
|
||||
addEventListener('resize', reeval, false);
|
||||
}
|
||||
|
||||
if(!('addSize' in cfg)){
|
||||
cfg.addSize = true;
|
||||
} else {
|
||||
cfg.addSize = !!cfg.addSize;
|
||||
}
|
||||
|
||||
reeval();
|
||||
}));
|
||||
|
||||
|
||||
(function(){
|
||||
|
||||
@ -537,8 +520,7 @@
|
||||
})();
|
||||
|
||||
|
||||
;/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */
|
||||
|
||||
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */
|
||||
window.matchMedia || (window.matchMedia = function() {
|
||||
"use strict";
|
||||
|
||||
|
@ -209,7 +209,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
|
||||
|
||||
});
|
||||
;webshims.register('form-number-date-api', function($, webshims, window, document, undefined, options){
|
||||
webshims.register('form-number-date-api', function ($, webshims, window, document, undefined, options) {
|
||||
"use strict";
|
||||
if(!webshims.addInputType){
|
||||
webshims.error("you can not call forms-ext feature after calling forms feature. call both at once instead: $.webshims.polyfill('forms forms-ext')");
|
||||
@ -825,7 +825,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
}
|
||||
|
||||
});
|
||||
;(function($){
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
var isNumber = function(string){
|
||||
@ -1445,7 +1445,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
webshims.isReady('range-ui', true);
|
||||
}
|
||||
})(window.webshims ? webshims.$ : jQuery);
|
||||
;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
|
||||
webshims.register('form-number-date-ui', function ($, webshims, window, document, undefined, options) {
|
||||
"use strict";
|
||||
var curCfg;
|
||||
var formcfg = webshims.formcfg;
|
||||
@ -2010,9 +2010,9 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
return val;
|
||||
},
|
||||
month: function(val, opts, noCorrect){
|
||||
|
||||
var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
|
||||
|
||||
var regSplit = opts.monthNames == 'monthNamesShort' ? /[\s-\/\\]+/ : /[\.\s-\/\\]+/;
|
||||
var p = (!opts.splitInput) ? val.trim().split(regSplit) : val;
|
||||
|
||||
if(p.length == 2 && p[0] && p[1]){
|
||||
p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0];
|
||||
p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1];
|
||||
@ -2484,34 +2484,35 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
var isValue = name == 'value';
|
||||
spinBtnProto[name] = function(val, force, isLive){
|
||||
var selectionEnd;
|
||||
if(isValue){
|
||||
this._beforeValue(val);
|
||||
} else {
|
||||
this.elemHelper.prop(name, val);
|
||||
}
|
||||
if(!this._init || force || val || this.options[name] !== val){
|
||||
if(isValue){
|
||||
this._beforeValue(val);
|
||||
} else {
|
||||
this.elemHelper.prop(name, val);
|
||||
}
|
||||
|
||||
val = formatVal[this.type](val, this.options);
|
||||
if(this.options.splitInput){
|
||||
$.each(this.splits, function(i, elem){
|
||||
var setOption;
|
||||
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
||||
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
||||
} else {
|
||||
$.prop(elem, name, val[i]);
|
||||
val = formatVal[this.type](val, this.options);
|
||||
if(this.options.splitInput){
|
||||
$.each(this.splits, function(i, elem){
|
||||
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
||||
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
||||
} else {
|
||||
$.prop(elem, name, val[i]);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
val = this.toFixed(val);
|
||||
if(isLive && this._getSelectionEnd){
|
||||
selectionEnd = this._getSelectionEnd(val);
|
||||
}
|
||||
this.element.prop(name, val);
|
||||
if(selectionEnd != null){
|
||||
this.element.prop('selectionEnd', selectionEnd);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
val = this.toFixed(val);
|
||||
if(isLive && this._getSelectionEnd){
|
||||
selectionEnd = this._getSelectionEnd(val);
|
||||
}
|
||||
this.element.prop(name, val);
|
||||
if(selectionEnd != null){
|
||||
this.element.prop('selectionEnd', selectionEnd);
|
||||
}
|
||||
this._propertyChange(name);
|
||||
this.mirrorValidity();
|
||||
}
|
||||
this._propertyChange(name);
|
||||
this.mirrorValidity();
|
||||
};
|
||||
});
|
||||
|
||||
@ -2861,7 +2862,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
} else {
|
||||
popover.hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
options.containerElements.push(popover.element[0]);
|
||||
@ -2967,7 +2968,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
popover.activeElement.focus();
|
||||
}, 4);
|
||||
}
|
||||
if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
|
||||
if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
|
||||
popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
|
||||
show();
|
||||
}
|
||||
@ -3284,7 +3285,11 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
$(data.shim.options.containerElements)
|
||||
.on({
|
||||
'focusin focus focusout blur': function(e){
|
||||
e.stopImmediatePropagation();
|
||||
if(e.type == 'focus'){
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
hasFocus = has[e.type];
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function(){
|
||||
|
@ -209,7 +209,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
|
||||
|
||||
});
|
||||
;webshims.register('form-number-date-api', function($, webshims, window, document, undefined, options){
|
||||
webshims.register('form-number-date-api', function ($, webshims, window, document, undefined, options) {
|
||||
"use strict";
|
||||
if(!webshims.addInputType){
|
||||
webshims.error("you can not call forms-ext feature after calling forms feature. call both at once instead: $.webshims.polyfill('forms forms-ext')");
|
||||
@ -825,7 +825,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
}
|
||||
|
||||
});
|
||||
;(function($){
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
var isNumber = function(string){
|
||||
@ -1445,7 +1445,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
webshims.isReady('range-ui', true);
|
||||
}
|
||||
})(window.webshims ? webshims.$ : jQuery);
|
||||
;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
|
||||
webshims.register('form-number-date-ui', function ($, webshims, window, document, undefined, options) {
|
||||
"use strict";
|
||||
var curCfg;
|
||||
var formcfg = webshims.formcfg;
|
||||
@ -2010,9 +2010,9 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
return val;
|
||||
},
|
||||
month: function(val, opts, noCorrect){
|
||||
|
||||
var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
|
||||
|
||||
var regSplit = opts.monthNames == 'monthNamesShort' ? /[\s-\/\\]+/ : /[\.\s-\/\\]+/;
|
||||
var p = (!opts.splitInput) ? val.trim().split(regSplit) : val;
|
||||
|
||||
if(p.length == 2 && p[0] && p[1]){
|
||||
p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0];
|
||||
p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1];
|
||||
@ -2484,34 +2484,35 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
var isValue = name == 'value';
|
||||
spinBtnProto[name] = function(val, force, isLive){
|
||||
var selectionEnd;
|
||||
if(isValue){
|
||||
this._beforeValue(val);
|
||||
} else {
|
||||
this.elemHelper.prop(name, val);
|
||||
}
|
||||
if(!this._init || force || val || this.options[name] !== val){
|
||||
if(isValue){
|
||||
this._beforeValue(val);
|
||||
} else {
|
||||
this.elemHelper.prop(name, val);
|
||||
}
|
||||
|
||||
val = formatVal[this.type](val, this.options);
|
||||
if(this.options.splitInput){
|
||||
$.each(this.splits, function(i, elem){
|
||||
var setOption;
|
||||
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
||||
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
||||
} else {
|
||||
$.prop(elem, name, val[i]);
|
||||
val = formatVal[this.type](val, this.options);
|
||||
if(this.options.splitInput){
|
||||
$.each(this.splits, function(i, elem){
|
||||
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
||||
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
||||
} else {
|
||||
$.prop(elem, name, val[i]);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
val = this.toFixed(val);
|
||||
if(isLive && this._getSelectionEnd){
|
||||
selectionEnd = this._getSelectionEnd(val);
|
||||
}
|
||||
this.element.prop(name, val);
|
||||
if(selectionEnd != null){
|
||||
this.element.prop('selectionEnd', selectionEnd);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
val = this.toFixed(val);
|
||||
if(isLive && this._getSelectionEnd){
|
||||
selectionEnd = this._getSelectionEnd(val);
|
||||
}
|
||||
this.element.prop(name, val);
|
||||
if(selectionEnd != null){
|
||||
this.element.prop('selectionEnd', selectionEnd);
|
||||
}
|
||||
this._propertyChange(name);
|
||||
this.mirrorValidity();
|
||||
}
|
||||
this._propertyChange(name);
|
||||
this.mirrorValidity();
|
||||
};
|
||||
});
|
||||
|
||||
@ -2861,7 +2862,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
} else {
|
||||
popover.hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
options.containerElements.push(popover.element[0]);
|
||||
@ -2967,7 +2968,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
popover.activeElement.focus();
|
||||
}, 4);
|
||||
}
|
||||
if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
|
||||
if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
|
||||
popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
|
||||
show();
|
||||
}
|
||||
@ -3284,7 +3285,11 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
$(data.shim.options.containerElements)
|
||||
.on({
|
||||
'focusin focus focusout blur': function(e){
|
||||
e.stopImmediatePropagation();
|
||||
if(e.type == 'focus'){
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
hasFocus = has[e.type];
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function(){
|
||||
@ -3449,7 +3454,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
||||
})();
|
||||
});
|
||||
|
||||
;webshims.register('form-datalist', function($, webshims, window, document, undefined, options){
|
||||
webshims.register('form-datalist', function ($, webshims, window, document, undefined, options) {
|
||||
"use strict";
|
||||
var lazyLoad = function(name){
|
||||
if(!name || typeof name != 'string'){
|
||||
|
@ -1234,7 +1234,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
||||
|
||||
})();
|
||||
});
|
||||
;(function($){
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
var isNumber = function(string){
|
||||
@ -1854,7 +1854,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
||||
webshims.isReady('range-ui', true);
|
||||
}
|
||||
})(window.webshims ? webshims.$ : jQuery);
|
||||
;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
|
||||
webshims.register('form-number-date-ui', function ($, webshims, window, document, undefined, options) {
|
||||
"use strict";
|
||||
var curCfg;
|
||||
var formcfg = webshims.formcfg;
|
||||
@ -2419,9 +2419,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
||||
return val;
|
||||
},
|
||||
month: function(val, opts, noCorrect){
|
||||
|
||||
var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
|
||||
|
||||
var regSplit = opts.monthNames == 'monthNamesShort' ? /[\s-\/\\]+/ : /[\.\s-\/\\]+/;
|
||||
var p = (!opts.splitInput) ? val.trim().split(regSplit) : val;
|
||||
|
||||
if(p.length == 2 && p[0] && p[1]){
|
||||
p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0];
|
||||
p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1];
|
||||
@ -2893,34 +2893,35 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
||||
var isValue = name == 'value';
|
||||
spinBtnProto[name] = function(val, force, isLive){
|
||||
var selectionEnd;
|
||||
if(isValue){
|
||||
this._beforeValue(val);
|
||||
} else {
|
||||
this.elemHelper.prop(name, val);
|
||||
}
|
||||
if(!this._init || force || val || this.options[name] !== val){
|
||||
if(isValue){
|
||||
this._beforeValue(val);
|
||||
} else {
|
||||
this.elemHelper.prop(name, val);
|
||||
}
|
||||
|
||||
val = formatVal[this.type](val, this.options);
|
||||
if(this.options.splitInput){
|
||||
$.each(this.splits, function(i, elem){
|
||||
var setOption;
|
||||
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
||||
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
||||
} else {
|
||||
$.prop(elem, name, val[i]);
|
||||
val = formatVal[this.type](val, this.options);
|
||||
if(this.options.splitInput){
|
||||
$.each(this.splits, function(i, elem){
|
||||
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
||||
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
||||
} else {
|
||||
$.prop(elem, name, val[i]);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
val = this.toFixed(val);
|
||||
if(isLive && this._getSelectionEnd){
|
||||
selectionEnd = this._getSelectionEnd(val);
|
||||
}
|
||||
this.element.prop(name, val);
|
||||
if(selectionEnd != null){
|
||||
this.element.prop('selectionEnd', selectionEnd);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
val = this.toFixed(val);
|
||||
if(isLive && this._getSelectionEnd){
|
||||
selectionEnd = this._getSelectionEnd(val);
|
||||
}
|
||||
this.element.prop(name, val);
|
||||
if(selectionEnd != null){
|
||||
this.element.prop('selectionEnd', selectionEnd);
|
||||
}
|
||||
this._propertyChange(name);
|
||||
this.mirrorValidity();
|
||||
}
|
||||
this._propertyChange(name);
|
||||
this.mirrorValidity();
|
||||
};
|
||||
});
|
||||
|
||||
@ -3270,7 +3271,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
||||
} else {
|
||||
popover.hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
options.containerElements.push(popover.element[0]);
|
||||
@ -3376,7 +3377,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
||||
popover.activeElement.focus();
|
||||
}, 4);
|
||||
}
|
||||
if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
|
||||
if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
|
||||
popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
|
||||
show();
|
||||
}
|
||||
@ -3693,7 +3694,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
||||
$(data.shim.options.containerElements)
|
||||
.on({
|
||||
'focusin focus focusout blur': function(e){
|
||||
e.stopImmediatePropagation();
|
||||
if(e.type == 'focus'){
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
hasFocus = has[e.type];
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function(){
|
||||
@ -3858,7 +3863,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
||||
})();
|
||||
});
|
||||
|
||||
;webshims.register('form-datalist', function($, webshims, window, document, undefined, options){
|
||||
webshims.register('form-datalist', function ($, webshims, window, document, undefined, options) {
|
||||
"use strict";
|
||||
var lazyLoad = function(name){
|
||||
if(!name || typeof name != 'string'){
|
||||
|
@ -563,9 +563,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
||||
return val;
|
||||
},
|
||||
month: function(val, opts, noCorrect){
|
||||
|
||||
var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
|
||||
|
||||
var regSplit = opts.monthNames == 'monthNamesShort' ? /[\s-\/\\]+/ : /[\.\s-\/\\]+/;
|
||||
var p = (!opts.splitInput) ? val.trim().split(regSplit) : val;
|
||||
|
||||
if(p.length == 2 && p[0] && p[1]){
|
||||
p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0];
|
||||
p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1];
|
||||
@ -1037,34 +1037,35 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
||||
var isValue = name == 'value';
|
||||
spinBtnProto[name] = function(val, force, isLive){
|
||||
var selectionEnd;
|
||||
if(isValue){
|
||||
this._beforeValue(val);
|
||||
} else {
|
||||
this.elemHelper.prop(name, val);
|
||||
}
|
||||
if(!this._init || force || val || this.options[name] !== val){
|
||||
if(isValue){
|
||||
this._beforeValue(val);
|
||||
} else {
|
||||
this.elemHelper.prop(name, val);
|
||||
}
|
||||
|
||||
val = formatVal[this.type](val, this.options);
|
||||
if(this.options.splitInput){
|
||||
$.each(this.splits, function(i, elem){
|
||||
var setOption;
|
||||
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
||||
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
||||
} else {
|
||||
$.prop(elem, name, val[i]);
|
||||
val = formatVal[this.type](val, this.options);
|
||||
if(this.options.splitInput){
|
||||
$.each(this.splits, function(i, elem){
|
||||
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
||||
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
||||
} else {
|
||||
$.prop(elem, name, val[i]);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
val = this.toFixed(val);
|
||||
if(isLive && this._getSelectionEnd){
|
||||
selectionEnd = this._getSelectionEnd(val);
|
||||
}
|
||||
this.element.prop(name, val);
|
||||
if(selectionEnd != null){
|
||||
this.element.prop('selectionEnd', selectionEnd);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
val = this.toFixed(val);
|
||||
if(isLive && this._getSelectionEnd){
|
||||
selectionEnd = this._getSelectionEnd(val);
|
||||
}
|
||||
this.element.prop(name, val);
|
||||
if(selectionEnd != null){
|
||||
this.element.prop('selectionEnd', selectionEnd);
|
||||
}
|
||||
this._propertyChange(name);
|
||||
this.mirrorValidity();
|
||||
}
|
||||
this._propertyChange(name);
|
||||
this.mirrorValidity();
|
||||
};
|
||||
});
|
||||
|
||||
@ -1414,7 +1415,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
||||
} else {
|
||||
popover.hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
options.containerElements.push(popover.element[0]);
|
||||
@ -1520,7 +1521,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
||||
popover.activeElement.focus();
|
||||
}, 4);
|
||||
}
|
||||
if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
|
||||
if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
|
||||
popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
|
||||
show();
|
||||
}
|
||||
@ -1837,7 +1838,11 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
||||
$(data.shim.options.containerElements)
|
||||
.on({
|
||||
'focusin focus focusout blur': function(e){
|
||||
e.stopImmediatePropagation();
|
||||
if(e.type == 'focus'){
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
hasFocus = has[e.type];
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function(){
|
||||
|
@ -643,7 +643,7 @@ webshims.register('form-validation', function($, webshims, window, document, und
|
||||
var errorBox = $('.'+errorBoxClass, fieldWrapper);
|
||||
|
||||
if(!errorBox.length){
|
||||
errorBox = $('<'+errorBoxWrapper+' class="'+ errorBoxClass +'" hidden="hidden" style="display: none;">');
|
||||
errorBox = $('<'+errorBoxWrapper+' class="'+ errorBoxClass +'" hidden="hidden" style="display: none;" />');
|
||||
fieldWrapper.append(errorBox);
|
||||
}
|
||||
if(!errorBox.prop('id')){
|
||||
|
@ -252,8 +252,8 @@ webshims.ready('form-validation', function(){
|
||||
(function(){
|
||||
var formCFG = webshims.cfg.forms;
|
||||
var addCustomValidityRule = webshims.addCustomValidityRule;
|
||||
var getId = function(name){
|
||||
return document.getElementById(name) || document.getElementsByName(name);
|
||||
var getId = function(i, name){
|
||||
return document.getElementById(name) || document.getElementsByName(name)[0];
|
||||
};
|
||||
|
||||
addCustomValidityRule('partialPattern', function(elem, val, pattern){
|
||||
|
@ -62,12 +62,12 @@ webshims.formcfg.fr = {
|
||||
currentText: 'Aujourd\'hui',
|
||||
monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
|
||||
'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
|
||||
monthNamesShort: ['Janv.','Févr.','Mars','Avril','Mai','Juin',
|
||||
'Juil.','Août','Sept.','Oct.','Nov.','Déc.'],
|
||||
monthNamesShort: ['Janv','Févr','Mars','Avril','Mai','Juin',
|
||||
'Juil','Août','Sept','Oct','Nov','Déc'],
|
||||
dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
|
||||
dayNamesShort: ['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'],
|
||||
dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
|
||||
dayNamesMin: ['D','L','M','M','J','V','S'],
|
||||
weekHeader: 'Sem.',
|
||||
weekHeader: 'Sem',
|
||||
firstDay: 1,
|
||||
isRTL: false,
|
||||
showMonthAfterYear: false,
|
||||
|
@ -28,8 +28,8 @@ webshims.validityMessages.nl = {
|
||||
"month": "Maand moet op of voor {%max} zijn."
|
||||
},
|
||||
"stepMismatch": "Ongeldige invoer.",
|
||||
"tooLong": "Voer maximaal {%maxLength} karakter(s) in. {%valueLen} is te lang.",
|
||||
"tooShort": "Voer minimaal {%minLength} karakter(s) in. {%valueLen} is te kort.",
|
||||
"tooLong": "Voer maximaal {%maxlength} karakter(s) in. {%valueLen} is te lang.",
|
||||
"tooShort": "Voer minimaal {%minlength} karakter(s) in. {%valueLen} is te kort.",
|
||||
"patternMismatch": "Voer een waarde in met de gevraagde opmaak: {%title}.",
|
||||
"valueMissing": {
|
||||
"defaultMessage": "Vul dit veld in.",
|
||||
@ -63,59 +63,59 @@ webshims.formcfg.nl = {
|
||||
"nextText": "Volgende",
|
||||
"currentText": "Vandaag",
|
||||
"monthNames": [
|
||||
"januari",
|
||||
"februari",
|
||||
"maart",
|
||||
"april",
|
||||
"mei",
|
||||
"juni",
|
||||
"juli",
|
||||
"augustus",
|
||||
"september",
|
||||
"oktober",
|
||||
"november",
|
||||
"december"
|
||||
"januari",
|
||||
"februari",
|
||||
"maart",
|
||||
"april",
|
||||
"mei",
|
||||
"juni",
|
||||
"juli",
|
||||
"augustus",
|
||||
"september",
|
||||
"oktober",
|
||||
"november",
|
||||
"december"
|
||||
],
|
||||
"monthNamesShort": [
|
||||
"jan",
|
||||
"feb",
|
||||
"mrt",
|
||||
"apr",
|
||||
"mei",
|
||||
"jun",
|
||||
"jul",
|
||||
"aug",
|
||||
"sep",
|
||||
"okt",
|
||||
"nov",
|
||||
"dec"
|
||||
"jan",
|
||||
"feb",
|
||||
"mrt",
|
||||
"apr",
|
||||
"mei",
|
||||
"jun",
|
||||
"jul",
|
||||
"aug",
|
||||
"sep",
|
||||
"okt",
|
||||
"nov",
|
||||
"dec"
|
||||
],
|
||||
"dayNames": [
|
||||
"zondag",
|
||||
"maandag",
|
||||
"dinsdag",
|
||||
"woensdag",
|
||||
"donderdag",
|
||||
"vrijdag",
|
||||
"zaterdag"
|
||||
"zondag",
|
||||
"maandag",
|
||||
"dinsdag",
|
||||
"woensdag",
|
||||
"donderdag",
|
||||
"vrijdag",
|
||||
"zaterdag"
|
||||
],
|
||||
"dayNamesShort": [
|
||||
"zon",
|
||||
"maa",
|
||||
"din",
|
||||
"woe",
|
||||
"don",
|
||||
"vri",
|
||||
"zat"
|
||||
"zon",
|
||||
"maa",
|
||||
"din",
|
||||
"woe",
|
||||
"don",
|
||||
"vri",
|
||||
"zat"
|
||||
],
|
||||
"dayNamesMin": [
|
||||
"zo",
|
||||
"ma",
|
||||
"di",
|
||||
"wo",
|
||||
"do",
|
||||
"vr",
|
||||
"za"
|
||||
"zo",
|
||||
"ma",
|
||||
"di",
|
||||
"wo",
|
||||
"do",
|
||||
"vr",
|
||||
"za"
|
||||
],
|
||||
"weekHeader": "Wk",
|
||||
"firstDay": 1,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*! respimage - v1.1.6 - 2014-11-20
|
||||
/*! respimage - v1.2.1 - 2014-12-23
|
||||
Licensed MIT */
|
||||
!function(window, document, undefined) {
|
||||
"use strict";
|
||||
@ -7,31 +7,18 @@
|
||||
}
|
||||
function updateMetrics() {
|
||||
var dprM;
|
||||
(isVwDirty || DPR != window.devicePixelRatio) && (isVwDirty = !1, DPR = window.devicePixelRatio,
|
||||
cssCache = {}, sizeLengthCache = {}, dprM = (DPR || 1) * cfg.xQuant, cfg.uT || (dprM = Math.min(dprM, 3),
|
||||
dprM > 1.4 && (dprM = Math.round(dprM / (1 + (dprM - 1.4) / 12) * 100) / 100), ri.DPR = dprM),
|
||||
tLow = cfg.tLow * dprM, greed = cfg.greed / 2, greed += greed * dprM, tHigh = cfg.tHigh,
|
||||
tMemory = 2 + dprM, units.width = Math.max(window.innerWidth || 0, docElem.clientWidth),
|
||||
units.height = Math.max(window.innerHeight || 0, docElem.clientHeight), isLandscape = units.width > units.height,
|
||||
units.vw = units.width / 100, units.vh = units.height / 100, units.em = ri.getEmValue(),
|
||||
units.rem = units.em);
|
||||
}
|
||||
function parseDescriptor(descriptor) {
|
||||
if (!(descriptor in memDescriptor)) {
|
||||
var descriptorObj = {
|
||||
val: 1,
|
||||
type: "x"
|
||||
}, parsedDescriptor = trim(descriptor || "");
|
||||
parsedDescriptor && (parsedDescriptor = parsedDescriptor.replace(regHDesc, ""),
|
||||
parsedDescriptor.match(regDescriptor) ? (descriptorObj.val = 1 * RegExp.$1, descriptorObj.type = RegExp.$2) : descriptorObj = !1),
|
||||
memDescriptor[descriptor] = descriptorObj;
|
||||
}
|
||||
return memDescriptor[descriptor];
|
||||
isVwDirty = !1, DPR = window.devicePixelRatio, cssCache = {}, sizeLengthCache = {},
|
||||
dprM = (DPR || 1) * cfg.xQuant, cfg.uT || (cfg.maxX = Math.max(1.3, cfg.maxX), dprM = Math.min(dprM, cfg.maxX),
|
||||
ri.DPR = dprM), units.width = Math.max(window.innerWidth || 0, docElem.clientWidth),
|
||||
units.height = Math.max(window.innerHeight || 0, docElem.clientHeight), units.vw = units.width / 100,
|
||||
units.vh = units.height / 100, units.em = ri.getEmValue(), units.rem = units.em,
|
||||
lazyFactor = cfg.lazyFactor / 2, lazyFactor = lazyFactor * dprM + lazyFactor, substractCurRes = .1 * dprM,
|
||||
lowTreshHold = .5 + .2 * dprM, partialLowTreshHold = .5 + .25 * dprM, tMemory = dprM + 1.3,
|
||||
(isLandscape = units.width > units.height) || (lazyFactor *= .9), supportAbort && (lazyFactor *= .9);
|
||||
}
|
||||
function chooseLowRes(lowRes, diff, dpr) {
|
||||
var add = diff * greed * lowRes;
|
||||
return isLandscape || (add /= 1.5), lowRes += add, diff > tHigh && (lowRes += tLow),
|
||||
lowRes > dpr;
|
||||
var add = diff * Math.pow(lowRes, 2);
|
||||
return isLandscape || (add /= 1.3), lowRes += add, lowRes > dpr;
|
||||
}
|
||||
function inView(el) {
|
||||
if (!el.getBoundingClientRect) return !0;
|
||||
@ -61,20 +48,6 @@
|
||||
}
|
||||
return candidate;
|
||||
}
|
||||
function hasOneX(set) {
|
||||
var i, ret, candidates, desc;
|
||||
if (set) for (candidates = ri.parseSet(set), i = 0; i < candidates.length; i++) if (desc = candidates[i].desc,
|
||||
"x" == desc.type && 1 == desc.val) {
|
||||
ret = !0;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function hasWDescripor(set) {
|
||||
if (!set) return !1;
|
||||
var candidates = ri.parseSet(set);
|
||||
return candidates[0] && "w" == candidates[0].desc.type;
|
||||
}
|
||||
function getAllSourceElements(picture, candidates) {
|
||||
var i, len, source, srcset, sources = picture.getElementsByTagName("source");
|
||||
for (i = 0, len = sources.length; len > i; i++) source = sources[i], source[ri.ns] = !0,
|
||||
@ -85,57 +58,31 @@
|
||||
sizes: source.getAttribute("sizes")
|
||||
});
|
||||
}
|
||||
function setResolution(candidate, sizesattr) {
|
||||
var descriptor = candidate.desc;
|
||||
return "w" == descriptor.type ? (candidate.cWidth = ri.calcListLength(sizesattr || "100vw"),
|
||||
candidate.res = descriptor.val / candidate.cWidth) : candidate.res = descriptor.val,
|
||||
candidate;
|
||||
}
|
||||
document.createElement("picture");
|
||||
var ri = {}, noop = function() {}, image = document.createElement("img"), getImgAttr = image.getAttribute, setImgAttr = image.setAttribute, removeImgAttr = image.removeAttribute, docElem = document.documentElement, types = {}, cfg = {
|
||||
var lowTreshHold, partialLowTreshHold, isLandscape, lazyFactor, tMemory, substractCurRes, eminpx, alwaysCheckWDescriptor, resizeThrottle, ri = {}, noop = function() {}, image = document.createElement("img"), getImgAttr = image.getAttribute, setImgAttr = image.setAttribute, removeImgAttr = image.removeAttribute, docElem = document.documentElement, types = {}, cfg = {
|
||||
xQuant: 1,
|
||||
tLow: .1,
|
||||
tHigh: .6,
|
||||
tLazy: .33,
|
||||
greed: .5
|
||||
}, srcAttr = "data-risrc", srcsetAttr = srcAttr + "set", supportAbort = /rident/.test(navigator.userAgent), curSrcProp = "currentSrc";
|
||||
ri.ns = ("ri" + new Date().getTime()).substr(0, 9), curSrcProp in image || (curSrcProp = "src"),
|
||||
ri.supSrcset = "srcset" in image, ri.supSizes = "sizes" in image, ri.selShort = "picture>img,img[srcset]",
|
||||
ri.sel = ri.selShort, ri.cfg = cfg, ri.supSrcset && (ri.sel += ",img[" + srcsetAttr + "]");
|
||||
var anchor = document.createElement("a");
|
||||
ri.makeUrl = function(src) {
|
||||
return anchor.href = src, anchor.href;
|
||||
}, ri.qsa = function(context, sel) {
|
||||
return context.querySelectorAll(sel);
|
||||
};
|
||||
{
|
||||
var on = function(obj, evt, fn, capture) {
|
||||
obj.addEventListener ? obj.addEventListener(evt, fn, capture || !1) : obj.attachEvent && obj.attachEvent("on" + evt, fn);
|
||||
}, off = function(obj, evt, fn, capture) {
|
||||
obj.removeEventListener ? obj.removeEventListener(evt, fn, capture || !1) : obj.detachEvent && obj.detachEvent("on" + evt, fn);
|
||||
};
|
||||
"https:" == location.protocol;
|
||||
}
|
||||
ri.matchesMedia = function() {
|
||||
return ri.matchesMedia = window.matchMedia && (matchMedia("(min-width: 0.1em)") || {}).matches ? function(media) {
|
||||
return !media || matchMedia(media).matches;
|
||||
} : ri.mMQ, ri.matchesMedia.apply(this, arguments);
|
||||
};
|
||||
var tLow, greed, tHigh, tMemory, isWinComplete, isLandscape, isVwDirty = !0, cssCache = {}, sizeLengthCache = {}, DPR = window.devicePixelRatio, units = {
|
||||
lazyFactor: .4,
|
||||
maxX: 2
|
||||
}, srcAttr = "data-risrc", srcsetAttr = srcAttr + "set", reflowBug = "webkitBackfaceVisibility" in docElem.style, ua = navigator.userAgent, supportNativeLQIP = /AppleWebKit/i.test(ua), supportAbort = /rident/.test(ua) || /ecko/.test(ua) && ua.match(/rv\:(\d+)/) && RegExp.$1 > 35, imgAbortCount = 0, curSrcProp = "currentSrc", regWDesc = /\s+\+?\d+(e\d+)?w/, regSize = /(\([^)]+\))?\s*(.+)/, regDescriptor = /^([\+eE\d\.]+)(w|x)$/, regHDesc = /\s*\d+h\s*/, setOptions = window.respimgCFG, baseStyle = ("https:" == location.protocol,
|
||||
"position:absolute;left:0;visibility:hidden;display:block;padding:0;border:none;font-size:1em;width:1em;overflow:hidden;clip:rect(0px, 0px, 0px, 0px)"), fsCss = "font-size:100%!important;", isVwDirty = !0, cssCache = {}, sizeLengthCache = {}, DPR = window.devicePixelRatio, units = {
|
||||
px: 1,
|
||||
"in": 96
|
||||
};
|
||||
ri.DPR = DPR || 1, ri.u = units, ri.mMQ = function(media) {
|
||||
return media ? evalCSS(media) : !0;
|
||||
};
|
||||
var evalCSS = function() {
|
||||
var cache = {}, regLength = /^([\d\.]+)(em|vw|px)$/, replace = function() {
|
||||
}, anchor = document.createElement("a"), alreadyRun = !1, on = function(obj, evt, fn, capture) {
|
||||
obj.addEventListener ? obj.addEventListener(evt, fn, capture || !1) : obj.attachEvent && obj.attachEvent("on" + evt, fn);
|
||||
}, off = function(obj, evt, fn, capture) {
|
||||
obj.removeEventListener ? obj.removeEventListener(evt, fn, capture || !1) : obj.detachEvent && obj.detachEvent("on" + evt, fn);
|
||||
}, memoize = function(fn) {
|
||||
var cache = {};
|
||||
return function(input) {
|
||||
return input in cache || (cache[input] = fn(input)), cache[input];
|
||||
};
|
||||
}, evalCSS = function() {
|
||||
var regLength = /^([\d\.]+)(em|vw|px)$/, replace = function() {
|
||||
for (var args = arguments, index = 0, string = args[0]; ++index in args; ) string = string.replace(args[index], args[++index]);
|
||||
return string;
|
||||
}, buidlStr = function(css) {
|
||||
return cache[css] || (cache[css] = "return " + replace((css || "").toLowerCase(), /\band\b/g, "&&", /,/g, "||", /min-([a-z-\s]+):/g, "e.$1>=", /max-([a-z-\s]+):/g, "e.$1<=", /calc([^)]+)/g, "($1)", /(\d+[\.]*[\d]*)([a-z]+)/g, "($1 * e.$2)", /^(?!(e.[a-z]|[0-9\.&=|><\+\-\*\(\)\/])).*/gi, "") + ";"),
|
||||
cache[css];
|
||||
};
|
||||
}, buidlStr = memoize(function(css) {
|
||||
return "return " + replace((css || "").toLowerCase(), /\band\b/g, "&&", /,/g, "||", /min-([a-z-\s]+):/g, "e.$1>=", /max-([a-z-\s]+):/g, "e.$1<=", /calc([^)]+)/g, "($1)", /(\d+[\.]*[\d]*)([a-z]+)/g, "($1 * e.$2)", /^(?!(e.[a-z]|[0-9\.&=|><\+\-\*\(\)\/])).*/gi, "");
|
||||
});
|
||||
return function(css, length) {
|
||||
var parsedLength;
|
||||
if (!(css in cssCache)) if (cssCache[css] = !1, length && (parsedLength = css.match(regLength))) cssCache[css] = parsedLength[1] * units[parsedLength[2]]; else try {
|
||||
@ -143,41 +90,76 @@
|
||||
} catch (e) {}
|
||||
return cssCache[css];
|
||||
};
|
||||
}();
|
||||
ri.calcLength = function(sourceSizeValue) {
|
||||
}(), setResolution = function(candidate, sizesattr) {
|
||||
return candidate.w ? (candidate.cWidth = ri.calcListLength(sizesattr || "100vw"),
|
||||
candidate.res = candidate.w / candidate.cWidth) : candidate.res = candidate.x, candidate;
|
||||
}, respimage = function(opt) {
|
||||
var elements, i, plen, options = opt || {};
|
||||
if (options.elements && 1 == options.elements.nodeType && ("IMG" == options.elements.nodeName.toUpperCase() ? options.elements = [ options.elements ] : (options.context = options.elements,
|
||||
options.elements = null)), elements = options.elements || ri.qsa(options.context || document, options.reevaluate || options.reparse ? ri.sel : ri.selShort),
|
||||
plen = elements.length) {
|
||||
for (ri.setupRun(options), alreadyRun = !0, i = 0; plen > i; i++) imgAbortCount++,
|
||||
6 > imgAbortCount && !elements[i].complete && imgAbortCount++, ri.fillImg(elements[i], options);
|
||||
ri.teardownRun(options), imgAbortCount++;
|
||||
}
|
||||
}, reevaluateAfterLoad = function() {
|
||||
var onload = function() {
|
||||
off(this, "load", onload), off(this, "error", onload), ri.fillImgs({
|
||||
elements: [ this ]
|
||||
});
|
||||
};
|
||||
return function(img) {
|
||||
off(img, "load", onload), off(img, "error", onload), on(img, "error", onload), on(img, "load", onload);
|
||||
};
|
||||
}(), parseDescriptor = memoize(function(descriptor) {
|
||||
var descriptorObj = [ 1, "x" ], parsedDescriptor = trim(descriptor || "");
|
||||
return parsedDescriptor && (parsedDescriptor = parsedDescriptor.replace(regHDesc, ""),
|
||||
descriptorObj = parsedDescriptor.match(regDescriptor) ? [ 1 * RegExp.$1, RegExp.$2 ] : !1),
|
||||
descriptorObj;
|
||||
});
|
||||
curSrcProp in image || (curSrcProp = "src"), types["image/jpeg"] = !0, types["image/gif"] = !0,
|
||||
types["image/png"] = !0, types["image/svg+xml"] = document.implementation.hasFeature("http://wwwindow.w3.org/TR/SVG11/feature#Image", "1.1"),
|
||||
ri.ns = ("ri" + new Date().getTime()).substr(0, 9), ri.supSrcset = "srcset" in image,
|
||||
ri.supSizes = "sizes" in image, ri.selShort = "picture>img,img[srcset]", ri.sel = ri.selShort,
|
||||
ri.cfg = cfg, ri.supSrcset && (ri.sel += ",img[" + srcsetAttr + "]"), ri.DPR = DPR || 1,
|
||||
ri.u = units, ri.types = types, alwaysCheckWDescriptor = ri.supSrcset && !ri.supSizes,
|
||||
ri.setSize = noop, ri.makeUrl = memoize(function(src) {
|
||||
return anchor.href = src, anchor.href;
|
||||
}), ri.qsa = function(context, sel) {
|
||||
return context.querySelectorAll(sel);
|
||||
}, ri.matchesMedia = function() {
|
||||
return ri.matchesMedia = window.matchMedia && (matchMedia("(min-width: 0.1em)") || {}).matches ? function(media) {
|
||||
return !media || matchMedia(media).matches;
|
||||
} : ri.mMQ, ri.matchesMedia.apply(this, arguments);
|
||||
}, ri.mMQ = function(media) {
|
||||
return media ? evalCSS(media) : !0;
|
||||
}, ri.calcLength = function(sourceSizeValue) {
|
||||
var value = evalCSS(sourceSizeValue, !0) || !1;
|
||||
return 0 > value && (value = !1), value;
|
||||
}, ri.types = types, types["image/jpeg"] = !0, types["image/gif"] = !0, types["image/png"] = !0,
|
||||
types["image/svg+xml"] = document.implementation.hasFeature("http://wwwindow.w3.org/TR/SVG11/feature#Image", "1.1"),
|
||||
ri.supportsType = function(type) {
|
||||
return type ? types[type] : !0;
|
||||
}, ri.supportsType = function(type) {
|
||||
return type ? types[type] : !0;
|
||||
}, ri.parseSize = memoize(function(sourceSizeStr) {
|
||||
var match = (sourceSizeStr || "").match(regSize);
|
||||
return {
|
||||
media: match && match[1],
|
||||
length: match && match[2]
|
||||
};
|
||||
var regSize = /(\([^)]+\))?\s*(.+)/, memSize = {};
|
||||
ri.parseSize = function(sourceSizeStr) {
|
||||
var match;
|
||||
return memSize[sourceSizeStr] || (match = (sourceSizeStr || "").match(regSize),
|
||||
memSize[sourceSizeStr] = {
|
||||
media: match && match[1],
|
||||
length: match && match[2]
|
||||
}), memSize[sourceSizeStr];
|
||||
}, ri.parseSet = function(set) {
|
||||
}), ri.parseSet = function(set) {
|
||||
if (!set.cands) {
|
||||
var pos, url, descriptor, last, descpos, srcset = set.srcset;
|
||||
var pos, url, descriptor, last, descpos, can, srcset = set.srcset;
|
||||
for (set.cands = []; srcset; ) srcset = srcset.replace(/^\s+/g, ""), pos = srcset.search(/\s/g),
|
||||
descriptor = null, -1 != pos ? (url = srcset.slice(0, pos), last = url.charAt(url.length - 1),
|
||||
"," != last && url || (url = url.replace(/,+$/, ""), descriptor = ""), srcset = srcset.slice(pos + 1),
|
||||
null == descriptor && (descpos = srcset.indexOf(","), -1 != descpos ? (descriptor = srcset.slice(0, descpos),
|
||||
srcset = srcset.slice(descpos + 1)) : (descriptor = srcset, srcset = ""))) : (url = srcset,
|
||||
srcset = ""), url && (descriptor = parseDescriptor(descriptor)) && set.cands.push({
|
||||
srcset = ""), url && (descriptor = parseDescriptor(descriptor)) && (can = {
|
||||
url: url.replace(/^,+/, ""),
|
||||
desc: descriptor,
|
||||
set: set
|
||||
});
|
||||
}, can[descriptor[1]] = descriptor[0], "x" == descriptor[1] && 1 == descriptor[0] && (set.has1x = !0),
|
||||
set.cands.push(can));
|
||||
}
|
||||
return set.cands;
|
||||
};
|
||||
var eminpx, memDescriptor = {}, regDescriptor = /^([\+eE\d\.]+)(w|x)$/, regHDesc = /\s*\d+h\s*/, baseStyle = "position:absolute;left:0;visibility:hidden;display:block;padding:0;border:none;font-size:1em;width:1em;overflow:hidden;clip:rect(0px, 0px, 0px, 0px)", fsCss = "font-size:100%!important;";
|
||||
ri.getEmValue = function() {
|
||||
}, ri.getEmValue = function() {
|
||||
var body;
|
||||
if (!eminpx && (body = document.body)) {
|
||||
var div = document.createElement("div"), originalHTMLCSS = docElem.style.cssText, originalBodyCSS = body.style.cssText;
|
||||
@ -196,75 +178,64 @@
|
||||
}
|
||||
return sizeLengthCache[sourceSizeListStr];
|
||||
}, ri.setRes = function(set) {
|
||||
var candidates, candidate;
|
||||
var candidates;
|
||||
if (set) {
|
||||
candidates = ri.parseSet(set);
|
||||
for (var i = 0, len = candidates.length; len > i; i++) candidate = candidates[i],
|
||||
candidate.descriptor || setResolution(candidate, set.sizes);
|
||||
for (var i = 0, len = candidates.length; len > i; i++) setResolution(candidates[i], set.sizes);
|
||||
}
|
||||
return candidates;
|
||||
}, ri.applySetCandidate = function(candidates, img) {
|
||||
}, ri.setRes.res = setResolution, ri.applySetCandidate = function(candidates, img) {
|
||||
if (candidates.length) {
|
||||
var candidate, dpr, i, j, diff, length, bestCandidate, curSrc, curCan, isSameSet, candidateSrc, oldRes, imageData = img[ri.ns], evaled = !0;
|
||||
var candidate, dpr, i, j, diff, length, bestCandidate, curSrc, curCan, isSameSet, candidateSrc, abortCurSrc, oldRes, imageData = img[ri.ns], evaled = !0, lazyF = lazyFactor, sub = substractCurRes;
|
||||
if (curSrc = imageData.curSrc || img[curSrcProp], curCan = imageData.curCan || setSrcToCur(img, curSrc, candidates[0].set),
|
||||
dpr = ri.DPR, curSrc && (curCan && curCan.res < dpr && (oldRes = curCan.res, curCan.res += cfg.tLazy * Math.pow(curCan.res - .1, isLandscape ? 2.2 : 1.9)),
|
||||
isSameSet = !imageData.pic || curCan && curCan.set == candidates[0].set, curCan && isSameSet && curCan.res >= dpr && (oldRes || tMemory > curCan.res) ? bestCandidate = curCan : supportAbort || img.complete || !getImgAttr.call(img, "src") || img.lazyload || (isSameSet || !inView(img)) && (bestCandidate = curCan,
|
||||
candidateSrc = curSrc, evaled = "L", isWinComplete && reevaluateAfterLoad(img))),
|
||||
!bestCandidate) for (oldRes && (curCan.res = curCan.res - (curCan.res - oldRes) / 2),
|
||||
candidates.sort(ascendingSort), length = candidates.length, bestCandidate = candidates[length - 1],
|
||||
i = 0; length > i; i++) if (candidate = candidates[i], candidate.res >= dpr) {
|
||||
j = i - 1, bestCandidate = candidates[j] && (diff = candidate.res - dpr) && curSrc != ri.makeUrl(candidate.url) && chooseLowRes(candidates[j].res, diff, dpr) ? candidates[j] : candidate;
|
||||
dpr = ri.DPR, oldRes = curCan && curCan.res, !bestCandidate && curSrc && (abortCurSrc = supportAbort && !img.complete && curCan && oldRes > dpr,
|
||||
abortCurSrc || curCan && !(tMemory > oldRes) || (curCan && dpr > oldRes && oldRes > lowTreshHold && (partialLowTreshHold > oldRes && (lazyF *= .87,
|
||||
sub += .04 * dpr), curCan.res += lazyF * Math.pow(oldRes - sub, 2)), isSameSet = !imageData.pic || curCan && curCan.set == candidates[0].set,
|
||||
curCan && isSameSet && curCan.res >= dpr ? bestCandidate = curCan : supportNativeLQIP || img.complete || !getImgAttr.call(img, "src") || img.lazyload || supportAbort && !(5 > imgAbortCount) || !isSameSet && inView(img) || (bestCandidate = curCan,
|
||||
candidateSrc = curSrc, evaled = "L", reevaluateAfterLoad(img)))), !bestCandidate) for (oldRes && (curCan.res = curCan.res - (curCan.res - oldRes) / 2),
|
||||
candidates.sort(ascendingSort), length = candidates.length, bestCandidate = candidates[length - 1],
|
||||
i = 0; length > i; i++) if (candidate = candidates[i], candidate.res >= dpr) {
|
||||
j = i - 1, bestCandidate = candidates[j] && (diff = candidate.res - dpr) && (abortCurSrc || curSrc != ri.makeUrl(candidate.url)) && chooseLowRes(candidates[j].res, diff, dpr) ? candidates[j] : candidate;
|
||||
break;
|
||||
}
|
||||
return oldRes && (curCan.res = oldRes), bestCandidate && (candidateSrc = ri.makeUrl(bestCandidate.url),
|
||||
imageData.curSrc = candidateSrc, imageData.curCan = bestCandidate, candidateSrc != curSrc ? ri.setSrc(img, bestCandidate) : ri.setSize(img)),
|
||||
evaled;
|
||||
imageData.curSrc = candidateSrc, imageData.curCan = bestCandidate, candidateSrc != curSrc && ri.setSrc(img, bestCandidate),
|
||||
ri.setSize(img)), evaled;
|
||||
}
|
||||
};
|
||||
ri.setSrc = function(img, bestCandidate) {
|
||||
var origWidth;
|
||||
img.src = bestCandidate.url, "image/svg+xml" == bestCandidate.set.type && (origWidth = img.style.width,
|
||||
img.style.width = img.offsetWidth + 1 + "px", img.offsetWidth + 1 && (img.style.width = origWidth)),
|
||||
ri.setSize(img);
|
||||
}, ri.setSize = noop, ri.getSet = function(img) {
|
||||
}, ri.setSrc = function(img, bestCandidate) {
|
||||
var origStyle;
|
||||
img.src = bestCandidate.url, reflowBug && (origStyle = img.style.zoom, img.style.zoom = "0.999",
|
||||
img.style.zoom = origStyle);
|
||||
}, ri.getSet = function(img) {
|
||||
var i, set, supportsType, match = !1, sets = img[ri.ns].sets;
|
||||
for (i = 0; i < sets.length && !match; i++) if (set = sets[i], set.srcset && ri.matchesMedia(set.media) && (supportsType = ri.supportsType(set.type))) {
|
||||
"pending" == supportsType && (set = supportsType), match = set;
|
||||
break;
|
||||
}
|
||||
return match;
|
||||
};
|
||||
var alwaysCheckWDescriptor = ri.supSrcset && !ri.supSizes;
|
||||
ri.parseSets = function(element, parent) {
|
||||
var srcsetAttribute, fallbackCandidate, isWDescripor, srcsetParsed, hasPicture = "PICTURE" == parent.nodeName.toUpperCase(), imageData = element[ri.ns];
|
||||
}, ri.parseSets = function(element, parent) {
|
||||
var srcsetAttribute, imageSet, isWDescripor, srcsetParsed, hasPicture = "PICTURE" == parent.nodeName.toUpperCase(), imageData = element[ri.ns];
|
||||
imageData.src === undefined && (imageData.src = getImgAttr.call(element, "src"),
|
||||
imageData.src ? setImgAttr.call(element, srcAttr, imageData.src) : removeImgAttr.call(element, srcAttr)),
|
||||
imageData.srcset === undefined && (srcsetAttribute = getImgAttr.call(element, "srcset"),
|
||||
imageData.srcset = srcsetAttribute, srcsetParsed = !0), imageData.sets = [], hasPicture && (imageData.pic = !0,
|
||||
getAllSourceElements(parent, imageData.sets)), imageData.srcset ? (fallbackCandidate = {
|
||||
getAllSourceElements(parent, imageData.sets)), imageData.srcset ? (imageSet = {
|
||||
srcset: imageData.srcset,
|
||||
sizes: getImgAttr.call(element, "sizes")
|
||||
}, imageData.sets.push(fallbackCandidate), isWDescripor = alwaysCheckWDescriptor || imageData.src ? hasWDescripor(fallbackCandidate) : !1,
|
||||
isWDescripor || !imageData.src || getCandidateForSrc(imageData.src, fallbackCandidate) || hasOneX(fallbackCandidate) || (fallbackCandidate.srcset += ", " + imageData.src,
|
||||
fallbackCandidate.cands = !1)) : imageData.src && imageData.sets.push({
|
||||
}, imageData.sets.push(imageSet), isWDescripor = (alwaysCheckWDescriptor || imageData.src) && regWDesc.test(imageData.srcset || ""),
|
||||
isWDescripor || !imageData.src || getCandidateForSrc(imageData.src, imageSet) || imageSet.has1x || (imageSet.srcset += ", " + imageData.src,
|
||||
imageSet.cands.push({
|
||||
url: imageData.src,
|
||||
x: 1,
|
||||
set: imageSet
|
||||
}))) : imageData.src && imageData.sets.push({
|
||||
srcset: imageData.src,
|
||||
sizes: null
|
||||
}), imageData.curCan = null, imageData.supported = !(hasPicture || fallbackCandidate && !ri.supSrcset || isWDescripor),
|
||||
}), imageData.curCan = null, imageData.supported = !(hasPicture || imageSet && !ri.supSrcset || isWDescripor),
|
||||
srcsetParsed && ri.supSrcset && !imageData.supported && (srcsetAttribute ? (setImgAttr.call(element, srcsetAttr, srcsetAttribute),
|
||||
element.srcset = "") : removeImgAttr.call(element, srcsetAttr)), imageData.supported && !imageData.srcset && (!imageData.src && element.src || element.src != ri.makeUrl(imageData.src)) && (null == imageData.src ? element.removeAttribute("src") : element.src = imageData.src),
|
||||
imageData.parsed = !0;
|
||||
};
|
||||
var reevaluateAfterLoad = function() {
|
||||
var onload = function() {
|
||||
off(this, "load", onload), off(this, "error", onload), ri.fillImgs({
|
||||
elements: [ this ]
|
||||
});
|
||||
};
|
||||
return function(img) {
|
||||
off(img, "load", onload), off(img, "error", onload), on(img, "error", onload), on(img, "load", onload);
|
||||
};
|
||||
}();
|
||||
ri.fillImg = function(element, options) {
|
||||
}, ri.fillImg = function(element, options) {
|
||||
var parent, imageData, extreme = options.reparse || options.reevaluate;
|
||||
if (element[ri.ns] || (element[ri.ns] = {}), imageData = element[ri.ns], "L" == imageData.evaled && element.complete && (imageData.evaled = !1),
|
||||
extreme || !imageData.evaled) {
|
||||
@ -274,28 +245,13 @@
|
||||
}
|
||||
imageData.supported ? imageData.evaled = !0 : applyBestCandidate(element);
|
||||
}
|
||||
};
|
||||
var resizeThrottle;
|
||||
ri.setupRun = function(options) {
|
||||
}, ri.setupRun = function(options) {
|
||||
(!alreadyRun || options.reevaluate || isVwDirty) && (updateMetrics(), options.elements || options.context || clearTimeout(resizeThrottle));
|
||||
}, ri.teardownRun = noop;
|
||||
var alreadyRun = !1, respimage = function(opt) {
|
||||
var elements, i, plen, options = opt || {};
|
||||
if (options.elements && 1 == options.elements.nodeType && ("IMG" == options.elements.nodeName.toUpperCase() ? options.elements = [ options.elements ] : (options.context = options.elements,
|
||||
options.elements = null)), elements = options.elements || ri.qsa(options.context || document, options.reevaluate || options.reparse ? ri.sel : ri.selShort),
|
||||
plen = elements.length) {
|
||||
for (ri.setupRun(options), alreadyRun = !0, i = 0; plen > i; i++) ri.fillImg(elements[i], options);
|
||||
ri.teardownRun(options);
|
||||
}
|
||||
};
|
||||
ri.fillImgs = respimage, window.HTMLPictureElement ? (respimage = noop, ri.fillImg = noop) : !function() {
|
||||
var lDelay;
|
||||
lDelay = supportAbort ? 180 : 400;
|
||||
var run = function() {
|
||||
}, window.HTMLPictureElement ? (respimage = noop, ri.fillImg = noop) : !function() {
|
||||
var isDomReady, regReady = window.attachEvent ? /d$|^c/ : /d$|^c|^i/, run = function() {
|
||||
var readyState = document.readyState || "";
|
||||
clearTimeout(timerId), timerId = setTimeout(run, "loading" == readyState ? lDelay : 2e3),
|
||||
document.body && (/d$|^c/.test(readyState) && (isWinComplete = !0, clearTimeout(timerId),
|
||||
off(document, "readystatechange", run)), ri.fillImgs());
|
||||
timerId = setTimeout(run, "loading" == readyState ? 200 : 999), document.body && (isDomReady = isDomReady || regReady.test(readyState),
|
||||
ri.fillImgs(), isDomReady && (imgAbortCount += 6, clearTimeout(timerId)));
|
||||
}, resizeEval = function() {
|
||||
ri.fillImgs({
|
||||
reevaluate: !0
|
||||
@ -304,134 +260,19 @@
|
||||
clearTimeout(resizeThrottle), isVwDirty = !0, resizeThrottle = setTimeout(resizeEval, 99);
|
||||
}, timerId = setTimeout(run, document.body ? 9 : 99);
|
||||
on(window, "resize", onResize), on(document, "readystatechange", run);
|
||||
}(), respimage._ = ri, respimage.config = function(name, value, value2) {
|
||||
if ("addType" == name) {
|
||||
if (types[value] = value2, "pending" == value2) return;
|
||||
} else cfg[name] = value;
|
||||
alreadyRun && ri.fillImgs({
|
||||
reevaluate: !0
|
||||
});
|
||||
}, window.respimage = respimage;
|
||||
}(), ri.respimage = respimage, ri.fillImgs = respimage, ri.teardownRun = noop, respimage._ = ri,
|
||||
window.respimage = respimage, window.respimgCFG = {
|
||||
ri: ri,
|
||||
push: function(args) {
|
||||
var name = args.shift();
|
||||
"function" == typeof ri[name] ? ri[name].apply(ri, args) : (cfg[name] = args[0],
|
||||
alreadyRun && ri.fillImgs({
|
||||
reevaluate: !0
|
||||
}));
|
||||
}
|
||||
};
|
||||
for (;setOptions && setOptions.length; ) window.respimgCFG.push(setOptions.shift());
|
||||
}(window, document);
|
||||
|
||||
(function( factory ) {
|
||||
"use strict";
|
||||
var interValId;
|
||||
var intervalIndex = 0;
|
||||
var run = function(){
|
||||
if ( window.respimage ) {
|
||||
factory( window.respimage );
|
||||
}
|
||||
if(window.respimage || intervalIndex > 9999){
|
||||
clearInterval(interValId);
|
||||
}
|
||||
intervalIndex++;
|
||||
};
|
||||
interValId = setInterval(run, 8);
|
||||
|
||||
run();
|
||||
|
||||
}( function( respimage, undefined ) {
|
||||
"use strict";
|
||||
|
||||
var ri = respimage._;
|
||||
var knownWidths = {};
|
||||
var cfg = ri.cfg;
|
||||
var curSrcProp = "currentSrc";
|
||||
var setSize = function(width, img, data){
|
||||
var curCandidate = data.curCan;
|
||||
|
||||
if ( width ) {
|
||||
if ( curCandidate.desc.type == "x" ) {
|
||||
img.setAttribute( "width", parseInt( (width / curCandidate.res) / cfg.xQuant, 10) );
|
||||
} else if ( curCandidate.desc.type == "w" ) {
|
||||
img.setAttribute( "width", parseInt( curCandidate.cWidth * (width / curCandidate.desc.val), 10) );
|
||||
}
|
||||
}
|
||||
};
|
||||
var loadBg = function(url, img, data){
|
||||
var bgImg;
|
||||
var curCandidate;
|
||||
if(knownWidths[url]){
|
||||
setSize(knownWidths[url], img, data);
|
||||
} else {
|
||||
curCandidate = data.curCan;
|
||||
if(curCandidate.desc.type == 'w'){
|
||||
setSize(curCandidate.desc.val, img, data);
|
||||
}
|
||||
|
||||
bgImg = document.createElement('img');
|
||||
bgImg.onload = function(){
|
||||
knownWidths[url] = bgImg.naturalWidth || bgImg.width;
|
||||
if(url == img[curSrcProp]){
|
||||
setSize(knownWidths[url], img, data);
|
||||
}
|
||||
bgImg.onload = null;
|
||||
bgImg.onerror = null;
|
||||
img = null;
|
||||
bgImg = null;
|
||||
};
|
||||
bgImg.onerror = function(){
|
||||
img = null;
|
||||
bgImg.onload = null;
|
||||
bgImg.onerror = null;
|
||||
bgImg = null;
|
||||
};
|
||||
bgImg.src = url;
|
||||
|
||||
if(bgImg && bgImg.complete){
|
||||
bgImg.onload();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
var reeval = (function(){
|
||||
var running, timer;
|
||||
var run = function(){
|
||||
running = false;
|
||||
clearTimeout(timer);
|
||||
respimage({reevaluate: true});
|
||||
};
|
||||
|
||||
return function(){
|
||||
if(!running && cfg.addSize){
|
||||
running = true;
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(run, 33);
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
if( !(curSrcProp in document.createElement("img")) ){
|
||||
curSrcProp = "src";
|
||||
}
|
||||
|
||||
cfg.addSize = true;
|
||||
|
||||
ri.setSize = function( img ) {
|
||||
var url;
|
||||
var data = img[ ri.ns ];
|
||||
var curCandidate = data.curCan;
|
||||
|
||||
if ( data.dims === undefined ) {
|
||||
data.dims = img.getAttribute( "height" ) && img.getAttribute( "width" );
|
||||
}
|
||||
|
||||
if ( !cfg.addSize || !curCandidate || data.dims ) {return;}
|
||||
url = ri.makeUrl(curCandidate.url);
|
||||
if(url == img[curSrcProp]){
|
||||
loadBg(url, img, data);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if(window.addEventListener){
|
||||
addEventListener('resize', reeval, false);
|
||||
}
|
||||
respimage({reevaluate: true});
|
||||
}));
|
||||
|
||||
(function( factory ) {
|
||||
"use strict";
|
||||
var interValId;
|
||||
@ -524,6 +365,148 @@
|
||||
|
||||
}));
|
||||
|
||||
(function( factory ) {
|
||||
"use strict";
|
||||
var interValId;
|
||||
var intervalIndex = 0;
|
||||
var run = function(){
|
||||
if ( window.respimage ) {
|
||||
factory( window.respimage );
|
||||
}
|
||||
if(window.respimage || intervalIndex > 9999){
|
||||
clearInterval(interValId);
|
||||
}
|
||||
intervalIndex++;
|
||||
};
|
||||
interValId = setInterval(run, 8);
|
||||
|
||||
run();
|
||||
|
||||
}( function( respimage, undefined ) {
|
||||
"use strict";
|
||||
|
||||
var ri = respimage._;
|
||||
var knownWidths = {};
|
||||
var cfg = ri.cfg;
|
||||
var curSrcProp = "currentSrc";
|
||||
var setSize = function(width, img, data){
|
||||
var curCandidate = data.curCan;
|
||||
|
||||
if ( width ) {
|
||||
img.setAttribute( "width", parseInt(width / curCandidate.res, 10) );
|
||||
}
|
||||
};
|
||||
var loadBg = function(url, img, data){
|
||||
var bgImg, curCandidate, clear;
|
||||
|
||||
|
||||
if(knownWidths[url]){
|
||||
setSize(knownWidths[url], img, data);
|
||||
} else {
|
||||
clear = function(){
|
||||
data.pendingURLSize = null;
|
||||
bgImg.onload = null;
|
||||
bgImg.onerror = null;
|
||||
img = null;
|
||||
bgImg = null;
|
||||
};
|
||||
|
||||
data.pendingURLSize = url;
|
||||
curCandidate = data.curCan;
|
||||
|
||||
if(curCandidate.w){
|
||||
setSize(curCandidate.w, img, data);
|
||||
}
|
||||
|
||||
bgImg = document.createElement('img');
|
||||
|
||||
bgImg.onload = function(){
|
||||
knownWidths[url] = bgImg.naturalWidth || bgImg.width;
|
||||
if(url == img[curSrcProp]){
|
||||
setSize(knownWidths[url], img, data);
|
||||
}
|
||||
clear();
|
||||
};
|
||||
bgImg.onerror = clear;
|
||||
|
||||
bgImg.src = url;
|
||||
|
||||
if(bgImg && bgImg.complete){
|
||||
bgImg.onload();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
var reeval = (function(){
|
||||
var running, timer;
|
||||
|
||||
var run = function(){
|
||||
var i, len, imgData;
|
||||
var imgs = document.getElementsByTagName('img');
|
||||
var options = {elements: []};
|
||||
|
||||
ri.setupRun(options);
|
||||
|
||||
running = false;
|
||||
clearTimeout(timer);
|
||||
|
||||
for(i = 0, len = imgs.length; i < len; i++){
|
||||
imgData = imgs[i][ri.ns];
|
||||
|
||||
if(imgData && imgData.curCan){
|
||||
ri.setRes.res(imgData.curCan, imgData.curCan.set.sizes);
|
||||
ri.setSize(imgs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
ri.teardownRun( options );
|
||||
};
|
||||
|
||||
return function(){
|
||||
if(!running && cfg.addSize){
|
||||
running = true;
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(run);
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
if( !(curSrcProp in document.createElement("img")) ){
|
||||
curSrcProp = "src";
|
||||
}
|
||||
|
||||
ri.setSize = function( img ) {
|
||||
var url;
|
||||
var data = img[ ri.ns ];
|
||||
var curCandidate = data.curCan;
|
||||
|
||||
if ( data.dims === undefined ) {
|
||||
data.dims = img.getAttribute( "height" ) && img.getAttribute( "width" );
|
||||
}
|
||||
|
||||
if ( !cfg.addSize || !curCandidate || data.dims ) {return;}
|
||||
url = ri.makeUrl(curCandidate.url);
|
||||
|
||||
if(url == img[curSrcProp] && url !== data.pendingURLSize){
|
||||
loadBg(url, img, data);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if(window.addEventListener){
|
||||
addEventListener('resize', reeval, false);
|
||||
}
|
||||
|
||||
if(!('addSize' in cfg)){
|
||||
cfg.addSize = true;
|
||||
} else {
|
||||
cfg.addSize = !!cfg.addSize;
|
||||
}
|
||||
|
||||
reeval();
|
||||
}));
|
||||
|
||||
|
||||
(function(){
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user