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
@@ -741,6 +741,8 @@ if(Modernizr.inputtypes.date && /webkit/i.test(navigator.userAgent)){
741
741
  fixInputTypes = {
742
742
  date: 1,
743
743
  time: 1,
744
+ month: 1,
745
+ week: 1,
744
746
  "datetime-local": 1
745
747
  },
746
748
  noFocusEvents = {
@@ -810,83 +812,7 @@ if(Modernizr.inputtypes.date && /webkit/i.test(navigator.userAgent)){
810
812
  ;
811
813
  }
812
814
  ;
813
- if($.event.customEvent){
814
- $.event.customEvent.updateInput = true;
815
- }
816
815
 
817
- (function(){
818
-
819
- var correctValue = function(elem){
820
- var i = 1;
821
- var len = 3;
822
- var abort, val;
823
- if(elem.type == 'date' && (isSubmit || !$(elem).is(':focus'))){
824
- val = elem.value;
825
- if(val && val.length < 10 && (val = val.split('-')) && val.length == len){
826
- for(; i < len; i++){
827
- if(val[i].length == 1){
828
- val[i] = '0'+val[i];
829
- } else if(val[i].length != 2){
830
- abort = true;
831
- break;
832
- }
833
- }
834
- if(!abort){
835
- val = val.join('-');
836
- $.prop(elem, 'value', val);
837
- return val;
838
- }
839
- }
840
- }
841
- };
842
- var inputCheckValidityDesc, formCheckValidityDesc, inputValueDesc, inputValidityDesc;
843
-
844
- inputCheckValidityDesc = webshims.defineNodeNameProperty('input', 'checkValidity', {
845
- prop: {
846
- value: function(){
847
- correctValue(this);
848
- return inputCheckValidityDesc.prop._supvalue.apply(this, arguments);
849
- }
850
- }
851
- });
852
-
853
- formCheckValidityDesc = webshims.defineNodeNameProperty('form', 'checkValidity', {
854
- prop: {
855
- value: function(){
856
- $('input', this).each(function(){
857
- correctValue(this);
858
- });
859
- return formCheckValidityDesc.prop._supvalue.apply(this, arguments);
860
- }
861
- }
862
- });
863
-
864
- inputValueDesc = webshims.defineNodeNameProperty('input', 'value', {
865
- prop: {
866
- set: function(){
867
- return inputValueDesc.prop._supset.apply(this, arguments);
868
- },
869
- get: function(){
870
- return correctValue(this) || inputValueDesc.prop._supget.apply(this, arguments);
871
- }
872
- }
873
- });
874
-
875
- inputValidityDesc = webshims.defineNodeNameProperty('input', 'validity', {
876
- prop: {
877
- writeable: false,
878
- get: function(){
879
- correctValue(this);
880
- return inputValidityDesc.prop._supget.apply(this, arguments);
881
- }
882
- }
883
- });
884
-
885
- $(document).on('change', function(e){
886
- correctValue(e.target);
887
- });
888
-
889
- })();
890
816
 
891
817
  $(document)
892
818
  .on('focusin', function(e){
@@ -244,7 +244,7 @@ webshims.register('form-validation', function($, webshims, window, document, und
244
244
  clearTimeout(that.timers.repos);
245
245
  that.timers.repos = setTimeout(function(){
246
246
  that.position(visual);
247
- }, 900);
247
+ }, 400);
248
248
  });
249
249
  },
250
250
  prepareFor: function(element, visual){
@@ -455,7 +455,7 @@ webshims.register('form-validation', function($, webshims, window, document, und
455
455
  errorBox = this.create(elem, fieldWrapper);
456
456
  } else if(typeof errorBox == 'string'){
457
457
  errorBox = $('#'+errorBox);
458
- $.data(elem, 'errorbox', errorBox);
458
+ fieldWrapper.data('errorbox', errorBox);
459
459
  }
460
460
  return errorBox;
461
461
  },
@@ -10,7 +10,7 @@ webshims.register('forms-picker', function($, webshims, window, document, undefi
10
10
  ret.date = ret[0]+'-'+ret[1]+'-'+ret[2];
11
11
  return ret;
12
12
  };
13
- var today = getDateArray(new Date());
13
+ var today = getDateArray(new Date(new Date().getTime() - (new Date().getTimezoneOffset() * 60 * 1000 )));
14
14
 
15
15
 
16
16
  var _setFocus = function(element, _noFocus){
@@ -1,14 +1,17 @@
1
1
  jQuery.webshims.validityMessages.fr = {
2
2
  "typeMismatch": {
3
+ "defaultMessage": "Veuillez saisir une valeur valide.",
3
4
  "email": "Veuillez saisir une adresse courriel valide.",
4
5
  "url": "Veuillez saisir une URL.",
5
- "number": "Valeur incorrecte",
6
- "date": "Valeur incorrecte",
7
- "time": "Valeur incorrecte",
8
- "range": "Valeur incorrecte",
9
- "datetime-local": "Valeur incorrecte"
6
+ "number": "Veuillez saisir un nombre valide.",
7
+ "date": "Veuillez saisir une date valide.",
8
+ "month": "Veuillez saisir un mois valide.",
9
+ "week": "Veuillez saisir un numéro de semaine valide.",
10
+ "time": "Veuillez saisir une heure valide.",
11
+ "range": "Veuillez saisir une borne valide.",
12
+ "datetime-local": "Veuillez saisir une date valide."
10
13
  },
11
- "tooLong": "Valeur incorrecte",
14
+ "tooLong": "Contenu saisi trop long.",
12
15
  "patternMismatch": "Veuillez modifier la valeur du champ pour correspondre au format demandé : {%title}.",
13
16
  "valueMissing": {
14
17
  "defaultMessage": "Veuillez compléter ce champ.",
@@ -18,7 +21,7 @@ jQuery.webshims.validityMessages.fr = {
18
21
  },
19
22
  "rangeUnderflow": {
20
23
  "defaultMessage": "Cette valeur doit être supérieure ou égale à {%min}.",
21
- "date": "Cette valeur doit être supérieure ou égale à {%min}.",
24
+ "date": "Cette valeur doit être supérieure ou égale à {%min}.",
22
25
  "time": "Cette valeur doit être supérieure ou égale à {%min}.",
23
26
  "datetime-local": "Cette valeur doit être supérieure ou égale à {%min}."
24
27
  },
@@ -42,8 +45,15 @@ jQuery.webshims.formcfg.fr = {
42
45
  patterns: {
43
46
  d: 'dd/mm/yy'
44
47
  },
48
+ month: {
49
+ currentText: 'Ce mois-ci'
50
+ },
51
+ week: {
52
+ currentText: 'Cette semaine-ci'
53
+ },
45
54
  date: {
46
55
  closeText: 'Fermer',
56
+ clear: 'Effacer',
47
57
  prevText: 'Précédent',
48
58
  nextText: 'Suivant',
49
59
  currentText: 'Aujourd\'hui',
@@ -60,4 +70,4 @@ jQuery.webshims.formcfg.fr = {
60
70
  showMonthAfterYear: false,
61
71
  yearSuffix: ''
62
72
  }
63
- };
73
+ };
@@ -32,52 +32,55 @@
32
32
  });
33
33
  webshims.loader.loadList(['mediaelement-native-fix']);
34
34
  }
35
- }
36
-
37
- if(hasNative && !options.preferFlash){
38
- var noSwitch = {
39
- 1: 1,
40
- 2: 1
41
- };
42
- var switchOptions = function(e){
43
- var media;
44
- var parent;
45
- if(!options.preferFlash &&
35
+
36
+ if(!options.preferFlash){
37
+ var noSwitch = {
38
+ 1: 1,
39
+ 2: 1
40
+ };
41
+ var switchOptions = function(e){
42
+ var media, error, parent;
43
+ if(!options.preferFlash &&
46
44
  ($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source:last', parent)[0] == e.target)) &&
47
- (media = $(e.target).closest('audio, video')) && !noSwitch[media.prop('error')]
45
+ (media = $(e.target).closest('audio, video')) && !noSwitch[(error = media.prop('error'))]
48
46
  ){
49
- $(function(){
50
- if(hasSwf && !options.preferFlash){
51
- loadSwf();
52
- webshims.ready('WINDOWLOAD '+swfType, function(){
53
- setTimeout(function(){
54
- if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
55
- options.preferFlash = true;
56
- document.removeEventListener('error', switchOptions, true);
57
- $('audio, video').each(function(){
58
- webshims.mediaelement.selectSource(this);
59
- });
60
- webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
61
- }
62
- }, 9);
63
- });
64
- } else{
65
- document.removeEventListener('error', switchOptions, true);
47
+ if(error == null){
48
+ webshims.warn("There was an unspecified error on a mediaelement");
49
+ return;
50
+
66
51
  }
67
- });
68
- }
69
- };
70
- document.addEventListener('error', switchOptions, true);
71
- $('audio, video').each(function(){
72
- var error = $.prop(this, 'error');
73
- if(error && !noSwitch[error]){
74
- switchOptions({target: this});
75
- return false;
76
- }
77
- });
52
+ $(function(){
53
+ if(hasSwf && !options.preferFlash){
54
+ loadSwf();
55
+ webshims.ready('WINDOWLOAD '+swfType, function(){
56
+ setTimeout(function(){
57
+ if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
58
+ options.preferFlash = true;
59
+ document.removeEventListener('error', switchOptions, true);
60
+ $('audio, video').each(function(){
61
+ webshims.mediaelement.selectSource(this);
62
+ });
63
+ webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
64
+ }
65
+ }, 9);
66
+ });
67
+ } else{
68
+ document.removeEventListener('error', switchOptions, true);
69
+ }
70
+ });
71
+ }
72
+ };
73
+ document.addEventListener('error', switchOptions, true);
74
+ $('audio, video').each(function(){
75
+ var error = $.prop(this, 'error');
76
+ if(error && !noSwitch[error]){
77
+ switchOptions({target: this});
78
+ return false;
79
+ }
80
+ });
81
+ }
78
82
  }
79
83
 
80
-
81
84
  if(Modernizr.track && !bugs.track){
82
85
  (function(){
83
86
 
@@ -458,63 +461,14 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
458
461
 
459
462
  });
460
463
 
461
- webshims.ready('dom-support', function(){
462
- if(!supportsLoop){
463
- webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
464
- }
465
-
466
- ['audio', 'video'].forEach(function(nodeName){
467
- var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
468
- prop: {
469
- value: function(){
470
- var data = webshims.data(this, 'mediaelement');
471
- selectSource(this, data);
472
- if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
473
- supLoad.prop._supvalue.apply(this, arguments);
474
- }
475
- }
476
- }
477
- });
478
- nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
479
- prop: {
480
- value: function(type){
481
- var ret = '';
482
- if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
483
- ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
484
- if(ret == 'no'){
485
- ret = '';
486
- }
487
- }
488
- if(!ret && hasSwf){
489
- type = $.trim((type || '').split(';')[0]);
490
- if(mediaelement.swfMimeTypes.indexOf(type) != -1){
491
- ret = 'maybe';
492
- }
493
- }
494
- return ret;
495
- }
496
- }
497
- });
498
- });
499
- webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
500
- set: function(){
501
- var elem = this;
502
- var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
503
- clearTimeout(baseData.loadTimer);
504
- baseData.loadTimer = setTimeout(function(){
505
- selectSource(elem);
506
- elem = null;
507
- }, 9);
508
- }
509
- });
510
- });
511
-
464
+ var handleMedia = false;
512
465
  var initMediaElements = function(){
513
466
  var testFixMedia = function(){
514
467
  if(webshims.implement(this, 'mediaelement')){
515
468
  selectSource(this);
516
469
 
517
- if(hasNative){
470
+ //fixes for FF 12 and IE9/10 || does not hurt, if run in other browsers
471
+ if(hasNative && (!supportsLoop || ('ActiveXObject' in window))){
518
472
  var bufferTimer;
519
473
  var lastBuffered;
520
474
  var elem = this;
@@ -543,7 +497,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
543
497
  lastBuffered = getBufferedString();
544
498
  }
545
499
  clearTimeout(bufferTimer);
546
- bufferTimer = setTimeout(testBuffer, 999);
500
+ bufferTimer = setTimeout(testBuffer, 400);
547
501
  },
548
502
  'emptied stalled mediaerror abort suspend': function(e){
549
503
  if(e.type == 'emptied'){
@@ -560,11 +514,62 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
560
514
  }
561
515
 
562
516
  };
563
- var handleMedia = false;
517
+
564
518
 
565
519
 
566
520
  webshims.ready('dom-support', function(){
567
521
  handleMedia = true;
522
+
523
+ if(!supportsLoop){
524
+ webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
525
+ }
526
+
527
+ ['audio', 'video'].forEach(function(nodeName){
528
+ var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
529
+ prop: {
530
+ value: function(){
531
+ var data = webshims.data(this, 'mediaelement');
532
+ selectSource(this, data);
533
+ if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
534
+ supLoad.prop._supvalue.apply(this, arguments);
535
+ }
536
+ }
537
+ }
538
+ });
539
+ nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
540
+ prop: {
541
+ value: function(type){
542
+ var ret = '';
543
+ if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
544
+ ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
545
+ if(ret == 'no'){
546
+ ret = '';
547
+ }
548
+ }
549
+ if(!ret && hasSwf){
550
+ type = $.trim((type || '').split(';')[0]);
551
+ if(mediaelement.swfMimeTypes.indexOf(type) != -1){
552
+ ret = 'maybe';
553
+ }
554
+ }
555
+ return ret;
556
+ }
557
+ }
558
+ });
559
+ });
560
+ webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
561
+ set: function(){
562
+ var elem = this;
563
+ var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
564
+ clearTimeout(baseData.loadTimer);
565
+ baseData.loadTimer = setTimeout(function(){
566
+ selectSource(elem);
567
+ elem = null;
568
+ }, 9);
569
+ }
570
+ });
571
+
572
+
568
573
  webshims.addReady(function(context, insertedElement){
569
574
  var media = $('video, audio', context)
570
575
  .add(insertedElement.filter('video, audio'))
@@ -6,6 +6,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
6
6
  var hasNative = Modernizr.audio && Modernizr.video;
7
7
  var hasFlash = swfmini.hasFlashPlayerVersion('9.0.115');
8
8
  var loadedSwf = 0;
9
+ var needsLoadPreload = 'ActiveXObject' in window && hasNative;
9
10
  var getProps = {
10
11
  paused: true,
11
12
  ended: false,
@@ -119,12 +120,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
119
120
  data.readyState = readyState;
120
121
  };
121
122
 
122
- $.extend($.event.customEvent, {
123
- updatemediaelementdimensions: true,
124
- flashblocker: true,
125
- swfstageresize: true,
126
- mediaelementapichange: true
127
- });
123
+
128
124
 
129
125
  mediaelement.jarisEvent = {};
130
126
  var localConnectionTimer;
@@ -373,8 +369,13 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
373
369
  var isNativeHTML5 = ( event.originalEvent && event.originalEvent.type === event.type );
374
370
  if( isNativeHTML5 == (data.activating == 'third') ){
375
371
  event.stopImmediatePropagation();
376
- if(stopEvents[event.type] && data.isActive != data.activating){
377
- $(event.target).pause();
372
+
373
+ if(stopEvents[event.type]){
374
+ if(data.isActive != data.activating){
375
+ $(event.target).pause();
376
+ } else if(isNativeHTML5){
377
+ ($.prop(event.target, 'pause')._supvalue || $.noop).apply(event.target);
378
+ }
378
379
  }
379
380
  }
380
381
  };
@@ -438,15 +439,18 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
438
439
  })();
