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.
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
@@ -401,16 +401,20 @@
401
401
  this.thumb.on({
402
402
  mousedown: add
403
403
  });
404
- $(function(){
405
- webshims.ready('dom-support', function(){
406
- that.element.onWSOff('updateshadowdom', function(){
407
- that.updateMetrics();
404
+ if (window.webshims) {
405
+ webshims.ready('WINDOWLOAD', function(){
406
+ webshims.ready('dom-support', function(){
407
+ if ($.fn.onWSOff) {
408
+ that.element.onWSOff('updateshadowdom', function(){
409
+ that.updateMetrics();
410
+ });
411
+ }
408
412
  });
413
+ if (!$.fn.onWSOff && webshims._polyfill) {
414
+ webshims._polyfill(['dom-support']);
415
+ }
409
416
  });
410
- if(!$.fn.onWSOff){
411
- webshims._polyfill(['dom-support']);
412
- }
413
- });
417
+ }
414
418
  },
415
419
  posCenter: function(elem, outerWidth){
416
420
  var temp;
@@ -452,6 +456,12 @@
452
456
  }
453
457
  };
454
458
 
459
+ var oCreate = function (o) {
460
+ function F() {}
461
+ F.prototype = o;
462
+ return new F();
463
+ };
464
+
455
465
  $.fn.rangeUI = function(opts){
456
466
  opts = $.extend({
457
467
  readonly: false,
@@ -470,14 +480,19 @@
470
480
  calcTrail: true
471
481
  }, opts);
472
482
  return this.each(function(){
473
- webshims.objectCreate(rangeProto, {
474
- element: {
475
- value: $(this)
476
- }
477
- }, opts);
483
+ var obj = $.extend(oCreate(rangeProto), {element: $(this)});
484
+ obj.options = opts;
485
+ obj._create.call(obj);
478
486
  });
479
487
  };
480
- webshims.isReady('range-ui', true);
488
+ if(window.webshims && webshims.isReady){
489
+ webshims.ready('es5', function(){
490
+ webshims.isReady('range-ui', true);
491
+ });
492
+ if(webshims._polyfill){
493
+ webshims._polyfill(['es5']);
494
+ }
495
+ }
481
496
  })(jQuery);
482
497
  webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
483
498
  "use strict";
@@ -524,10 +539,14 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
524
539
  }
525
540
  },
526
541
  month: {
527
- _create: function(){
542
+ _create: function(opts){
543
+
528
544
  var obj = {
529
545
  splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0], $('<input type="text" class="mm ws-spin" />')[0]]
530
546
  };
547
+ if(opts.onlyMonthDigits){
548
+ $(obj.splits[1]).attr({inputmode: 'numeric', size: 2, maxlength: 2});
549
+ }
531
550
  obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1]];
532
551
  return obj;
533
552
  },
@@ -547,6 +566,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
547
566
  }
548
567
  };
549
568
 
569
+ var nowDate = new Date().getTime() - (new Date().getTimezoneOffset() * 60 * 1000 );
550
570
  var steps = {
551
571
  number: {
552
572
  step: 1
@@ -556,11 +576,11 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
556
576
  },
557
577
  month: {
558
578
  step: 1,
559
- start: new Date()
579
+ start: new Date(nowDate)
560
580
  },
561
581
  date: {
562
582
  step: 1,
563
- start: new Date()
583
+ start: new Date(nowDate)
564
584
  }
565
585
  };
566
586
  var labelWidth = (function(){
@@ -656,9 +676,19 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
656
676
  "showMonthAfterYear": false,
657
677
  "yearSuffix": ""
658
678
  }
659
- }, formcfg['en'] || {});
679
+ }, formcfg.en || {});
680
+
660
681
  if(!formcfg['en-US']){
661
- formcfg['en-US'] = formcfg['en'];
682
+ formcfg['en-US'] = $.extend(true, {}, formcfg['en']);
683
+ }
684
+ if(!formcfg['en-GB']){
685
+ formcfg['en-GB'] = $.extend(true, {}, formcfg.en, {
686
+ date: {firstDay: 1},
687
+ patterns: {d: "dd/mm/yy"}
688
+ });
689
+ }
690
+ if(!formcfg['en-AU']){
691
+ formcfg['en-AU'] = $.extend(true, {}, formcfg['en-GB']);
662
692
  }
