webshims-rails 1.10.6 → 1.10.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +8 -8
  2. data/lib/webshims-rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/webshims/polyfiller.js +14 -7
  4. data/vendor/assets/javascripts/webshims/shims/color-picker.js +1 -0
  5. data/vendor/assets/javascripts/webshims/shims/combos/1.js +153 -155
  6. data/vendor/assets/javascripts/webshims/shims/combos/10.js +168 -136
  7. data/vendor/assets/javascripts/webshims/shims/combos/11.js +116 -44
  8. data/vendor/assets/javascripts/webshims/shims/combos/12.js +100 -95
  9. data/vendor/assets/javascripts/webshims/shims/combos/13.js +100 -95
  10. data/vendor/assets/javascripts/webshims/shims/combos/14.js +51 -91
  11. data/vendor/assets/javascripts/webshims/shims/combos/15.js +129 -232
  12. data/vendor/assets/javascripts/webshims/shims/combos/16.js +228 -326
  13. data/vendor/assets/javascripts/webshims/shims/combos/17.js +116 -44
  14. data/vendor/assets/javascripts/webshims/shims/combos/18.js +116 -44
  15. data/vendor/assets/javascripts/webshims/shims/combos/19.js +210 -214
  16. data/vendor/assets/javascripts/webshims/shims/combos/2.js +204 -246
  17. data/vendor/assets/javascripts/webshims/shims/combos/20.js +210 -214
  18. data/vendor/assets/javascripts/webshims/shims/combos/21.js +59 -28
  19. data/vendor/assets/javascripts/webshims/shims/combos/23.js +100 -95
  20. data/vendor/assets/javascripts/webshims/shims/combos/24.js +2 -2
  21. data/vendor/assets/javascripts/webshims/shims/combos/25.js +210 -214
  22. data/vendor/assets/javascripts/webshims/shims/combos/26.js +51 -91
  23. data/vendor/assets/javascripts/webshims/shims/combos/28.js +110 -119
  24. data/vendor/assets/javascripts/webshims/shims/combos/29.js +6 -0
  25. data/vendor/assets/javascripts/webshims/shims/combos/3.js +126 -156
  26. data/vendor/assets/javascripts/webshims/shims/combos/30.js +126 -155
  27. data/vendor/assets/javascripts/webshims/shims/combos/31.js +104 -151
  28. data/vendor/assets/javascripts/webshims/shims/combos/4.js +73 -96
  29. data/vendor/assets/javascripts/webshims/shims/combos/5.js +116 -44
  30. data/vendor/assets/javascripts/webshims/shims/combos/6.js +116 -44
  31. data/vendor/assets/javascripts/webshims/shims/combos/7.js +226 -250
  32. data/vendor/assets/javascripts/webshims/shims/combos/8.js +226 -250
  33. data/vendor/assets/javascripts/webshims/shims/combos/9.js +168 -136
  34. data/vendor/assets/javascripts/webshims/shims/dom-extend.js +51 -91
  35. data/vendor/assets/javascripts/webshims/shims/form-core.js +53 -60
  36. data/vendor/assets/javascripts/webshims/shims/form-message.js +22 -5
  37. data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +87 -30
  38. data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +2 -76
  39. data/vendor/assets/javascripts/webshims/shims/form-validation.js +2 -2
  40. data/vendor/assets/javascripts/webshims/shims/forms-picker.js +1 -1
  41. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-fr.js +18 -8
  42. data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +100 -95
  43. data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +59 -28
  44. data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +9 -2
  45. data/vendor/assets/javascripts/webshims/shims/range-ui.js +29 -14
  46. data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +21 -7
  47. data/vendor/assets/javascripts/webshims/shims/styles/shim.css +30 -15
  48. data/vendor/assets/javascripts/webshims/shims/track-ui.js +6 -0
  49. 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