439
440
 
440
441
  var setElementDimension = function(data, hasControls){
442
+ var cAttr;
441
443
  var elem = data._elem;
442
444
  var box = data.shadowElem;
445
+
443
446
  $(elem)[hasControls ? 'addClass' : 'removeClass']('webshims-controls');
444
447
  if(data._elemNodeName == 'audio' && !hasControls){
445
448
  box.css({width: 0, height: 0});
446
449
  } else {
450
+
447
451
  box.css({
448
- width: elem.style.width || $(elem).width(),
449
- height: elem.style.height || $(elem).height()
452
+ width: elem.style.width || ((cAttr = $(elem).attr('width')) && cAttr+'px') || $(elem).width(),
453
+ height: elem.style.height|| ((cAttr = $(elem).attr('height')) && cAttr+'px') || $(elem).height()
450
454
  });
451
455
  }
452
456
  };
@@ -475,7 +479,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
475
479
  replaceVar = function(val){
476
480
  return (val.replace) ? val.replace(regs.A, '%26').replace(regs.a, '%26').replace(regs.e, '%3D').replace(regs.q, '%3F') : val;
477
481
  };
478
-
482
+
479
483
  mediaelement.createSWF = function( elem, canPlaySrc, data ){
480
484
  if(!hasFlash){
481
485
  setTimeout(function(){
@@ -483,7 +487,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
483
487
  }, 1);
484
488
  return;
485
489
  }
486
-
490
+
487
491
  if(loadedSwf < 1){
488
492
  loadedSwf = 1;
489
493
  } else {
@@ -494,7 +498,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
494
498
  }
495
499
 
496
500
  if($.attr(elem, 'height') || $.attr(elem, 'width')){
497
- webshims.warn("width or height content attributes used. Webshims only uses CSS (computed styles or inline styles) to detect size of a video/audio");
501
+ webshims.warn("width or height content attributes used. Webshims prefers the usage of CSS (computed styles or inline styles) to detect size of a video/audio. It's really more powerfull.");
498
502
  }
499
503
 
500
504
  var isRtmp = canPlaySrc.type == 'audio/rtmp' || canPlaySrc.type == 'video/rtmp';
@@ -591,6 +595,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
591
595
  }