663
693
  if(!formcfg['']){
664
694
  formcfg[''] = formcfg['en-US'];
@@ -686,22 +716,37 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
686
716
  langCfg.colorSigns = '#abcdefABCDEF';
687
717
  }
688
718
  };
719
+ var triggerLocaleChange = function(){
720
+ processLangCFG(curCfg);
721
+ $(document).triggerHandler('wslocalechange');
722
+ };
689
723
 
690
- processLangCFG(curCfg);
724
+ triggerLocaleChange();
691
725
 
692
- $.webshims.activeLang({
693
- register: 'form-core',
726
+ webshims.activeLang({
727
+ register: 'form-core',
694
728
  callback: function(){
695
729
  $.each(arguments, function(i, val){
696
730
  if(formcfg[val]){
697
- curCfg = formcfg[val];
698
- processLangCFG(curCfg);
699
- $(document).triggerHandler('wslocalechange');
731
+ if(formcfg[val] != curCfg){
732
+ curCfg = formcfg[val];
733
+ triggerLocaleChange();
734
+ }
700
735
  return false;
701
736
  }
702
737
  });
703
738
  }
704
739
  });
740
+ webshims.activeLang({
741
+ langObj: formcfg,
742
+ module: 'form-core',
743
+ callback: function(val){
744
+ if(curCfg != val){
745
+ curCfg = val;
746
+ triggerLocaleChange();
747
+ }
748
+ }
749
+ });
705
750
  })();
706
751
 
707
752
 
@@ -740,6 +785,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
740
785
  } else if(p[1]){
741
786
  val = curCfg.date.showMonthAfterYear ? p.join(' ') : p[1]+' '+p[0];
742
787
  }
788
+ } else if(options && options.splitInput){
789
+ val = [p[0] || '', p[1] || ''];
743
790
  }
744
791
  return val;
745
792
  },
@@ -778,16 +825,16 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
778
825
  time: function(val){
779
826
  return val;
780
827
  },
781
- month: function(val, opts){
828
+ month: function(val, opts, noCorrect){
782
829
 
783
830
  var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
784
831
 
785
832
  if(p.length == 2 && p[0] && p[1]){
786
- p[0] = curCfg.date.monthkeys[p[0]] || p[0];
787
- p[1] = curCfg.date.monthkeys[p[1]] || p[1];
788
- if(p[1].length == 2){
833
+ p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0];
834
+ p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1];
835
+ if(p[1].length == 2 && p[0].length > 3){
789
836
  val = p[0]+'-'+p[1];
790
- } else if(p[0].length == 2){
837
+ } else if(p[0].length == 2 && p[1].length > 3){
791
838
  val = p[1]+'-'+p[0];
792
839
  } else {
793
840
  val = '';
@@ -797,7 +844,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
797
844
  }
798
845
  return val;
799
846
  },
800
- date: function(val, opts){
847
+ date: function(val, opts, noCorrect){
801
848
  createFormat('d');
802
849
  var i;
803
850
  var obj;
@@ -808,7 +855,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
808
855
  val = val.split(curCfg.dFormat);
809
856
  }
810
857
 
811
- return (val.length == 3 && val[0] && val[1] && val[2]) ?
858
+ 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))) ?
812
859
  ([addZero(val[obj.yy]), addZero(val[obj.mm]), addZero(val[obj.dd])]).join('-') :
813
860
  ''
814
861
  ;
