webshims-rails 1.10.10 → 1.10.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +8 -8
  2. data/MIT_LICENSE.txt +3 -1
  3. data/lib/webshims-rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/webshims/polyfiller.js +8 -9
  5. data/vendor/assets/javascripts/webshims/shims/combos/1.js +91 -58
  6. data/vendor/assets/javascripts/webshims/shims/combos/10.js +247 -101
  7. data/vendor/assets/javascripts/webshims/shims/combos/11.js +241 -96
  8. data/vendor/assets/javascripts/webshims/shims/combos/12.js +79 -58
  9. data/vendor/assets/javascripts/webshims/shims/combos/13.js +79 -12
  10. data/vendor/assets/javascripts/webshims/shims/combos/14.js +6 -5
  11. data/vendor/assets/javascripts/webshims/shims/combos/15.js +68 -75
  12. data/vendor/assets/javascripts/webshims/shims/combos/16.js +147 -133
  13. data/vendor/assets/javascripts/webshims/shims/combos/17.js +288 -143
  14. data/vendor/assets/javascripts/webshims/shims/combos/18.js +288 -143
  15. data/vendor/assets/javascripts/webshims/shims/combos/19.js +85 -63
  16. data/vendor/assets/javascripts/webshims/shims/combos/2.js +97 -91
  17. data/vendor/assets/javascripts/webshims/shims/combos/20.js +85 -17
  18. data/vendor/assets/javascripts/webshims/shims/combos/21.js +17 -17
  19. data/vendor/assets/javascripts/webshims/shims/combos/23.js +79 -58
  20. data/vendor/assets/javascripts/webshims/shims/combos/24.js +17 -16
  21. data/vendor/assets/javascripts/webshims/shims/combos/25.js +85 -63
  22. data/vendor/assets/javascripts/webshims/shims/combos/26.js +6 -5
  23. data/vendor/assets/javascripts/webshims/shims/combos/27.js +0 -46
  24. data/vendor/assets/javascripts/webshims/shims/combos/28.js +6 -5
  25. data/vendor/assets/javascripts/webshims/shims/combos/29.js +13 -6
  26. data/vendor/assets/javascripts/webshims/shims/combos/3.js +47 -31
  27. data/vendor/assets/javascripts/webshims/shims/combos/30.js +47 -59
  28. data/vendor/assets/javascripts/webshims/shims/combos/31.js +18 -33
  29. data/vendor/assets/javascripts/webshims/shims/combos/4.js +35 -31
  30. data/vendor/assets/javascripts/webshims/shims/combos/5.js +304 -157
  31. data/vendor/assets/javascripts/webshims/shims/combos/6.js +304 -185
  32. data/vendor/assets/javascripts/webshims/shims/combos/7.js +126 -117
  33. data/vendor/assets/javascripts/webshims/shims/combos/8.js +126 -89
  34. data/vendor/assets/javascripts/webshims/shims/combos/9.js +247 -129
  35. data/vendor/assets/javascripts/webshims/shims/dom-extend.js +6 -5
  36. data/vendor/assets/javascripts/webshims/shims/form-core.js +12 -0
  37. data/vendor/assets/javascripts/webshims/shims/form-datalist-lazy.js +3 -0
  38. data/vendor/assets/javascripts/webshims/shims/form-datalist.js +0 -28
  39. data/vendor/assets/javascripts/webshims/shims/form-message.js +29 -26
  40. data/vendor/assets/javascripts/webshims/shims/form-native-extend.js +16 -14
  41. data/vendor/assets/javascripts/webshims/shims/form-number-date-api.js +47 -47
  42. data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +241 -96
  43. data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +21 -16
  44. data/vendor/assets/javascripts/webshims/shims/form-validation.js +17 -16
  45. data/vendor/assets/javascripts/webshims/shims/forms-picker.js +173 -41
  46. data/vendor/assets/javascripts/webshims/shims/geolocation.js +17 -17
  47. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ar.js +35 -33
  48. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ch-ZN.js +32 -30
  49. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-de.txt +17 -13
  50. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-el.js +32 -30
  51. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-en.txt +4 -1
  52. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-es.js +30 -28
  53. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-fr.js +35 -32
  54. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-he.js +32 -30
  55. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-hi.js +32 -30
  56. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-hu.js +32 -30
  57. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-it.js +32 -30
  58. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ja.js +32 -30
  59. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-lt.js +37 -36
  60. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-nl.js +32 -30
  61. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-pl.js +5 -2
  62. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-pt-PT.js +33 -30
  63. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ru.js +3 -1
  64. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-sv.js +32 -30
  65. data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +79 -12
  66. data/vendor/assets/javascripts/webshims/shims/styles/forms.png +0 -0
  67. data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +126 -121
  68. data/vendor/assets/javascripts/webshims/shims/styles/shim.css +100 -111
  69. data/vendor/assets/javascripts/webshims/shims/swfmini.js +0 -46
  70. data/vendor/assets/javascripts/webshims/shims/track-ui.js +13 -6
  71. data/webshims-rails.gemspec +1 -0
  72. metadata +4 -3