- opts = opts || {};
632
- if(nativeElem.jquery){
633
- nativeElem = nativeElem[0];
634
- }
635
- if(shadowElem.jquery){
636
- shadowElem = shadowElem[0];
637
- }
638
- var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
639
- var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
640
- var shadowFocusElementData = {};
641
- if(!opts.shadowFocusElement){
642
- opts.shadowFocusElement = shadowElem;
643
- } else if(opts.shadowFocusElement){
644
- if(opts.shadowFocusElement.jquery){
645
- opts.shadowFocusElement = opts.shadowFocusElement[0];
589
+ if(nativeElem && shadowElem){
590
+ opts = opts || {};
591
+ if(nativeElem.jquery){
592
+ nativeElem = nativeElem[0];
646
593
  }
647
- shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
648
- }
649
-
650
- $(nativeElem).on('remove', function(e){
651
- if (!e.originalEvent) {
652
- $(shadowElem).remove();
594
+ if(shadowElem.jquery){
595
+ shadowElem = shadowElem[0];
653
596
  }
654
- });
655
-
656
- nativeData.hasShadow = shadowElem;
657
- shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
658
- shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
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);
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);
607
+ }
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 removeLang
916
+ // get/set including remoteLang
957
917
  // - webshims.activeLang({
958
918
  // module: moduleName:string,
959
919
  // callback: callback:function,
@@ -75,12 +75,13 @@ webshims.register('form-core', function($, webshims, window, document, undefined
75
75
  $.expr[":"][name] = $.expr.filters[name+"-element"];
76
76
  });
77
77
 
78
-
79
- $.expr[":"].focus = function( elem ) {
78
+ var pseudoFocus = $.expr[":"].focus;
79
+ $.expr[":"].focus = function(){
80
80
  try {
81
- var doc = elem.ownerDocument;
82
- return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus());
83
- } catch(e){}
81
+ return pseudoFocus.apply(this, arguments);
82
+ } catch(e){
83
+ webshims.error(e);
84
+ }
84
85
  return false;
85
86
  };
86
87
 
@@ -95,7 +96,7 @@ webshims.register('form-core', function($, webshims, window, document, undefined
95
96
  });
96
97
  };
97
98
 
