webshims-rails 1.10.9 → 1.10.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/webshims-rails/version.rb +2 -2
- data/vendor/assets/javascripts/webshims/polyfiller.js +8 -9
- data/vendor/assets/javascripts/webshims/shims/combos/1.js +24 -14
- data/vendor/assets/javascripts/webshims/shims/combos/10.js +61 -20
- data/vendor/assets/javascripts/webshims/shims/combos/11.js +54 -16
- data/vendor/assets/javascripts/webshims/shims/combos/12.js +9 -13
- data/vendor/assets/javascripts/webshims/shims/combos/13.js +8 -12
- data/vendor/assets/javascripts/webshims/shims/combos/14.js +10 -7
- data/vendor/assets/javascripts/webshims/shims/combos/15.js +40 -11
- data/vendor/assets/javascripts/webshims/shims/combos/16.js +49 -24
- data/vendor/assets/javascripts/webshims/shims/combos/17.js +128 -19
- data/vendor/assets/javascripts/webshims/shims/combos/18.js +131 -22
- data/vendor/assets/javascripts/webshims/shims/combos/19.js +133 -40
- data/vendor/assets/javascripts/webshims/shims/combos/2.js +31 -18
- data/vendor/assets/javascripts/webshims/shims/combos/20.js +132 -39
- data/vendor/assets/javascripts/webshims/shims/combos/21.js +116 -22
- data/vendor/assets/javascripts/webshims/shims/combos/23.js +9 -13
- data/vendor/assets/javascripts/webshims/shims/combos/24.js +48 -13
- data/vendor/assets/javascripts/webshims/shims/combos/25.js +133 -40
- data/vendor/assets/javascripts/webshims/shims/combos/26.js +7 -4
- data/vendor/assets/javascripts/webshims/shims/combos/27.js +1 -1
- data/vendor/assets/javascripts/webshims/shims/combos/28.js +121 -24
- data/vendor/assets/javascripts/webshims/shims/combos/29.js +4 -6
- data/vendor/assets/javascripts/webshims/shims/combos/3.js +30 -6
- data/vendor/assets/javascripts/webshims/shims/combos/30.js +30 -6
- data/vendor/assets/javascripts/webshims/shims/combos/31.js +22 -5
- data/vendor/assets/javascripts/webshims/shims/combos/4.js +15 -5
- data/vendor/assets/javascripts/webshims/shims/combos/5.js +128 -19
- data/vendor/assets/javascripts/webshims/shims/combos/6.js +128 -19
- data/vendor/assets/javascripts/webshims/shims/combos/7.js +39 -19
- data/vendor/assets/javascripts/webshims/shims/combos/8.js +39 -19
- data/vendor/assets/javascripts/webshims/shims/combos/9.js +61 -20
- data/vendor/assets/javascripts/webshims/shims/dom-extend.js +7 -4
- data/vendor/assets/javascripts/webshims/shims/es5.js +3 -3
- data/vendor/assets/javascripts/webshims/shims/form-core.js +15 -1
- data/vendor/assets/javascripts/webshims/shims/form-message.js +8 -1
- data/vendor/assets/javascripts/webshims/shims/form-number-date-api.js +74 -3
- data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +53 -15
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +10 -5
- data/vendor/assets/javascripts/webshims/shims/form-validation.js +48 -13
- data/vendor/assets/javascripts/webshims/shims/forms-picker.js +14 -2
- data/vendor/assets/javascripts/webshims/shims/geolocation.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ar.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ch-ZN.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-de.txt +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-el.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-en.txt +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-es.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-fr.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-he.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-hi.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-hu.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-it.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ja.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-lt.js +7 -4
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-nl.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-pl.js +106 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-pt-PT.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ru.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-sv.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +8 -12
- data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +114 -20
- data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +132 -17
- data/vendor/assets/javascripts/webshims/shims/range-ui.js +1 -1
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +38 -3
- data/vendor/assets/javascripts/webshims/shims/styles/shim.css +42 -13
- data/vendor/assets/javascripts/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/swfmini.js +1 -1
- data/vendor/assets/javascripts/webshims/shims/track-ui.js +4 -6
- metadata +3 -2
@@ -12,14 +12,14 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
12
12
|
webshims.error("Webshims needs jQuery 1.8+ to work properly. Please update your jQuery version or downgrade webshims.");
|
13
13
|
}
|
14
14
|
|
15
|
-
if(webshims.cfg.extendNative
|
15
|
+
if(webshims.cfg.extendNative === 1){
|
16
16
|
webshims.warn("extendNative configuration will be set to false by default with next release. In case you rely on it set it to 'true' otherwise to 'false'. See http://bit.ly/16OOTQO");
|
17
17
|
}
|
18
18
|
|
19
19
|
if (!webshims.cfg.no$Switch) {
|
20
20
|
var switch$ = function(){
|
21
21
|
if (window.jQuery && (!window.$ || window.jQuery == window.$) && !window.jQuery.webshims) {
|
22
|
-
webshims.error("jQuery was included more than once. Make sure to include it only once or try the $.noConflict(extreme) feature! Webshims and other Plugins might not work properly
|
22
|
+
webshims.error("jQuery was included more than once. Make sure to include it only once or try the $.noConflict(extreme) feature! Webshims and other Plugins might not work properly. Or set webshims.cfg.no$Switch to 'true'.");
|
23
23
|
if (window.$) {
|
24
24
|
window.$ = webshims.$;
|
25
25
|
}
|
@@ -561,6 +561,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
561
561
|
setInterval(this.test, 600);
|
562
562
|
$(this.test);
|
563
563
|
webshims.ready('WINDOWLOAD', this.test);
|
564
|
+
$(document).on('updatelayout', this.handler);
|
564
565
|
$(window).bind('resize', this.handler);
|
565
566
|
(function(){
|
566
567
|
var oldAnimate = $.fn.animate;
|
@@ -608,7 +609,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
608
609
|
|
609
610
|
$(nativeElem).on('remove', function(e){
|
610
611
|
if (!e.originalEvent) {
|
611
|
-
|
612
|
+
setTimeout(function(){
|
613
|
+
$(shadowElem).remove();
|
614
|
+
}, 4);
|
612
615
|
}
|
613
616
|
});
|
614
617
|
|
@@ -1086,7 +1089,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
1086
1089
|
}
|
1087
1090
|
});
|
1088
1091
|
|
1089
|
-
})(
|
1092
|
+
})(webshims.$, document);
|
1090
1093
|
|
1091
1094
|
webshims.register('form-core', function($, webshims, window, document, undefined, options){
|
1092
1095
|
"use strict";
|
@@ -1165,6 +1168,7 @@ webshims.register('form-core', function($, webshims, window, document, undefined
|
|
1165
1168
|
$.expr[":"][name] = $.expr.filters[name+"-element"];
|
1166
1169
|
});
|
1167
1170
|
|
1171
|
+
//bug was partially fixed in 1.10.0 for IE9, but not IE8 (move to es5 as soon as 1.10.2 is used)
|
1168
1172
|
var pseudoFocus = $.expr[":"].focus;
|
1169
1173
|
$.expr[":"].focus = function(){
|
1170
1174
|
try {
|
@@ -1187,10 +1191,18 @@ webshims.register('form-core', function($, webshims, window, document, undefined
|
|
1187
1191
|
};
|
1188
1192
|
|
1189
1193
|
var transClass = ('transitionDelay' in document.documentElement.style) ? '' : ' no-transition';
|
1194
|
+
var poCFG = webshims.cfg.wspopover;
|
1195
|
+
if(!poCFG.position && poCFG.position !== false){
|
1196
|
+
poCFG.position = {
|
1197
|
+
at: 'left bottom',
|
1198
|
+
my: 'left top',
|
1199
|
+
collision: 'fit flip'
|
1200
|
+
};
|
1201
|
+
}
|
1190
1202
|
webshims.wsPopover = {
|
1191
1203
|
id: 0,
|
1192
1204
|
_create: function(){
|
1193
|
-
this.options = $.extend({},
|
1205
|
+
this.options = $.extend(true, {}, poCFG, this.options);
|
1194
1206
|
this.id = webshims.wsPopover.id++;
|
1195
1207
|
this.eventns = '.wsoverlay' + this.id;
|
1196
1208
|
this.timers = {};
|
@@ -1237,6 +1249,11 @@ webshims.register('form-core', function($, webshims, window, document, undefined
|
|
1237
1249
|
var message = $(elem).data('errormessage') || elem.getAttribute('x-moz-errormessage') || '';
|
1238
1250
|
if(key && message[key]){
|
1239
1251
|
message = message[key];
|
1252
|
+
} else if(message) {
|
1253
|
+
validity = validity || $.prop(elem, 'validity') || {valid: 1};
|
1254
|
+
if(validity.valid){
|
1255
|
+
message = '';
|
1256
|
+
}
|
1240
1257
|
}
|
1241
1258
|
if(typeof message == 'object'){
|
1242
1259
|
validity = validity || $.prop(elem, 'validity') || {valid: 1};
|
@@ -12,14 +12,14 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
12
12
|
webshims.error("Webshims needs jQuery 1.8+ to work properly. Please update your jQuery version or downgrade webshims.");
|
13
13
|
}
|
14
14
|
|
15
|
-
if(webshims.cfg.extendNative
|
15
|
+
if(webshims.cfg.extendNative === 1){
|
16
16
|
webshims.warn("extendNative configuration will be set to false by default with next release. In case you rely on it set it to 'true' otherwise to 'false'. See http://bit.ly/16OOTQO");
|
17
17
|
}
|
18
18
|
|
19
19
|
if (!webshims.cfg.no$Switch) {
|
20
20
|
var switch$ = function(){
|
21
21
|
if (window.jQuery && (!window.$ || window.jQuery == window.$) && !window.jQuery.webshims) {
|
22
|
-
webshims.error("jQuery was included more than once. Make sure to include it only once or try the $.noConflict(extreme) feature! Webshims and other Plugins might not work properly
|
22
|
+
webshims.error("jQuery was included more than once. Make sure to include it only once or try the $.noConflict(extreme) feature! Webshims and other Plugins might not work properly. Or set webshims.cfg.no$Switch to 'true'.");
|
23
23
|
if (window.$) {
|
24
24
|
window.$ = webshims.$;
|
25
25
|
}
|
@@ -561,6 +561,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
561
561
|
setInterval(this.test, 600);
|
562
562
|
$(this.test);
|
563
563
|
webshims.ready('WINDOWLOAD', this.test);
|
564
|
+
$(document).on('updatelayout', this.handler);
|
564
565
|
$(window).bind('resize', this.handler);
|
565
566
|
(function(){
|
566
567
|
var oldAnimate = $.fn.animate;
|
@@ -608,7 +609,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
608
609
|
|
609
610
|
$(nativeElem).on('remove', function(e){
|
610
611
|
if (!e.originalEvent) {
|
611
|
-
|
612
|
+
setTimeout(function(){
|
613
|
+
$(shadowElem).remove();
|
614
|
+
}, 4);
|
612
615
|
}
|
613
616
|
});
|
614
617
|
|
@@ -1086,7 +1089,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
1086
1089
|
}
|
1087
1090
|
});
|
1088
1091
|
|
1089
|
-
})(
|
1092
|
+
})(webshims.$, document);
|
1090
1093
|
|
1091
1094
|
webshims.register('form-message', function($, webshims, window, document, undefined, options){
|
1092
1095
|
"use strict";
|
@@ -1266,6 +1269,10 @@ webshims.register('form-message', function($, webshims, window, document, undefi
|
|
1266
1269
|
});
|
1267
1270
|
|
1268
1271
|
implementProperties.forEach(function(messageProp){
|
1272
|
+
var skipNames = {
|
1273
|
+
valid: 1,
|
1274
|
+
badInput: 1
|
1275
|
+
};
|
1269
1276
|
webshims.defineNodeNamesProperty(['fieldset', 'output', 'button'], messageProp, {
|
1270
1277
|
prop: {
|
1271
1278
|
value: '',
|
@@ -1294,13 +1301,16 @@ webshims.register('form-message', function($, webshims, window, document, undefi
|
|
1294
1301
|
if(message){return message;}
|
1295
1302
|
}
|
1296
1303
|
$.each(validity, function(name, prop){
|
1297
|
-
if(name
|
1304
|
+
if(skipNames[name] || !prop){return;}
|
1298
1305
|
|
1299
1306
|
message = webshims.createValidationMessage(elem, name);
|
1300
1307
|
if(message){
|
1301
1308
|
return false;
|
1302
1309
|
}
|
1303
1310
|
});
|
1311
|
+
if(!message && validity.badInput){
|
1312
|
+
message = webshims.createValidationMessage(elem, 'typeMismatch') || webshims.createValidationMessage(elem, 'valueMissing');
|
1313
|
+
}
|
1304
1314
|
return message || '';
|
1305
1315
|
},
|
1306
1316
|
writeable: false
|
@@ -272,7 +272,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
272
272
|
if(!('type' in cache)){
|
273
273
|
cache.type = getType(input[0]);
|
274
274
|
}
|
275
|
-
|
275
|
+
if(cache.type == 'week'){return false;}
|
276
276
|
var ret = (validityState || {}).stepMismatch || false, base;
|
277
277
|
if(typeModels[cache.type] && typeModels[cache.type].step){
|
278
278
|
if( !('step' in cache) ){
|
@@ -460,6 +460,29 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
460
460
|
});
|
461
461
|
});
|
462
462
|
|
463
|
+
/*
|
464
|
+
* ToDO: WEEK
|
465
|
+
*/
|
466
|
+
// var getWeek = function(date){
|
467
|
+
// var time;
|
468
|
+
// var checkDate = new Date(date.getTime());
|
469
|
+
//
|
470
|
+
// checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
|
471
|
+
//
|
472
|
+
// time = checkDate.getTime();
|
473
|
+
// checkDate.setMonth(0);
|
474
|
+
// checkDate.setDate(1);
|
475
|
+
// return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
|
476
|
+
// };
|
477
|
+
//
|
478
|
+
// var setWeek = function(year, week){
|
479
|
+
// var date = new Date(year, 0, 1);
|
480
|
+
//
|
481
|
+
// week = (week - 1) * 86400000 * 7;
|
482
|
+
// date = new Date(date.getTime() + week);
|
483
|
+
// date.setDate(date.getDate() + 1 - (date.getDay() || 7));
|
484
|
+
// return date;
|
485
|
+
// };
|
463
486
|
|
464
487
|
var typeProtos = {
|
465
488
|
|
@@ -536,6 +559,56 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
536
559
|
return (date && date.getFullYear) ? addleadingZero(date.getUTCFullYear(), 4) +'-'+ addleadingZero(date.getUTCMonth()+1, 2) +'-'+ addleadingZero(date.getUTCDate(), 2) : false;
|
537
560
|
}
|
538
561
|
},
|
562
|
+
/*
|
563
|
+
* ToDO: WEEK
|
564
|
+
*/
|
565
|
+
// week: {
|
566
|
+
// mismatch: function(val){
|
567
|
+
// if(!val || !val.split){return true;}
|
568
|
+
// var valA = val.split('-W');
|
569
|
+
// var ret = true;
|
570
|
+
// if(valA.length == 2 && valA[0].length > 3 && valA.length == 2){
|
571
|
+
// ret = this.dateToString(setWeek(valA[0], valA[1])) != val;
|
572
|
+
// }
|
573
|
+
// return ret;
|
574
|
+
// },
|
575
|
+
// step: 1,
|
576
|
+
// stepScaleFactor: 604800000,
|
577
|
+
// stepBase: -259200000,
|
578
|
+
// asDate: function(str, _noMismatch){
|
579
|
+
// var ret = null;
|
580
|
+
// if(_noMismatch || !this.mismatch(str)){
|
581
|
+
// ret = str.split('-W');
|
582
|
+
// ret = setWeek(ret[0], ret[1]);
|
583
|
+
// }
|
584
|
+
// return ret;
|
585
|
+
// },
|
586
|
+
// asNumber: function(str, _noMismatch){
|
587
|
+
// var ret = nan;
|
588
|
+
// var date = this.asDate(str, _noMismatch);
|
589
|
+
// if(date && date.getUTCFullYear){
|
590
|
+
// ret = date.getTime();
|
591
|
+
// }
|
592
|
+
// return ret;
|
593
|
+
// },
|
594
|
+
// dateToString: function(date){
|
595
|
+
// var week, checkDate;
|
596
|
+
// var ret = false;
|
597
|
+
// if(date && date.getFullYear){
|
598
|
+
// week = getWeek(date);
|
599
|
+
// if(week == 1){
|
600
|
+
// checkDate = new Date(date.getTime());
|
601
|
+
// checkDate.setDate(checkDate.getDate() + 7);
|
602
|
+
// date.setUTCFullYear(checkDate.getUTCFullYear());
|
603
|
+
// }
|
604
|
+
// ret = addleadingZero(date.getUTCFullYear(), 4) +'-W'+addleadingZero(week, 2);
|
605
|
+
// }
|
606
|
+
// return ret;
|
607
|
+
// },
|
608
|
+
// numberToString: function(num){
|
609
|
+
// return (isNumber(num)) ? this.dateToString(new Date( num * 1)) : false;
|
610
|
+
// }
|
611
|
+
// },
|
539
612
|
time: {
|
540
613
|
mismatch: function(val, _getParsed){
|
541
614
|
if(!val || !val.split || !(/\d$/.test(val))){return true;}
|
@@ -694,8 +767,6 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
694
767
|
// typeProtos['datetime-local'] = $.extend({}, typeProtos.date, typeProtos.time, typeProtos['datetime-local']);
|
695
768
|
}
|
696
769
|
|
697
|
-
|
698
|
-
|
699
770
|
//'datetime-local'
|
700
771
|
['number', 'month', 'range', 'date', 'time', 'color'].forEach(function(type){
|
701
772
|
if(typeBugs || !supportsType(type)){
|
@@ -1223,14 +1294,14 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
1223
1294
|
webshims._polyfill(['es5']);
|
1224
1295
|
}
|
1225
1296
|
}
|
1226
|
-
})(jQuery);
|
1297
|
+
})(window.webshims ? webshims.$ : jQuery);
|
1227
1298
|
webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
|
1228
1299
|
"use strict";
|
1229
1300
|
var curCfg;
|
1230
1301
|
var formcfg = webshims.formcfg;
|
1231
1302
|
|
1232
1303
|
var stopPropagation = function(e){
|
1233
|
-
e.stopImmediatePropagation(
|
1304
|
+
e.stopImmediatePropagation();
|
1234
1305
|
};
|
1235
1306
|
var createFormat = function(name){
|
1236
1307
|
if(!curCfg.patterns[name+'Obj']){
|
@@ -1301,6 +1372,10 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1301
1372
|
number: {
|
1302
1373
|
step: 1
|
1303
1374
|
},
|
1375
|
+
// week: {
|
1376
|
+
// step: 1,
|
1377
|
+
// start: new Date(nowDate)
|
1378
|
+
// },
|
1304
1379
|
time: {
|
1305
1380
|
step: 60
|
1306
1381
|
},
|
@@ -1503,6 +1578,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1503
1578
|
time: function(val){
|
1504
1579
|
return val;
|
1505
1580
|
},
|
1581
|
+
week: function(val){
|
1582
|
+
return val;
|
1583
|
+
},
|
1506
1584
|
//todo empty val for month/split
|
1507
1585
|
month: function(val, options){
|
1508
1586
|
var names;
|
@@ -1552,6 +1630,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1552
1630
|
number: function(val){
|
1553
1631
|
return (val+'').replace(curCfg.numberFormat[','], '').replace(curCfg.numberFormat['.'], '.');
|
1554
1632
|
},
|
1633
|
+
// week: function(val){
|
1634
|
+
// return val;
|
1635
|
+
// },
|
1555
1636
|
time: function(val){
|
1556
1637
|
return val;
|
1557
1638
|
},
|
@@ -1688,6 +1769,10 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1688
1769
|
steps[this.type].start = this.asNumber(steps[this.type].start);
|
1689
1770
|
}
|
1690
1771
|
|
1772
|
+
if(!webshims.picker[this.type]){
|
1773
|
+
o.buttonOnly = false;
|
1774
|
+
}
|
1775
|
+
|
1691
1776
|
for(i = 0; i < createOpts.length; i++){
|
1692
1777
|
if(o[createOpts[i]] != null){
|
1693
1778
|
this[createOpts[i]](o[createOpts[i]], o[createOpts[i]]);
|
@@ -1699,6 +1784,11 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1699
1784
|
this.addBindings();
|
1700
1785
|
$(this.element).data('wsWidget'+o.type, this);
|
1701
1786
|
|
1787
|
+
|
1788
|
+
if(o.buttonOnly){
|
1789
|
+
this.inputElements.prop({readOnly: true});
|
1790
|
+
}
|
1791
|
+
|
1702
1792
|
this._init = true;
|
1703
1793
|
|
1704
1794
|
if(o.mirrorValidity){
|
@@ -1779,7 +1869,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1779
1869
|
if(preventBlur.prevent){
|
1780
1870
|
e.preventDefault();
|
1781
1871
|
(isFocused || that.element.getShadowFocusElement()).focus();
|
1782
|
-
e
|
1872
|
+
stopPropagation(e);
|
1783
1873
|
return true;
|
1784
1874
|
}
|
1785
1875
|
};
|
@@ -2151,12 +2241,18 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2151
2241
|
['readonly', 'disabled'].forEach(function(name){
|
2152
2242
|
var isDisabled = name == 'disabled';
|
2153
2243
|
wsWidgetProto[name] = function(val, boolVal){
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2244
|
+
var options = this.options;
|
2245
|
+
if(options[name] != boolVal || !this._init){
|
2246
|
+
options[name] = !!boolVal;
|
2247
|
+
|
2248
|
+
if(!isDisabled && options.buttonOnly){
|
2249
|
+
this.inputElements.attr({'aria-readonly': options[name]});
|
2250
|
+
} else {
|
2251
|
+
this.inputElements.prop(name, options[name]);
|
2252
|
+
}
|
2253
|
+
this.buttonWrapper[options[name] ? 'addClass' : 'removeClass']('ws-'+name);
|
2158
2254
|
if(isDisabled){
|
2159
|
-
$('button', this.buttonWrapper).prop('disabled',
|
2255
|
+
$('button', this.buttonWrapper).prop('disabled', options[name]);
|
2160
2256
|
}
|
2161
2257
|
}
|
2162
2258
|
};
|
@@ -2443,9 +2539,10 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2443
2539
|
|
2444
2540
|
|
2445
2541
|
picker._common = function(data){
|
2446
|
-
var popover = webshims.objectCreate(webshims.wsPopover, {}, {prepareFor: data.element});
|
2447
|
-
var opener = $('<button type="button" class="ws-popover-opener"><span /></button>').appendTo(data.buttonWrapper);
|
2448
2542
|
var options = data.options;
|
2543
|
+
var popover = webshims.objectCreate(webshims.wsPopover, {}, {prepareFor: data.element, position: options.widgetPosition});
|
2544
|
+
var opener = $('<button type="button" class="ws-popover-opener"><span /></button>').appendTo(data.buttonWrapper);
|
2545
|
+
|
2449
2546
|
|
2450
2547
|
var showPickerContent = function(){
|
2451
2548
|
(picker[data.type].showPickerContent || picker.showPickerContent)(data, popover);
|
@@ -2534,8 +2631,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2534
2631
|
};
|
2535
2632
|
data.inputElements.on({
|
2536
2633
|
focus: function(){
|
2537
|
-
if(!popover.stopOpen && (
|
2538
|
-
popover.openedByFocus = !options.noInput;
|
2634
|
+
if(!popover.stopOpen && (options.buttonOnly || options.openOnFocus || (mouseFocus && options.openOnMouseFocus))){
|
2635
|
+
popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
|
2539
2636
|
show();
|
2540
2637
|
} else {
|
2541
2638
|
popover.preventBlur();
|
@@ -2544,8 +2641,15 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2544
2641
|
mousedown: function(){
|
2545
2642
|
mouseFocus = true;
|
2546
2643
|
setTimeout(resetMouseFocus, 9);
|
2644
|
+
if(options.buttonOnly && popover.isVisible && popover.activeElement){
|
2645
|
+
popover.openedByFocus = false;
|
2646
|
+
setTimeout(function(){
|
2647
|
+
popover.openedByFocus = false;
|
2648
|
+
popover.activeElement.focus();
|
2649
|
+
}, 4);
|
2650
|
+
}
|
2547
2651
|
if(data.element.is(':focus')){
|
2548
|
-
popover.openedByFocus = !options.noInput;
|
2652
|
+
popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
|
2549
2653
|
show();
|
2550
2654
|
}
|
2551
2655
|
popover.preventBlur();
|
@@ -2556,8 +2660,10 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2556
2660
|
data.opener = opener;
|
2557
2661
|
$(data.orig).on('remove', function(e){
|
2558
2662
|
if(!e.originalEvent){
|
2559
|
-
|
2560
|
-
|
2663
|
+
setTimeout(function(){
|
2664
|
+
opener.remove();
|
2665
|
+
popover.element.remove();
|
2666
|
+
}, 4);
|
2561
2667
|
}
|
2562
2668
|
});
|
2563
2669
|
|
@@ -2566,6 +2672,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2566
2672
|
|
2567
2673
|
picker.month = picker._common;
|
2568
2674
|
picker.date = picker._common;
|
2675
|
+
// picker.week = picker._common;
|
2569
2676
|
picker.color = function(data){
|
2570
2677
|
var ret = picker._common.apply(this, arguments);
|
2571
2678
|
var alpha = $(data.orig).data('alphacontrol');
|
@@ -2817,10 +2924,12 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2817
2924
|
data.shim.element.addClass('has-input-buttons');
|
2818
2925
|
}
|
2819
2926
|
|
2927
|
+
data.shim.element.addClass($.prop(this, 'className'));
|
2928
|
+
|
2820
2929
|
if(opts.calculateWidth){
|
2821
2930
|
sizeInput(data.shim);
|
2822
2931
|
} else {
|
2823
|
-
$(this).
|
2932
|
+
$(this).addClass('ws-important-hide');
|
2824
2933
|
}
|
2825
2934
|
}
|
2826
2935
|
|
@@ -272,7 +272,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
272
272
|
if(!('type' in cache)){
|
273
273
|
cache.type = getType(input[0]);
|
274
274
|
}
|
275
|
-
|
275
|
+
if(cache.type == 'week'){return false;}
|
276
276
|
var ret = (validityState || {}).stepMismatch || false, base;
|
277
277
|
if(typeModels[cache.type] && typeModels[cache.type].step){
|
278
278
|
if( !('step' in cache) ){
|
@@ -460,6 +460,29 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
460
460
|
});
|
461
461
|
});
|
462
462
|
|
463
|
+
/*
|
464
|
+
* ToDO: WEEK
|
465
|
+
*/
|
466
|
+
// var getWeek = function(date){
|
467
|
+
// var time;
|
468
|
+
// var checkDate = new Date(date.getTime());
|
469
|
+
//
|
470
|
+
// checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
|
471
|
+
//
|
472
|
+
// time = checkDate.getTime();
|
473
|
+
// checkDate.setMonth(0);
|
474
|
+
// checkDate.setDate(1);
|
475
|
+
// return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
|
476
|
+
// };
|
477
|
+
//
|
478
|
+
// var setWeek = function(year, week){
|
479
|
+
// var date = new Date(year, 0, 1);
|
480
|
+
//
|
481
|
+
// week = (week - 1) * 86400000 * 7;
|
482
|
+
// date = new Date(date.getTime() + week);
|
483
|
+
// date.setDate(date.getDate() + 1 - (date.getDay() || 7));
|
484
|
+
// return date;
|
485
|
+
// };
|
463
486
|
|
464
487
|
var typeProtos = {
|
465
488
|
|
@@ -536,6 +559,56 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
536
559
|
return (date && date.getFullYear) ? addleadingZero(date.getUTCFullYear(), 4) +'-'+ addleadingZero(date.getUTCMonth()+1, 2) +'-'+ addleadingZero(date.getUTCDate(), 2) : false;
|
537
560
|
}
|
538
561
|
},
|
562
|
+
/*
|
563
|
+
* ToDO: WEEK
|
564
|
+
*/
|
565
|
+
// week: {
|
566
|
+
// mismatch: function(val){
|
567
|
+
// if(!val || !val.split){return true;}
|
568
|
+
// var valA = val.split('-W');
|
569
|
+
// var ret = true;
|
570
|
+
// if(valA.length == 2 && valA[0].length > 3 && valA.length == 2){
|
571
|
+
// ret = this.dateToString(setWeek(valA[0], valA[1])) != val;
|
572
|
+
// }
|
573
|
+
// return ret;
|
574
|
+
// },
|
575
|
+
// step: 1,
|
576
|
+
// stepScaleFactor: 604800000,
|
577
|
+
// stepBase: -259200000,
|
578
|
+
// asDate: function(str, _noMismatch){
|
579
|
+
// var ret = null;
|
580
|
+
// if(_noMismatch || !this.mismatch(str)){
|
581
|
+
// ret = str.split('-W');
|
582
|
+
// ret = setWeek(ret[0], ret[1]);
|
583
|
+
// }
|
584
|
+
// return ret;
|
585
|
+
// },
|
586
|
+
// asNumber: function(str, _noMismatch){
|
587
|
+
// var ret = nan;
|
588
|
+
// var date = this.asDate(str, _noMismatch);
|
589
|
+
// if(date && date.getUTCFullYear){
|
590
|
+
// ret = date.getTime();
|
591
|
+
// }
|
592
|
+
// return ret;
|
593
|
+
// },
|
594
|
+
// dateToString: function(date){
|
595
|
+
// var week, checkDate;
|
596
|
+
// var ret = false;
|
597
|
+
// if(date && date.getFullYear){
|
598
|
+
// week = getWeek(date);
|
599
|
+
// if(week == 1){
|
600
|
+
// checkDate = new Date(date.getTime());
|
601
|
+
// checkDate.setDate(checkDate.getDate() + 7);
|
602
|
+
// date.setUTCFullYear(checkDate.getUTCFullYear());
|
603
|
+
// }
|
604
|
+
// ret = addleadingZero(date.getUTCFullYear(), 4) +'-W'+addleadingZero(week, 2);
|
605
|
+
// }
|
606
|
+
// return ret;
|
607
|
+
// },
|
608
|
+
// numberToString: function(num){
|
609
|
+
// return (isNumber(num)) ? this.dateToString(new Date( num * 1)) : false;
|
610
|
+
// }
|
611
|
+
// },
|
539
612
|
time: {
|
540
613
|
mismatch: function(val, _getParsed){
|
541
614
|
if(!val || !val.split || !(/\d$/.test(val))){return true;}
|
@@ -694,8 +767,6 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
694
767
|
// typeProtos['datetime-local'] = $.extend({}, typeProtos.date, typeProtos.time, typeProtos['datetime-local']);
|
695
768
|
}
|
696
769
|
|
697
|
-
|
698
|
-
|
699
770
|
//'datetime-local'
|
700
771
|
['number', 'month', 'range', 'date', 'time', 'color'].forEach(function(type){
|
701
772
|
if(typeBugs || !supportsType(type)){
|
@@ -1223,14 +1294,14 @@ webshims.register('form-number-date-api', function($, webshims, window, document
|
|
1223
1294
|
webshims._polyfill(['es5']);
|
1224
1295
|
}
|
1225
1296
|
}
|
1226
|
-
})(jQuery);
|
1297
|
+
})(window.webshims ? webshims.$ : jQuery);
|
1227
1298
|
webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
|
1228
1299
|
"use strict";
|
1229
1300
|
var curCfg;
|
1230
1301
|
var formcfg = webshims.formcfg;
|
1231
1302
|
|
1232
1303
|
var stopPropagation = function(e){
|
1233
|
-
e.stopImmediatePropagation(
|
1304
|
+
e.stopImmediatePropagation();
|
1234
1305
|
};
|
1235
1306
|
var createFormat = function(name){
|
1236
1307
|
if(!curCfg.patterns[name+'Obj']){
|
@@ -1301,6 +1372,10 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1301
1372
|
number: {
|
1302
1373
|
step: 1
|
1303
1374
|
},
|
1375
|
+
// week: {
|
1376
|
+
// step: 1,
|
1377
|
+
// start: new Date(nowDate)
|
1378
|
+
// },
|
1304
1379
|
time: {
|
1305
1380
|
step: 60
|
1306
1381
|
},
|
@@ -1503,6 +1578,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1503
1578
|
time: function(val){
|
1504
1579
|
return val;
|
1505
1580
|
},
|
1581
|
+
week: function(val){
|
1582
|
+
return val;
|
1583
|
+
},
|
1506
1584
|
//todo empty val for month/split
|
1507
1585
|
month: function(val, options){
|
1508
1586
|
var names;
|
@@ -1552,6 +1630,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1552
1630
|
number: function(val){
|
1553
1631
|
return (val+'').replace(curCfg.numberFormat[','], '').replace(curCfg.numberFormat['.'], '.');
|
1554
1632
|
},
|
1633
|
+
// week: function(val){
|
1634
|
+
// return val;
|
1635
|
+
// },
|
1555
1636
|
time: function(val){
|
1556
1637
|
return val;
|
1557
1638
|
},
|
@@ -1688,6 +1769,10 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1688
1769
|
steps[this.type].start = this.asNumber(steps[this.type].start);
|
1689
1770
|
}
|
1690
1771
|
|
1772
|
+
if(!webshims.picker[this.type]){
|
1773
|
+
o.buttonOnly = false;
|
1774
|
+
}
|
1775
|
+
|
1691
1776
|
for(i = 0; i < createOpts.length; i++){
|
1692
1777
|
if(o[createOpts[i]] != null){
|
1693
1778
|
this[createOpts[i]](o[createOpts[i]], o[createOpts[i]]);
|
@@ -1699,6 +1784,11 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1699
1784
|
this.addBindings();
|
1700
1785
|
$(this.element).data('wsWidget'+o.type, this);
|
1701
1786
|
|
1787
|
+
|
1788
|
+
if(o.buttonOnly){
|
1789
|
+
this.inputElements.prop({readOnly: true});
|
1790
|
+
}
|
1791
|
+
|
1702
1792
|
this._init = true;
|
1703
1793
|
|
1704
1794
|
if(o.mirrorValidity){
|
@@ -1779,7 +1869,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1779
1869
|
if(preventBlur.prevent){
|
1780
1870
|
e.preventDefault();
|
1781
1871
|
(isFocused || that.element.getShadowFocusElement()).focus();
|
1782
|
-
e
|
1872
|
+
stopPropagation(e);
|
1783
1873
|
return true;
|
1784
1874
|
}
|
1785
1875
|
};
|
@@ -2151,12 +2241,18 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2151
2241
|
['readonly', 'disabled'].forEach(function(name){
|
2152
2242
|
var isDisabled = name == 'disabled';
|
2153
2243
|
wsWidgetProto[name] = function(val, boolVal){
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2244
|
+
var options = this.options;
|
2245
|
+
if(options[name] != boolVal || !this._init){
|
2246
|
+
options[name] = !!boolVal;
|
2247
|
+
|
2248
|
+
if(!isDisabled && options.buttonOnly){
|
2249
|
+
this.inputElements.attr({'aria-readonly': options[name]});
|
2250
|
+
} else {
|
2251
|
+
this.inputElements.prop(name, options[name]);
|
2252
|
+
}
|
2253
|
+
this.buttonWrapper[options[name] ? 'addClass' : 'removeClass']('ws-'+name);
|
2158
2254
|
if(isDisabled){
|
2159
|
-
$('button', this.buttonWrapper).prop('disabled',
|
2255
|
+
$('button', this.buttonWrapper).prop('disabled', options[name]);
|
2160
2256
|
}
|
2161
2257
|
}
|
2162
2258
|
};
|
@@ -2443,9 +2539,10 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2443
2539
|
|
2444
2540
|
|
2445
2541
|
picker._common = function(data){
|
2446
|
-
var popover = webshims.objectCreate(webshims.wsPopover, {}, {prepareFor: data.element});
|
2447
|
-
var opener = $('<button type="button" class="ws-popover-opener"><span /></button>').appendTo(data.buttonWrapper);
|
2448
2542
|
var options = data.options;
|
2543
|
+
var popover = webshims.objectCreate(webshims.wsPopover, {}, {prepareFor: data.element, position: options.widgetPosition});
|
2544
|
+
var opener = $('<button type="button" class="ws-popover-opener"><span /></button>').appendTo(data.buttonWrapper);
|
2545
|
+
|
2449
2546
|
|
2450
2547
|
var showPickerContent = function(){
|
2451
2548
|
(picker[data.type].showPickerContent || picker.showPickerContent)(data, popover);
|
@@ -2534,8 +2631,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2534
2631
|
};
|
2535
2632
|
data.inputElements.on({
|
2536
2633
|
focus: function(){
|
2537
|
-
if(!popover.stopOpen && (
|
2538
|
-
popover.openedByFocus = !options.noInput;
|
2634
|
+
if(!popover.stopOpen && (options.buttonOnly || options.openOnFocus || (mouseFocus && options.openOnMouseFocus))){
|
2635
|
+
popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
|
2539
2636
|
show();
|
2540
2637
|
} else {
|
2541
2638
|
popover.preventBlur();
|
@@ -2544,8 +2641,15 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2544
2641
|
mousedown: function(){
|
2545
2642
|
mouseFocus = true;
|
2546
2643
|
setTimeout(resetMouseFocus, 9);
|
2644
|
+
if(options.buttonOnly && popover.isVisible && popover.activeElement){
|
2645
|
+
popover.openedByFocus = false;
|
2646
|
+
setTimeout(function(){
|
2647
|
+
popover.openedByFocus = false;
|
2648
|
+
popover.activeElement.focus();
|
2649
|
+
}, 4);
|
2650
|
+
}
|
2547
2651
|
if(data.element.is(':focus')){
|
2548
|
-
popover.openedByFocus = !options.noInput;
|
2652
|
+
popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
|
2549
2653
|
show();
|
2550
2654
|
}
|
2551
2655
|
popover.preventBlur();
|
@@ -2556,8 +2660,10 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2556
2660
|
data.opener = opener;
|
2557
2661
|
$(data.orig).on('remove', function(e){
|
2558
2662
|
if(!e.originalEvent){
|
2559
|
-
|
2560
|
-
|
2663
|
+
setTimeout(function(){
|
2664
|
+
opener.remove();
|
2665
|
+
popover.element.remove();
|
2666
|
+
}, 4);
|
2561
2667
|
}
|
2562
2668
|
});
|
2563
2669
|
|
@@ -2566,6 +2672,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2566
2672
|
|
2567
2673
|
picker.month = picker._common;
|
2568
2674
|
picker.date = picker._common;
|
2675
|
+
// picker.week = picker._common;
|
2569
2676
|
picker.color = function(data){
|
2570
2677
|
var ret = picker._common.apply(this, arguments);
|
2571
2678
|
var alpha = $(data.orig).data('alphacontrol');
|
@@ -2817,10 +2924,12 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2817
2924
|
data.shim.element.addClass('has-input-buttons');
|
2818
2925
|
}
|
2819
2926
|
|
2927
|
+
data.shim.element.addClass($.prop(this, 'className'));
|
2928
|
+
|
2820
2929
|
if(opts.calculateWidth){
|
2821
2930
|
sizeInput(data.shim);
|
2822
2931
|
} else {
|
2823
|
-
$(this).
|
2932
|
+
$(this).addClass('ws-important-hide');
|
2824
2933
|
}
|
2825
2934
|
}
|
2826
2935
|
|