@@ -866,7 +913,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
866
913
  return function(type){
867
914
  var input;
868
915
  if(!types[type]){
869
- input = $('<input type="'+type+'" />');
916
+ input = $('<input type="'+type+'" step="any" />');
870
917
  types[type] = {
871
918
  asNumber: function(val){
872
919
  var type = (typeof val == 'object') ? 'valueAsDate' : 'value';
@@ -1095,6 +1142,22 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1095
1142
  e.preventDefault();
1096
1143
  }
1097
1144
  },
1145
+ input: (this.type == 'color' && this.isValid) ?
1146
+ $.noop :
1147
+ (function(){
1148
+ var timer;
1149
+ var check = function(){
1150
+ var val = that.parseValue(true);
1151
+ if(val && that.isValid(val)){
1152
+ that.setInput(val);
1153
+ }
1154
+
1155
+ };
1156
+ return function(){
1157
+ clearTimeout(timer);
1158
+ timer = setTimeout(check, 200);
1159
+ };
1160
+ })(),
1098
1161
  'input keydown keypress': (function(){
1099
1162
  var timer;
1100
1163
  var isStopped = false;
@@ -1112,8 +1175,12 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1112
1175
  timer = setTimeout(releaseTab, 300);
1113
1176
  };
1114
1177
  var select = function(){
1115
- this.focus();
1116
- this.select();
1178
+ var elem = this;
1179
+ setTimeout(function(){
1180
+ elem.focus();
1181
+ elem.select();
1182
+ }, 4);
1183
+
1117
1184
  stopTab();
1118
1185
  };
1119
1186
 
@@ -1234,8 +1301,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1234
1301
  var localeChange ;
1235
1302
  if(!o.splitInput){
1236
1303
  localeChange = function(){
1304
+
1237
1305
  if(o.value){
1238
- that.value(o.value);
1306
+ that.value(o.value, true);
1239
1307
  }
1240
1308
 
1241
1309
  if(placeholderFormat[that.type] && o.placeholder){
@@ -1254,8 +1322,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1254
1322
 
1255
1323
  initChangeEvents();
1256
1324
  },
1257
- value: function(val){
1258
- if(!this._init || val !== this.options.value){
1325
+ value: function(val, force){
1326
+ if(!this._init || force || val !== this.options.value){
1259
1327
  this.element.val(this.formatValue(val));
1260
1328
  this.options.value = val;
1261
1329
  this._propertyChange('value');
@@ -1267,14 +1335,14 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1267
1335
  this.inputElements.attr({'aria-required': ''+boolVal});
1268
1336
  this.mirrorValidity();
1269
1337
  },
1270
- parseValue: function(){
1338
+ parseValue: function(noCorrect){
1271
1339
  var value = this.inputElements.map(function(){
1272
1340
  return $.prop(this, 'value');
1273
1341
  }).get();
1274
1342
  if(!this.options.splitInput){
1275
1343
  value = value[0];
1276
1344
  }
1277
- return parseVal[this.type](value, this.options);
1345
+ return parseVal[this.type](value, this.options, noCorrect);
1278
1346
  },
1279
1347
  formatValue: function(val, noSplit){
1280
1348
  return formatVal[this.type](val, noSplit === false ? false : this.options);
@@ -1372,6 +1440,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1372
1440
  this.elemHelper = $('<input type="'+ o.type+'" />');
1373
1441
  this.asNumber = helper.asNumber;
1374
1442
  this.asValue = helper.asValue;
1443
+ this.isValid = helper.isValid;
1444
+
1375
1445
 
1376
1446
  wsWidgetProto._create.apply(this, arguments);
1377
1447
  this._init = false;
@@ -1397,7 +1467,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1397
1467
  createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'value', 'required'],
1398
1468
  _addSplitInputs: function(){
1399
1469
  if(!this.inputElements){
1400
- var create = splitInputs[this.type]._create();
1470
+ var create = splitInputs[this.type]._create(this.options);
1401
1471
  this.splits = create.splits;
1402
1472
  this.inputElements = $(create.elements).prependTo(this.element).filter('input');
1403
1473
  }
@@ -1434,9 +1504,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1434
1504
  }, 9);
1435
1505
  }
1436
1506
  },
1437
- value: function(val){
1507
+ value: function(val, force){
1438
1508
 
1439
- if(!this._init || this.options.value !== val){
1509
+ if(!this._init || force || this.options.value !== val){
1440
1510
  this.valueAsNumber = this.asNumber(val);
1441
1511
  this.options.value = val;
1442
1512
 
@@ -1948,7 +2018,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1948
2018
  opts[optsName] = $.attr(this, copyAttrs[i]) || opts[optsName];
1949
2019
  }
1950
2020
  }
1951
-
2021
+ if(opts.onlyMonthDigits){
2022
+ opts.formatMonthNames = 'monthDigits';
2023
+ }
1952
2024
  data.shim = inputTypes[type]._create(opts);
1953
2025
 
1954
2026
  webshims.addShadowDom(this, data.shim.element, {
@@ -530,52 +530,55 @@ var swfmini = function() {
530
530
  });
531
531
  webshims.loader.loadList(['mediaelement-native-fix']);
532
532
  }
533
- }
534
-
535
- if(hasNative && !options.preferFlash){
536
- var noSwitch = {
537
- 1: 1,
538
- 2: 1
539
- };
540
- var switchOptions = function(e){
541
- var media;
542
- var parent;
543
- if(!options.preferFlash &&
533
+
534
+ if(!options.preferFlash){
535
+ var noSwitch = {
536
+ 1: 1,
537
+ 2: 1
538
+ };
539
+ var switchOptions = function(e){
540
+ var media, error, parent;
541
+ if(!options.preferFlash &&
544
542
  ($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source:last', parent)[0] == e.target)) &&
545
- (media = $(e.target).closest('audio, video')) && !noSwitch[media.prop('error')]
543
+ (media = $(e.target).closest('audio, video')) && !noSwitch[(error = media.prop('error'))]
546
544
  ){
547
- $(function(){
548
- if(hasSwf && !options.preferFlash){
549
- loadSwf();
550
- webshims.ready('WINDOWLOAD '+swfType, function(){
551
- setTimeout(function(){
552
- if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
553
- options.preferFlash = true;
554
- document.removeEventListener('error', switchOptions, true);
555
- $('audio, video').each(function(){
556
- webshims.mediaelement.selectSource(this);
557
- });
558
- webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
559
- }
560
- }, 9);
561
- });
562
- } else{
563
- document.removeEventListener('error', switchOptions, true);
545
+ if(error == null){
546
+ webshims.warn("There was an unspecified error on a mediaelement");
547
+ return;
548
+
564
549
  }
565
- });
566
- }
567
- };
568
- document.addEventListener('error', switchOptions, true);
569
- $('audio, video').each(function(){
570
- var error = $.prop(this, 'error');
571
- if(error && !noSwitch[error]){
572
- switchOptions({target: this});
573
- return false;
574
- }
575
- });
550
+ $(function(){
551
+ if(hasSwf && !options.preferFlash){
552
+ loadSwf();
553
+ webshims.ready('WINDOWLOAD '+swfType, function(){
554
+ setTimeout(function(){
555
+ if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
556
+ options.preferFlash = true;
557
+ document.removeEventListener('error', switchOptions, true);
558
+ $('audio, video').each(function(){
559
+ webshims.mediaelement.selectSource(this);
560
+ });
561
+ webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
562
+ }
563
+ }, 9);
564
+ });
565
+ } else{
566
+ document.removeEventListener('error', switchOptions, true);
567
+ }
568
+ });
569
+ }
570
+ };
571
+ document.addEventListener('error', switchOptions, true);
572
+ $('audio, video').each(function(){
573
+ var error = $.prop(this, 'error');
574
+ if(error && !noSwitch[error]){
575
+ switchOptions({target: this});
576
+ return false;
577
+ }
578
+ });
579
+ }
576
580
  }
577
581
 
578
-
579
582
  if(Modernizr.track && !bugs.track){
580
583
  (function(){
581
584
 
@@ -956,63 +959,14 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
956
959
 
957
960
  });
958
961
 
959
- webshims.ready('dom-support', function(){
960
- if(!supportsLoop){
961
- webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
962
- }
963
-
964
- ['audio', 'video'].forEach(function(nodeName){
965
- var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
966
- prop: {
967
- value: function(){
968
- var data = webshims.data(this, 'mediaelement');
969
- selectSource(this, data);
970
- if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
971
- supLoad.prop._supvalue.apply(this, arguments);
972
- }
973
- }
974
- }
975
- });
976
- nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
977
- prop: {
978
- value: function(type){
979
- var ret = '';
980
- if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
981
- ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
982
- if(ret == 'no'){
983
- ret = '';
984
- }
985
- }
986
- if(!ret && hasSwf){
987
- type = $.trim((type || '').split(';')[0]);
988
- if(mediaelement.swfMimeTypes.indexOf(type) != -1){
989
- ret = 'maybe';
990
- }
991
- }
992
- return ret;
993
- }
994
- }
995
- });
996
- });
997
- webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
998
- set: function(){
999
- var elem = this;
1000
- var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
1001
- clearTimeout(baseData.loadTimer);
1002
- baseData.loadTimer = setTimeout(function(){
1003
- selectSource(elem);
1004
- elem = null;
1005
- }, 9);
1006
- }
1007
- });
1008
- });
1009
-
962
+ var handleMedia = false;
1010
963
  var initMediaElements = function(){
1011
964
  var testFixMedia = function(){
1012
965
  if(webshims.implement(this, 'mediaelement')){
1013
966
  selectSource(this);
1014
967
 
1015
- if(hasNative){
968
+ //fixes for FF 12 and IE9/10 || does not hurt, if run in other browsers
969
+ if(hasNative && (!supportsLoop || ('ActiveXObject' in window))){
1016
970
  var bufferTimer;
1017
971
  var lastBuffered;
1018
972
  var elem = this;
@@ -1041,7 +995,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
1041
995
  lastBuffered = getBufferedString();
1042
996
  }
1043
997
  clearTimeout(bufferTimer);
1044
- bufferTimer = setTimeout(testBuffer, 999);
998
+ bufferTimer = setTimeout(testBuffer, 400);
1045
999
  },
1046
1000
  'emptied stalled mediaerror abort suspend': function(e){
1047
1001
  if(e.type == 'emptied'){
@@ -1058,11 +1012,62 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
1058
1012
  }
1059
1013
 
1060
1014
  };
1061
- var handleMedia = false;
1015
+
1062
1016
 
1063
1017
 
1064
1018
  webshims.ready('dom-support', function(){
1065
1019
  handleMedia = true;
1020
+
1021
+ if(!supportsLoop){
1022
+ webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
1023
+ }
1024
+
1025
+ ['audio', 'video'].forEach(function(nodeName){
1026
+ var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
1027
+ prop: {
1028
+ value: function(){
1029
+ var data = webshims.data(this, 'mediaelement');
1030
+ selectSource(this, data);
1031
+ if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
1032
+ supLoad.prop._supvalue.apply(this, arguments);
1033
+ }
1034
+ }
1035
+ }
1036
+ });
1037
+ nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
1038
+ prop: {
1039
+ value: function(type){
1040
+ var ret = '';
1041
+ if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
1042
+ ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
1043
+ if(ret == 'no'){
1044
+ ret = '';
1045
+ }
1046
+ }
1047
+ if(!ret && hasSwf){
1048
+ type = $.trim((type || '').split(';')[0]);
1049
+ if(mediaelement.swfMimeTypes.indexOf(type) != -1){
1050
+ ret = 'maybe';
1051
+ }
1052
+ }
1053
+ return ret;
1054
+ }
1055
+ }
1056
+ });
1057
+ });
1058
+ webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
1059
+ set: function(){
1060
+ var elem = this;
1061
+ var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
1062
+ clearTimeout(baseData.loadTimer);
1063
+ baseData.loadTimer = setTimeout(function(){
1064
+ selectSource(elem);
1065
+ elem = null;
1066
+ }, 9);
1067
+ }
1068
+ });
1069
+
1070
+
1066
1071
  webshims.addReady(function(context, insertedElement){
1067
1072
  var media = $('video, audio', context)
1068
1073
  .add(insertedElement.filter('video, audio'))