98
-
99
+ var transClass = ('transitionDelay' in document.documentElement.style) ? '' : ' no-transition';
99
100
  webshims.wsPopover = {
100
101
  id: 0,
101
102
  _create: function(){
@@ -103,7 +104,7 @@ webshims.register('form-core', function($, webshims, window, document, undefined
103
104
  this.id = webshims.wsPopover.id++;
104
105
  this.eventns = '.wsoverlay' + this.id;
105
106
  this.timers = {};
106
- this.element = $('<div class="ws-popover" tabindex="-1"><div class="ws-po-outerbox"><div class="ws-po-arrow"><div class="ws-po-arrowbox" /></div><div class="ws-po-box" /></div></div>');
107
+ this.element = $('<div class="ws-popover'+transClass+'" tabindex="-1"><div class="ws-po-outerbox"><div class="ws-po-arrow"><div class="ws-po-arrowbox" /></div><div class="ws-po-box" /></div></div>');
107
108
  this.contentElement = $('.ws-po-box', this.element);
108
109
  this.lastElement = $([]);
109
110
  this.bindElement();
@@ -142,47 +143,6 @@ webshims.register('form-core', function($, webshims, window, document, undefined
142
143
  };
143
144
 
144
145
 
145
- /* extension, but also used to fix native implementation workaround/bugfixes */
146
- (function(){
147
- var firstEvent,
148
- invalids = [],
149
- stopSubmitTimer,
150
- form
151
- ;
152
-
153
- $(document).on('invalid', function(e){
154
- if(e.wrongWebkitInvalid){return;}
155
- var jElm = $(e.target);
156
-
157
-
158
- if(!firstEvent){
159
- //trigger firstinvalid
160
- firstEvent = $.Event('firstinvalid');
161
- firstEvent.isInvalidUIPrevented = e.isDefaultPrevented;
162
- var firstSystemInvalid = $.Event('firstinvalidsystem');
163
- $(document).triggerHandler(firstSystemInvalid, {element: e.target, form: e.target.form, isInvalidUIPrevented: e.isDefaultPrevented});
164
- jElm.trigger(firstEvent);
165
- }
166
-
167
- //if firstinvalid was prevented all invalids will be also prevented
168
- if( firstEvent && firstEvent.isDefaultPrevented() ){
169
- e.preventDefault();
170
- }
171
- invalids.push(e.target);
172
- e.extraData = 'fix';
173
- clearTimeout(stopSubmitTimer);
174
- stopSubmitTimer = setTimeout(function(){
175
- var lastEvent = {type: 'lastinvalid', cancelable: false, invalidlist: $(invalids)};
176
- //reset firstinvalid
177
- firstEvent = false;
178
- invalids = [];
179
- $(e.target).trigger(lastEvent, lastEvent);
180
- }, 9);
181
- jElm = null;
182
- });
183
- })();
184
-
185
-
186
146
  webshims.getContentValidationMessage = function(elem, validity, key){
187
147
  var message = $(elem).data('errormessage') || elem.getAttribute('x-moz-errormessage') || '';
188
148
  if(key && message[key]){
@@ -216,19 +176,13 @@ webshims.register('form-core', function($, webshims, window, document, undefined
216
176
  };
217
177
 
218
178
 
219
- webshims.ready('forms', function(){
220
- $(document).on('focusin.lazyloadvalidation', function(e){
221
- if('form' in e.target && $(e.target).is(':invalid')){
222
- lazyLoad();
223
- }
224
- });
179
+ $(document).on('focusin.lazyloadvalidation', function(e){
180
+ if('form' in e.target && $(e.target).is(':invalid')){
181
+ lazyLoad();
182
+ }
225
183
  });
226
184
  webshims.ready('WINDOWLOAD', lazyLoad);
227
- if(options.overrideMessages){
228
- options.customMessages = true;
229
- webshims.reTest('form-message');
230
- webshims.error('overrideMessages is deprecated. use customMessages instead.');
231
- }
185
+
232
186
  if(options.replaceValidationUI){
233
187
  webshims.ready('DOM forms', function(){
234
188
  $(document).on('firstinvalid', function(e){
@@ -239,5 +193,44 @@ webshims.register('form-core', function($, webshims, window, document, undefined
239
193
  });
240
194
  });
241
195
  }
242
- });
196
+
197
+ /* extension, but also used to fix native implementation workaround/bugfixes */
198
+ (function(){
199
+ var firstEvent,
200
+ invalids = [],
201
+ stopSubmitTimer,
202
+ form
203
+ ;
204
+
205
+ $(document).on('invalid', function(e){
206
+ if(e.wrongWebkitInvalid){return;}
207
+ var jElm = $(e.target);
208
+
209
+
210
+ if(!firstEvent){
211
+ //trigger firstinvalid
212
+ firstEvent = $.Event('firstinvalid');
213
+ firstEvent.isInvalidUIPrevented = e.isDefaultPrevented;
214
+ var firstSystemInvalid = $.Event('firstinvalidsystem');
215
+ $(document).triggerHandler(firstSystemInvalid, {element: e.target, form: e.target.form, isInvalidUIPrevented: e.isDefaultPrevented});
216
+ jElm.trigger(firstEvent);
217
+ }
243
218
 
219
+ //if firstinvalid was prevented all invalids will be also prevented
220
+ if( firstEvent && firstEvent.isDefaultPrevented() ){
221
+ e.preventDefault();
222
+ }
223
+ invalids.push(e.target);
224
+ e.extraData = 'fix';
225
+ clearTimeout(stopSubmitTimer);
226
+ stopSubmitTimer = setTimeout(function(){
227
+ var lastEvent = {type: 'lastinvalid', cancelable: false, invalidlist: $(invalids)};
228
+ //reset firstinvalid
229
+ firstEvent = false;
230
+ invalids = [];
231
+ $(e.target).trigger(lastEvent, lastEvent);
232
+ }, 9);
233
+ jElm = null;
234
+ });
235
+ })();
236
+ });
@@ -50,8 +50,15 @@ webshims.register('form-message', function($, webshims, window, document, undefi
50
50
  validityMessages.en.rangeOverflow[type] = validityMessages.en.rangeOverflow[type] || 'Value must be at or before {%max}.';
51
51
  });
52
52
  }
53
-
54
- validityMessages['en-US'] = validityMessages['en-US'] || validityMessages.en;
53
+ if(!validityMessages['en-US']){
54
+ validityMessages['en-US'] = $.extend(true, {}, validityMessages.en);
55
+ }
56
+ if(!validityMessages['en-GB']){
57
+ validityMessages['en-GB'] = $.extend(true, {}, validityMessages.en);
58
+ }
59
+ if(!validityMessages['en-AU']){
60
+ validityMessages['en-AU'] = $.extend(true, {}, validityMessages.en);
61
+ }
55
62
  validityMessages[''] = validityMessages[''] || validityMessages['en-US'];
56
63
 
57
64
  validityMessages.de = $.extend(true, {
@@ -151,12 +158,22 @@ webshims.register('form-message', function($, webshims, window, document, undefi
151
158
 
152
159
  webshims.activeLang({
153
160
  langObj: validityMessages,
154
- module: 'form-core',
161
+ module: 'form-core',
155
162
  callback: function(langObj){
156
-
157
163
  currentValidationMessage = langObj;
158
164
  }
159
165
  });
166
+ webshims.activeLang({
167
+ register: 'form-core',
168
+ callback: function(val){
169
+ $.each(validityMessages, function(i, val){
170
+ if(validityMessages[val]){
171
+ currentValidationMessage = validityMessages[val];
172
+ return false;
173
+ }
174
+ });
175
+ }
176
+ });
160
177
 
161
178
  implementProperties.forEach(function(messageProp){
162
179
  webshims.defineNodeNamesProperty(['fieldset', 'output', 'button'], messageProp, {
@@ -202,4 +219,4 @@ webshims.register('form-message', function($, webshims, window, document, undefi
202
219
  });
203
220
 
204
221
  });
205
- });
222
+ });
@@ -43,10 +43,14 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
43
43
  }
44
44
  },
45
45
  month: {
46
- _create: function(){
46
+ _create: function(opts){
47
+
47
48
  var obj = {
48
49
  splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0], $('<input type="text" class="mm ws-spin" />')[0]]
49
50
  };
51
+ if(opts.onlyMonthDigits){
52
+ $(obj.splits[1]).attr({inputmode: 'numeric', size: 2, maxlength: 2});
53
+ }
50
54
  obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1]];
51
55
  return obj;
52
56
  },
@@ -66,6 +70,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
66
70
  }
67
71
  };
68
72
 
73
+ var nowDate = new Date().getTime() - (new Date().getTimezoneOffset() * 60 * 1000 );
69
74
  var steps = {
70
75
  number: {
71
76
  step: 1
@@ -75,11 +80,11 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
75
80
  },
76
81
  month: {
77
82
  step: 1,
78
- start: new Date()
83
+ start: new Date(nowDate)
79
84
  },
80
85
  date: {
81
86
  step: 1,
82
- start: new Date()
87
+ start: new Date(nowDate)
83
88
  }
84
89
  };
85
90
  var labelWidth = (function(){
@@ -175,9 +180,19 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
175
180
  "showMonthAfterYear": false,
176
181
  "yearSuffix": ""
177
182
  }
178
- }, formcfg['en'] || {});
183
+ }, formcfg.en || {});
184
+
179
185
  if(!formcfg['en-US']){
180
- formcfg['en-US'] = formcfg['en'];
186
+ formcfg['en-US'] = $.extend(true, {}, formcfg['en']);
187
+ }
188
+ if(!formcfg['en-GB']){
189
+ formcfg['en-GB'] = $.extend(true, {}, formcfg.en, {
190
+ date: {firstDay: 1},
191
+ patterns: {d: "dd/mm/yy"}
192
+ });
193
+ }
194
+ if(!formcfg['en-AU']){
195
+ formcfg['en-AU'] = $.extend(true, {}, formcfg['en-GB']);
181
196
  }
