webshims-rails 1.12.5 → 1.12.7
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 +111 -132
- data/vendor/assets/javascripts/webshims/shims/combos/1.js +40 -37
- data/vendor/assets/javascripts/webshims/shims/combos/10.js +217 -36
- data/vendor/assets/javascripts/webshims/shims/combos/11.js +151 -29
- data/vendor/assets/javascripts/webshims/shims/combos/12.js +70 -93
- data/vendor/assets/javascripts/webshims/shims/combos/13.js +70 -93
- data/vendor/assets/javascripts/webshims/shims/combos/14.js +90 -13
- data/vendor/assets/javascripts/webshims/shims/combos/15.js +202 -59
- data/vendor/assets/javascripts/webshims/shims/combos/16.js +208 -70
- data/vendor/assets/javascripts/webshims/shims/combos/17.js +151 -29
- data/vendor/assets/javascripts/webshims/shims/combos/18.js +155 -30
- data/vendor/assets/javascripts/webshims/shims/combos/19.js +79 -20
- data/vendor/assets/javascripts/webshims/shims/combos/2.js +109 -47
- data/vendor/assets/javascripts/webshims/shims/combos/20.js +79 -20
- data/vendor/assets/javascripts/webshims/shims/combos/21.js +80 -87
- data/vendor/assets/javascripts/webshims/shims/combos/22.js +66 -83
- data/vendor/assets/javascripts/webshims/shims/combos/23.js +4 -10
- data/vendor/assets/javascripts/webshims/shims/combos/25.js +79 -20
- data/vendor/assets/javascripts/webshims/shims/combos/26.js +66 -7
- data/vendor/assets/javascripts/webshims/shims/combos/28.js +100 -25
- data/vendor/assets/javascripts/webshims/shims/combos/3.js +192 -47
- data/vendor/assets/javascripts/webshims/shims/combos/30.js +193 -49
- data/vendor/assets/javascripts/webshims/shims/combos/31.js +103 -36
- data/vendor/assets/javascripts/webshims/shims/combos/32.js +5 -3
- data/vendor/assets/javascripts/webshims/shims/combos/33.js +1 -2
- data/vendor/assets/javascripts/webshims/shims/combos/34.js +2048 -0
- data/vendor/assets/javascripts/webshims/shims/combos/4.js +156 -20
- data/vendor/assets/javascripts/webshims/shims/combos/5.js +151 -29
- data/vendor/assets/javascripts/webshims/shims/combos/6.js +152 -31
- data/vendor/assets/javascripts/webshims/shims/combos/7.js +199 -60
- data/vendor/assets/javascripts/webshims/shims/combos/8.js +197 -58
- data/vendor/assets/javascripts/webshims/shims/combos/9.js +218 -38
- data/vendor/assets/javascripts/webshims/shims/combos/97.js +1004 -0
- data/vendor/assets/javascripts/webshims/shims/combos/98.js +1283 -0
- data/vendor/assets/javascripts/webshims/shims/combos/99.js +204 -1248
- data/vendor/assets/javascripts/webshims/shims/dom-extend.js +66 -7
- data/vendor/assets/javascripts/webshims/shims/es5.js +4 -1
- data/vendor/assets/javascripts/webshims/shims/form-combat.js +3 -3
- data/vendor/assets/javascripts/webshims/shims/form-core.js +36 -27
- data/vendor/assets/javascripts/webshims/shims/form-datalist.js +1 -2
- data/vendor/assets/javascripts/webshims/shims/form-fixrangechange.js +137 -0
- data/vendor/assets/javascripts/webshims/shims/form-message.js +90 -13
- data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +129 -15
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +9 -10
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend2.js +886 -985
- data/vendor/assets/javascripts/webshims/shims/form-validation.js +78 -174
- data/vendor/assets/javascripts/webshims/shims/form-validators.js +39 -26
- data/vendor/assets/javascripts/webshims/shims/forms-picker.js +45 -17
- data/vendor/assets/javascripts/webshims/shims/geolocation.js +10 -3
- data/vendor/assets/javascripts/webshims/shims/jme/b.js +71 -246
- data/vendor/assets/javascripts/webshims/shims/jme/c.js +133 -1002
- data/vendor/assets/javascripts/webshims/shims/jme/controls.css +62 -23
- data/vendor/assets/javascripts/webshims/shims/jme/controls.scss +73 -10
- data/vendor/assets/javascripts/webshims/shims/jme/mediacontrols-lazy.js +1117 -0
- data/vendor/assets/javascripts/webshims/shims/jme/p.js +603 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/jpicker.css +5 -2
- data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +4 -10
- data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +4 -1
- data/vendor/assets/javascripts/webshims/shims/range-ui.js +22 -14
- data/vendor/assets/javascripts/webshims/shims/styles/forms-ext.css +29 -344
- data/vendor/assets/javascripts/webshims/shims/styles/forms-picker.css +362 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-ext.scss +6 -483
- data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-picker.scss +488 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim-ext.scss +2 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +10 -2
- data/vendor/assets/javascripts/webshims/shims/styles/shim.css +6 -2
- data/vendor/assets/javascripts/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/track-ui.js +8 -1
- data/vendor/assets/javascripts/webshims/shims/track.js +66 -83
- metadata +12 -5
- data/vendor/assets/javascripts/webshims/shims/$ajax.js +0 -862
- data/vendor/assets/javascripts/webshims/shims/combos/24.js +0 -2087
@@ -1,3 +1,61 @@
|
|
1
|
+
|
2
|
+
//this might was already extended by ES5 shim feature
|
3
|
+
(function($){
|
4
|
+
"use strict";
|
5
|
+
var webshims = window.webshims;
|
6
|
+
if(webshims.defineProperties){return;}
|
7
|
+
var defineProperty = 'defineProperty';
|
8
|
+
var has = Object.prototype.hasOwnProperty;
|
9
|
+
var descProps = ['configurable', 'enumerable', 'writable'];
|
10
|
+
var extendUndefined = function(prop){
|
11
|
+
for(var i = 0; i < 3; i++){
|
12
|
+
if(prop[descProps[i]] === undefined && (descProps[i] !== 'writable' || prop.value !== undefined)){
|
13
|
+
prop[descProps[i]] = true;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
};
|
17
|
+
|
18
|
+
var extendProps = function(props){
|
19
|
+
if(props){
|
20
|
+
for(var i in props){
|
21
|
+
if(has.call(props, i)){
|
22
|
+
extendUndefined(props[i]);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
};
|
27
|
+
|
28
|
+
if(Object.create){
|
29
|
+
webshims.objectCreate = function(proto, props, opts){
|
30
|
+
extendProps(props);
|
31
|
+
var o = Object.create(proto, props);
|
32
|
+
if(opts){
|
33
|
+
o.options = $.extend(true, {}, o.options || {}, opts);
|
34
|
+
opts = o.options;
|
35
|
+
}
|
36
|
+
if(o._create && $.isFunction(o._create)){
|
37
|
+
o._create(opts);
|
38
|
+
}
|
39
|
+
return o;
|
40
|
+
};
|
41
|
+
}
|
42
|
+
|
43
|
+
if(Object[defineProperty]){
|
44
|
+
webshims[defineProperty] = function(obj, prop, desc){
|
45
|
+
extendUndefined(desc);
|
46
|
+
return Object[defineProperty](obj, prop, desc);
|
47
|
+
};
|
48
|
+
}
|
49
|
+
if(Object.defineProperties){
|
50
|
+
webshims.defineProperties = function(obj, props){
|
51
|
+
extendProps(props);
|
52
|
+
return Object.defineProperties(obj, props);
|
53
|
+
};
|
54
|
+
}
|
55
|
+
webshims.getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
56
|
+
|
57
|
+
webshims.getPrototypeOf = Object.getPrototypeOf;
|
58
|
+
})(window.webshims.$);
|
1
59
|
//DOM-Extension helper
|
2
60
|
webshims.register('dom-extend', function($, webshims, window, document, undefined){
|
3
61
|
"use strict";
|
@@ -633,6 +691,13 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
633
691
|
this.width = docObserve.getWidth();
|
634
692
|
setInterval(this.test, 999);
|
635
693
|
$(this.test);
|
694
|
+
if($.support.boxSizing == null){
|
695
|
+
$(function(){
|
696
|
+
if($.support.boxSizing){
|
697
|
+
docObserve.handler({type: 'boxsizing'});
|
698
|
+
}
|
699
|
+
});
|
700
|
+
}
|
636
701
|
webshims.ready('WINDOWLOAD', this.test);
|
637
702
|
$(document).on('updatelayout.webshim pageinit popupafteropen panelbeforeopen tabsactivate collapsibleexpand shown.bs.modal shown.bs.collapse slid.bs.carousel', this.handler);
|
638
703
|
$(window).on('resize', this.handler);
|
@@ -644,13 +709,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
644
709
|
webshims.docObserve = function(){
|
645
710
|
webshims.ready('DOM', function(){
|
646
711
|
docObserve.start();
|
647
|
-
|
648
|
-
$(function(){
|
649
|
-
if($.support.boxSizing){
|
650
|
-
docObserve.handler({type: 'boxsizing'});
|
651
|
-
}
|
652
|
-
});
|
653
|
-
}
|
712
|
+
|
654
713
|
});
|
655
714
|
};
|
656
715
|
return function(nativeElem, shadowElem, opts){
|
@@ -1257,26 +1316,103 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
1257
1316
|
min: 1,
|
1258
1317
|
max: 1
|
1259
1318
|
};
|
1319
|
+
var toLocale = (function(){
|
1320
|
+
var monthFormatter;
|
1321
|
+
var transforms = {
|
1322
|
+
number: function(val){
|
1323
|
+
var num = val * 1;
|
1324
|
+
if(num.toLocaleString && !isNaN(num)){
|
1325
|
+
val = num.toLocaleString() || val;
|
1326
|
+
}
|
1327
|
+
return val;
|
1328
|
+
}
|
1329
|
+
};
|
1330
|
+
var _toLocale = function(val, elem, attr){
|
1331
|
+
var type, widget;
|
1332
|
+
if(valueVals[attr]){
|
1333
|
+
type = $.prop(elem, 'type');
|
1334
|
+
widget = $(elem).getShadowElement().data('wsWidget'+ type );
|
1335
|
+
if(widget && widget.formatValue){
|
1336
|
+
val = widget.formatValue(val, false);
|
1337
|
+
} else if(transforms[type]){
|
1338
|
+
val = transforms[type](val);
|
1339
|
+
}
|
1340
|
+
}
|
1341
|
+
return val;
|
1342
|
+
};
|
1343
|
+
|
1344
|
+
[{n: 'date', f: 'toLocaleDateString'}, {n: 'time', f: 'toLocaleTimeString'}, {n: 'datetime-local', f: 'toLocaleString'}].forEach(function(desc){
|
1345
|
+
transforms[desc.n] = function(val){
|
1346
|
+
var date = new Date(val);
|
1347
|
+
if(date && date[desc.f]){
|
1348
|
+
val = date[desc.f]() || val;
|
1349
|
+
}
|
1350
|
+
return val;
|
1351
|
+
};
|
1352
|
+
});
|
1353
|
+
|
1354
|
+
if(window.Intl && Intl.DateTimeFormat){
|
1355
|
+
monthFormatter = new Intl.DateTimeFormat(navigator.browserLanguage || navigator.language, {year: "numeric", month: "2-digit"}).format(new Date());
|
1356
|
+
if(monthFormatter && monthFormatter.format){
|
1357
|
+
transforms.month = function(val){
|
1358
|
+
var date = new Date(val);
|
1359
|
+
if(date){
|
1360
|
+
val = monthFormatter.format(date) || val;
|
1361
|
+
}
|
1362
|
+
return val;
|
1363
|
+
};
|
1364
|
+
}
|
1365
|
+
}
|
1366
|
+
|
1367
|
+
webshims.format = {};
|
1368
|
+
|
1369
|
+
['date', 'number', 'month', 'time', 'datetime-local'].forEach(function(name){
|
1370
|
+
webshims.format[name] = function(val, opts){
|
1371
|
+
if(opts && opts.nodeType){
|
1372
|
+
return _toLocale(val, opts, name);
|
1373
|
+
}
|
1374
|
+
if(name == 'number' && opts && opts.toFixed ){
|
1375
|
+
val = (val * 1);
|
1376
|
+
if(!opts.fixOnlyFloat || val % 1){
|
1377
|
+
val = val.toFixed(opts.toFixed);
|
1378
|
+
}
|
1379
|
+
}
|
1380
|
+
if(webshims._format && webshims._format[name]){
|
1381
|
+
return webshims._format[name](val, opts);
|
1382
|
+
}
|
1383
|
+
return transforms[name](val);
|
1384
|
+
};
|
1385
|
+
});
|
1386
|
+
|
1387
|
+
return _toLocale;
|
1388
|
+
})();
|
1260
1389
|
|
1261
1390
|
webshims.replaceValidationplaceholder = function(elem, message, name){
|
1262
|
-
var
|
1391
|
+
var val = $.prop(elem, 'title');
|
1392
|
+
if(message){
|
1393
|
+
if(name == 'patternMismatch' && !val){
|
1394
|
+
webshims.error('no title for patternMismatch provided. Always add a title attribute.');
|
1395
|
+
}
|
1396
|
+
if(val){
|
1397
|
+
val = '<span class="ws-titlevalue">'+ val.replace(lReg, '<').replace(gReg, '>') +'</span>';
|
1398
|
+
}
|
1399
|
+
|
1400
|
+
if(message.indexOf('{%title}') != -1){
|
1401
|
+
message = message.replace('{%title}', val);
|
1402
|
+
} else if(val) {
|
1403
|
+
message = message+' '+val;
|
1404
|
+
}
|
1405
|
+
}
|
1406
|
+
|
1263
1407
|
if(message && message.indexOf('{%') != -1){
|
1264
|
-
['value', 'min', 'max', '
|
1408
|
+
['value', 'min', 'max', 'maxlength', 'minlength', 'label'].forEach(function(attr){
|
1265
1409
|
if(message.indexOf('{%'+attr) === -1){return;}
|
1266
1410
|
var val = ((attr == 'label') ? $.trim($('label[for="'+ elem.id +'"]', elem.form).text()).replace(/\*$|:$/, '') : $.prop(elem, attr)) || '';
|
1267
1411
|
val = ''+val;
|
1268
|
-
if(name == 'patternMismatch' && attr == 'title' && !val){
|
1269
|
-
webshims.error('no title for patternMismatch provided. Always add a title attribute.');
|
1270
|
-
}
|
1271
1412
|
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
}
|
1276
|
-
if(widget && widget.formatValue){
|
1277
|
-
val = widget.formatValue(val, false);
|
1278
|
-
}
|
1279
|
-
}
|
1413
|
+
|
1414
|
+
val = toLocale(val, elem, attr);
|
1415
|
+
|
1280
1416
|
message = message.replace('{%'+ attr +'}', val.replace(lReg, '<').replace(gReg, '>'));
|
1281
1417
|
if('value' == attr){
|
1282
1418
|
message = message.replace('{%valueLen}', val.length);
|
@@ -831,10 +831,11 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
831
831
|
_create: function(){
|
832
832
|
var i;
|
833
833
|
|
834
|
-
this.element.addClass(this.options.baseClass || 'ws-range').attr({role: 'slider'}).append('<span class="ws-range-
|
834
|
+
this.element.addClass(this.options.baseClass || 'ws-range ws-input').attr({role: 'slider'}).append('<span class="ws-range-rail ws-range-track"><span class="ws-range-min ws-range-progress" /><span class="ws-range-thumb"><span><span data-value="" data-valuetext="" /></span></span></span>');
|
835
835
|
this.trail = $('.ws-range-track', this.element);
|
836
836
|
this.range = $('.ws-range-progress', this.element);
|
837
837
|
this.thumb = $('.ws-range-thumb', this.trail);
|
838
|
+
this.thumbValue = $('span[data-value]', this.thumb);
|
838
839
|
|
839
840
|
this.updateMetrics();
|
840
841
|
|
@@ -885,8 +886,8 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
885
886
|
|
886
887
|
|
887
888
|
if(!animate || !$.fn.animate){
|
888
|
-
this.thumb.
|
889
|
-
this.range.
|
889
|
+
this.thumb[0].style[this.dirs.left] = thumbStyle[this.dirs.left];
|
890
|
+
this.range[0].style[this.dirs.width] = rangeStyle[this.dirs.width];
|
890
891
|
} else {
|
891
892
|
if(typeof animate != 'object'){
|
892
893
|
animate = {};
|
@@ -909,20 +910,19 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
909
910
|
_setValueMarkup: function(){
|
910
911
|
var o = this.options;
|
911
912
|
var textValue = o.textValue ? o.textValue(this.options.value) : o.options[o.value] || o.value;
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
});
|
913
|
+
|
914
|
+
this.element[0].setAttribute('aria-valuenow', this.options.value);
|
915
|
+
this.element[0].setAttribute('aria-valuetext', textValue);
|
916
|
+
|
917
|
+
this.thumbValue[0].setAttribute('data-value', this.options.value);
|
918
|
+
this.thumbValue[0].setAttribute('data-valuetext', textValue);
|
919
|
+
|
920
920
|
if(o.selectedOption){
|
921
921
|
$(o.selectedOption).removeClass('ws-selected-option');
|
922
922
|
o.selectedOption = null;
|
923
923
|
}
|
924
924
|
if(o.value in o.options){
|
925
|
-
o.selectedOption = $('[data-value="'+o.value+'"].ws-range-ticks').addClass('ws-selected-option');
|
925
|
+
o.selectedOption = $('[data-value="'+o.value+'"].ws-range-ticks', this.trail).addClass('ws-selected-option');
|
926
926
|
}
|
927
927
|
},
|
928
928
|
initDataList: function(){
|
@@ -1358,9 +1358,16 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
1358
1358
|
temp = this.element[this.dirs.innerHeight]();
|
1359
1359
|
eS[this.dirs.marginTop] = ((elem[this.dirs.outerHeight]() - temp) / -2) + 'px';
|
1360
1360
|
this.range[0].style[this.dirs.marginTop] = ((this.range[this.dirs.outerHeight]() - temp) / -2 ) +'px';
|
1361
|
+
|
1362
|
+
this.range[0].style[this.dirs.posLeft] = outerWidth +'px';
|
1363
|
+
|
1361
1364
|
outerWidth *= -1;
|
1365
|
+
|
1366
|
+
this.range[0].style[this.dirs.paddingRight] = outerWidth +'px';
|
1362
1367
|
this.trail[0].style[this.dirs.left] = outerWidth +'px';
|
1363
1368
|
this.trail[0].style[this.dirs.right] = outerWidth +'px';
|
1369
|
+
|
1370
|
+
|
1364
1371
|
}
|
1365
1372
|
}
|
1366
1373
|
},
|
@@ -1369,14 +1376,15 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
1369
1376
|
this.vertical = (width && this.element.innerHeight() - width > 10);
|
1370
1377
|
|
1371
1378
|
this.dirs = this.vertical ?
|
1372
|
-
{mouse: 'pageY', pos: 'top', min: 'max', max: 'min', left: 'top', right: 'bottom', width: 'height', innerWidth: 'innerHeight', innerHeight: 'innerWidth', outerWidth: 'outerHeight', outerHeight: 'outerWidth', marginTop: 'marginLeft', marginLeft: 'marginTop'} :
|
1373
|
-
{mouse: 'pageX', pos: 'left', min: 'min', max: 'max', left: 'left', right: 'right', width: 'width', innerWidth: 'innerWidth', innerHeight: 'innerHeight', outerWidth: 'outerWidth', outerHeight: 'outerHeight', marginTop: 'marginTop', marginLeft: 'marginLeft'}
|
1379
|
+
{mouse: 'pageY', pos: 'top', posLeft: 'bottom', paddingRight: 'paddingTop', min: 'max', max: 'min', left: 'top', right: 'bottom', width: 'height', innerWidth: 'innerHeight', innerHeight: 'innerWidth', outerWidth: 'outerHeight', outerHeight: 'outerWidth', marginTop: 'marginLeft', marginLeft: 'marginTop'} :
|
1380
|
+
{mouse: 'pageX', pos: 'left', posLeft: 'left', paddingRight: 'paddingRight', min: 'min', max: 'max', left: 'left', right: 'right', width: 'width', innerWidth: 'innerWidth', innerHeight: 'innerHeight', outerWidth: 'outerWidth', outerHeight: 'outerHeight', marginTop: 'marginTop', marginLeft: 'marginLeft'}
|
1374
1381
|
;
|
1375
1382
|
if(!this.vertical && this.element.css('direction') == 'rtl'){
|
1376
1383
|
this.isRtl = true;
|
1377
1384
|
this.dirs.left = 'right';
|
1378
1385
|
this.dirs.right = 'left';
|
1379
1386
|
this.dirs.marginLeft = 'marginRight';
|
1387
|
+
this.dirs.posLeft = 'right';
|
1380
1388
|
}
|
1381
1389
|
this.element
|
1382
1390
|
[this.vertical ? 'addClass' : 'removeClass']('vertical-range')
|
@@ -1629,6 +1637,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
1629
1637
|
options.addZero = addZero;
|
1630
1638
|
webshims.loader.addModule('forms-picker', {
|
1631
1639
|
noAutoCallback: true,
|
1640
|
+
css: 'styles/forms-picker.css',
|
1632
1641
|
options: options
|
1633
1642
|
});
|
1634
1643
|
webshims.loader.addModule('color-picker', {
|
@@ -1801,8 +1810,40 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
1801
1810
|
|
1802
1811
|
|
1803
1812
|
var formatVal = {
|
1804
|
-
number: function(val, o){
|
1805
|
-
|
1813
|
+
number: function(val, o, noCorrect){
|
1814
|
+
var parts, len, i, isNegative;
|
1815
|
+
if(o && o.nogrouping){
|
1816
|
+
return (val+'').replace(/\,/g, '').replace(/\./, curCfg.numberFormat['.']);
|
1817
|
+
}
|
1818
|
+
|
1819
|
+
val += '';
|
1820
|
+
|
1821
|
+
if(val.charAt(0) == '-'){
|
1822
|
+
isNegative = true;
|
1823
|
+
val = val.replace('-', '');
|
1824
|
+
}
|
1825
|
+
parts = val.split('.');
|
1826
|
+
len = parts[0].length;
|
1827
|
+
i = len - 1;
|
1828
|
+
|
1829
|
+
val = "";
|
1830
|
+
while(i >= 0) {
|
1831
|
+
val = parts[0].charAt(i) + val;
|
1832
|
+
if (i > 0 && (len - i) % 3 === 0) {
|
1833
|
+
val = curCfg.numberFormat[','] + val;
|
1834
|
+
}
|
1835
|
+
--i;
|
1836
|
+
}
|
1837
|
+
if(parts[1] != null){
|
1838
|
+
if(!noCorrect){
|
1839
|
+
parts[1] = parts[1].replace(/\-/g, '0');
|
1840
|
+
}
|
1841
|
+
val += curCfg.numberFormat['.'] + parts[1];
|
1842
|
+
}
|
1843
|
+
if(isNegative){
|
1844
|
+
val = '-'+val;
|
1845
|
+
}
|
1846
|
+
return val;
|
1806
1847
|
},
|
1807
1848
|
time: function(val){
|
1808
1849
|
var fVal;
|
@@ -1881,10 +1922,10 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
1881
1922
|
return ret;
|
1882
1923
|
}
|
1883
1924
|
};
|
1884
|
-
|
1925
|
+
|
1885
1926
|
var parseVal = {
|
1886
1927
|
number: function(val){
|
1887
|
-
return (val+'').
|
1928
|
+
return (val+'').split(curCfg.numberFormat[',']).join('').replace(curCfg.numberFormat['.'], '.');
|
1888
1929
|
},
|
1889
1930
|
// week: function(val){
|
1890
1931
|
// return val;
|
@@ -1953,7 +1994,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
1953
1994
|
val = val.split(curCfg.dFormat);
|
1954
1995
|
}
|
1955
1996
|
if(val.length == 3 && val[0] && val[1] && val[2] && (!noCorrect || (val[obj.yy].length > 3 && val[obj.mm].length == 2 && val[obj.dd].length == 2))){
|
1956
|
-
if(val[obj.mm] > 12 && val[obj.dd] < 13){
|
1997
|
+
if(!opts.noDayMonthSwitch && val[obj.mm] > 12 && val[obj.dd] < 13){
|
1957
1998
|
tmp = val[obj.dd];
|
1958
1999
|
val[obj.dd] = val[obj.mm];
|
1959
2000
|
val[obj.mm] = tmp;
|
@@ -2386,7 +2427,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
2386
2427
|
},
|
2387
2428
|
toFixed: function(val, force){
|
2388
2429
|
var o = this.options;
|
2389
|
-
if(o.toFixed && o.type == 'number' && val && this.valueAsNumber && (force || !this.element.is(':focus')) && (!o.fixOnlyFloat || (this.valueAsNumber % 1))
|
2430
|
+
if(o.toFixed && o.type == 'number' && val && !isNaN(this.valueAsNumber) && (force || !this.element.is(':focus')) && (!o.fixOnlyFloat || (this.valueAsNumber % 1))){
|
2390
2431
|
val = formatVal[this.type](this.valueAsNumber.toFixed(o.toFixed), this.options);
|
2391
2432
|
}
|
2392
2433
|
return val;
|
@@ -2395,7 +2436,8 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
2395
2436
|
|
2396
2437
|
['defaultValue', 'value'].forEach(function(name){
|
2397
2438
|
var isValue = name == 'value';
|
2398
|
-
spinBtnProto[name] = function(val, force){
|
2439
|
+
spinBtnProto[name] = function(val, force, isLive){
|
2440
|
+
var selectionEnd;
|
2399
2441
|
if(!this._init || force || this.options[name] !== val){
|
2400
2442
|
if(isValue){
|
2401
2443
|
this._beforeValue(val);
|
@@ -2414,7 +2456,14 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
2414
2456
|
}
|
2415
2457
|
});
|
2416
2458
|
} else {
|
2417
|
-
|
2459
|
+
val = this.toFixed(val);
|
2460
|
+
if(isLive && this._getSelectionEnd){
|
2461
|
+
selectionEnd = this._getSelectionEnd(val);
|
2462
|
+
}
|
2463
|
+
this.element.prop(name, val);
|
2464
|
+
if(selectionEnd){
|
2465
|
+
this.element.prop('selectionEnd', selectionEnd);
|
2466
|
+
}
|
2418
2467
|
}
|
2419
2468
|
this._propertyChange(name);
|
2420
2469
|
this.mirrorValidity();
|
@@ -2442,7 +2491,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
2442
2491
|
$.fn.wsBaseWidget = function(opts){
|
2443
2492
|
opts = $.extend({}, opts);
|
2444
2493
|
return this.each(function(){
|
2445
|
-
|
2494
|
+
webshims.objectCreate(wsWidgetProto, {
|
2446
2495
|
element: {
|
2447
2496
|
value: $(this)
|
2448
2497
|
}
|
@@ -2457,7 +2506,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
2457
2506
|
monthNames: 'monthNamesShort'
|
2458
2507
|
}, opts);
|
2459
2508
|
return this.each(function(){
|
2460
|
-
|
2509
|
+
webshims.objectCreate(spinBtnProto, {
|
2461
2510
|
element: {
|
2462
2511
|
value: $(this)
|
2463
2512
|
}
|
@@ -2466,12 +2515,80 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
2466
2515
|
};
|
2467
2516
|
|
2468
2517
|
$.fn.spinbtnUI.wsProto = spinBtnProto;
|
2518
|
+
|
2519
|
+
webshims._format = formatVal;
|
2469
2520
|
|
2470
2521
|
})();
|
2471
|
-
|
2522
|
+
|
2523
|
+
|
2524
|
+
$.fn.wsTouchClick = (function(){
|
2525
|
+
var supportsTouchaction = ('touchAction' in document.documentElement.style);
|
2526
|
+
var addTouch = !supportsTouchaction && ('ontouchstart' in window) && document.addEventListener;
|
2527
|
+
return function(target, handler){
|
2528
|
+
var touchData, touchEnd, touchStart;
|
2529
|
+
|
2530
|
+
if(addTouch){
|
2531
|
+
|
2532
|
+
touchEnd = function(e){
|
2533
|
+
var ret, touch;
|
2534
|
+
e = e.originalEvent || {};
|
2535
|
+
$(this).off('touchend', touchEnd);
|
2536
|
+
var changedTouches = e.changedTouches || e.touches;
|
2537
|
+
if(!touchData || !changedTouches || changedTouches.length != 1){
|
2538
|
+
return;
|
2539
|
+
}
|
2540
|
+
|
2541
|
+
touch = changedTouches[0];
|
2542
|
+
if(Math.abs(touchData.x - touch.pageX) > 40 || Math.abs(touchData.y - touch.pageY) > 40 || Date.now() - touchData.now > 600){
|
2543
|
+
return;
|
2544
|
+
}
|
2545
|
+
e.preventDefault();
|
2546
|
+
ret = handler.apply(this, arguments);
|
2547
|
+
|
2548
|
+
return ret;
|
2549
|
+
};
|
2550
|
+
|
2551
|
+
touchStart = function(e){
|
2552
|
+
var touch, elemTarget;
|
2553
|
+
|
2554
|
+
|
2555
|
+
if((!e || e.touches.length != 1)){
|
2556
|
+
return;
|
2557
|
+
}
|
2558
|
+
touch = e.touches[0];
|
2559
|
+
elemTarget = target ? $(touch.target).closest(target) : $(this);
|
2560
|
+
if(!elemTarget.length){
|
2561
|
+
return;
|
2562
|
+
}
|
2563
|
+
touchData = {
|
2564
|
+
x: touch.pageX,
|
2565
|
+
y: touch.pageY,
|
2566
|
+
now: Date.now()
|
2567
|
+
};
|
2568
|
+
elemTarget.on('touchend', touchEnd);
|
2569
|
+
};
|
2570
|
+
|
2571
|
+
this.each(function(){
|
2572
|
+
this.addEventListener('touchstart', touchStart, true);
|
2573
|
+
});
|
2574
|
+
} else if(supportsTouchaction){
|
2575
|
+
this.css('touch-action', 'manipulation');
|
2576
|
+
}
|
2577
|
+
|
2578
|
+
if($.isFunction(target)){
|
2579
|
+
handler = target;
|
2580
|
+
target = false;
|
2581
|
+
this.on('click', handler);
|
2582
|
+
} else {
|
2583
|
+
this.on('click', target, handler);
|
2584
|
+
}
|
2585
|
+
return this;
|
2586
|
+
};
|
2587
|
+
})();
|
2588
|
+
|
2472
2589
|
(function(){
|
2473
2590
|
var picker = {};
|
2474
|
-
|
2591
|
+
var assumeVirtualKeyBoard = Modernizr.touchevents || Modernizr.touch || (/android|iphone|ipad|ipod|blackberry|iemobile/i.test(navigator.userAgent.toLowerCase()));
|
2475
2592
|
webshims.inlinePopover = {
|
2476
2593
|
_create: function(){
|
2477
2594
|
this.element = $('<div class="ws-inline-picker"><div class="ws-po-box" /></div>').data('wspopover', this);
|
@@ -2562,7 +2679,11 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
2562
2679
|
cancel: function(val, popover, data){
|
2563
2680
|
if(!data.options.inlinePicker){
|
2564
2681
|
popover.stopOpen = true;
|
2565
|
-
|
2682
|
+
if(assumeVirtualKeyBoard){
|
2683
|
+
$('button', data.buttonWrapper).trigger('focus');
|
2684
|
+
} else {
|
2685
|
+
data.element.getShadowFocusElement().trigger('focus');
|
2686
|
+
}
|
2566
2687
|
setTimeout(function(){
|
2567
2688
|
popover.stopOpen = false;
|
2568
2689
|
}, 9);
|
@@ -2653,6 +2774,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
2653
2774
|
|
2654
2775
|
|
2655
2776
|
picker._common = function(data){
|
2777
|
+
if(data.options.nopicker){return;}
|
2656
2778
|
var options = data.options;
|
2657
2779
|
var popover = webshims.objectCreate(options.inlinePicker ? webshims.inlinePopover : webshims.wsPopover, {}, $.extend(options.popover || {}, {prepareFor: options.inlinePicker ? data.buttonWrapper : data.element}));
|
2658
2780
|
var opener = $('<button type="button" class="ws-popover-opener"><span /></button>').appendTo(data.buttonWrapper);
|
@@ -2722,7 +2844,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
2722
2844
|
}
|
2723
2845
|
|
2724
2846
|
|
2725
|
-
opener.
|
2847
|
+
opener.wsTouchClick(open);
|
2726
2848
|
|
2727
2849
|
if(options.inlinePicker){
|
2728
2850
|
popover.openedByFocus = true;
|
@@ -2915,7 +3037,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
|
|
2915
3037
|
var init, parent, lastWidth, left, right, isRtl, hasButtons;
|
2916
3038
|
var oriStyleO = data.orig.style;
|
2917
3039
|
var styleO = data.element[0].style;
|
2918
|
-
if($.support.boxSizing == null
|
3040
|
+
if($.support.boxSizing == null){
|
2919
3041
|
$(function(){
|
2920
3042
|
parent = data.orig.parentNode;
|
2921
3043
|
});
|