@@ -149,8 +149,8 @@ webshims.register('form-number-date-api', function($, webshims, window, document
149
149
  } else {
150
150
  webshims.error('INVALID_STATE_ERR: DOM Exception 11');
151
151
  }
152
- } else {
153
- valueAsNumberDescriptor.prop._supset && valueAsNumberDescriptor.prop._supset.apply(elem, arguments);
152
+ } else if(valueAsNumberDescriptor.prop._supset) {
153
+ valueAsNumberDescriptor.prop._supset.apply(elem, arguments);
154
154
  }
155
155
  }
156
156
  }
@@ -277,7 +277,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
277
277
  var typeProtos = {
278
278
 
279
279
  number: {
280
- mismatch: function(val){
280
+ bad: function(val){
281
281
  return !(isNumber(val));
282
282
  },
283
283
  step: 1,
@@ -296,7 +296,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
296
296
  maxDefault: 100
297
297
  },
298
298
  color: {
299
- mismatch: (function(){
299
+ bad: (function(){
300
300
  var cReg = /^\u0023[a-f0-9]{6}$/;
301
301
  return function(val){
302
302
  return (!val || val.length != 7 || !(cReg.test(val)));
@@ -304,7 +304,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
304
304
  })()
305
305
  },
306
306
  date: {
307
- mismatch: function(val){
307
+ bad: function(val){
308
308
  if(!val || !val.split || !(/\d$/.test(val))){return true;}
309
309
  var i;
310
310
  var valA = val.split(/\u002D/);
@@ -329,14 +329,14 @@ webshims.register('form-number-date-api', function($, webshims, window, document
329
329
  //stepBase: 0, 0 = default
330
330
  stepScaleFactor: 86400000,
331
331
  asDate: function(val, _noMismatch){
332
- if(!_noMismatch && this.mismatch(val)){
332
+ if(!_noMismatch && this.bad(val)){
333
333
  return null;
334
334
  }
335
335
  return new Date(this.asNumber(val, true));
336
336
  },
337
337
  asNumber: function(str, _noMismatch){
338
338
  var ret = nan;
339
- if(_noMismatch || !this.mismatch(str)){
339
+ if(_noMismatch || !this.bad(str)){
340
340
  str = str.split(/\u002D/);
341
341
  ret = Date.UTC(str[0], str[1] - 1, str[2]);
342
342
  }
@@ -353,7 +353,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
353
353
  * ToDO: WEEK
354
354
  */
355
355
  // week: {
356
- // mismatch: function(val){
356
+ // bad: function(val){
357
357
  // if(!val || !val.split){return true;}
358
358
  // var valA = val.split('-W');
359
359
  // var ret = true;
@@ -367,7 +367,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
367
367
  // stepBase: -259200000,
368
368
  // asDate: function(str, _noMismatch){
369
369
  // var ret = null;
370
- // if(_noMismatch || !this.mismatch(str)){
370
+ // if(_noMismatch || !this.bad(str)){
371
371
  // ret = str.split('-W');
372
372
  // ret = setWeek(ret[0], ret[1]);
373
373
  // }
@@ -400,7 +400,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
400
400
  // }
401
401
  // },
402
402
  time: {
403
- mismatch: function(val, _getParsed){
403
+ bad: function(val, _getParsed){
404
404
  if(!val || !val.split || !(/\d$/.test(val))){return true;}
405
405
  val = val.split(/\u003A/);
406
406
  if(val.length < 2 || val.length > 3){return true;}
@@ -445,7 +445,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
445
445
  },
446
446
  asNumber: function(val){
447
447
  var ret = nan;
448
- val = this.mismatch(val, true);
448
+ val = this.bad(val, true);
449
449
  if(val !== true){
450
450
  ret = Date.UTC('1970', 0, 1, val[0][0], val[0][1], val[0][2] || 0);
451
451
  if(val[1]){
@@ -473,8 +473,8 @@ webshims.register('form-number-date-api', function($, webshims, window, document
473
473
  }
474
474
  },
475
475
  month: {
476
- mismatch: function(val){
477
- return typeProtos.date.mismatch(val+'-01');
476
+ bad: function(val){
477
+ return typeProtos.date.bad(val+'-01');
478
478
  },
479
479
  step: 1,
480
480
  stepScaleFactor: false,
@@ -485,7 +485,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
485
485
  asNumber: function(val){
486
486
  //1970-01
487
487
  var ret = nan;
488
- if(val && !this.mismatch(val)){
488
+ if(val && !this.bad(val)){
489
489
  val = val.split(/\u002D/);
490
490
  val[0] = (val[0] * 1) - 1970;
491
491
  val[1] = (val[1] * 1) - 1;
@@ -519,46 +519,46 @@ webshims.register('form-number-date-api', function($, webshims, window, document
519
519
  }
520
520
  }
521
521
  }
522
- // ,'datetime-local': {
523
- // mismatch: function(val, _getParsed){
524
- // if(!val || !val.split || (val+'special').split(/\u0054/).length !== 2){return true;}
525
- // val = val.split(/\u0054/);
526
- // return ( typeProtos.date.mismatch(val[0]) || typeProtos.time.mismatch(val[1], _getParsed) );
527
- // },
528
- // noAsDate: true,
529
- // asDate: function(val){
530
- // val = new Date(this.asNumber(val));
531
- //
532
- // return (isNaN(val)) ? null : val;
533
- // },
534
- // asNumber: function(val){
535
- // var ret = nan;
536
- // var time = this.mismatch(val, true);
537
- // if(time !== true){
538
- // val = val.split(/\u0054/)[0].split(/\u002D/);
539
- //
540
- // ret = Date.UTC(val[0], val[1] - 1, val[2], time[0][0], time[0][1], time[0][2] || 0);
541
- // if(time[1]){
542
- // ret += time[1];
543
- // }
544
- // }
545
- // return ret;
546
- // },
547
- // dateToString: function(date, _getParsed){
548
- // return typeProtos.date.dateToString(date) +'T'+ typeProtos.time.dateToString(date, _getParsed);
549
- // }
550
- // }
522
+ ,'datetime-local': {
523
+ bad: function(val, _getParsed){
524
+ if(!val || !val.split || (val+'special').split(/\u0054/).length !== 2){return true;}
525
+ val = val.split(/\u0054/);
526
+ return ( typeProtos.date.bad(val[0]) || typeProtos.time.bad(val[1], _getParsed) );
527
+ },
528
+ noAsDate: true,
529
+ asDate: function(val){
530
+ val = new Date(this.asNumber(val));
531
+
532
+ return (isNaN(val)) ? null : val;
533
+ },
534
+ asNumber: function(val){
535
+ var ret = nan;
536
+ var time = this.bad(val, true);
537
+ if(time !== true){
538
+ val = val.split(/\u0054/)[0].split(/\u002D/);
539
+
540
+ ret = Date.UTC(val[0], val[1] - 1, val[2], time[0][0], time[0][1], time[0][2] || 0);
541
+ if(time[1]){
542
+ ret += time[1];
543
+ }
544
+ }
545
+ return ret;
546
+ },
547
+ dateToString: function(date, _getParsed){
548
+ return typeProtos.date.dateToString(date) +'T'+ typeProtos.time.dateToString(date, _getParsed);
549
+ }
550
+ }
551
551
  };
552
552
 
553
- if(typeBugs || !supportsType('range') || !supportsType('time') || !supportsType('month')){
553
+ if(typeBugs || !supportsType('range') || !supportsType('time') || !supportsType('month') || !supportsType('datetime-local')){
554
554
  typeProtos.range = $.extend({}, typeProtos.number, typeProtos.range);
555
555
  typeProtos.time = $.extend({}, typeProtos.date, typeProtos.time);
556
556
  typeProtos.month = $.extend({}, typeProtos.date, typeProtos.month);
557
- // typeProtos['datetime-local'] = $.extend({}, typeProtos.date, typeProtos.time, typeProtos['datetime-local']);
557
+ typeProtos['datetime-local'] = $.extend({}, typeProtos.date, typeProtos.time, typeProtos['datetime-local']);
558
558
  }
559
559
 
560
- //'datetime-local'
561
- ['number', 'month', 'range', 'date', 'time', 'color'].forEach(function(type){
560
+ //
561
+ ['number', 'month', 'range', 'date', 'time', 'color', 'datetime-local'].forEach(function(type){
562
562
  if(typeBugs || !supportsType(type)){
563
563
  webshims.addInputType(type, typeProtos[type]);
564
564
  }
@@ -1089,10 +1089,21 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1089
1089
  "use strict";
1090
1090
  var curCfg;
1091
1091
  var formcfg = webshims.formcfg;
1092
-
1092
+ var monthDigits = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
1093
1093
  var stopPropagation = function(e){
1094
1094
  e.stopImmediatePropagation();
1095
1095
  };
1096
+ var getMonthOptions = (function(){
1097
+ var str;
1098
+ return function(){
1099
+ if(!str){
1100
+ str = ('<option></option>')+$.map(monthDigits, function(val){
1101
+ return '<option>'+val+'</option>';
1102
+ }).join('');
1103
+ }
1104
+ return str;
1105
+ };
1106
+ })();
1096
1107
  var createFormat = function(name){
1097
1108
  if(!curCfg.patterns[name+'Obj']){
1098
1109
  var obj = {};
@@ -1104,10 +1115,18 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1104
1115
  };
1105
1116
  var splitInputs = {
1106
1117
  date: {
1107
- _create: function(){
1118
+ _create: function(opts){
1108
1119
  var obj = {
1109
- splits: [$('<input type="text" class="yy" size="4" inputmode="numeric" />')[0], $('<input type="text" class="mm" inputmode="numeric" maxlength="2" size="2" />')[0], $('<input type="text" class="dd ws-spin" inputmode="numeric" maxlength="2" size="2" />')[0]]
1120
+ splits: [$('<input type="text" class="yy" size="4" inputmode="numeric" />')[0]]
1110
1121
  };
1122
+ if(opts.monthSelect){
1123
+ obj.splits.push($('<select class="mm">'+getMonthOptions()+'</select>')[0]);
1124
+ } else {
1125
+ obj.splits.push($('<input type="text" class="mm" inputmode="numeric" maxlength="2" size="2" />')[0]);
1126
+ }
1127
+ obj.splits.push($('<input type="text" class="dd ws-spin" inputmode="numeric" maxlength="2" size="2" />')[0]);
1128
+
1129
+
1111
1130
  obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1], $('<span class="ws-input-seperator" />')[0], obj.splits[2]];
1112
1131
  return obj;
1113
1132
  },
@@ -1115,7 +1134,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1115
1134
  createFormat('d');
1116
1135
  var i = 0;
1117
1136
  var seperators = $('.ws-input-seperator', element).html(curCfg.dFormat);
1118
- var inputs = $('input', element);
1137
+ var inputs = $('input, select', element);
1119
1138
  $.each(curCfg.patterns.dObj, function(name, value){
1120
1139
  var input = inputs.filter('.'+ name);
1121
1140
  if(input[0]){
@@ -1133,17 +1152,23 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1133
1152
  _create: function(opts){
1134
1153
 
1135
1154
  var obj = {
1136
- splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0], $('<input type="text" class="mm ws-spin" />')[0]]
1155
+ splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0]]
1137
1156
  };
1138
- if(opts.onlyMonthDigits){
1139
- $(obj.splits[1]).attr({inputmode: 'numeric', size: 2, maxlength: 2});
1157
+ if(opts.monthSelect){
1158
+ obj.splits.push($('<select class="mm ws-spin">'+getMonthOptions()+'</select>')[0]);
1159
+ } else {
1160
+ obj.splits.push($('<input type="text" class="mm ws-spin" />')[0]);
1161
+ if(opts.onlyMonthDigits){
1162
+ $(obj.splits[1]).attr({inputmode: 'numeric', size: 2, maxlength: 2});
1163
+ }
1140
1164
  }
1165
+
1141
1166
  obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1]];
1142
1167
  return obj;
1143
1168
  },
1144
1169
  sort: function(element){
1145
1170
  var seperator = $('.ws-input-seperator', element).html(curCfg.dFormat);
1146
- var mm = $('input.mm', element);
1171
+ var mm = $('input.mm, select.mm', element);
1147
1172
  var action;
1148
1173
  if(curCfg.date.showMonthAfterYear){
1149
1174
  mm.appendTo(element);
@@ -1157,7 +1182,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1157
1182
  }
1158
1183
  };
1159
1184
 
1160
- var nowDate = new Date().getTime() - (new Date().getTimezoneOffset() * 60 * 1000 );
1185
+ var nowDate = new Date(new Date().getTime() - (new Date().getTimezoneOffset() * 60 * 1000 ));
1186
+ nowDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), nowDate.getHours()).getTime()
1161
1187
  var steps = {
1162
1188
  number: {
1163
1189
  step: 1
@@ -1166,6 +1192,10 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1166
1192
  // step: 1,
1167
1193
  // start: new Date(nowDate)
1168
1194
  // },
1195
+ 'datetime-local': {
1196
+ step: 60,
1197
+ start: new Date(nowDate).getTime()
1198
+ },
1169
1199
  time: {
1170
1200
  step: 60
1171
1201
  },
@@ -1201,7 +1231,6 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1201
1231
 
1202
1232
 
1203
1233
  (function(){
1204
- var monthDigits = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
1205
1234
 
1206
1235
  formcfg.de = $.extend(true, {
1207
1236
  numberFormat: {
@@ -1251,6 +1280,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1251
1280
  patterns: {
1252
1281
  d: "mm/dd/yy"
1253
1282
  },
1283
+ meridian: ['AM', 'PM'],
1254
1284
  month: {
1255
1285
  currentText: 'This month'
1256
1286
  },
@@ -1304,12 +1334,18 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1304
1334
  langCfg.date.monthkeys = {};
1305
1335
  langCfg.date.monthDigits = monthDigits;
1306
1336
  langCfg.numberSigns += '-';
1337
+ if(langCfg.meridian){
1338
+ langCfg.timeSigns += langCfg.meridian[0] + langCfg.meridian[1];
1339
+ }
1307
1340
  $.each(langCfg.date.monthNames, create);
1308
1341
  $.each(langCfg.date.monthNamesShort, create);
1309
1342
  }
1310
1343
  if(!langCfg.colorSigns){
1311
1344
  langCfg.colorSigns = '#abcdefABCDEF';
1312
1345
  }
1346
+ if(!langCfg['datetime-localSigns']){
1347
+ langCfg['datetime-localSigns'] = langCfg.dateSigns+langCfg.timeSigns;
1348
+ }
1313
1349
  };
1314
1350
  var triggerLocaleChange = function(){
1315
1351
  processLangCFG(curCfg);
@@ -1366,11 +1402,31 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1366
1402
  return (val+'').replace(/\,/g, '').replace(/\./, curCfg.numberFormat['.']);
1367
1403
  },
1368
1404
  time: function(val){
1405
+ var fVal;
1406
+ if(val && curCfg.meridian){
1407
+ val = val.split(':');
1408
+ fVal = (val[0] * 1);
1409
+ if(fVal && fVal >= 12){
1410
+ val[0] = addZero(fVal - 12+'');
1411
+ fVal = 1;
1412
+
1413
+ } else {
1414
+ fVal = 0;
1415
+ }
1416
+ val = $.trim(val.join(':')) + ' '+ curCfg.meridian[fVal];
1417
+ }
1369
1418
  return val;
1370
1419
  },
1371
- week: function(val){
1420
+ 'datetime-local': function(val, o){
1421
+ var fVal = $.trim(val || '').split('T');
1422
+ if(fVal.length == 2){
1423
+ val = this.date(fVal[0], o) +' '+this.time(fVal[1], o);
1424
+ }
1372
1425
  return val;
1373
1426
  },
1427
+ // week: function(val){
1428
+ // return val;
1429
+ // },
1374
1430
  //todo empty val for month/split
1375
1431
  month: function(val, options){
1376
1432
  var names;
@@ -1423,7 +1479,32 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1423
1479
  // week: function(val){
1424
1480
  // return val;
1425
1481
  // },
1482
+ 'datetime-local': function(val, o){
1483
+ var tmp;
1484
+ var fVal = $.trim(val || '').split(/\s+/);
1485
+ if(fVal.length == 2){
1486
+ if(fVal[0].indexOf(':') != -1 && fVal[1].indexOf(':') == -1){
1487
+ tmp = fVal[1];
1488
+ fVal[1] = fVal[0];
1489
+ fVal[0] = tmp;
1490
+ }
1491
+ val = this.date(fVal[0], o) +'T'+ this.time(fVal[1], o);
1492
+ }
1493
+ return val;
1494
+ },
1426
1495
  time: function(val){
1496
+ var fVal;
1497
+ if(val && curCfg.meridian){
1498
+ if(val.indexOf(curCfg.meridian[1]) != -1){
1499
+ val = val.split(':');
1500
+ fVal = (val[0] * 1);
1501
+ if(!isNaN(fVal)){
1502
+ val[0] = fVal + 12;
1503
+ }
1504
+ val = val.join(':');
1505
+ }
1506
+ val = $.trim(val.replace(curCfg.meridian[0], '').replace(curCfg.meridian[1], ''));
1507
+ }
1427
1508
  return val;
1428
1509
  },
1429
1510
  month: function(val, opts, noCorrect){
@@ -1524,8 +1605,16 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1524
1605
  var type = (typeof val == 'object') ? 'valueAsDate' : 'valueAsNumber';
1525
1606
  return input.prop(type, val).prop('value');
1526
1607
  },
1527
- isValid: function(val){
1528
- return input.prop('value', val).is(':valid') && input.prop('value') == val;
1608
+ isValid: function(val, attrs){
1609
+ if(attrs && (attrs.nodeName || attrs.jquery)){
1610
+ attrs = {
1611
+ min: $(attrs).prop('min') || '',
1612
+ max: $(attrs).prop('max') || '',
1613
+ step: $(attrs).prop('step') || 'any'
1614
+ };
1615
+ }
1616
+ attrs = $.extend({step: 'any', min: '', max: ''}, attrs || {});
1617
+ return input.attr(attrs).prop('value', val).is(':valid') && input.prop('value') == val;
1529
1618
  }
1530
1619
  };
1531
1620
  }
@@ -1550,6 +1639,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1550
1639
  o.mirrorValidity = o.mirrorValidity && this.orig && Modernizr.formvalidation && !webshims.bugs.bustedValidity;
1551
1640
 
1552
1641
  if(o.splitInput && this._addSplitInputs){
1642
+ if(o.monthSelect){
1643
+ this.element.addClass('ws-month-select');
1644
+ }
1553
1645
  this._addSplitInputs();
1554
1646
  } else {
1555
1647
  this.inputElements = this.element;
@@ -1801,7 +1893,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1801
1893
  try {
1802
1894
  $(this)
1803
1895
  .next()
1804
- .next('input')
1896
+ .next('input, select')
1805
1897
  .each(select)
1806
1898
  ;
1807
1899
  } catch(er){}
@@ -1879,7 +1971,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1879
1971
  }
1880
1972
  };
1881
1973
  spinEvents.keydown = function(e){
1882
- if(o.list || e.isDefaultPrevented() || $.attr(this, 'list')){return;}
1974
+ if(o.list || e.isDefaultPrevented() || (e.altKey && e.keyCode == 40) || $.attr(this, 'list')){return;}
1883
1975
  var stepped = true;
1884
1976
  var code = e.keyCode;
1885
1977
  if (code == 38) {
@@ -2002,7 +2094,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2002
2094
  return [options, datalist.data('label')];
2003
2095
  },
2004
2096
  list: function(val){
2005
- if(this.type == 'number' || this.type == 'time'){
2097
+ if(this.type == 'number'){
2006
2098
  this.element.attr('list', $.attr(this.orig, 'list'));
2007
2099
  }
2008
2100
  this.options.list = val;
@@ -2085,7 +2177,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2085
2177
  if(!this.inputElements){
2086
2178
  var create = splitInputs[this.type]._create(this.options);
2087
2179
  this.splits = create.splits;
2088
- this.inputElements = $(create.elements).prependTo(this.element).filter('input');
2180
+ this.inputElements = $(create.elements).prependTo(this.element).filter('input, select');
2089
2181
  }
2090
2182
  },
2091
2183
 
@@ -2111,11 +2203,11 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2111
2203
  reorderInputs: function(){
2112
2204
  if(splitInputs[this.type]){
2113
2205
  var element = this.element;
2114
- splitInputs[this.type].sort(element);
2206
+ splitInputs[this.type].sort(element, this.options);
2115
2207
  setTimeout(function(){
2116
2208
  var data = webshims.data(element);
2117
2209
  if(data && data.shadowData){
2118
- data.shadowData.shadowFocusElement = element.find('input')[0] || element[0];
2210
+ data.shadowData.shadowFocusElement = element.find('input, select')[0] || element[0];
2119
2211
  }
2120
2212
  }, 9);
2121
2213
  }
@@ -2218,8 +2310,21 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2218
2310
  options: options
2219
2311
  });
2220
2312
 
2313
+ webshims.inlinePopover = {
2314
+ _create: function(){
2315
+ this.element = $('<div class="ws-inline-picker"><div class="ws-po-box" /></div>').data('wspopover', this);
2316
+ this.contentElement = $('.ws-po-box', this.element);
2317
+ this.element.insertAfter(this.options.prepareFor);
2318
+ },
2319
+ show: $.noop,
2320
+ hide: $.noop,
2321
+ preventBlur: $.noop,
2322
+ isVisible: true
2323
+ };
2324
+
2221
2325
  picker._genericSetFocus = function(element, _noFocus){
2222
2326
  element = $(element || this.activeButton);
2327
+
2223
2328
  if(!this.popover.openedByFocus && !_noFocus){
2224
2329
  var that = this;
2225
2330
  var setFocus = function(noTrigger){
@@ -2244,12 +2349,14 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2244
2349
  data.setChange(val);
2245
2350
  },
2246
2351
  cancel: function(val, popover, data){
2247
- popover.stopOpen = true;
2248
- data.element.getShadowFocusElement().focus();
2249
- setTimeout(function(){
2250
- popover.stopOpen = false;
2251
- }, 9);
2252
- popover.hide();
2352
+ if(!data.options.inlinePicker){
2353
+ popover.stopOpen = true;
2354
+ data.element.getShadowFocusElement().focus();
2355
+ setTimeout(function(){
2356
+ popover.stopOpen = false;
2357
+ }, 9);
2358
+ popover.hide();
2359
+ }
2253
2360
  }
2254
2361
  };
2255
2362
 
@@ -2262,28 +2369,31 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2262
2369
  popover.element.on('updatepickercontent pickerchange', function(){
2263
2370
  tabbable = false;
2264
2371
  });
2265
- popover.contentElement.on({
2266
- keydown: function(e){
2267
- if(e.keyCode == 9){
2268
- if(!tabbable){
2269
- tabbable = $('input:not(:disabled), [tabindex="0"]:not(:disabled)', this).filter(':visible');
2270
- }
2271
- var index = tabbable.index(e.target);
2272
- if(e.shiftKey && index <= 0){
2273
- tabbable.last().focus();
2274
- return false;
2275
- }
2276
- if(!e.shiftKey && index >= tabbable.length - 1){
2277
- tabbable.first().focus();
2372
+
2373
+ if(!data.options.inlinePicker){
2374
+ popover.contentElement.on({
2375
+ keydown: function(e){
2376
+ if(e.keyCode == 9){
2377
+ if(!tabbable){
2378
+ tabbable = $('input:not(:disabled), [tabindex="0"]:not(:disabled)', this).filter(':visible');
2379
+ }
2380
+ var index = tabbable.index(e.target);
2381
+ if(e.shiftKey && index <= 0){
2382
+ tabbable.last().focus();
2383
+ return false;
2384
+ }
2385
+ if(!e.shiftKey && index >= tabbable.length - 1){
2386
+ tabbable.first().focus();
2387
+ return false;
2388
+ }
2389
+ } else if(e.keyCode == 27){
2390
+ data.element.getShadowFocusElement().focus();
2391
+ popover.hide();
2278
2392
  return false;
2279
2393
  }
2280
- } else if(e.keyCode == 27){
2281
- data.element.getShadowFocusElement().focus();
2282
- popover.hide();
2283
- return false;
2284
2394
  }
2285
- }
2286
- });
2395
+ });
2396
+ }
2287
2397
 
2288
2398
  data._propertyChange = (function(){
2289
2399
  var timer;
@@ -2293,7 +2403,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2293
2403
  }
2294
2404
  };
2295
2405
  return function(prop){
2296
- if(prop == 'value'){return;}
2406
+ if(prop == 'value' && !data.options.inlinePicker){return;}
2297
2407
  popover.isDirty = true;
2298
2408
  if(popover.isVisible){
2299
2409
  clearTimeout(timer);
@@ -2330,7 +2440,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2330
2440
 
2331
2441
  picker._common = function(data){
2332
2442
  var options = data.options;
2333
- var popover = webshims.objectCreate(webshims.wsPopover, {}, {prepareFor: data.element, position: options.widgetPosition});
2443
+ var popover = webshims.objectCreate(options.inlinePicker ? webshims.inlinePopover : webshims.wsPopover, {}, {prepareFor: options.inlinePicker ? data.buttonWrapper : data.element, position: options.widgetPosition});
2334
2444
  var opener = $('<button type="button" class="ws-popover-opener"><span /></button>').appendTo(data.buttonWrapper);
2335
2445
 
2336
2446
 
@@ -2339,18 +2449,34 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2339
2449
  };
2340
2450
  var show = function(){
2341
2451
  var type = loadPicker(data.type, 'DOM');
2342
- if(!options.disabled && !options.readonly && !popover.isVisible){
2452
+ if(!options.disabled && !options.readonly && (options.inlinePicker || !popover.isVisible)){
2343
2453
  webshims.ready(type, showPickerContent);
2344
2454
  popover.show(data.element);
2345
2455
  }
2346
2456
  };
2457
+ var open = function(){
2458
+ if((options.inlinePicker || popover.isVisible) && popover.activeElement){
2459
+ popover.openedByFocus = false;
2460
+ popover.activeElement.focus();
2461
+ }
2462
+ show();
2463
+ };
2464
+
2347
2465
 
2348
2466
  options.containerElements.push(popover.element[0]);
2349
2467
 
2350
2468
  if(data.type != 'color'){
2469
+ if(options.yearButtons){
2470
+ options.startView = 2;
2471
+ }
2351
2472
  if(!options.startView){
2352
2473
  options.startView = 0;
2353
2474
  }
2475
+
2476
+ if(data.type == 'time'){
2477
+ options.minView = 3;
2478
+ options.startView = 3;
2479
+ }
2354
2480
  if(!options.minView){
2355
2481
  options.minView = 0;
2356
2482
  }
@@ -2380,6 +2506,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2380
2506
  if(popover.activeElement){
2381
2507
  popover.activeElement.removeClass('ws-focus');
2382
2508
  }
2509
+ if(options.inlinePicker){
2510
+ popover.openedByFocus = true;
2511
+ }
2383
2512
  }
2384
2513
  })
2385
2514
  ;
@@ -2395,57 +2524,63 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2395
2524
  opener.prop({disabled: true});
2396
2525
  }
2397
2526
 
2398
- opener
2399
- .on({
2400
- mousedown: function(){
2401
- stopPropagation.apply(this, arguments);
2402
- popover.preventBlur();
2403
- },
2404
- click: function(){
2405
- if(popover.isVisible && popover.activeElement){
2406
- popover.openedByFocus = false;
2407
- popover.activeElement.focus();
2408
- }
2409
- show();
2410
- },
2411
- focus: function(){
2412
- popover.preventBlur();
2413
- }
2414
- })
2415
- ;
2416
2527
 
2417
- (function(){
2418
- var mouseFocus = false;
2419
- var resetMouseFocus = function(){
2420
- mouseFocus = false;
2421
- };
2422
- data.inputElements.on({
2423
- focus: function(){
2424
- if(!popover.stopOpen && (options.buttonOnly || options.openOnFocus || (mouseFocus && options.openOnMouseFocus))){
2425
- popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
2426
- show();
2427
- } else {
2528
+ opener.on({click: open});
2529
+
2530
+ if(options.inlinePicker){
2531
+ popover.openedByFocus = true;
2532
+ } else {
2533
+ opener
2534
+ .on({
2535
+ mousedown: function(){
2536
+ stopPropagation.apply(this, arguments);
2537
+ popover.preventBlur();
2538
+ },
2539
+ focus: function(){
2428
2540
  popover.preventBlur();
2429
2541
  }
2430
- },
2431
- mousedown: function(){
2432
- mouseFocus = true;
2433
- setTimeout(resetMouseFocus, 9);
2434
- if(options.buttonOnly && popover.isVisible && popover.activeElement){
2435
- popover.openedByFocus = false;
2436
- setTimeout(function(){
2542
+ })
2543
+ ;
2544
+
2545
+ (function(){
2546
+ var mouseFocus = false;
2547
+ var resetMouseFocus = function(){
2548
+ mouseFocus = false;
2549
+ };
2550
+ data.inputElements.on({
2551
+ keydown: function(e){
2552
+ if(e.keyCode == 40 && e.altKey){
2553
+ open();
2554
+ }
2555
+ },
2556
+ focus: function(){
2557
+ if(!popover.stopOpen && (options.buttonOnly || options.openOnFocus || (mouseFocus && options.openOnMouseFocus))){
2558
+ popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
2559
+ show();
2560
+ } else {
2561
+ popover.preventBlur();
2562
+ }
2563
+ },
2564
+ mousedown: function(){
2565
+ mouseFocus = true;
2566
+ setTimeout(resetMouseFocus, 9);
2567
+ if(options.buttonOnly && popover.isVisible && popover.activeElement){
2437
2568
  popover.openedByFocus = false;
2438
- popover.activeElement.focus();
2439
- }, 4);
2440
- }
2441
- if(data.element.is(':focus')){
2442
- popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
2443
- show();
2569
+ setTimeout(function(){
2570
+ popover.openedByFocus = false;
2571
+ popover.activeElement.focus();
2572
+ }, 4);
2573
+ }
2574
+ if(data.element.is(':focus')){
2575
+ popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
2576
+ show();
2577
+ }
2578
+ popover.preventBlur();
2444
2579
  }
2445
- popover.preventBlur();
2446
- }
2447
- });
2448
- })();
2580
+ });
2581
+ })();
2582
+ }
2583
+
2449
2584
  data.popover = popover;
2450
2585
  data.opener = opener;
2451
2586
  $(data.orig).on('remove', function(e){
@@ -2456,12 +2591,16 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2456
2591
  }, 4);
2457
2592
  }
2458
2593
  });
2459
-
2594
+ if(options.inlinePicker){
2595
+ show();
2596
+ }
2460
2597
  loadPicker(data.type, 'WINDOWLOAD');
2461
2598
  };
2462
2599
 
2463
2600
  picker.month = picker._common;
2464
2601
  picker.date = picker._common;
2602
+ picker.time = picker._common;
2603
+ picker['datetime-local'] = picker._common;
2465
2604
  // picker.week = picker._common;
2466
2605
  picker.color = function(data){
2467
2606
  var ret = picker._common.apply(this, arguments);
@@ -2645,6 +2784,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2645
2784
  opts[optsName] = $.attr(this, copyAttrs[i]) || opts[optsName];
2646
2785
  }
2647
2786
  }
2787
+ if(opts.monthSelect){
2788
+ opts.onlyMonthDigits = true;
2789
+ }
2648
2790
  if(opts.onlyMonthDigits){
2649
2791
  opts.formatMonthNames = 'monthDigits';
2650
2792
  }
@@ -2750,11 +2892,14 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2750
2892
  });
2751
2893
  }
2752
2894
 
2753
- var isStupid = navigator.userAgent.indexOf('MSIE 10.0') != -1 && navigator.userAgent.indexOf('Touch') == -1;
2754
- ['number', 'time', 'month', 'date', 'color'].forEach(function(name){
2895
+ var isStupid = modernizrInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && (/MSIE 1[0|1]\.\d/.test(navigator.userAgent) || /Trident\/7\.0/.test(navigator.userAgent));
2896
+ ['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){
2755
2897
  if(!modernizrInputTypes[name] || options.replaceUI || (name == 'number' && isStupid)){
2756
2898
  extendType(name, {
2757
2899
  _create: function(opts, set){
2900
+ if(opts.monthSelect){
2901
+ opts.splitInput = true;
2902
+ }
2758
2903
  if(opts.splitInput && !splitInputs[name]){
2759
2904
  webshims.warn('splitInput not supported for '+ name);
2760
2905
  opts.splitInput = false;