182
197
  if(!formcfg['']){
183
198
  formcfg[''] = formcfg['en-US'];
@@ -205,22 +220,37 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
205
220
  langCfg.colorSigns = '#abcdefABCDEF';
206
221
  }
207
222
  };
223
+ var triggerLocaleChange = function(){
224
+ processLangCFG(curCfg);
225
+ $(document).triggerHandler('wslocalechange');
226
+ };
208
227
 
209
- processLangCFG(curCfg);
228
+ triggerLocaleChange();
210
229
 
211
- $.webshims.activeLang({
212
- register: 'form-core',
230
+ webshims.activeLang({
231
+ register: 'form-core',
213
232
  callback: function(){
214
233
  $.each(arguments, function(i, val){
215
234
  if(formcfg[val]){
216
- curCfg = formcfg[val];
217
- processLangCFG(curCfg);
218
- $(document).triggerHandler('wslocalechange');
235
+ if(formcfg[val] != curCfg){
236
+ curCfg = formcfg[val];
237
+ triggerLocaleChange();
238
+ }
219
239
  return false;
220
240
  }
221
241
  });
222
242
  }
223
243
  });
244
+ webshims.activeLang({
245
+ langObj: formcfg,
246
+ module: 'form-core',
247
+ callback: function(val){
248
+ if(curCfg != val){
249
+ curCfg = val;
250
+ triggerLocaleChange();
251
+ }
252
+ }
253
+ });
224
254
  })();
