webshims-rails 1.15.3 → 1.15.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/webshims-rails/version.rb +2 -2
- data/vendor/assets/javascripts/webshims/polyfiller.js +32 -30
- data/vendor/assets/javascripts/webshims/shims/canvas-blob.js +1 -7
- data/vendor/assets/javascripts/webshims/shims/combos/1.js +2 -0
- data/vendor/assets/javascripts/webshims/shims/combos/10.js +50 -41
- data/vendor/assets/javascripts/webshims/shims/combos/11.js +34 -30
- data/vendor/assets/javascripts/webshims/shims/combos/12.js +14 -2
- data/vendor/assets/javascripts/webshims/shims/combos/13.js +14 -2
- data/vendor/assets/javascripts/webshims/shims/combos/15.js +31 -21
- data/vendor/assets/javascripts/webshims/shims/combos/16.js +31 -21
- data/vendor/assets/javascripts/webshims/shims/combos/17.js +34 -30
- data/vendor/assets/javascripts/webshims/shims/combos/18.js +387 -527
- data/vendor/assets/javascripts/webshims/shims/combos/2.js +18 -11
- data/vendor/assets/javascripts/webshims/shims/combos/21.js +39 -2
- data/vendor/assets/javascripts/webshims/shims/combos/22.js +14 -2
- data/vendor/assets/javascripts/webshims/shims/combos/25.js +53 -26
- data/vendor/assets/javascripts/webshims/shims/combos/27.js +12 -15
- data/vendor/assets/javascripts/webshims/shims/combos/28.js +13 -10
- data/vendor/assets/javascripts/webshims/shims/combos/3.js +18 -11
- data/vendor/assets/javascripts/webshims/shims/combos/30.js +18 -11
- data/vendor/assets/javascripts/webshims/shims/combos/31.js +18 -11
- data/vendor/assets/javascripts/webshims/shims/combos/34.js +30 -13
- data/vendor/assets/javascripts/webshims/shims/combos/4.js +16 -11
- data/vendor/assets/javascripts/webshims/shims/combos/5.js +34 -30
- data/vendor/assets/javascripts/webshims/shims/combos/6.js +34 -30
- data/vendor/assets/javascripts/webshims/shims/combos/7.js +18 -11
- data/vendor/assets/javascripts/webshims/shims/combos/8.js +18 -11
- data/vendor/assets/javascripts/webshims/shims/combos/9.js +50 -41
- data/vendor/assets/javascripts/webshims/shims/dom-extend.js +16 -11
- data/vendor/assets/javascripts/webshims/shims/es5.js +507 -481
- data/vendor/assets/javascripts/webshims/shims/filereader-xhr.js +12 -15
- data/vendor/assets/javascripts/webshims/shims/form-core.js +2 -0
- data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +34 -30
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +13 -10
- data/vendor/assets/javascripts/webshims/shims/form-validation.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/form-validators.js +0 -6
- data/vendor/assets/javascripts/webshims/shims/forms-picker.js +3 -3
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ca.js +65 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ru.js +8 -1
- data/vendor/assets/javascripts/webshims/shims/jme/controls.css +1 -3
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/AlphaBar.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/Bars.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/Maps.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/NoColor.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/bar-opacity.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/map-opacity.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/preview-opacity.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/mediacapture.js +9 -3
- data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +25 -0
- data/vendor/assets/javascripts/webshims/shims/picture.js +387 -527
- data/vendor/assets/javascripts/webshims/shims/styles/color-picker.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/forms-ext.css +12 -4
- data/vendor/assets/javascripts/webshims/shims/styles/forms-picker.css +5 -5
- data/vendor/assets/javascripts/webshims/shims/styles/progress.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-ext.scss +37 -1
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +7 -5
- data/vendor/assets/javascripts/webshims/shims/styles/shim-ext.css +22 -11
- data/vendor/assets/javascripts/webshims/shims/styles/shim.css +10 -7
- data/vendor/assets/javascripts/webshims/shims/styles/transparent.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/widget-font.zip +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/widget.eot +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/widget.svg +6 -2
- data/vendor/assets/javascripts/webshims/shims/styles/widget.ttf +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/widget.woff +0 -0
- data/vendor/assets/javascripts/webshims/shims/track.js +14 -2
- data/vendor/assets/javascripts/webshims/shims/url.js +18 -7
- metadata +9 -7
@@ -380,22 +380,19 @@ webshim.register('filereader-xhr', function($, webshim, window, document, undefi
|
|
380
380
|
qualitiy = 0.8;
|
381
381
|
}
|
382
382
|
loadMoxie();
|
383
|
-
|
383
|
+
webshim.ready('moxie', function(){
|
384
|
+
var img = new mOxie.Image();
|
384
385
|
dataURL = $canvas.callProp('getAsDataURL', [type, qualitiy]);
|
385
|
-
|
386
|
-
var
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
};
|
396
|
-
img.load(dataURL);
|
397
|
-
});
|
398
|
-
}, 9);
|
386
|
+
img.onload = function() {
|
387
|
+
var blob = img.getAsBlob();
|
388
|
+
webshim.defineProperty(blob, '_wsDataURL', {
|
389
|
+
value: dataURL,
|
390
|
+
enumerable: false
|
391
|
+
});
|
392
|
+
cb(blob);
|
393
|
+
};
|
394
|
+
img.load(dataURL);
|
395
|
+
});
|
399
396
|
}
|
400
397
|
}
|
401
398
|
});
|
@@ -424,9 +424,13 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
424
424
|
},
|
425
425
|
time: function(val, o, noCorrect){
|
426
426
|
var fVal, i;
|
427
|
+
|
427
428
|
if(val){
|
428
429
|
|
429
430
|
val = val.split(':');
|
431
|
+
if(val.length != 2 || isNaN(parseInt(val[0] || '', 10)) || isNaN(parseInt(val[1] || '', 10))){
|
432
|
+
return val.join(':');
|
433
|
+
}
|
430
434
|
if(curCfg.meridian){
|
431
435
|
fVal = (val[0] * 1);
|
432
436
|
if(fVal && fVal >= 12){
|
@@ -581,6 +585,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
581
585
|
createFormat('d');
|
582
586
|
var tmp, obj;
|
583
587
|
var ret = '';
|
588
|
+
|
584
589
|
if(opts.splitInput){
|
585
590
|
obj = {yy: 0, mm: 1, dd: 2};
|
586
591
|
} else {
|
@@ -602,8 +607,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
602
607
|
}
|
603
608
|
ret = ([addZero(val[obj.yy]), addZero(val[obj.mm]), addZero(val[obj.dd])]).join('-');
|
604
609
|
}
|
605
|
-
return ret
|
606
|
-
;
|
610
|
+
return ret;
|
607
611
|
},
|
608
612
|
color: function(val, opts){
|
609
613
|
var ret = '#000000';
|
@@ -905,9 +909,11 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
905
909
|
};
|
906
910
|
|
907
911
|
['defaultValue', 'value'].forEach(function(name){
|
912
|
+
var formatName = 'format'+name;
|
908
913
|
wsWidgetProto[name] = function(val, force){
|
909
|
-
if(!this._init || force || val !== this.options[name]){
|
910
|
-
this.
|
914
|
+
if(!this._init || force || val !== this.options[name] || this.options[formatName] != this.element.prop(name)){
|
915
|
+
this.options[formatName] = this.formatValue(val);
|
916
|
+
this.element.prop(name, this.options[formatName]);
|
911
917
|
this.options[name] = val;
|
912
918
|
this._propertyChange(name);
|
913
919
|
this.mirrorValidity();
|
@@ -1031,36 +1037,34 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1031
1037
|
var isValue = name == 'value';
|
1032
1038
|
spinBtnProto[name] = function(val, force, isLive){
|
1033
1039
|
var selectionEnd;
|
1034
|
-
if(
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
}
|
1040
|
+
if(isValue){
|
1041
|
+
this._beforeValue(val);
|
1042
|
+
} else {
|
1043
|
+
this.elemHelper.prop(name, val);
|
1044
|
+
}
|
1040
1045
|
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
}
|
1050
|
-
});
|
1051
|
-
} else {
|
1052
|
-
val = this.toFixed(val);
|
1053
|
-
if(isLive && this._getSelectionEnd){
|
1054
|
-
selectionEnd = this._getSelectionEnd(val);
|
1055
|
-
}
|
1056
|
-
this.element.prop(name, val);
|
1057
|
-
if(selectionEnd != null){
|
1058
|
-
this.element.prop('selectionEnd', selectionEnd);
|
1046
|
+
val = formatVal[this.type](val, this.options);
|
1047
|
+
if(this.options.splitInput){
|
1048
|
+
$.each(this.splits, function(i, elem){
|
1049
|
+
var setOption;
|
1050
|
+
if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
|
1051
|
+
$('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
|
1052
|
+
} else {
|
1053
|
+
$.prop(elem, name, val[i]);
|
1059
1054
|
}
|
1055
|
+
});
|
1056
|
+
} else {
|
1057
|
+
val = this.toFixed(val);
|
1058
|
+
if(isLive && this._getSelectionEnd){
|
1059
|
+
selectionEnd = this._getSelectionEnd(val);
|
1060
|
+
}
|
1061
|
+
this.element.prop(name, val);
|
1062
|
+
if(selectionEnd != null){
|
1063
|
+
this.element.prop('selectionEnd', selectionEnd);
|
1060
1064
|
}
|
1061
|
-
this._propertyChange(name);
|
1062
|
-
this.mirrorValidity();
|
1063
1065
|
}
|
1066
|
+
this._propertyChange(name);
|
1067
|
+
this.mirrorValidity();
|
1064
1068
|
};
|
1065
1069
|
});
|
1066
1070
|
|
@@ -607,22 +607,25 @@ if(webshims.support.inputtypes.date && /webkit/i.test(navigator.userAgent)){
|
|
607
607
|
|
608
608
|
webshims.addReady(function(context, contextElem){
|
609
609
|
//start constrain-validation
|
610
|
-
|
610
|
+
|
611
611
|
$('form', context)
|
612
612
|
.add(contextElem.filter('form'))
|
613
613
|
.on('invalid', $.noop)
|
614
614
|
;
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
if
|
620
|
-
focusElem.
|
615
|
+
|
616
|
+
setTimeout(function(){
|
617
|
+
var focusElem;
|
618
|
+
try {
|
619
|
+
if(!('form' in (document.activeElement || {}))) {
|
620
|
+
focusElem = $(context.querySelector('input[autofocus], select[autofocus], textarea[autofocus]')).eq(0).getShadowFocusElement()[0];
|
621
|
+
if (focusElem && (focusElem.offsetHeight || focusElem.offsetWidth)) {
|
622
|
+
focusElem.focus();
|
623
|
+
}
|
621
624
|
}
|
622
625
|
}
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
+
catch (er) {}
|
627
|
+
}, 9);
|
628
|
+
|
626
629
|
});
|
627
630
|
|
628
631
|
if(!webshims.support.datalist){
|
@@ -117,7 +117,7 @@ webshims.register('form-validation', function($, webshims, window, document, und
|
|
117
117
|
){
|
118
118
|
return;
|
119
119
|
}
|
120
|
-
if(webshims.refreshCustomValidityRules
|
120
|
+
if(webshims.refreshCustomValidityRules(elem) == 'async'){
|
121
121
|
$(elem).one('updatevalidation.webshims', switchValidityClass);
|
122
122
|
return;
|
123
123
|
}
|
@@ -423,7 +423,7 @@ webshims.register('form-validation', function($, webshims, window, document, und
|
|
423
423
|
if(!appendElement && !invalidParent.test(parent.nodeName)){
|
424
424
|
appendElement = parent;
|
425
425
|
}
|
426
|
-
if(appendElement && $.css(parent, 'overflow')
|
426
|
+
if(appendElement && $.css(parent, 'overflow') != 'visible' && $.css(parent, 'position') != 'static'){
|
427
427
|
appendElement = false;
|
428
428
|
}
|
429
429
|
}
|
@@ -7,10 +7,6 @@ webshims.ready('form-validation', function(){
|
|
7
7
|
});
|
8
8
|
|
9
9
|
(function(){
|
10
|
-
if(webshims.refreshCustomValidityRules){
|
11
|
-
webshims.error("form-validators already included. please remove custom-validity.js");
|
12
|
-
}
|
13
|
-
|
14
10
|
var customValidityRules = {};
|
15
11
|
var formReady = false;
|
16
12
|
var blockCustom;
|
@@ -341,8 +337,6 @@ webshims.ready('form-validation', function(){
|
|
341
337
|
val = $.inArray(val, data.specialVal) !== -1;
|
342
338
|
} if(data.toggle){
|
343
339
|
val = !val;
|
344
|
-
} else {
|
345
|
-
val = !!val;
|
346
340
|
}
|
347
341
|
$.prop( elem, data.prop, val);
|
348
342
|
if(iValClasses && e){
|
@@ -1188,12 +1188,12 @@ webshims.register('forms-picker', function($, webshims, window, document, undefi
|
|
1188
1188
|
|
1189
1189
|
str.push('<th class="week-header ws-week">'+ dateCfg.weekHeader +'</th>');
|
1190
1190
|
|
1191
|
-
for(k = dateCfg.firstDay; k < dateCfg.
|
1192
|
-
str.push('<th class="day-'+ k +'"><abbr title="'+ dateCfg.dayNames[k] +'">'+ dateCfg.
|
1191
|
+
for(k = dateCfg.firstDay; k < dateCfg.dayNamesMin.length; k++){
|
1192
|
+
str.push('<th class="day-'+ k +'"><abbr title="'+ dateCfg.dayNames[k] +'">'+ dateCfg.dayNamesMin[k] +'</abbr></th>');
|
1193
1193
|
}
|
1194
1194
|
k = dateCfg.firstDay;
|
1195
1195
|
while(k--){
|
1196
|
-
str.push('<th class="day-'+ k +'"><abbr title="'+ dateCfg.dayNames[k] +'">'+ dateCfg.
|
1196
|
+
str.push('<th class="day-'+ k +'"><abbr title="'+ dateCfg.dayNames[k] +'">'+ dateCfg.dayNamesMin[k] +'</abbr></th>');
|
1197
1197
|
}
|
1198
1198
|
str.push('</tr></thead><tbody><tr class="ws-row-0">');
|
1199
1199
|
|
@@ -0,0 +1,65 @@
|
|
1
|
+
webshims.validityMessages.es = {
|
2
|
+
"typeMismatch": {
|
3
|
+
"email": "Si us plau, introduïu una adreça de correu.",
|
4
|
+
"url": "Si us plau, introduïu un URL."
|
5
|
+
},
|
6
|
+
"badInput": {
|
7
|
+
"number": "Valor no válid",
|
8
|
+
"date": "Valor no válid",
|
9
|
+
"time": "Valor no válid",
|
10
|
+
"range": "Valor no válid",
|
11
|
+
"datetime-local": "Valor no válid"
|
12
|
+
},
|
13
|
+
"tooLong": "Valor no válid",
|
14
|
+
"patternMismatch": "Si us plau, ajusteu-vos al format sol·licitat: {%title}.",
|
15
|
+
"valueMissing": {
|
16
|
+
"defaultMessage": "Si us plau, ompliu aquest camp.",
|
17
|
+
"checkbox": "Si us plau, marqueu aquesta casella si voleu continuar.",
|
18
|
+
"select": "Si us plau, seleccioneu un element de la llista.",
|
19
|
+
"radio": "Si us plau, seleccioneu una de les opcions."
|
20
|
+
},
|
21
|
+
"rangeUnderflow": {
|
22
|
+
"defaultMessage": "El valor ha de superior o igual a {%min}.",
|
23
|
+
"date": "El valor ha de superior o igual a {%min}.",
|
24
|
+
"time": "El valor ha de superior o igual a {%min}.",
|
25
|
+
"datetime-local": "El valor ha de superior o igual a {%min}."
|
26
|
+
},
|
27
|
+
"rangeOverflow": {
|
28
|
+
"defaultMessage": "El valor ha de inferior o igual a {%max}.",
|
29
|
+
"date": "El valor ha de inferior o igual a {%max}.",
|
30
|
+
"time": "El valor ha de inferior o igual a {%max}.",
|
31
|
+
"datetime-local": "El valor ha de inferior o igual a {%max}."
|
32
|
+
},
|
33
|
+
"stepMismatch": "Valor no válid"
|
34
|
+
};
|
35
|
+
webshims.formcfg.es = {
|
36
|
+
numberFormat: {
|
37
|
+
".": ".",
|
38
|
+
",": ","
|
39
|
+
},
|
40
|
+
numberSigns: '.',
|
41
|
+
dateSigns: '/',
|
42
|
+
timeSigns: ":. ",
|
43
|
+
dFormat: "/",
|
44
|
+
patterns: {
|
45
|
+
d: 'dd/mm/yy'
|
46
|
+
},
|
47
|
+
date: {
|
48
|
+
closeText: 'Tanca',
|
49
|
+
prevText: '<Ant',
|
50
|
+
nextText: 'Seg>',
|
51
|
+
currentText: 'Avui',
|
52
|
+
monthNames: ['gener','gebrer','març','abril','maig','juny',
|
53
|
+
'juliol','agost','setembre','octubre','novembre','desembre'],
|
54
|
+
monthNamesShort: ['gen','febr','març','abr','maig','juny',
|
55
|
+
'jul','ag','set','oct','nov','des'],
|
56
|
+
dayNames: ['diumenge','dilluns','dimarts','dimecres','dijous','divendres','dissabte'],
|
57
|
+
dayNamesShort: ['dg','dl','dt','dc','dj','dv','ds'],
|
58
|
+
dayNamesMin: ['dg','dl','dt','dc','dj','dv','ds'],
|
59
|
+
weekHeader: 'St',
|
60
|
+
firstDay: 1,
|
61
|
+
isRTL: false,
|
62
|
+
showMonthAfterYear: false,
|
63
|
+
yearSuffix: ''
|
64
|
+
}
|
65
|
+
};
|
@@ -44,8 +44,15 @@ webshims.formcfg.ru = {
|
|
44
44
|
patterns: {
|
45
45
|
d: 'dd.mm.yy'
|
46
46
|
},
|
47
|
+
month: {
|
48
|
+
currentText: 'Текущий месяц'
|
49
|
+
},
|
50
|
+
time: {
|
51
|
+
currentText: 'Сейчас'
|
52
|
+
},
|
47
53
|
date: {
|
48
54
|
closeText: 'Закрыть',
|
55
|
+
clear: 'Очистить',
|
49
56
|
prevText: '<Пред',
|
50
57
|
nextText: 'След>',
|
51
58
|
currentText: 'Сегодня',
|
@@ -53,7 +60,7 @@ webshims.formcfg.ru = {
|
|
53
60
|
'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
|
54
61
|
monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
|
55
62
|
'Июл','Авг','Сен','Окт','Ноя','Дек'],
|
56
|
-
dayNames: ['
|
63
|
+
dayNames: ['Воскресенье','Понедельник','Вторник','Среда','Четверг','Пятница','Суббота'],
|
57
64
|
dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
|
58
65
|
dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
|
59
66
|
weekHeader: 'Нед',
|
@@ -103,7 +103,6 @@
|
|
103
103
|
0% {
|
104
104
|
-webkit-transform: rotate(0deg);
|
105
105
|
}
|
106
|
-
|
107
106
|
100% {
|
108
107
|
-webkit-transform: rotate(360deg);
|
109
108
|
}
|
@@ -113,7 +112,6 @@
|
|
113
112
|
-webkit-transform: rotate(0deg);
|
114
113
|
transform: rotate(0deg);
|
115
114
|
}
|
116
|
-
|
117
115
|
100% {
|
118
116
|
-webkit-transform: rotate(360deg);
|
119
117
|
transform: rotate(360deg);
|
@@ -468,7 +466,7 @@
|
|
468
466
|
.mediaplayer .mediamenu > div > .media-submenu {
|
469
467
|
margin: 0.3125em 0;
|
470
468
|
padding: 0.3125em 0;
|
471
|
-
border-top: 0.0625em solid #
|
469
|
+
border-top: 0.0625em solid #eee;
|
472
470
|
border-top: 0.0625em solid rgba(255, 255, 255, 0.4);
|
473
471
|
}
|
474
472
|
.mediaplayer .mediamenu > div > .media-submenu:first-child {
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -81,6 +81,7 @@ webshim.register('mediacapture', function($, webshim, window, document, undefine
|
|
81
81
|
resolve();
|
82
82
|
}
|
83
83
|
})();
|
84
|
+
var regImage = /image\/\*|image\/jp/i;
|
84
85
|
var loadPicker = function(){
|
85
86
|
webshim.ready('WINDOWLOAD', function(){
|
86
87
|
webshim.loader.loadList(['mediacapture-picker']);
|
@@ -91,10 +92,15 @@ webshim.register('mediacapture', function($, webshim, window, document, undefine
|
|
91
92
|
|
92
93
|
var _createPhotoPicker = function(){
|
93
94
|
if($(this).is('[capture].ws-filereader, .ws-capture') && webshim.implement(this, 'capture')){
|
94
|
-
var $wrapper, $customFile;
|
95
|
+
var $wrapper, $customFile, $button, popover;
|
95
96
|
var $fileinput = $(this);
|
96
|
-
var
|
97
|
-
|
97
|
+
var accept = $fileinput.prop('accept') || 'image/*';
|
98
|
+
|
99
|
+
if(!regImage.test(accept)){return;}
|
100
|
+
|
101
|
+
$button = $('<button type="button" class="ws-capture-button" />');
|
102
|
+
popover = webshim.objectCreate(webshim.wsPopover, {}, $.extend({prepareFor: $button}));
|
103
|
+
|
98
104
|
popover.element.addClass('capture-popover input-picker');
|
99
105
|
|
100
106
|
if($fileinput.is('.ws-custom-file > *')){
|
@@ -1137,6 +1137,25 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
|
|
1137
1137
|
VIDEO: 1
|
1138
1138
|
};
|
1139
1139
|
var tested = {};
|
1140
|
+
var addToBlob = function(){
|
1141
|
+
var desc = webshim.defineNodeNameProperty('canvas', 'toBlob', {
|
1142
|
+
prop: {
|
1143
|
+
value: function(){
|
1144
|
+
var context = $(this).callProp('getContext', ['2d']);
|
1145
|
+
var that = this;
|
1146
|
+
var args = arguments;
|
1147
|
+
var cb = function(){
|
1148
|
+
return desc.prop._supvalue.apply(that, args);
|
1149
|
+
};
|
1150
|
+
if(context.wsImageComplete && context._wsIsLoading){
|
1151
|
+
context.wsImageComplete(cb);
|
1152
|
+
} else {
|
1153
|
+
return cb();
|
1154
|
+
}
|
1155
|
+
}
|
1156
|
+
}
|
1157
|
+
});
|
1158
|
+
};
|
1140
1159
|
|
1141
1160
|
if(!_drawImage){
|
1142
1161
|
webshim.error('canvas.drawImage feature is needed. In IE8 flashvanvas pro can be used');
|
@@ -1211,6 +1230,12 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
|
|
1211
1230
|
}
|
1212
1231
|
return _drawImage.apply(this, arguments);
|
1213
1232
|
};
|
1233
|
+
|
1234
|
+
if(!document.createElement('canvas').toBlob){
|
1235
|
+
webshims.ready('filereader', addToBlob);
|
1236
|
+
} else {
|
1237
|
+
addToBlob();
|
1238
|
+
}
|
1214
1239
|
return true;
|
1215
1240
|
};
|
1216
1241
|
|
@@ -1,579 +1,439 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
} catch(e){
|
5
|
-
window.Image = function(){
|
6
|
-
return document.createElement('img');
|
7
|
-
};
|
8
|
-
}
|
9
|
-
webshim.isReady('picture', true);
|
10
|
-
// Enable strict mode
|
1
|
+
/*! respimage - v0.9.5 - 2014-10-22
|
2
|
+
Licensed MIT */
|
3
|
+
!function(window, document, undefined) {
|
11
4
|
"use strict";
|
12
|
-
|
13
|
-
|
14
|
-
if ( w.HTMLPictureElement ) {
|
15
|
-
w.picturefill = function() { };
|
16
|
-
return;
|
5
|
+
function trim(str) {
|
6
|
+
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
|
17
7
|
}
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
pf.sizesSupported = w.HTMLImageElement.sizes;
|
31
|
-
|
32
|
-
// just a string trim workaround
|
33
|
-
pf.trim = function( str ) {
|
34
|
-
return str.trim ? str.trim() : str.replace( /^\s+|\s+$/g, "" );
|
35
|
-
};
|
36
|
-
|
37
|
-
// just a string endsWith workaround
|
38
|
-
pf.endsWith = function( str, suffix ) {
|
39
|
-
return str.endsWith ? str.endsWith( suffix ) : str.indexOf( suffix, str.length - suffix.length ) !== -1;
|
40
|
-
};
|
41
|
-
|
42
|
-
/**
|
43
|
-
* Shortcut method for matchMedia ( for easy overriding in tests )
|
44
|
-
*/
|
45
|
-
pf.matchesMedia = function( media ) {
|
46
|
-
return w.matchMedia && w.matchMedia( media ).matches;
|
47
|
-
};
|
48
|
-
|
49
|
-
/**
|
50
|
-
* Shortcut method for `devicePixelRatio` ( for easy overriding in tests )
|
51
|
-
*/
|
52
|
-
pf.getDpr = function() {
|
53
|
-
return ( w.devicePixelRatio || 1 );
|
54
|
-
};
|
55
|
-
|
56
|
-
/**
|
57
|
-
* Get width in css pixel value from a "length" value
|
58
|
-
* http://dev.w3.org/csswg/css-values-3/#length-value
|
59
|
-
*/
|
60
|
-
pf.getWidthFromLength = function( length ) {
|
61
|
-
// If no length was specified, or it is 0 or negative, default to `100vw` (per the spec).
|
62
|
-
length = length && ( parseFloat( length ) > 0 || length.indexOf( "calc(" ) > -1 ) ? length : "100vw";
|
63
|
-
|
64
|
-
/**
|
65
|
-
* If length is specified in `vw` units, use `%` instead since the div we’re measuring
|
66
|
-
* is injected at the top of the document.
|
67
|
-
*
|
68
|
-
* TODO: maybe we should put this behind a feature test for `vw`?
|
69
|
-
*/
|
70
|
-
length = length.replace( "vw", "%" );
|
71
|
-
|
72
|
-
// Create a cached element for getting length value widths
|
73
|
-
if ( !pf.lengthEl ) {
|
74
|
-
pf.lengthEl = doc.createElement( "div" );
|
75
|
-
doc.documentElement.insertBefore( pf.lengthEl, doc.documentElement.firstChild );
|
8
|
+
function updateView() {
|
9
|
+
isVwDirty = !1, ri.vW = window.innerWidth || Math.max(docElem.offsetWidth || 0, docElem.clientWidth || 0),
|
10
|
+
vH = window.innerHeight || Math.max(docElem.offsetHeight || 0, docElem.clientHeight || 0);
|
11
|
+
}
|
12
|
+
function parseDescriptor(descriptor) {
|
13
|
+
if (!(descriptor in memDescriptor)) {
|
14
|
+
var descriptorObj = {
|
15
|
+
val: 1,
|
16
|
+
type: "x"
|
17
|
+
}, parsedDescriptor = trim(descriptor || "");
|
18
|
+
parsedDescriptor && (parsedDescriptor.match(regDescriptor) ? (descriptorObj.val = 1 * RegExp.$1,
|
19
|
+
descriptorObj.type = RegExp.$2) : descriptorObj = !1), memDescriptor[descriptor] = descriptorObj;
|
76
20
|
}
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
21
|
+
return memDescriptor[descriptor];
|
22
|
+
}
|
23
|
+
function chooseLowRes(lowRes, diff, dpr) {
|
24
|
+
return lowRes / dpr > .2 && (lowRes += diff * greed, diff > tHigh && (lowRes += tLow)),
|
25
|
+
lowRes > dpr;
|
26
|
+
}
|
27
|
+
function inView(el) {
|
28
|
+
if (!el.getBoundingClientRect) return !0;
|
29
|
+
var bottom, right, left, top, rect = el.getBoundingClientRect();
|
30
|
+
return !!((bottom = rect.bottom) >= -9 && (top = rect.top) <= vH + 9 && (right = rect.right) >= -9 && (left = rect.left) <= ri.vW + 9 && (bottom || right || left || top));
|
31
|
+
}
|
32
|
+
function applyBestCandidate(img) {
|
33
|
+
var srcSetCandidates, matchingSet = ri.getSet(img), evaluated = !1;
|
34
|
+
"pending" != matchingSet && (evaluated = !0, matchingSet && (srcSetCandidates = ri.setRes(matchingSet),
|
35
|
+
evaluated = ri.applySetCandidate(srcSetCandidates, img))), img[ri.ns].evaled = evaluated;
|
36
|
+
}
|
37
|
+
function ascendingSort(a, b) {
|
38
|
+
return a.res - b.res;
|
39
|
+
}
|
40
|
+
function setSrcToCur(img, src, set) {
|
41
|
+
var candidate;
|
42
|
+
return !set && src && (set = img[ri.ns].sets, set = set && set[set.length - 1]),
|
43
|
+
candidate = getCandidateForSrc(src, set), candidate && (src = ri.makeUrl(src), img[ri.ns].curSrc = src,
|
44
|
+
img[ri.ns].curCan = candidate, currentSrcSupported || (img.currentSrc = src), candidate.res || setResolution(candidate, candidate.set.sizes)),
|
45
|
+
candidate;
|
46
|
+
}
|
47
|
+
function getCandidateForSrc(src, set) {
|
48
|
+
var i, candidate, candidates;
|
49
|
+
if (src && set) for (candidates = ri.parseSet(set), src = ri.makeUrl(src), i = 0; i < candidates.length; i++) if (src == ri.makeUrl(candidates[i].url)) {
|
50
|
+
candidate = candidates[i];
|
51
|
+
break;
|
84
52
|
}
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
pf.types["image/jpeg"] = true;
|
94
|
-
pf.types["image/gif"] = true;
|
95
|
-
pf.types["image/png"] = true;
|
96
|
-
|
97
|
-
// test svg support
|
98
|
-
pf.types[ "image/svg+xml" ] = doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image", "1.1");
|
99
|
-
|
100
|
-
// test webp support, only when the markup calls for it
|
101
|
-
pf.types[ "image/webp" ] = function() {
|
102
|
-
// based on Modernizr's lossless img-webp test
|
103
|
-
// note: asynchronous
|
104
|
-
var img = new w.Image(),
|
105
|
-
type = "image/webp";
|
106
|
-
|
107
|
-
img.onerror = function() {
|
108
|
-
pf.types[ type ] = false;
|
109
|
-
picturefill();
|
110
|
-
};
|
111
|
-
img.onload = function() {
|
112
|
-
pf.types[ type ] = img.width === 1;
|
113
|
-
picturefill();
|
114
|
-
};
|
115
|
-
img.src = "data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=";
|
116
|
-
};
|
117
|
-
|
118
|
-
/**
|
119
|
-
* Takes a source element and checks if its type attribute is present and if so, supported
|
120
|
-
* Note: for type tests that require a async logic,
|
121
|
-
* you can define them as a function that'll run only if that type needs to be tested. Just make the test function call picturefill again when it is complete.
|
122
|
-
* see the async webp test above for example
|
123
|
-
*/
|
124
|
-
pf.verifyTypeSupport = function( source ) {
|
125
|
-
var type = source.getAttribute( "type" );
|
126
|
-
// if type attribute exists, return test result, otherwise return true
|
127
|
-
if ( type === null || type === "" ) {
|
128
|
-
return true;
|
129
|
-
} else {
|
130
|
-
// if the type test is a function, run it and return "pending" status. The function will rerun picturefill on pending elements once finished.
|
131
|
-
if ( typeof( pf.types[ type ] ) === "function" ) {
|
132
|
-
pf.types[ type ]();
|
133
|
-
return "pending";
|
134
|
-
} else {
|
135
|
-
return pf.types[ type ];
|
136
|
-
}
|
53
|
+
return candidate;
|
54
|
+
}
|
55
|
+
function hasOneX(set) {
|
56
|
+
var i, ret, candidates, desc;
|
57
|
+
if (set) for (candidates = ri.parseSet(set), i = 0; i < candidates.length; i++) if (desc = candidates[i].desc,
|
58
|
+
"x" == desc.type && 1 == desc.val) {
|
59
|
+
ret = !0;
|
60
|
+
break;
|
137
61
|
}
|
62
|
+
return ret;
|
63
|
+
}
|
64
|
+
function hasWDescripor(set) {
|
65
|
+
if (!set) return !1;
|
66
|
+
var candidates = ri.parseSet(set);
|
67
|
+
return candidates[0] && "w" == candidates[0].desc.type;
|
68
|
+
}
|
69
|
+
function getAllSourceElements(picture, candidates) {
|
70
|
+
var i, len, source, srcset, sources = picture.getElementsByTagName("source");
|
71
|
+
for (i = 0, len = sources.length; len > i; i++) source = sources[i], source[ri.ns] = !0,
|
72
|
+
srcset = source.getAttribute("srcset"), srcset && candidates.push({
|
73
|
+
srcset: srcset,
|
74
|
+
media: source.getAttribute("media"),
|
75
|
+
type: source.getAttribute("type"),
|
76
|
+
sizes: source.getAttribute("sizes")
|
77
|
+
});
|
78
|
+
}
|
79
|
+
function setResolution(candidate, sizesattr) {
|
80
|
+
var descriptor = candidate.desc;
|
81
|
+
return "w" == descriptor.type ? (candidate.cWidth = ri.calcListLength(sizesattr || "100vw"),
|
82
|
+
candidate.res = descriptor.val / candidate.cWidth) : candidate.res = descriptor.val,
|
83
|
+
candidate;
|
84
|
+
}
|
85
|
+
document.createElement("picture");
|
86
|
+
var lengthElInstered, lengthEl, currentSrcSupported, curSrcProp, ri = {}, noop = function() {}, image = document.createElement("img"), getImgAttr = image.getAttribute, setImgAttr = image.setAttribute, removeImgAttr = image.removeAttribute, docElem = document.documentElement, types = {}, cfg = {
|
87
|
+
addSize: !1,
|
88
|
+
xQuant: 1,
|
89
|
+
tLow: .1,
|
90
|
+
tHigh: .5,
|
91
|
+
tLazy: .1,
|
92
|
+
greed: .32
|
93
|
+
}, srcAttr = "data-risrc", srcsetAttr = srcAttr + "set";
|
94
|
+
ri.ns = ("ri" + new Date().getTime()).substr(0, 9), currentSrcSupported = "currentSrc" in image,
|
95
|
+
curSrcProp = currentSrcSupported ? "currentSrc" : "src", ri.supSrcset = "srcset" in image,
|
96
|
+
ri.supSizes = "sizes" in image, ri.selShort = "picture > img, img[srcset]", ri.sel = ri.selShort,
|
97
|
+
ri.cfg = cfg, ri.supSrcset && (ri.sel += ", img[" + srcsetAttr + "]");
|
98
|
+
var anchor = document.createElement("a");
|
99
|
+
ri.makeUrl = function(src) {
|
100
|
+
return anchor.href = src, anchor.href;
|
101
|
+
}, ri.qsa = function(context, sel) {
|
102
|
+
return context.querySelectorAll(sel);
|
138
103
|
};
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
media: match && match[1],
|
147
|
-
length: match && match[2]
|
104
|
+
{
|
105
|
+
var on = (window.console && "function" == typeof console.warn ? function(message) {
|
106
|
+
console.warn(message);
|
107
|
+
} : noop, function(obj, evt, fn, capture) {
|
108
|
+
obj.addEventListener ? obj.addEventListener(evt, fn, capture || !1) : obj.attachEvent && obj.attachEvent("on" + evt, fn);
|
109
|
+
}), off = function(obj, evt, fn, capture) {
|
110
|
+
obj.removeEventListener ? obj.removeEventListener(evt, fn, capture || !1) : obj.detachEvent && obj.detachEvent("on" + evt, fn);
|
148
111
|
};
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
pf.parseSrcset = function( srcset ) {
|
185
|
-
/**
|
186
|
-
* A lot of this was pulled from Boris Smus’ parser for the now-defunct WHATWG `srcset`
|
187
|
-
* https://github.com/borismus/srcset-polyfill/blob/master/js/srcset-info.js
|
188
|
-
*
|
189
|
-
* 1. Let input (`srcset`) be the value passed to this algorithm.
|
190
|
-
* 2. Let position be a pointer into input, initially pointing at the start of the string.
|
191
|
-
* 3. Let raw candidates be an initially empty ordered list of URLs with associated
|
192
|
-
* unparsed descriptors. The order of entries in the list is the order in which entries
|
193
|
-
* are added to the list.
|
194
|
-
*/
|
195
|
-
var candidates = [];
|
196
|
-
|
197
|
-
while ( srcset !== "" ) {
|
198
|
-
srcset = srcset.replace(/^\s+/g,"");
|
199
|
-
|
200
|
-
// 5. Collect a sequence of characters that are not space characters, and let that be url.
|
201
|
-
var pos = srcset.search(/\s/g),
|
202
|
-
url, descriptor = null;
|
203
|
-
|
204
|
-
if ( pos !== -1 ) {
|
205
|
-
url = srcset.slice( 0, pos );
|
206
|
-
|
207
|
-
var last = url[ url.length - 1 ];
|
208
|
-
|
209
|
-
// 6. If url ends with a U+002C COMMA character (,), remove that character from url
|
210
|
-
// and let descriptors be the empty string. Otherwise, follow these substeps
|
211
|
-
// 6.1. If url is empty, then jump to the step labeled descriptor parser.
|
212
|
-
|
213
|
-
if ( last === "," || url === "" ) {
|
214
|
-
url = url.replace(/,+$/, "");
|
215
|
-
descriptor = "";
|
216
|
-
}
|
217
|
-
srcset = srcset.slice( pos + 1 );
|
218
|
-
|
219
|
-
// 6.2. Collect a sequence of characters that are not U+002C COMMA characters (,), and
|
220
|
-
// let that be descriptors.
|
221
|
-
if ( descriptor === null ) {
|
222
|
-
var descpos = srcset.indexOf(",");
|
223
|
-
if ( descpos !== -1 ) {
|
224
|
-
descriptor = srcset.slice( 0, descpos );
|
225
|
-
srcset = srcset.slice( descpos + 1 );
|
226
|
-
} else {
|
227
|
-
descriptor = srcset;
|
228
|
-
srcset = "";
|
229
|
-
}
|
230
|
-
}
|
231
|
-
} else {
|
232
|
-
url = srcset;
|
233
|
-
srcset = "";
|
234
|
-
}
|
235
|
-
|
236
|
-
// 7. Add url to raw candidates, associated with descriptors.
|
237
|
-
if ( url || descriptor ) {
|
238
|
-
candidates.push({
|
239
|
-
url: url,
|
240
|
-
descriptor: descriptor
|
241
|
-
});
|
242
|
-
}
|
243
|
-
}
|
244
|
-
return candidates;
|
245
|
-
};
|
246
|
-
|
247
|
-
pf.parseDescriptor = function( descriptor, sizesattr ) {
|
248
|
-
// 11. Descriptor parser: Let candidates be an initially empty source set. The order of entries in the list
|
249
|
-
// is the order in which entries are added to the list.
|
250
|
-
var sizes = sizesattr || "100vw",
|
251
|
-
sizeDescriptor = descriptor && descriptor.replace(/(^\s+|\s+$)/g, ""),
|
252
|
-
widthInCssPixels = pf.findWidthFromSourceSize( sizes ),
|
253
|
-
resCandidate;
|
254
|
-
|
255
|
-
if ( sizeDescriptor ) {
|
256
|
-
var splitDescriptor = sizeDescriptor.split(" ");
|
257
|
-
|
258
|
-
for (var i = splitDescriptor.length + 1; i >= 0; i--) {
|
259
|
-
if ( splitDescriptor[ i ] !== undefined ) {
|
260
|
-
var curr = splitDescriptor[ i ],
|
261
|
-
lastchar = curr && curr.slice( curr.length - 1 );
|
262
|
-
|
263
|
-
if ( ( lastchar === "h" || lastchar === "w" ) && !pf.sizesSupported ) {
|
264
|
-
resCandidate = parseFloat( ( parseInt( curr, 10 ) / widthInCssPixels ) );
|
265
|
-
} else if ( lastchar === "x" ) {
|
266
|
-
var res = curr && parseFloat( curr, 10 );
|
267
|
-
resCandidate = res && !isNaN( res ) ? res : 1;
|
268
|
-
}
|
112
|
+
"https:" == location.protocol;
|
113
|
+
}
|
114
|
+
ri.matchesMedia = function() {
|
115
|
+
return ri.matchesMedia = window.matchMedia && (matchMedia("(min-width: 0.1em)") || {}).matches ? function(media) {
|
116
|
+
return !media || matchMedia(media).matches;
|
117
|
+
} : ri.mMQ, ri.matchesMedia.apply(this, arguments);
|
118
|
+
}, ri.vW = 0;
|
119
|
+
var vH, isVwDirty = !0, regex = {
|
120
|
+
minw: /\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,
|
121
|
+
maxw: /\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/
|
122
|
+
}, mediaCache = {};
|
123
|
+
ri.mMQ = function(media) {
|
124
|
+
var min, max, ret = !1;
|
125
|
+
return media ? (mediaCache[media] || (min = media.match(regex.minw) && parseFloat(RegExp.$1) + (RegExp.$2 || ""),
|
126
|
+
max = media.match(regex.maxw) && parseFloat(RegExp.$1) + (RegExp.$2 || ""), min && (min = parseFloat(min, 10) * (min.indexOf("em") > 0 ? ri.getEmValue() : 1)),
|
127
|
+
max && (max = parseFloat(max, 10) * (max.indexOf("em") > 0 ? ri.getEmValue() : 1)),
|
128
|
+
mediaCache[media] = {
|
129
|
+
min: min,
|
130
|
+
max: max
|
131
|
+
}), min = mediaCache[media].min, max = mediaCache[media].max, (min && ri.vW >= min || max && ri.vW <= max) && (ret = !0),
|
132
|
+
ret) : !0;
|
133
|
+
}, ri.DPR = window.devicePixelRatio || 1;
|
134
|
+
var lengthCache = {}, regLength = /^([\d\.]+)(em|vw|px)$/, baseStyle = "position:absolute;left:0;visibility:hidden;display:block;padding:0;border:none;font-size:1em;width:1em;";
|
135
|
+
ri.calcLength = function(sourceSizeValue) {
|
136
|
+
var failed, parsedLength, orirgValue = sourceSizeValue, value = !1;
|
137
|
+
if (!(orirgValue in lengthCache)) {
|
138
|
+
if (parsedLength = sourceSizeValue.match(regLength)) parsedLength[1] = parseFloat(parsedLength[1], 10),
|
139
|
+
value = parsedLength[1] ? "vw" == parsedLength[2] ? ri.vW * parsedLength[1] / 100 : "em" == parsedLength[2] ? ri.getEmValue() * parsedLength[1] : parsedLength[1] : !1; else if (sourceSizeValue.indexOf("calc") > -1 || parseInt(sourceSizeValue, 10)) {
|
140
|
+
sourceSizeValue = sourceSizeValue.replace("vw", "%"), lengthEl || (lengthEl = document.createElement("div"),
|
141
|
+
lengthEl.style.cssText = baseStyle), lengthElInstered || (lengthElInstered = !0,
|
142
|
+
docElem.insertBefore(lengthEl, docElem.firstChild)), lengthEl.style.width = "0px";
|
143
|
+
try {
|
144
|
+
lengthEl.style.width = sourceSizeValue;
|
145
|
+
} catch (e) {
|
146
|
+
failed = !0;
|
269
147
|
}
|
148
|
+
value = lengthEl.offsetWidth, failed && (value = !1);
|
270
149
|
}
|
150
|
+
0 >= value && (value = !1), lengthCache[orirgValue] = value;
|
271
151
|
}
|
272
|
-
return
|
273
|
-
}
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
152
|
+
return lengthCache[orirgValue];
|
153
|
+
}, ri.types = types, types["image/jpeg"] = !0, types["image/gif"] = !0, types["image/png"] = !0,
|
154
|
+
types["image/svg+xml"] = document.implementation.hasFeature("http://wwwindow.w3.org/TR/SVG11/feature#Image", "1.1"),
|
155
|
+
ri.supportsType = function(type) {
|
156
|
+
return type ? types[type] : !0;
|
157
|
+
};
|
158
|
+
var regSize = /(\([^)]+\))?\s*(.+)/, memSize = {};
|
159
|
+
ri.parseSize = function(sourceSizeStr) {
|
160
|
+
var match;
|
161
|
+
return memSize[sourceSizeStr] || (match = (sourceSizeStr || "").match(regSize),
|
162
|
+
memSize[sourceSizeStr] = {
|
163
|
+
media: match && match[1],
|
164
|
+
length: match && match[2]
|
165
|
+
}), memSize[sourceSizeStr];
|
166
|
+
}, ri.parseSet = function(set) {
|
167
|
+
if (!set.cands) {
|
168
|
+
var pos, url, descriptor, last, descpos, srcset = set.srcset;
|
169
|
+
for (set.cands = []; srcset; ) srcset = srcset.replace(/^\s+/g, ""), pos = srcset.search(/\s/g),
|
170
|
+
descriptor = null, -1 != pos ? (url = srcset.slice(0, pos), last = url.charAt(url.length - 1),
|
171
|
+
"," != last && url || (url = url.replace(/,+$/, ""), descriptor = ""), srcset = srcset.slice(pos + 1),
|
172
|
+
null == descriptor && (descpos = srcset.indexOf(","), -1 != descpos ? (descriptor = srcset.slice(0, descpos),
|
173
|
+
srcset = srcset.slice(descpos + 1)) : (descriptor = srcset, srcset = ""))) : (url = srcset,
|
174
|
+
srcset = ""), url && (descriptor = parseDescriptor(descriptor)) && set.cands.push({
|
175
|
+
url: url.replace(/^,+/, ""),
|
176
|
+
desc: descriptor,
|
177
|
+
set: set
|
295
178
|
});
|
296
179
|
}
|
297
|
-
return
|
180
|
+
return set.cands;
|
298
181
|
};
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
if ( img.srcset ) {
|
308
|
-
img[ pf.ns ].srcset = img.srcset;
|
309
|
-
img.removeAttribute( "srcset" );
|
182
|
+
var eminpx, memDescriptor = {}, regDescriptor = /^([\+eE\d\.]+)(w|x)$/, fsCss = "font-size:100% !important;";
|
183
|
+
ri.getEmValue = function() {
|
184
|
+
var body;
|
185
|
+
if (!eminpx && (body = document.body)) {
|
186
|
+
var div = document.createElement("div"), originalHTMLCSS = docElem.style.cssText, originalBodyCSS = body.style.cssText;
|
187
|
+
div.style.cssText = baseStyle, docElem.style.cssText = fsCss, body.style.cssText = fsCss,
|
188
|
+
body.appendChild(div), eminpx = div.offsetWidth, body.removeChild(div), eminpx = parseFloat(eminpx, 10),
|
189
|
+
docElem.style.cssText = originalHTMLCSS, body.style.cssText = originalBodyCSS;
|
310
190
|
}
|
191
|
+
return eminpx || 16;
|
311
192
|
};
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
// if it's an img element, use the cached srcset property (defined or not)
|
322
|
-
if ( el.nodeName.toUpperCase() === "IMG" && el[ pf.ns ] && el[ pf.ns ].srcset ) {
|
323
|
-
srcset = el[ pf.ns ].srcset;
|
193
|
+
var sizeLengthCache = {};
|
194
|
+
ri.calcListLength = function(sourceSizeListStr) {
|
195
|
+
if (!(sourceSizeListStr in sizeLengthCache) || cfg.uT) {
|
196
|
+
var sourceSize, parsedSize, length, media, i, len, sourceSizeList = trim(sourceSizeListStr).split(/\s*,\s*/), winningLength = !1;
|
197
|
+
for (i = 0, len = sourceSizeList.length; len > i && (sourceSize = sourceSizeList[i],
|
198
|
+
parsedSize = ri.parseSize(sourceSize), length = parsedSize.length, media = parsedSize.media,
|
199
|
+
!length || !ri.matchesMedia(media) || (winningLength = ri.calcLength(length)) === !1); i++) ;
|
200
|
+
sizeLengthCache[sourceSizeListStr] = winningLength ? winningLength : ri.vW;
|
324
201
|
}
|
325
|
-
|
326
|
-
|
327
|
-
|
202
|
+
return sizeLengthCache[sourceSizeListStr];
|
203
|
+
}, ri.setRes = function(set) {
|
204
|
+
var candidates, candidate;
|
205
|
+
if (set) {
|
206
|
+
candidates = ri.parseSet(set);
|
207
|
+
for (var i = 0, len = candidates.length; len > i; i++) candidate = candidates[i],
|
208
|
+
candidate.descriptor || setResolution(candidate, set.sizes);
|
328
209
|
}
|
329
210
|
return candidates;
|
330
211
|
};
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
length,
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
candidate = candidates[ i ];
|
344
|
-
if ( candidate.resolution >= pf.getDpr() ) {
|
345
|
-
bestCandidate = candidate;
|
212
|
+
var dprM, tLow, greed, tLazy, tHigh, tMemory, isWinComplete;
|
213
|
+
ri.applySetCandidate = function(candidates, img) {
|
214
|
+
if (candidates.length) {
|
215
|
+
var candidate, dpr, i, j, diff, length, bestCandidate, curSrc, curCan, isSameSet, candidateSrc, imageData = img[ri.ns], evaled = !0;
|
216
|
+
if (curSrc = imageData.curSrc || img[curSrcProp], curCan = imageData.curCan || setSrcToCur(img, curSrc, candidates[0].set),
|
217
|
+
dpr = ri.getX(candidates, curCan), curSrc && (curCan && (curCan.res += tLazy), isSameSet = !imageData.pic || curCan && curCan.set == candidates[0].set,
|
218
|
+
curCan && isSameSet && curCan.res >= dpr && tMemory > curCan.res - dpr ? bestCandidate = curCan : img.complete || imageData.src != getImgAttr.call(img, "src") || img.lazyload || (isSameSet || !isWinComplete && !inView(img)) && (bestCandidate = curCan,
|
219
|
+
candidateSrc = curSrc, evaled = "lazy", isWinComplete && reevaluateAfterLoad(img))),
|
220
|
+
!bestCandidate) for (candidates.sort(ascendingSort), length = candidates.length,
|
221
|
+
bestCandidate = candidates[length - 1], i = 0; length > i; i++) if (candidate = candidates[i],
|
222
|
+
candidate.res >= dpr) {
|
223
|
+
j = i - 1, bestCandidate = candidates[j] && (diff = candidate.res - dpr) && curSrc != ri.makeUrl(candidate.url) && chooseLowRes(candidates[j].res, diff, dpr) ? candidates[j] : candidate;
|
346
224
|
break;
|
347
225
|
}
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
// currentSrc attribute and property to match
|
353
|
-
// http://picture.responsiveimages.org/#the-img-element
|
354
|
-
picImg.currentSrc = picImg.src;
|
226
|
+
return curSrc && curCan && (curCan.res -= tLazy), bestCandidate && (candidateSrc = ri.makeUrl(bestCandidate.url),
|
227
|
+
currentSrcSupported || (img.currentSrc = candidateSrc), imageData.curSrc = candidateSrc,
|
228
|
+
imageData.curCan = bestCandidate, candidateSrc != curSrc ? ri.setSrc(img, bestCandidate) : ri.setSize(img)),
|
229
|
+
evaled;
|
355
230
|
}
|
356
231
|
};
|
357
|
-
|
358
|
-
|
359
|
-
|
232
|
+
ri.getX = function() {
|
233
|
+
return ri.DPR * cfg.xQuant;
|
234
|
+
}, ri.setSrc = function(img, bestCandidate) {
|
235
|
+
var origWidth;
|
236
|
+
img.src = bestCandidate.url, "image/svg+xml" == bestCandidate.set.type && (origWidth = img.style.width,
|
237
|
+
img.style.width = img.offsetWidth + 1 + "px", img.offsetWidth + 1 && (img.style.width = origWidth));
|
360
238
|
};
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
while ( vsources.length ) {
|
375
|
-
picture.insertBefore( vsources[ 0 ], video );
|
239
|
+
var intrinsicSizeHandler = function() {
|
240
|
+
off(this, "load", intrinsicSizeHandler), ri.setSize(this);
|
241
|
+
};
|
242
|
+
ri.setSize = function(img) {
|
243
|
+
var width, curCandidate = img[ri.ns].curCan;
|
244
|
+
cfg.addSize && curCandidate && !img[ri.ns].dims && (img.complete || (off(img, "load", intrinsicSizeHandler),
|
245
|
+
on(img, "load", intrinsicSizeHandler)), width = img.naturalWidth, width && ("x" == curCandidate.desc.type ? setImgAttr.call(img, "width", parseInt(width / curCandidate.res / cfg.xQuant, 10)) : "w" == curCandidate.desc.type && setImgAttr.call(img, "width", parseInt(curCandidate.cWidth * (width / curCandidate.desc.val), 10))));
|
246
|
+
}, document.addEventListener && "naturalWidth" in image && "complete" in image || (ri.setSize = noop),
|
247
|
+
ri.getSet = function(img) {
|
248
|
+
var i, set, supportsType, match = !1, sets = img[ri.ns].sets;
|
249
|
+
for (i = 0; i < sets.length && !match; i++) if (set = sets[i], set.srcset && ri.matchesMedia(set.media) && (supportsType = ri.supportsType(set.type))) {
|
250
|
+
"pending" == supportsType && (set = supportsType), match = set;
|
251
|
+
break;
|
376
252
|
}
|
377
|
-
|
378
|
-
|
379
|
-
|
253
|
+
return match;
|
254
|
+
};
|
255
|
+
var alwaysCheckWDescriptor = ri.supSrcset && !ri.supSizes;
|
256
|
+
ri.parseSets = function(element, parent) {
|
257
|
+
var srcsetAttribute, fallbackCandidate, isWDescripor, srcsetParsed, hasPicture = "PICTURE" == parent.nodeName.toUpperCase(), imageData = element[ri.ns];
|
258
|
+
imageData.src === undefined && (imageData.src = getImgAttr.call(element, "src"),
|
259
|
+
imageData.src ? setImgAttr.call(element, srcAttr, imageData.src) : removeImgAttr.call(element, srcAttr)),
|
260
|
+
imageData.srcset === undefined && (srcsetAttribute = getImgAttr.call(element, "srcset"),
|
261
|
+
imageData.srcset = srcsetAttribute, srcsetParsed = !0), imageData.dims === undefined && (imageData.dims = getImgAttr.call(element, "height") && getImgAttr.call(element, "width")),
|
262
|
+
imageData.sets = [], hasPicture && (imageData.pic = !0, getAllSourceElements(parent, imageData.sets)),
|
263
|
+
imageData.srcset ? (fallbackCandidate = {
|
264
|
+
srcset: imageData.srcset,
|
265
|
+
sizes: getImgAttr.call(element, "sizes")
|
266
|
+
}, imageData.sets.push(fallbackCandidate), isWDescripor = alwaysCheckWDescriptor || imageData.src ? hasWDescripor(fallbackCandidate) : !1,
|
267
|
+
isWDescripor || !imageData.src || getCandidateForSrc(imageData.src, fallbackCandidate) || hasOneX(fallbackCandidate) || (fallbackCandidate.srcset += ", " + imageData.src,
|
268
|
+
fallbackCandidate.cands = !1)) : imageData.src && imageData.sets.push({
|
269
|
+
srcset: imageData.src,
|
270
|
+
sizes: null
|
271
|
+
}), imageData.curCan = null, imageData.supported = !(hasPicture || fallbackCandidate && !ri.supSrcset || isWDescripor),
|
272
|
+
srcsetParsed && ri.supSrcset && !imageData.supported && (srcsetAttribute ? (setImgAttr.call(element, srcsetAttr, srcsetAttribute),
|
273
|
+
element.srcset = "") : removeImgAttr.call(element, srcsetAttr)), imageData.parsed = !0;
|
380
274
|
};
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
275
|
+
var reevaluateAfterLoad = function() {
|
276
|
+
var onload = function() {
|
277
|
+
off(this, "load", onload), ri.fillImgs({
|
278
|
+
elements: [ this ]
|
279
|
+
});
|
280
|
+
};
|
281
|
+
return function(img) {
|
282
|
+
off(img, "load", onload), on(img, "load", onload);
|
283
|
+
};
|
284
|
+
}();
|
285
|
+
ri.fillImg = function(element, options) {
|
286
|
+
var parent, imageData, extreme = options.reparse || options.reevaluate;
|
287
|
+
if (element[ri.ns] || (element[ri.ns] = {}), imageData = element[ri.ns], "lazy" == imageData.evaled && (isWinComplete || element.complete) && (imageData.evaled = !1),
|
288
|
+
extreme || !imageData.evaled) {
|
289
|
+
if (!imageData.parsed || options.reparse) {
|
290
|
+
if (parent = element.parentNode, !parent) return;
|
291
|
+
ri.parseSets(element, parent, options);
|
397
292
|
}
|
293
|
+
imageData.supported ? imageData.evaled = !0 : applyBestCandidate(element);
|
398
294
|
}
|
399
|
-
return elems;
|
400
295
|
};
|
296
|
+
var resizeThrottle;
|
297
|
+
ri.setupRun = function(options) {
|
298
|
+
(!alreadyRun || options.reevaluate || isVwDirty) && (cfg.uT || (ri.DPR = window.devicePixelRatio || 1),
|
299
|
+
dprM = Math.min(Math.max(ri.DPR * cfg.xQuant, 1), 2.5), tLow = cfg.tLow * dprM,
|
300
|
+
tLazy = cfg.tLazy * dprM, greed = cfg.greed * dprM, tHigh = cfg.tHigh, tMemory = .6 + .4 * dprM + tLazy),
|
301
|
+
isVwDirty && (lengthCache = {}, sizeLengthCache = {}, updateView(), options.elements || options.context || clearTimeout(resizeThrottle));
|
302
|
+
}, ri.teardownRun = function() {
|
303
|
+
var parent;
|
304
|
+
lengthElInstered && (lengthElInstered = !1, parent = lengthEl.parentNode, parent && parent.removeChild(lengthEl));
|
305
|
+
};
|
306
|
+
var alreadyRun = !1, respimage = function(opt) {
|
307
|
+
var elements, i, plen, options = opt || {};
|
308
|
+
if (options.elements && 1 == options.elements.nodeType && ("IMG" == options.elements.nodeName.toUpperCase() ? options.elements = [ options.elements ] : (options.context = options.elements,
|
309
|
+
options.elements = null)), elements = options.elements || ri.qsa(options.context || document, options.reevaluate || options.reparse ? ri.sel : ri.selShort),
|
310
|
+
plen = elements.length) {
|
311
|
+
for (ri.setupRun(options), alreadyRun = !0, i = 0; plen > i; i++) ri.fillImg(elements[i], options);
|
312
|
+
ri.teardownRun(options);
|
313
|
+
}
|
314
|
+
};
|
315
|
+
ri.fillImgs = respimage, window.HTMLPictureElement ? (respimage = noop, ri.fillImg = noop) : !function() {
|
316
|
+
var regWinComplete = /^loade|^c/, run = function() {
|
317
|
+
clearTimeout(timerId), timerId = setTimeout(run, 3e3), document.body && (regWinComplete.test(document.readyState || "") && (isWinComplete = !0,
|
318
|
+
clearTimeout(timerId), off(document, "readystatechange", run)), ri.fillImgs());
|
319
|
+
}, resizeEval = function() {
|
320
|
+
ri.fillImgs({
|
321
|
+
reevaluate: !0
|
322
|
+
});
|
323
|
+
}, onResize = function() {
|
324
|
+
clearTimeout(resizeThrottle), isVwDirty = !0, resizeThrottle = setTimeout(resizeEval, 99);
|
325
|
+
}, timerId = setTimeout(run, document.body ? 9 : 99);
|
326
|
+
on(window, "resize", onResize), on(document, "readystatechange", run);
|
327
|
+
}(), respimage._ = ri, respimage.config = function(name, value, value2) {
|
328
|
+
if ("addType" == name) {
|
329
|
+
if (types[value] = value2, "pending" == value2) return;
|
330
|
+
} else cfg[name] = value;
|
331
|
+
alreadyRun && ri.fillImgs({
|
332
|
+
reevaluate: !0
|
333
|
+
});
|
334
|
+
}, window.respimage = respimage;
|
335
|
+
}(window, document);
|
336
|
+
(function( factory ) {
|
337
|
+
"use strict";
|
338
|
+
var interValId;
|
339
|
+
var intervalIndex = 0;
|
340
|
+
var run = function(){
|
341
|
+
if ( window.respimage ) {
|
342
|
+
factory( window.respimage );
|
343
|
+
}
|
344
|
+
if(window.respimage || intervalIndex > 9999){
|
345
|
+
clearInterval(interValId);
|
346
|
+
}
|
347
|
+
intervalIndex++;
|
348
|
+
};
|
349
|
+
interValId = setInterval(run, 8);
|
401
350
|
|
402
|
-
|
403
|
-
var sources = picture.childNodes,
|
404
|
-
match;
|
405
|
-
|
406
|
-
// Go through each child, and if they have media queries, evaluate them
|
407
|
-
for ( var j = 0, slen = sources.length; j < slen; j++ ) {
|
408
|
-
var source = sources[ j ];
|
409
|
-
|
410
|
-
// ignore non-element nodes
|
411
|
-
if ( source.nodeType !== 1 ) {
|
412
|
-
continue;
|
413
|
-
}
|
414
|
-
|
415
|
-
// Hitting the `img` element that started everything stops the search for `sources`.
|
416
|
-
// If no previous `source` matches, the `img` itself is evaluated later.
|
417
|
-
if ( source === img ) {
|
418
|
-
return match;
|
419
|
-
}
|
420
|
-
|
421
|
-
// ignore non-`source` nodes
|
422
|
-
if ( source.nodeName.toUpperCase() !== "SOURCE" ) {
|
423
|
-
continue;
|
424
|
-
}
|
425
|
-
// if it's a source element that has the `src` property set, throw a warning in the console
|
426
|
-
if ( source.getAttribute( "src" ) !== null && typeof console !== undefined ){
|
427
|
-
console.warn("The `src` attribute is invalid on `picture` `source` element; instead, use `srcset`.");
|
428
|
-
}
|
429
|
-
|
430
|
-
var media = source.getAttribute( "media" );
|
431
|
-
|
432
|
-
// if source does not have a srcset attribute, skip
|
433
|
-
if ( !source.getAttribute( "srcset" ) ) {
|
434
|
-
continue;
|
435
|
-
}
|
351
|
+
run();
|
436
352
|
|
437
|
-
|
438
|
-
|
439
|
-
var typeSupported = pf.verifyTypeSupport( source );
|
353
|
+
}( function( respimage ) {
|
354
|
+
"use strict";
|
440
355
|
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
}
|
356
|
+
var ri = respimage._;
|
357
|
+
var runningTests = 0;
|
358
|
+
var setTypeValue = function(types, value){
|
359
|
+
var i;
|
360
|
+
for(i = 0; i < types.length; i++){
|
361
|
+
ri.types[types[i]] = value;
|
448
362
|
}
|
449
|
-
|
450
|
-
return match;
|
451
363
|
};
|
452
364
|
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
firstMatch,
|
458
|
-
candidates,
|
459
|
-
|
460
|
-
options = opt || {};
|
461
|
-
elements = options.elements || pf.getAllElements();
|
462
|
-
|
463
|
-
// Loop through all elements
|
464
|
-
for ( var i = 0, plen = elements.length; i < plen; i++ ) {
|
465
|
-
element = elements[ i ];
|
466
|
-
parent = element.parentNode;
|
467
|
-
firstMatch = undefined;
|
468
|
-
candidates = undefined;
|
365
|
+
if(window.HTMLPictureElement && !ri.cfg.uT){
|
366
|
+
respimage.testTypeSupport = function(){};
|
367
|
+
return;
|
368
|
+
}
|
469
369
|
|
470
|
-
|
471
|
-
|
472
|
-
element[ pf.ns ] = {};
|
473
|
-
}
|
370
|
+
ri.types["image/bmp"] = true;
|
371
|
+
ri.types["image/x-bmp"] = true;
|
474
372
|
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
373
|
+
respimage.testTypeSupport = function(types, url, width, useCanvas){
|
374
|
+
if(typeof types == "string"){
|
375
|
+
types = types.split(/\s*\,*\s+/g);
|
376
|
+
}
|
377
|
+
var canvas;
|
378
|
+
var supports = "pending";
|
379
|
+
var img = document.createElement('img');
|
380
|
+
var onComplete = function(){
|
381
|
+
runningTests--;
|
382
|
+
setTypeValue(types, supports);
|
383
|
+
if(runningTests < 1){
|
384
|
+
respimage({reevaluate: true});
|
480
385
|
}
|
386
|
+
};
|
481
387
|
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
// return the first match which might undefined
|
489
|
-
// returns false if there is a pending source
|
490
|
-
// TODO the return type here is brutal, cleanup
|
491
|
-
firstMatch = pf.getMatch( element, parent );
|
492
|
-
|
493
|
-
// if any sources are pending in this picture due to async type test(s)
|
494
|
-
// remove the evaluated attr and skip for now ( the pending test will
|
495
|
-
// rerun picturefill on this element when complete)
|
496
|
-
if ( firstMatch === false ) {
|
497
|
-
continue;
|
498
|
-
}
|
499
|
-
} else {
|
500
|
-
firstMatch = undefined;
|
388
|
+
if(useCanvas){
|
389
|
+
canvas = document.createElement('canvas');
|
390
|
+
if(!canvas.getContext){
|
391
|
+
setTypeValue(types, false);
|
392
|
+
return;
|
501
393
|
}
|
394
|
+
}
|
502
395
|
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
396
|
+
img.onload = function(){
|
397
|
+
var ctx;
|
398
|
+
supports = true;
|
399
|
+
if(width){
|
400
|
+
supports = img.width == width;
|
508
401
|
}
|
509
402
|
|
510
|
-
if
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
// No sources matched, so we’re down to processing the inner `img` as a source.
|
515
|
-
candidates = pf.processSourceSet( element );
|
516
|
-
|
517
|
-
if ( element.srcset === undefined || element[ pf.ns ].srcset ) {
|
518
|
-
// Either `srcset` is completely unsupported, or we need to polyfill `sizes` functionality.
|
519
|
-
pf.applyBestCandidate( candidates, element );
|
520
|
-
} // Else, resolution-only `srcset` is supported natively.
|
403
|
+
if(useCanvas){
|
404
|
+
ctx = canvas.getContext('2d');
|
405
|
+
ctx.drawImage(img, 0, 0);
|
406
|
+
supports = ctx.getImageData(0, 0, 1, 1).data[3] === 0;
|
521
407
|
}
|
408
|
+
onComplete();
|
409
|
+
};
|
522
410
|
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
* Also attaches picturefill on resize
|
532
|
-
*/
|
533
|
-
function runPicturefill() {
|
534
|
-
picturefill();
|
535
|
-
var intervalId = setInterval( function() {
|
536
|
-
// When the document has finished loading, stop checking for new images
|
537
|
-
// https://github.com/ded/domready/blob/master/ready.js#L15
|
538
|
-
picturefill();
|
539
|
-
if ( /^loaded|^i|^c/.test( doc.readyState ) ) {
|
540
|
-
clearInterval( intervalId );
|
541
|
-
return;
|
542
|
-
}
|
543
|
-
}, 250 );
|
544
|
-
if ( w.addEventListener ) {
|
545
|
-
var resizeThrottle;
|
546
|
-
w.addEventListener( "resize", function() {
|
547
|
-
if (!w._picturefillWorking) {
|
548
|
-
w._picturefillWorking = true;
|
549
|
-
w.clearTimeout( resizeThrottle );
|
550
|
-
resizeThrottle = w.setTimeout( function() {
|
551
|
-
picturefill({ reevaluate: true });
|
552
|
-
w._picturefillWorking = false;
|
553
|
-
}, 60 );
|
554
|
-
}
|
555
|
-
}, false );
|
556
|
-
}
|
557
|
-
}
|
411
|
+
img.onerror = function(){
|
412
|
+
supports = false;
|
413
|
+
onComplete();
|
414
|
+
};
|
415
|
+
runningTests++;
|
416
|
+
setTypeValue(types, "pending");
|
417
|
+
img.src = url;
|
418
|
+
};
|
558
419
|
|
559
|
-
runPicturefill();
|
560
420
|
|
561
|
-
|
562
|
-
|
421
|
+
respimage.testTypeSupport("image/webp", "data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA==", 1);
|
422
|
+
respimage.testTypeSupport("image/jp2 image/jpx image/jpm", "data:image/jp2;base64,AAAADGpQICANCocKAAAAFGZ0eXBqcDIgAAAAAGpwMiAAAABHanAyaAAAABZpaGRyAAAAAQAAAAEAAQAHAAAAAAAPY29scgEAAAAAABEAAAAacmVzIAAAABJyZXNjAGAA/gBgAP4EBAAAAABqcDJj/0//UQApAAAAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAABAAEB/1wADUAIEBAYEBAYEBAY/1IADAAAAAEAAwQEAAH/ZAAPAAFMV0ZfSlAyXzIxMf+QAAoAAAAAABIAAf+TgICAgP/Z", 1);
|
423
|
+
respimage.testTypeSupport("image/vnd.ms-photo", "data:image/vnd.ms-photo;base64,SUm8AQgAAAAFAAG8AQAQAAAASgAAAIC8BAABAAAAAQAAAIG8BAABAAAAAQAAAMC8BAABAAAAWgAAAMG8BAABAAAAHwAAAAAAAAAkw91vA07+S7GFPXd2jckNV01QSE9UTwAZAYBxAAAAABP/gAAEb/8AAQAAAQAAAA==", 1);
|
424
|
+
respimage.testTypeSupport("video/png video/apng video/x-mng video/x-png", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACGFjVEwAAAABAAAAAcMq2TYAAAANSURBVAiZY2BgYPgPAAEEAQB9ssjfAAAAGmZjVEwAAAAAAAAAAQAAAAEAAAAAAAAAAAD6A+gBAbNU+2sAAAARZmRBVAAAAAEImWNgYGBgAAAABQAB6MzFdgAAAABJRU5ErkJggg==", false, true);
|
563
425
|
|
564
|
-
|
565
|
-
w.picturefill = picturefill;
|
426
|
+
}));
|
566
427
|
|
567
|
-
|
428
|
+
(function(){
|
568
429
|
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
} );
|
430
|
+
webshim.isReady('picture', true);
|
431
|
+
var sel = 'picture, img[srcset]';
|
432
|
+
webshim.addReady(function(context){
|
433
|
+
if(context.querySelector(sel)){
|
434
|
+
window.respimage();
|
435
|
+
}
|
436
|
+
});
|
437
|
+
})();
|
578
438
|
|
579
439
|
|