592
596
  }
593
597
  }));
598
+
594
599
  setElementDimension(data, hasControls);
595
600
 
596
601
  box.insertBefore(elem);
@@ -600,16 +605,31 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
600
605
  }
601
606
 
602
607
  webshims.addShadowDom(elem, box);
608
+ if(!webshims.data(elem, 'mediaelement')){
609
+ webshims.data(elem, 'mediaelement', data);
610
+ }
603
611
  addMediaToStopEvents(elem);
612
+
604
613
  mediaelement.setActive(elem, 'third', data);
614
+
605
615
  $(elem)
606
616
  .on({'updatemediaelementdimensions': setDimension})
607
617
  .onWSOff('updateshadowdom', setDimension)
618
+ .on('remove', function(e){
619
+ if(!e.originalEvent && mediaelement.jarisEvent[data.id] && mediaelement.jarisEvent[data.id].elem == elem){
620
+ delete mediaelement.jarisEvent[data.id];
621
+ clearTimeout(localConnectionTimer);
622
+ clearTimeout(data.flashBlock);
623
+ }
624
+ box.remove();
625
+ })
608
626
  ;
609
627
  }
610
628
 
611
- if(!mediaelement.jarisEvent[data.id]){
629
+
630
+ if(!mediaelement.jarisEvent[data.id] || mediaelement.jarisEvent[data.id].elem != elem){
612
631
  mediaelement.jarisEvent[data.id] = function(jaris){
632
+
613
633
  if(jaris.type == 'ready'){
614
634
  var onReady = function(){
615
635
  if(data.api){
@@ -642,8 +662,8 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
642
662
  }
643
663
  data.duration = jaris.duration;
644
664
  }
645
-
646
665
  };
666
+ mediaelement.jarisEvent[data.id].elem = elem;
647
667
  }
648
668
 
649
669
  $.extend(vars,
@@ -669,27 +689,27 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
669
689
  clearTimeout(data.flashBlock);
670
690
 
671
691
  swfmini.embedSWF(playerSwfPath, elemId, "100%", "100%", "9.0.115", false, vars, params, attrs, function(swfData){
672
-
673
692
  if(swfData.success){
674
-
675
- data.api = swfData.ref;
676
-
677
- if(!hasControls){
678
- $(swfData.ref).attr('tabindex', '-1').css('outline', 'none');
679
- }
680
-
681
- data.flashBlock = setTimeout(function(){
693
+ var fBlocker = function(){
682
694
  if((!swfData.ref.parentNode && box[0].parentNode) || swfData.ref.style.display == "none"){
683
695
  box.addClass('flashblocker-assumed');
684
696
  $(elem).trigger('flashblocker');
685
697
  webshims.warn("flashblocker assumed");
686
698
  }
687
699
  $(swfData.ref).css({'minHeight': '2px', 'minWidth': '2px', display: 'block'});
688
- }, 9);
700
+ };
701
+ data.api = swfData.ref;
702
+
703
+ if(!hasControls){
704
+ $(swfData.ref).attr('tabindex', '-1').css('outline', 'none');
705
+ }
706
+
707
+ data.flashBlock = setTimeout(fBlocker, 99);
689
708
 
690
709
  if(!localConnectionTimer){
691
710
  clearTimeout(localConnectionTimer);
692
711
  localConnectionTimer = setTimeout(function(){
712
+ fBlocker();
693
713
  var flash = $(swfData.ref);
694
714
  if(flash[0].offsetWidth > 1 && flash[0].offsetHeight > 1 && location.protocol.indexOf('file:') === 0){
695
715
  webshims.error("Add your local development-directory to the local-trusted security sandbox: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html");
@@ -843,12 +863,23 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
843
863
  }
844
864
  });
845
865
 
866
+
846
867
  webshims.onNodeNamesPropertyModify(nodeName, 'preload', function(val){
847
- var data = getSwfDataFromElem(this);
868
+ var data, baseData, elem;
848
869
 
849
870
 
850
- if(data && bufferSrc(this)){
851
- queueSwfMethod(this, 'api_preload', [], data);
871
+ if(bufferSrc(this)){
872
+ data = getSwfDataFromElem(this);
873
+ if(data){
874
+ queueSwfMethod(this, 'api_preload', [], data);
875
+ } else if(needsLoadPreload && this.paused && !this.error && !$.data(this, 'mediaerror') && !this.readyState && !this.networkState && !this.autoplay && $(this).is(':not(.nonnative-api-active)')){
876
+ elem = this;
877
+ baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
878
+ clearTimeout(baseData.loadTimer);
879
+ baseData.loadTimer = setTimeout(function(){
880
+ $(elem).mediaLoad();
881
+ }, 9);
882
+ }
852
883
  }
853
884
  });
854
885