225
255
 
226
256
 
@@ -259,6 +289,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
259
289
  } else if(p[1]){
260
290
  val = curCfg.date.showMonthAfterYear ? p.join(' ') : p[1]+' '+p[0];
261
291
  }
292
+ } else if(options && options.splitInput){
293
+ val = [p[0] || '', p[1] || ''];
262
294
  }
263
295
  return val;
264
296
  },
@@ -297,16 +329,16 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
297
329
  time: function(val){
298
330
  return val;
299
331
  },
300
- month: function(val, opts){
332
+ month: function(val, opts, noCorrect){
301
333
 
302
334
  var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
303
335
 
304
336
  if(p.length == 2 && p[0] && p[1]){
305
- p[0] = curCfg.date.monthkeys[p[0]] || p[0];
306
- p[1] = curCfg.date.monthkeys[p[1]] || p[1];
307
- if(p[1].length == 2){
337
+ p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0];
338
+ p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1];
339
+ if(p[1].length == 2 && p[0].length > 3){
308
340
  val = p[0]+'-'+p[1];
309
- } else if(p[0].length == 2){
341
+ } else if(p[0].length == 2 && p[1].length > 3){
310
342
  val = p[1]+'-'+p[0];
311
343
  } else {
312
344
  val = '';
@@ -316,7 +348,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
316
348
  }
317
349
  return val;
318
350
  },
319
- date: function(val, opts){
351
+ date: function(val, opts, noCorrect){
320
352
  createFormat('d');
321
353
  var i;
322
354
  var obj;
@@ -327,7 +359,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
327
359
  val = val.split(curCfg.dFormat);
328
360
  }
329
361
 
330
- return (val.length == 3 && val[0] && val[1] && val[2]) ?
362
+ 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))) ?
331
363
  ([addZero(val[obj.yy]), addZero(val[obj.mm]), addZero(val[obj.dd])]).join('-') :
332
364
  ''
333
365
  ;
