webshims-rails 1.10.6 → 1.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/webshims-rails/version.rb +2 -2
- data/vendor/assets/javascripts/webshims/polyfiller.js +14 -7
- data/vendor/assets/javascripts/webshims/shims/color-picker.js +1 -0
- data/vendor/assets/javascripts/webshims/shims/combos/1.js +153 -155
- data/vendor/assets/javascripts/webshims/shims/combos/10.js +168 -136
- data/vendor/assets/javascripts/webshims/shims/combos/11.js +116 -44
- data/vendor/assets/javascripts/webshims/shims/combos/12.js +100 -95
- data/vendor/assets/javascripts/webshims/shims/combos/13.js +100 -95
- data/vendor/assets/javascripts/webshims/shims/combos/14.js +51 -91
- data/vendor/assets/javascripts/webshims/shims/combos/15.js +129 -232
- data/vendor/assets/javascripts/webshims/shims/combos/16.js +228 -326
- data/vendor/assets/javascripts/webshims/shims/combos/17.js +116 -44
- data/vendor/assets/javascripts/webshims/shims/combos/18.js +116 -44
- data/vendor/assets/javascripts/webshims/shims/combos/19.js +210 -214
- data/vendor/assets/javascripts/webshims/shims/combos/2.js +204 -246
- data/vendor/assets/javascripts/webshims/shims/combos/20.js +210 -214
- data/vendor/assets/javascripts/webshims/shims/combos/21.js +59 -28
- data/vendor/assets/javascripts/webshims/shims/combos/23.js +100 -95
- data/vendor/assets/javascripts/webshims/shims/combos/24.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/combos/25.js +210 -214
- data/vendor/assets/javascripts/webshims/shims/combos/26.js +51 -91
- data/vendor/assets/javascripts/webshims/shims/combos/28.js +110 -119
- data/vendor/assets/javascripts/webshims/shims/combos/29.js +6 -0
- data/vendor/assets/javascripts/webshims/shims/combos/3.js +126 -156
- data/vendor/assets/javascripts/webshims/shims/combos/30.js +126 -155
- data/vendor/assets/javascripts/webshims/shims/combos/31.js +104 -151
- data/vendor/assets/javascripts/webshims/shims/combos/4.js +73 -96
- data/vendor/assets/javascripts/webshims/shims/combos/5.js +116 -44
- data/vendor/assets/javascripts/webshims/shims/combos/6.js +116 -44
- data/vendor/assets/javascripts/webshims/shims/combos/7.js +226 -250
- data/vendor/assets/javascripts/webshims/shims/combos/8.js +226 -250
- data/vendor/assets/javascripts/webshims/shims/combos/9.js +168 -136
- data/vendor/assets/javascripts/webshims/shims/dom-extend.js +51 -91
- data/vendor/assets/javascripts/webshims/shims/form-core.js +53 -60
- data/vendor/assets/javascripts/webshims/shims/form-message.js +22 -5
- data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +87 -30
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +2 -76
- data/vendor/assets/javascripts/webshims/shims/form-validation.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/forms-picker.js +1 -1
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-fr.js +18 -8
- data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +100 -95
- data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +59 -28
- data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +9 -2
- data/vendor/assets/javascripts/webshims/shims/range-ui.js +29 -14
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +21 -7
- data/vendor/assets/javascripts/webshims/shims/styles/shim.css +30 -15
- data/vendor/assets/javascripts/webshims/shims/track-ui.js +6 -0
- metadata +2 -2
@@ -11,10 +11,15 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
11
11
|
if(!$.parseHTML){
|
12
12
|
webshims.error("Webshims needs jQuery 1.8+ to work properly. Please update your jQuery version or downgrade webshims.");
|
13
13
|
}
|
14
|
+
|
15
|
+
if(webshims.cfg.extendNative == 1){
|
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
|
+
}
|
18
|
+
|
14
19
|
if (!webshims.cfg.no$Switch) {
|
15
20
|
var switch$ = function(){
|
16
21
|
if (window.jQuery && (!window.$ || window.jQuery == window.$) && !window.jQuery.webshims) {
|
17
|
-
webshims.error("jQuery was included more than once. Make sure to include it only once! 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..");
|
18
23
|
if (window.$) {
|
19
24
|
window.$ = webshims.$;
|
20
25
|
}
|
@@ -32,7 +37,10 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
32
37
|
};
|
33
38
|
switch$();
|
34
39
|
setTimeout(switch$, 90);
|
40
|
+
webshims.ready('DOM', switch$);
|
35
41
|
$(switch$);
|
42
|
+
webshims.ready('WINDOWLOAD', switch$);
|
43
|
+
|
36
44
|
}
|
37
45
|
// (function(){
|
38
46
|
// var hostNames = {
|
@@ -140,6 +148,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
140
148
|
$(evtDel).off(evt, fn);
|
141
149
|
}
|
142
150
|
});
|
151
|
+
return this;
|
143
152
|
};
|
144
153
|
|
145
154
|
var dataID = '_webshimsLib'+ (Math.round(Math.random() * 1000));
|
@@ -174,57 +183,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
174
183
|
};
|
175
184
|
});
|
176
185
|
|
177
|
-
if($.Tween.propHooks._default && $.css){
|
178
|
-
(function(){
|
179
|
-
var isjQ8 = false;
|
180
|
-
try {
|
181
|
-
isjQ8 = $.css($('<b style="width: 10px" />')[0], 'width', '') == '10px';
|
182
|
-
} catch(er){
|
183
|
-
webshims.error(er);
|
184
|
-
}
|
185
|
-
var css = isjQ8 ?
|
186
|
-
function(elem, prop){
|
187
|
-
return $.css( elem, prop, false, "" );
|
188
|
-
} :
|
189
|
-
function(elem, prop){
|
190
|
-
return $.css( elem, prop, "" );
|
191
|
-
}
|
192
|
-
;
|
193
|
-
|
194
|
-
$.extend($.Tween.propHooks._default, {
|
195
|
-
get: function( tween ) {
|
196
|
-
var result;
|
197
|
-
|
198
|
-
if ( (tween.elem[ tween.prop ] != null || havePolyfill[ tween.prop ]) &&
|
199
|
-
(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
|
200
|
-
return havePolyfill[ tween.prop ] ? $.prop(tween.elem, tween.prop) : tween.elem[ tween.prop ];
|
201
|
-
}
|
202
|
-
|
203
|
-
// passing an empty string as a 3rd parameter to .css will automatically
|
204
|
-
// attempt a parseFloat and fallback to a string if the parse fails
|
205
|
-
// so, simple values such as "10px" are parsed to Float.
|
206
|
-
// complex values such as "rotate(1rad)" are returned as is.
|
207
|
-
result = css( tween.elem, tween.prop );
|
208
|
-
// Empty strings, null, undefined and "auto" are converted to 0.
|
209
|
-
return !result || result === "auto" ? 0 : result;
|
210
|
-
},
|
211
|
-
set: function( tween ) {
|
212
|
-
// use step hook for back compat - use cssHook if its there - use .style if its
|
213
|
-
// available and use plain properties where available
|
214
|
-
if ( jQuery.fx.step[ tween.prop ] ) {
|
215
|
-
jQuery.fx.step[ tween.prop ]( tween );
|
216
|
-
} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
|
217
|
-
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
|
218
|
-
} else if( !havePolyfill[ tween.prop ] ) {
|
219
|
-
tween.elem[ tween.prop ] = tween.now;
|
220
|
-
} else {
|
221
|
-
$.prop(tween.elem, tween.prop, tween.now);
|
222
|
-
}
|
223
|
-
}
|
224
|
-
});
|
225
|
-
})();
|
226
|
-
}
|
227
|
-
|
228
186
|
|
229
187
|
['removeAttr', 'prop', 'attr'].forEach(function(type){
|
230
188
|
olds[type] = $[type];
|
@@ -628,48 +586,50 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
628
586
|
});
|
629
587
|
};
|
630
588
|
return function(nativeElem, shadowElem, opts){
|
631
|
-
|
632
|
-
|
633
|
-
nativeElem
|
634
|
-
|
635
|
-
|
636
|
-
shadowElem
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
opts.shadowFocusElement
|
643
|
-
|
644
|
-
if(opts.shadowFocusElement
|
645
|
-
opts.shadowFocusElement
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
$(nativeElem).on('remove', function(e){
|
651
|
-
if (!e.originalEvent) {
|
652
|
-
$(shadowElem).remove();
|
589
|
+
if(nativeElem && shadowElem){
|
590
|
+
opts = opts || {};
|
591
|
+
if(nativeElem.jquery){
|
592
|
+
nativeElem = nativeElem[0];
|
593
|
+
}
|
594
|
+
if(shadowElem.jquery){
|
595
|
+
shadowElem = shadowElem[0];
|
596
|
+
}
|
597
|
+
var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
|
598
|
+
var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
|
599
|
+
var shadowFocusElementData = {};
|
600
|
+
if(!opts.shadowFocusElement){
|
601
|
+
opts.shadowFocusElement = shadowElem;
|
602
|
+
} else if(opts.shadowFocusElement){
|
603
|
+
if(opts.shadowFocusElement.jquery){
|
604
|
+
opts.shadowFocusElement = opts.shadowFocusElement[0];
|
605
|
+
}
|
606
|
+
shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
|
653
607
|
}
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
nativeElement: nativeElem,
|
660
|
-
shadowElement: shadowElem,
|
661
|
-
shadowFocusElement: opts.shadowFocusElement
|
662
|
-
};
|
663
|
-
if(opts.shadowChilds){
|
664
|
-
opts.shadowChilds.each(function(){
|
665
|
-
elementData(this, 'shadowData', shadowData.shadowData);
|
608
|
+
|
609
|
+
$(nativeElem).on('remove', function(e){
|
610
|
+
if (!e.originalEvent) {
|
611
|
+
$(shadowElem).remove();
|
612
|
+
}
|
666
613
|
});
|
614
|
+
|
615
|
+
nativeData.hasShadow = shadowElem;
|
616
|
+
shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
|
617
|
+
shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
|
618
|
+
nativeElement: nativeElem,
|
619
|
+
shadowElement: shadowElem,
|
620
|
+
shadowFocusElement: opts.shadowFocusElement
|
621
|
+
};
|
622
|
+
if(opts.shadowChilds){
|
623
|
+
opts.shadowChilds.each(function(){
|
624
|
+
elementData(this, 'shadowData', shadowData.shadowData);
|
625
|
+
});
|
626
|
+
}
|
627
|
+
|
628
|
+
if(opts.data){
|
629
|
+
shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
|
630
|
+
}
|
631
|
+
opts = null;
|
667
632
|
}
|
668
|
-
|
669
|
-
if(opts.data){
|
670
|
-
shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
|
671
|
-
}
|
672
|
-
opts = null;
|
673
633
|
webshims.docObserve();
|
674
634
|
};
|
675
635
|
})(),
|
@@ -953,7 +913,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
953
913
|
// register: moduleName:string,
|
954
914
|
// callback: callback:function
|
955
915
|
// });
|
956
|
-
// get/set including
|
916
|
+
// get/set including remoteLang
|
957
917
|
// - webshims.activeLang({
|
958
918
|
// module: moduleName:string,
|
959
919
|
// callback: callback:function,
|
@@ -1531,16 +1491,20 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
1531
1491
|
this.thumb.on({
|
1532
1492
|
mousedown: add
|
1533
1493
|
});
|
1534
|
-
|
1535
|
-
webshims.ready('
|
1536
|
-
|
1537
|
-
|
1494
|
+
if (window.webshims) {
|
1495
|
+
webshims.ready('WINDOWLOAD', function(){
|
1496
|
+
webshims.ready('dom-support', function(){
|
1497
|
+
if ($.fn.onWSOff) {
|
1498
|
+
that.element.onWSOff('updateshadowdom', function(){
|
1499
|
+
that.updateMetrics();
|
1500
|
+
});
|
1501
|
+
}
|
1538
1502
|
});
|
1503
|
+
if (!$.fn.onWSOff && webshims._polyfill) {
|
1504
|
+
webshims._polyfill(['dom-support']);
|
1505
|
+
}
|
1539
1506
|
});
|
1540
|
-
|
1541
|
-
webshims._polyfill(['dom-support']);
|
1542
|
-
}
|
1543
|
-
});
|
1507
|
+
}
|
1544
1508
|
},
|
1545
1509
|
posCenter: function(elem, outerWidth){
|
1546
1510
|
var temp;
|
@@ -1582,6 +1546,12 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
1582
1546
|
}
|
1583
1547
|
};
|
1584
1548
|
|
1549
|
+
var oCreate = function (o) {
|
1550
|
+
function F() {}
|
1551
|
+
F.prototype = o;
|
1552
|
+
return new F();
|
1553
|
+
};
|
1554
|
+
|
1585
1555
|
$.fn.rangeUI = function(opts){
|
1586
1556
|
opts = $.extend({
|
1587
1557
|
readonly: false,
|
@@ -1600,14 +1570,19 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
1600
1570
|
calcTrail: true
|
1601
1571
|
}, opts);
|
1602
1572
|
return this.each(function(){
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
}
|
1607
|
-
}, opts);
|
1573
|
+
var obj = $.extend(oCreate(rangeProto), {element: $(this)});
|
1574
|
+
obj.options = opts;
|
1575
|
+
obj._create.call(obj);
|
1608
1576
|
});
|
1609
1577
|
};
|
1610
|
-
webshims.isReady
|
1578
|
+
if(window.webshims && webshims.isReady){
|
1579
|
+
webshims.ready('es5', function(){
|
1580
|
+
webshims.isReady('range-ui', true);
|
1581
|
+
});
|
1582
|
+
if(webshims._polyfill){
|
1583
|
+
webshims._polyfill(['es5']);
|
1584
|
+
}
|
1585
|
+
}
|
1611
1586
|
})(jQuery);
|
1612
1587
|
webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
|
1613
1588
|
"use strict";
|
@@ -1654,10 +1629,14 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1654
1629
|
}
|
1655
1630
|
},
|
1656
1631
|
month: {
|
1657
|
-
_create: function(){
|
1632
|
+
_create: function(opts){
|
1633
|
+
|
1658
1634
|
var obj = {
|
1659
1635
|
splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0], $('<input type="text" class="mm ws-spin" />')[0]]
|
1660
1636
|
};
|
1637
|
+
if(opts.onlyMonthDigits){
|
1638
|
+
$(obj.splits[1]).attr({inputmode: 'numeric', size: 2, maxlength: 2});
|
1639
|
+
}
|
1661
1640
|
obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1]];
|
1662
1641
|
return obj;
|
1663
1642
|
},
|
@@ -1677,6 +1656,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1677
1656
|
}
|
1678
1657
|
};
|
1679
1658
|
|
1659
|
+
var nowDate = new Date().getTime() - (new Date().getTimezoneOffset() * 60 * 1000 );
|
1680
1660
|
var steps = {
|
1681
1661
|
number: {
|
1682
1662
|
step: 1
|
@@ -1686,11 +1666,11 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1686
1666
|
},
|
1687
1667
|
month: {
|
1688
1668
|
step: 1,
|
1689
|
-
start: new Date()
|
1669
|
+
start: new Date(nowDate)
|
1690
1670
|
},
|
1691
1671
|
date: {
|
1692
1672
|
step: 1,
|
1693
|
-
start: new Date()
|
1673
|
+
start: new Date(nowDate)
|
1694
1674
|
}
|
1695
1675
|
};
|
1696
1676
|
var labelWidth = (function(){
|
@@ -1786,9 +1766,19 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1786
1766
|
"showMonthAfterYear": false,
|
1787
1767
|
"yearSuffix": ""
|
1788
1768
|
}
|
1789
|
-
}, formcfg
|
1769
|
+
}, formcfg.en || {});
|
1770
|
+
|
1790
1771
|
if(!formcfg['en-US']){
|
1791
|
-
formcfg['en-US'] = formcfg['en'];
|
1772
|
+
formcfg['en-US'] = $.extend(true, {}, formcfg['en']);
|
1773
|
+
}
|
1774
|
+
if(!formcfg['en-GB']){
|
1775
|
+
formcfg['en-GB'] = $.extend(true, {}, formcfg.en, {
|
1776
|
+
date: {firstDay: 1},
|
1777
|
+
patterns: {d: "dd/mm/yy"}
|
1778
|
+
});
|
1779
|
+
}
|
1780
|
+
if(!formcfg['en-AU']){
|
1781
|
+
formcfg['en-AU'] = $.extend(true, {}, formcfg['en-GB']);
|
1792
1782
|
}
|
1793
1783
|
if(!formcfg['']){
|
1794
1784
|
formcfg[''] = formcfg['en-US'];
|
@@ -1816,22 +1806,37 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1816
1806
|
langCfg.colorSigns = '#abcdefABCDEF';
|
1817
1807
|
}
|
1818
1808
|
};
|
1809
|
+
var triggerLocaleChange = function(){
|
1810
|
+
processLangCFG(curCfg);
|
1811
|
+
$(document).triggerHandler('wslocalechange');
|
1812
|
+
};
|
1819
1813
|
|
1820
|
-
|
1814
|
+
triggerLocaleChange();
|
1821
1815
|
|
1822
|
-
|
1823
|
-
register: 'form-core',
|
1816
|
+
webshims.activeLang({
|
1817
|
+
register: 'form-core',
|
1824
1818
|
callback: function(){
|
1825
1819
|
$.each(arguments, function(i, val){
|
1826
1820
|
if(formcfg[val]){
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1821
|
+
if(formcfg[val] != curCfg){
|
1822
|
+
curCfg = formcfg[val];
|
1823
|
+
triggerLocaleChange();
|
1824
|
+
}
|
1830
1825
|
return false;
|
1831
1826
|
}
|
1832
1827
|
});
|
1833
1828
|
}
|
1834
1829
|
});
|
1830
|
+
webshims.activeLang({
|
1831
|
+
langObj: formcfg,
|
1832
|
+
module: 'form-core',
|
1833
|
+
callback: function(val){
|
1834
|
+
if(curCfg != val){
|
1835
|
+
curCfg = val;
|
1836
|
+
triggerLocaleChange();
|
1837
|
+
}
|
1838
|
+
}
|
1839
|
+
});
|
1835
1840
|
})();
|
1836
1841
|
|
1837
1842
|
|
@@ -1870,6 +1875,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1870
1875
|
} else if(p[1]){
|
1871
1876
|
val = curCfg.date.showMonthAfterYear ? p.join(' ') : p[1]+' '+p[0];
|
1872
1877
|
}
|
1878
|
+
} else if(options && options.splitInput){
|
1879
|
+
val = [p[0] || '', p[1] || ''];
|
1873
1880
|
}
|
1874
1881
|
return val;
|
1875
1882
|
},
|
@@ -1908,16 +1915,16 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1908
1915
|
time: function(val){
|
1909
1916
|
return val;
|
1910
1917
|
},
|
1911
|
-
month: function(val, opts){
|
1918
|
+
month: function(val, opts, noCorrect){
|
1912
1919
|
|
1913
1920
|
var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
|
1914
1921
|
|
1915
1922
|
if(p.length == 2 && p[0] && p[1]){
|
1916
|
-
p[0] = curCfg.date.monthkeys[p[0]] || p[0];
|
1917
|
-
p[1] = curCfg.date.monthkeys[p[1]] || p[1];
|
1918
|
-
if(p[1].length == 2){
|
1923
|
+
p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0];
|
1924
|
+
p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1];
|
1925
|
+
if(p[1].length == 2 && p[0].length > 3){
|
1919
1926
|
val = p[0]+'-'+p[1];
|
1920
|
-
} else if(p[0].length == 2){
|
1927
|
+
} else if(p[0].length == 2 && p[1].length > 3){
|
1921
1928
|
val = p[1]+'-'+p[0];
|
1922
1929
|
} else {
|
1923
1930
|
val = '';
|
@@ -1927,7 +1934,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1927
1934
|
}
|
1928
1935
|
return val;
|
1929
1936
|
},
|
1930
|
-
date: function(val, opts){
|
1937
|
+
date: function(val, opts, noCorrect){
|
1931
1938
|
createFormat('d');
|
1932
1939
|
var i;
|
1933
1940
|
var obj;
|
@@ -1938,7 +1945,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1938
1945
|
val = val.split(curCfg.dFormat);
|
1939
1946
|
}
|
1940
1947
|
|
1941
|
-
return (val.length == 3 && val[0] && val[1] && val[2]) ?
|
1948
|
+
return (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))) ?
|
1942
1949
|
([addZero(val[obj.yy]), addZero(val[obj.mm]), addZero(val[obj.dd])]).join('-') :
|
1943
1950
|
''
|
1944
1951
|
;
|
@@ -1996,7 +2003,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
1996
2003
|
return function(type){
|
1997
2004
|
var input;
|
1998
2005
|
if(!types[type]){
|
1999
|
-
input = $('<input type="'+type+'" />');
|
2006
|
+
input = $('<input type="'+type+'" step="any" />');
|
2000
2007
|
types[type] = {
|
2001
2008
|
asNumber: function(val){
|
2002
2009
|
var type = (typeof val == 'object') ? 'valueAsDate' : 'value';
|
@@ -2225,6 +2232,22 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2225
2232
|
e.preventDefault();
|
2226
2233
|
}
|
2227
2234
|
},
|
2235
|
+
input: (this.type == 'color' && this.isValid) ?
|
2236
|
+
$.noop :
|
2237
|
+
(function(){
|
2238
|
+
var timer;
|
2239
|
+
var check = function(){
|
2240
|
+
var val = that.parseValue(true);
|
2241
|
+
if(val && that.isValid(val)){
|
2242
|
+
that.setInput(val);
|
2243
|
+
}
|
2244
|
+
|
2245
|
+
};
|
2246
|
+
return function(){
|
2247
|
+
clearTimeout(timer);
|
2248
|
+
timer = setTimeout(check, 200);
|
2249
|
+
};
|
2250
|
+
})(),
|
2228
2251
|
'input keydown keypress': (function(){
|
2229
2252
|
var timer;
|
2230
2253
|
var isStopped = false;
|
@@ -2242,8 +2265,12 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2242
2265
|
timer = setTimeout(releaseTab, 300);
|
2243
2266
|
};
|
2244
2267
|
var select = function(){
|
2245
|
-
this
|
2246
|
-
|
2268
|
+
var elem = this;
|
2269
|
+
setTimeout(function(){
|
2270
|
+
elem.focus();
|
2271
|
+
elem.select();
|
2272
|
+
}, 4);
|
2273
|
+
|
2247
2274
|
stopTab();
|
2248
2275
|
};
|
2249
2276
|
|
@@ -2364,8 +2391,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2364
2391
|
var localeChange ;
|
2365
2392
|
if(!o.splitInput){
|
2366
2393
|
localeChange = function(){
|
2394
|
+
|
2367
2395
|
if(o.value){
|
2368
|
-
that.value(o.value);
|
2396
|
+
that.value(o.value, true);
|
2369
2397
|
}
|
2370
2398
|
|
2371
2399
|
if(placeholderFormat[that.type] && o.placeholder){
|
@@ -2384,8 +2412,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2384
2412
|
|
2385
2413
|
initChangeEvents();
|
2386
2414
|
},
|
2387
|
-
value: function(val){
|
2388
|
-
if(!this._init || val !== this.options.value){
|
2415
|
+
value: function(val, force){
|
2416
|
+
if(!this._init || force || val !== this.options.value){
|
2389
2417
|
this.element.val(this.formatValue(val));
|
2390
2418
|
this.options.value = val;
|
2391
2419
|
this._propertyChange('value');
|
@@ -2397,14 +2425,14 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2397
2425
|
this.inputElements.attr({'aria-required': ''+boolVal});
|
2398
2426
|
this.mirrorValidity();
|
2399
2427
|
},
|
2400
|
-
parseValue: function(){
|
2428
|
+
parseValue: function(noCorrect){
|
2401
2429
|
var value = this.inputElements.map(function(){
|
2402
2430
|
return $.prop(this, 'value');
|
2403
2431
|
}).get();
|
2404
2432
|
if(!this.options.splitInput){
|
2405
2433
|
value = value[0];
|
2406
2434
|
}
|
2407
|
-
return parseVal[this.type](value, this.options);
|
2435
|
+
return parseVal[this.type](value, this.options, noCorrect);
|
2408
2436
|
},
|
2409
2437
|
formatValue: function(val, noSplit){
|
2410
2438
|
return formatVal[this.type](val, noSplit === false ? false : this.options);
|
@@ -2502,6 +2530,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2502
2530
|
this.elemHelper = $('<input type="'+ o.type+'" />');
|
2503
2531
|
this.asNumber = helper.asNumber;
|
2504
2532
|
this.asValue = helper.asValue;
|
2533
|
+
this.isValid = helper.isValid;
|
2534
|
+
|
2505
2535
|
|
2506
2536
|
wsWidgetProto._create.apply(this, arguments);
|
2507
2537
|
this._init = false;
|
@@ -2527,7 +2557,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2527
2557
|
createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'value', 'required'],
|
2528
2558
|
_addSplitInputs: function(){
|
2529
2559
|
if(!this.inputElements){
|
2530
|
-
var create = splitInputs[this.type]._create();
|
2560
|
+
var create = splitInputs[this.type]._create(this.options);
|
2531
2561
|
this.splits = create.splits;
|
2532
2562
|
this.inputElements = $(create.elements).prependTo(this.element).filter('input');
|
2533
2563
|
}
|
@@ -2564,9 +2594,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
2564
2594
|
}, 9);
|
2565
2595
|
}
|
2566
2596
|
},
|
2567
|
-
value: function(val){
|
2597
|
+
value: function(val, force){
|
2568
2598
|
|
2569
|
-
if(!this._init || this.options.value !== val){
|
2599
|
+
if(!this._init || force || this.options.value !== val){
|
2570
2600
|
this.valueAsNumber = this.asNumber(val);
|
2571
2601
|
this.options.value = val;
|
2572
2602
|
|
@@ -3078,7 +3108,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
|
|
3078
3108
|
opts[optsName] = $.attr(this, copyAttrs[i]) || opts[optsName];
|
3079
3109
|
}
|
3080
3110
|
}
|
3081
|
-
|
3111
|
+
if(opts.onlyMonthDigits){
|
3112
|
+
opts.formatMonthNames = 'monthDigits';
|
3113
|
+
}
|
3082
3114
|
data.shim = inputTypes[type]._create(opts);
|
3083
3115
|
|
3084
3116
|
webshims.addShadowDom(this, data.shim.element, {
|