@@ -385,7 +417,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
385
417
  return function(type){
386
418
  var input;
387
419
  if(!types[type]){
388
- input = $('<input type="'+type+'" />');
420
+ input = $('<input type="'+type+'" step="any" />');
389
421
  types[type] = {
390
422
  asNumber: function(val){
391
423
  var type = (typeof val == 'object') ? 'valueAsDate' : 'value';
@@ -614,6 +646,22 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
614
646
  e.preventDefault();
615
647
  }
616
648
  },
649
+ input: (this.type == 'color' && this.isValid) ?
650
+ $.noop :
651
+ (function(){
652
+ var timer;
653
+ var check = function(){
654
+ var val = that.parseValue(true);
655
+ if(val && that.isValid(val)){
656
+ that.setInput(val);
657
+ }
658
+
659
+ };
660
+ return function(){
661
+ clearTimeout(timer);
662
+ timer = setTimeout(check, 200);
663
+ };
664
+ })(),
617
665
  'input keydown keypress': (function(){
618
666
  var timer;
619
667
  var isStopped = false;
@@ -631,8 +679,12 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
631
679
  timer = setTimeout(releaseTab, 300);
632
680
  };
633
681
  var select = function(){
634
- this.focus();
635
- this.select();
682
+ var elem = this;
683
+ setTimeout(function(){
684
+ elem.focus();
685
+ elem.select();
686
+ }, 4);
687
+
636
688
  stopTab();
637
689
  };
638
690
 
@@ -753,8 +805,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
753
805
  var localeChange ;
754
806
  if(!o.splitInput){
755
807
  localeChange = function(){
808
+
756
809
  if(o.value){
757
- that.value(o.value);
810
+ that.value(o.value, true);
758
811
  }
759
812
 
760
813
  if(placeholderFormat[that.type] && o.placeholder){
@@ -773,8 +826,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
773
826
 
774
827
  initChangeEvents();
775
828
  },
776
- value: function(val){
777
- if(!this._init || val !== this.options.value){
829
+ value: function(val, force){
830
+ if(!this._init || force || val !== this.options.value){
778
831
  this.element.val(this.formatValue(val));
779
832
  this.options.value = val;
780
833
  this._propertyChange('value');
@@ -786,14 +839,14 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
786
839
  this.inputElements.attr({'aria-required': ''+boolVal});
787
840
  this.mirrorValidity();
788
841
  },
789
- parseValue: function(){
842
+ parseValue: function(noCorrect){
790
843
  var value = this.inputElements.map(function(){
791
844
  return $.prop(this, 'value');
792
845
  }).get();
793
846
  if(!this.options.splitInput){
794
847
  value = value[0];
795
848
  }
796
- return parseVal[this.type](value, this.options);
849
+ return parseVal[this.type](value, this.options, noCorrect);
797
850
  },
798
851
  formatValue: function(val, noSplit){
799
852
  return formatVal[this.type](val, noSplit === false ? false : this.options);
@@ -891,6 +944,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
891
944
  this.elemHelper = $('<input type="'+ o.type+'" />');
892
945
  this.asNumber = helper.asNumber;
893
946
  this.asValue = helper.asValue;
947
+ this.isValid = helper.isValid;
948
+
894
949
 
895
950
  wsWidgetProto._create.apply(this, arguments);
896
951
  this._init = false;
@@ -916,7 +971,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
916
971
  createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'value', 'required'],
917
972
  _addSplitInputs: function(){
918
973
  if(!this.inputElements){
919
- var create = splitInputs[this.type]._create();
974
+ var create = splitInputs[this.type]._create(this.options);
920
975
  this.splits = create.splits;
921
976
  this.inputElements = $(create.elements).prependTo(this.element).filter('input');
922
977
  }
@@ -953,9 +1008,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
953
1008
  }, 9);
954
1009
  }
955
1010
  },
956
- value: function(val){
1011
+ value: function(val, force){
957
1012
 
958
- if(!this._init || this.options.value !== val){
1013
+ if(!this._init || force || this.options.value !== val){
959
1014
  this.valueAsNumber = this.asNumber(val);
960
1015
  this.options.value = val;
961
1016
 
@@ -1467,7 +1522,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1467
1522
  opts[optsName] = $.attr(this, copyAttrs[i]) || opts[optsName];
1468
1523
  }
1469
1524
  }
1470
-
1525
+ if(opts.onlyMonthDigits){
1526
+ opts.formatMonthNames = 'monthDigits';
1527
+ }
1471
1528
  data.shim = inputTypes[type]._create(opts);
1472
1529
 
1473
1530
  webshims.addShadowDom(this, data.shim.element, {