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
@@ -1312,10 +1312,15 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1312
1312
  if(!$.parseHTML){
1313
1313
  webshims.error("Webshims needs jQuery 1.8+ to work properly. Please update your jQuery version or downgrade webshims.");
1314
1314
  }
1315
+
1316
+ if(webshims.cfg.extendNative == 1){
1317
+ 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");
1318
+ }
1319
+
1315
1320
  if (!webshims.cfg.no$Switch) {
1316
1321
  var switch$ = function(){
1317
1322
  if (window.jQuery && (!window.$ || window.jQuery == window.$) && !window.jQuery.webshims) {
1318
- webshims.error("jQuery was included more than once. Make sure to include it only once! Webshims and other Plugins might not work properly.");
1323
+ 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..");
1319
1324
  if (window.$) {
1320
1325
  window.$ = webshims.$;
1321
1326
  }
@@ -1333,7 +1338,10 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1333
1338
  };
1334
1339
  switch$();
1335
1340
  setTimeout(switch$, 90);
1341
+ webshims.ready('DOM', switch$);
1336
1342
  $(switch$);
1343
+ webshims.ready('WINDOWLOAD', switch$);
1344
+
1337
1345
  }
1338
1346
  // (function(){
1339
1347
  // var hostNames = {
@@ -1441,6 +1449,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1441
1449
  $(evtDel).off(evt, fn);
1442
1450
  }
1443
1451
  });
1452
+ return this;
1444
1453
  };
1445
1454
 
1446
1455
  var dataID = '_webshimsLib'+ (Math.round(Math.random() * 1000));
@@ -1475,57 +1484,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1475
1484
  };
1476
1485
  });
1477
1486
 
1478
- if($.Tween.propHooks._default && $.css){
1479
- (function(){
1480
- var isjQ8 = false;
1481
- try {
1482
- isjQ8 = $.css($('<b style="width: 10px" />')[0], 'width', '') == '10px';
1483
- } catch(er){
1484
- webshims.error(er);
1485
- }
1486
- var css = isjQ8 ?
1487
- function(elem, prop){
1488
- return $.css( elem, prop, false, "" );
1489
- } :
1490
- function(elem, prop){
1491
- return $.css( elem, prop, "" );
1492
- }
1493
- ;
1494
-
1495
- $.extend($.Tween.propHooks._default, {
1496
- get: function( tween ) {
1497
- var result;
1498
-
1499
- if ( (tween.elem[ tween.prop ] != null || havePolyfill[ tween.prop ]) &&
1500
- (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
1501
- return havePolyfill[ tween.prop ] ? $.prop(tween.elem, tween.prop) : tween.elem[ tween.prop ];
1502
- }
1503
-
1504
- // passing an empty string as a 3rd parameter to .css will automatically
1505
- // attempt a parseFloat and fallback to a string if the parse fails
1506
- // so, simple values such as "10px" are parsed to Float.
1507
- // complex values such as "rotate(1rad)" are returned as is.
1508
- result = css( tween.elem, tween.prop );
1509
- // Empty strings, null, undefined and "auto" are converted to 0.
1510
- return !result || result === "auto" ? 0 : result;
1511
- },
1512
- set: function( tween ) {
1513
- // use step hook for back compat - use cssHook if its there - use .style if its
1514
- // available and use plain properties where available
1515
- if ( jQuery.fx.step[ tween.prop ] ) {
1516
- jQuery.fx.step[ tween.prop ]( tween );
1517
- } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
1518
- jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
1519
- } else if( !havePolyfill[ tween.prop ] ) {
1520
- tween.elem[ tween.prop ] = tween.now;
1521
- } else {
1522
- $.prop(tween.elem, tween.prop, tween.now);
1523
- }
1524
- }
1525
- });
1526
- })();
1527
- }
1528
-
1529
1487
 
1530
1488
  ['removeAttr', 'prop', 'attr'].forEach(function(type){
1531
1489
  olds[type] = $[type];
@@ -1929,48 +1887,50 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1929
1887
  });
1930
1888
  };
1931
1889
  return function(nativeElem, shadowElem, opts){
1932
- opts = opts || {};
1933
- if(nativeElem.jquery){
1934
- nativeElem = nativeElem[0];
1935
- }
1936
- if(shadowElem.jquery){
1937
- shadowElem = shadowElem[0];
1938
- }
1939
- var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
1940
- var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
1941
- var shadowFocusElementData = {};
1942
- if(!opts.shadowFocusElement){
1943
- opts.shadowFocusElement = shadowElem;
1944
- } else if(opts.shadowFocusElement){
1945
- if(opts.shadowFocusElement.jquery){
1946
- opts.shadowFocusElement = opts.shadowFocusElement[0];
1890
+ if(nativeElem && shadowElem){
1891
+ opts = opts || {};
1892
+ if(nativeElem.jquery){
1893
+ nativeElem = nativeElem[0];
1947
1894
  }
1948
- shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
1949
- }
1950
-
1951
- $(nativeElem).on('remove', function(e){
1952
- if (!e.originalEvent) {
1953
- $(shadowElem).remove();
1895
+ if(shadowElem.jquery){
1896
+ shadowElem = shadowElem[0];
1954
1897
  }
1955
- });
1956
-
1957
- nativeData.hasShadow = shadowElem;
1958
- shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
1959
- shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
1960
- nativeElement: nativeElem,
1961
- shadowElement: shadowElem,
1962
- shadowFocusElement: opts.shadowFocusElement
1963
- };
1964
- if(opts.shadowChilds){
1965
- opts.shadowChilds.each(function(){
1966
- elementData(this, 'shadowData', shadowData.shadowData);
1898
+ var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
1899
+ var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
1900
+ var shadowFocusElementData = {};
1901
+ if(!opts.shadowFocusElement){
1902
+ opts.shadowFocusElement = shadowElem;
1903
+ } else if(opts.shadowFocusElement){
1904
+ if(opts.shadowFocusElement.jquery){
1905
+ opts.shadowFocusElement = opts.shadowFocusElement[0];
1906
+ }
1907
+ shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
1908
+ }
1909
+
1910
+ $(nativeElem).on('remove', function(e){
1911
+ if (!e.originalEvent) {
1912
+ $(shadowElem).remove();
1913
+ }
1967
1914
  });
1915
+
1916
+ nativeData.hasShadow = shadowElem;
1917
+ shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
1918
+ shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
1919
+ nativeElement: nativeElem,
1920
+ shadowElement: shadowElem,
1921
+ shadowFocusElement: opts.shadowFocusElement
1922
+ };
1923
+ if(opts.shadowChilds){
1924
+ opts.shadowChilds.each(function(){
1925
+ elementData(this, 'shadowData', shadowData.shadowData);
1926
+ });
1927
+ }
1928
+
1929
+ if(opts.data){
1930
+ shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
1931
+ }
1932
+ opts = null;
1968
1933
  }
1969
-
1970
- if(opts.data){
1971
- shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
1972
- }
1973
- opts = null;
1974
1934
  webshims.docObserve();
1975
1935
  };
1976
1936
  })(),
@@ -2254,7 +2214,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2254
2214
  // register: moduleName:string,
2255
2215
  // callback: callback:function
2256
2216
  // });
2257
- // get/set including removeLang
2217
+ // get/set including remoteLang
2258
2218
  // - webshims.activeLang({
2259
2219
  // module: moduleName:string,
2260
2220
  // callback: callback:function,
@@ -2463,52 +2423,55 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2463
2423
  });
2464
2424
  webshims.loader.loadList(['mediaelement-native-fix']);
2465
2425
  }
2466
- }
2467
-
2468
- if(hasNative && !options.preferFlash){
2469
- var noSwitch = {
2470
- 1: 1,
2471
- 2: 1
2472
- };
2473
- var switchOptions = function(e){
2474
- var media;
2475
- var parent;
2476
- if(!options.preferFlash &&
2426
+
2427
+ if(!options.preferFlash){
2428
+ var noSwitch = {
2429
+ 1: 1,
2430
+ 2: 1
2431
+ };
2432
+ var switchOptions = function(e){
2433
+ var media, error, parent;
2434
+ if(!options.preferFlash &&
2477
2435
  ($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source:last', parent)[0] == e.target)) &&
2478
- (media = $(e.target).closest('audio, video')) && !noSwitch[media.prop('error')]
2436
+ (media = $(e.target).closest('audio, video')) && !noSwitch[(error = media.prop('error'))]
2479
2437
  ){
2480
- $(function(){
2481
- if(hasSwf && !options.preferFlash){
2482
- loadSwf();
2483
- webshims.ready('WINDOWLOAD '+swfType, function(){
2484
- setTimeout(function(){
2485
- if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
2486
- options.preferFlash = true;
2487
- document.removeEventListener('error', switchOptions, true);
2488
- $('audio, video').each(function(){
2489
- webshims.mediaelement.selectSource(this);
2490
- });
2491
- webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
2492
- }
2493
- }, 9);
2494
- });
2495
- } else{
2496
- document.removeEventListener('error', switchOptions, true);
2438
+ if(error == null){
2439
+ webshims.warn("There was an unspecified error on a mediaelement");
2440
+ return;
2441
+
2497
2442
  }
2498
- });
2499
- }
2500
- };
2501
- document.addEventListener('error', switchOptions, true);
2502
- $('audio, video').each(function(){
2503
- var error = $.prop(this, 'error');
2504
- if(error && !noSwitch[error]){
2505
- switchOptions({target: this});
2506
- return false;
2507
- }
2508
- });
2443
+ $(function(){
2444
+ if(hasSwf && !options.preferFlash){
2445
+ loadSwf();
2446
+ webshims.ready('WINDOWLOAD '+swfType, function(){
2447
+ setTimeout(function(){
2448
+ if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
2449
+ options.preferFlash = true;
2450
+ document.removeEventListener('error', switchOptions, true);
2451
+ $('audio, video').each(function(){
2452
+ webshims.mediaelement.selectSource(this);
2453
+ });
2454
+ webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
2455
+ }
2456
+ }, 9);
2457
+ });
2458
+ } else{
2459
+ document.removeEventListener('error', switchOptions, true);
2460
+ }
2461
+ });
2462
+ }
2463
+ };
2464
+ document.addEventListener('error', switchOptions, true);
2465
+ $('audio, video').each(function(){
2466
+ var error = $.prop(this, 'error');
2467
+ if(error && !noSwitch[error]){
2468
+ switchOptions({target: this});
2469
+ return false;
2470
+ }
2471
+ });
2472
+ }
2509
2473
  }
2510
2474
 
2511
-
2512
2475
  if(Modernizr.track && !bugs.track){
2513
2476
  (function(){
2514
2477
 
@@ -2889,63 +2852,14 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
2889
2852
 
2890
2853
  });
2891
2854
 
2892
- webshims.ready('dom-support', function(){
2893
- if(!supportsLoop){
2894
- webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
2895
- }
2896
-
2897
- ['audio', 'video'].forEach(function(nodeName){
2898
- var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
2899
- prop: {
2900
- value: function(){
2901
- var data = webshims.data(this, 'mediaelement');
2902
- selectSource(this, data);
2903
- if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
2904
- supLoad.prop._supvalue.apply(this, arguments);
2905
- }
2906
- }
2907
- }
2908
- });
2909
- nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
2910
- prop: {
2911
- value: function(type){
2912
- var ret = '';
2913
- if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
2914
- ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
2915
- if(ret == 'no'){
2916
- ret = '';
2917
- }
2918
- }
2919
- if(!ret && hasSwf){
2920
- type = $.trim((type || '').split(';')[0]);
2921
- if(mediaelement.swfMimeTypes.indexOf(type) != -1){
2922
- ret = 'maybe';
2923
- }
2924
- }
2925
- return ret;
2926
- }
2927
- }
2928
- });
2929
- });
2930
- webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
2931
- set: function(){
2932
- var elem = this;
2933
- var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
2934
- clearTimeout(baseData.loadTimer);
2935
- baseData.loadTimer = setTimeout(function(){
2936
- selectSource(elem);
2937
- elem = null;
2938
- }, 9);
2939
- }
2940
- });
2941
- });
2942
-
2855
+ var handleMedia = false;
2943
2856
  var initMediaElements = function(){
2944
2857
  var testFixMedia = function(){
2945
2858
  if(webshims.implement(this, 'mediaelement')){
2946
2859
  selectSource(this);
2947
2860
 
2948
- if(hasNative){
2861
+ //fixes for FF 12 and IE9/10 || does not hurt, if run in other browsers
2862
+ if(hasNative && (!supportsLoop || ('ActiveXObject' in window))){
2949
2863
  var bufferTimer;
2950
2864
  var lastBuffered;
2951
2865
  var elem = this;
@@ -2974,7 +2888,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
2974
2888
  lastBuffered = getBufferedString();
2975
2889
  }
2976
2890
  clearTimeout(bufferTimer);
2977
- bufferTimer = setTimeout(testBuffer, 999);
2891
+ bufferTimer = setTimeout(testBuffer, 400);
2978
2892
  },
2979
2893
  'emptied stalled mediaerror abort suspend': function(e){
2980
2894
  if(e.type == 'emptied'){
@@ -2991,11 +2905,62 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
2991
2905
  }
2992
2906
 
2993
2907
  };
2994
- var handleMedia = false;
2908
+
2995
2909
 
2996
2910
 
2997
2911
  webshims.ready('dom-support', function(){
2998
2912
  handleMedia = true;
2913
+
2914
+ if(!supportsLoop){
2915
+ webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
2916
+ }
2917
+
2918
+ ['audio', 'video'].forEach(function(nodeName){
2919
+ var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
2920
+ prop: {
2921
+ value: function(){
2922
+ var data = webshims.data(this, 'mediaelement');
2923
+ selectSource(this, data);
2924
+ if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
2925
+ supLoad.prop._supvalue.apply(this, arguments);
2926
+ }
2927
+ }
2928
+ }
2929
+ });
2930
+ nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
2931
+ prop: {
2932
+ value: function(type){
2933
+ var ret = '';
2934
+ if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
2935
+ ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
2936
+ if(ret == 'no'){
2937
+ ret = '';
2938
+ }
2939
+ }
2940
+ if(!ret && hasSwf){
2941
+ type = $.trim((type || '').split(';')[0]);
2942
+ if(mediaelement.swfMimeTypes.indexOf(type) != -1){
2943
+ ret = 'maybe';
2944
+ }
2945
+ }
2946
+ return ret;
2947
+ }
2948
+ }
2949
+ });
2950
+ });
2951
+ webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
2952
+ set: function(){
2953
+ var elem = this;
2954
+ var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
2955
+ clearTimeout(baseData.loadTimer);
2956
+ baseData.loadTimer = setTimeout(function(){
2957
+ selectSource(elem);
2958
+ elem = null;
2959
+ }, 9);
2960
+ }
2961
+ });
2962
+
2963
+
2999
2964
  webshims.addReady(function(context, insertedElement){
3000
2965
  var media = $('video, audio', context)
3001
2966
  .add(insertedElement.filter('video, audio'))
@@ -3055,6 +3020,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3055
3020
  var hasNative = Modernizr.audio && Modernizr.video;
3056
3021
  var hasFlash = swfmini.hasFlashPlayerVersion('9.0.115');
3057
3022
  var loadedSwf = 0;
3023
+ var needsLoadPreload = 'ActiveXObject' in window && hasNative;
3058
3024
  var getProps = {
3059
3025
  paused: true,
3060
3026
  ended: false,
@@ -3168,12 +3134,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3168
3134
  data.readyState = readyState;
3169
3135
  };
3170
3136
 
3171
- $.extend($.event.customEvent, {
3172
- updatemediaelementdimensions: true,
3173
- flashblocker: true,
3174
- swfstageresize: true,
3175
- mediaelementapichange: true
3176
- });
3137
+
3177
3138
 
3178
3139
  mediaelement.jarisEvent = {};
3179
3140
  var localConnectionTimer;
@@ -3422,8 +3383,13 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3422
3383
  var isNativeHTML5 = ( event.originalEvent && event.originalEvent.type === event.type );
3423
3384
  if( isNativeHTML5 == (data.activating == 'third') ){
3424
3385
  event.stopImmediatePropagation();
3425
- if(stopEvents[event.type] && data.isActive != data.activating){
3426
- $(event.target).pause();
3386
+
3387
+ if(stopEvents[event.type]){
3388
+ if(data.isActive != data.activating){
3389
+ $(event.target).pause();
3390
+ } else if(isNativeHTML5){
3391
+ ($.prop(event.target, 'pause')._supvalue || $.noop).apply(event.target);
3392
+ }
3427
3393
  }
3428
3394
  }
3429
3395
  };
@@ -3487,15 +3453,18 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3487
3453
  })();
3488
3454
 
3489
3455
  var setElementDimension = function(data, hasControls){
3456
+ var cAttr;
3490
3457
  var elem = data._elem;
3491
3458
  var box = data.shadowElem;
3459
+
3492
3460
  $(elem)[hasControls ? 'addClass' : 'removeClass']('webshims-controls');
3493
3461
  if(data._elemNodeName == 'audio' && !hasControls){
3494
3462
  box.css({width: 0, height: 0});
3495
3463
  } else {
3464
+
3496
3465
  box.css({
3497
- width: elem.style.width || $(elem).width(),
3498
- height: elem.style.height || $(elem).height()
3466
+ width: elem.style.width || ((cAttr = $(elem).attr('width')) && cAttr+'px') || $(elem).width(),
3467
+ height: elem.style.height|| ((cAttr = $(elem).attr('height')) && cAttr+'px') || $(elem).height()
3499
3468
  });
3500
3469
  }
3501
3470
  };
@@ -3524,7 +3493,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3524
3493
  replaceVar = function(val){
3525
3494
  return (val.replace) ? val.replace(regs.A, '%26').replace(regs.a, '%26').replace(regs.e, '%3D').replace(regs.q, '%3F') : val;
3526
3495
  };
3527
-
3496
+
3528
3497
  mediaelement.createSWF = function( elem, canPlaySrc, data ){
3529
3498
  if(!hasFlash){
3530
3499
  setTimeout(function(){
@@ -3532,7 +3501,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3532
3501
  }, 1);
3533
3502
  return;
3534
3503
  }
3535
-
3504
+
3536
3505
  if(loadedSwf < 1){
3537
3506
  loadedSwf = 1;
3538
3507
  } else {
@@ -3543,7 +3512,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3543
3512
  }
3544
3513
 
3545
3514
  if($.attr(elem, 'height') || $.attr(elem, 'width')){
3546
- webshims.warn("width or height content attributes used. Webshims only uses CSS (computed styles or inline styles) to detect size of a video/audio");
3515
+ 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.");
3547
3516
  }
3548
3517
 
3549
3518
  var isRtmp = canPlaySrc.type == 'audio/rtmp' || canPlaySrc.type == 'video/rtmp';
@@ -3640,6 +3609,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3640
3609
  }
3641
3610
  }
3642
3611
  }));
3612
+
3643
3613
  setElementDimension(data, hasControls);
3644
3614
 
3645
3615
  box.insertBefore(elem);
@@ -3649,16 +3619,31 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3649
3619
  }
3650
3620
 
3651
3621
  webshims.addShadowDom(elem, box);
3622
+ if(!webshims.data(elem, 'mediaelement')){
3623
+ webshims.data(elem, 'mediaelement', data);
3624
+ }
3652
3625
  addMediaToStopEvents(elem);
3626
+
3653
3627
  mediaelement.setActive(elem, 'third', data);
3628
+
3654
3629
  $(elem)
3655
3630
  .on({'updatemediaelementdimensions': setDimension})
3656
3631
  .onWSOff('updateshadowdom', setDimension)
3632
+ .on('remove', function(e){
3633
+ if(!e.originalEvent && mediaelement.jarisEvent[data.id] && mediaelement.jarisEvent[data.id].elem == elem){
3634
+ delete mediaelement.jarisEvent[data.id];
3635
+ clearTimeout(localConnectionTimer);
3636
+ clearTimeout(data.flashBlock);
3637
+ }
3638
+ box.remove();
3639
+ })
3657
3640
  ;
3658
3641
  }
3659
3642
 
3660
- if(!mediaelement.jarisEvent[data.id]){
3643
+
3644
+ if(!mediaelement.jarisEvent[data.id] || mediaelement.jarisEvent[data.id].elem != elem){
3661
3645
  mediaelement.jarisEvent[data.id] = function(jaris){
3646
+
3662
3647
  if(jaris.type == 'ready'){
3663
3648
  var onReady = function(){
3664
3649
  if(data.api){
@@ -3691,8 +3676,8 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3691
3676
  }
3692
3677
  data.duration = jaris.duration;
3693
3678
  }
3694
-
3695
3679
  };
3680
+ mediaelement.jarisEvent[data.id].elem = elem;
3696
3681
  }
3697
3682
 
3698
3683
  $.extend(vars,
@@ -3718,27 +3703,27 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3718
3703
  clearTimeout(data.flashBlock);
3719
3704
 
3720
3705
  swfmini.embedSWF(playerSwfPath, elemId, "100%", "100%", "9.0.115", false, vars, params, attrs, function(swfData){
3721
-
3722
3706
  if(swfData.success){
3723
-
3724
- data.api = swfData.ref;
3725
-
3726
- if(!hasControls){
3727
- $(swfData.ref).attr('tabindex', '-1').css('outline', 'none');
3728
- }
3729
-
3730
- data.flashBlock = setTimeout(function(){
3707
+ var fBlocker = function(){
3731
3708
  if((!swfData.ref.parentNode && box[0].parentNode) || swfData.ref.style.display == "none"){
3732
3709
  box.addClass('flashblocker-assumed');
3733
3710
  $(elem).trigger('flashblocker');
3734
3711
  webshims.warn("flashblocker assumed");
3735
3712
  }
3736
3713
  $(swfData.ref).css({'minHeight': '2px', 'minWidth': '2px', display: 'block'});
3737
- }, 9);
3714
+ };
3715
+ data.api = swfData.ref;
3716
+
3717
+ if(!hasControls){
3718
+ $(swfData.ref).attr('tabindex', '-1').css('outline', 'none');
3719
+ }
3720
+
3721
+ data.flashBlock = setTimeout(fBlocker, 99);
3738
3722
 
3739
3723
  if(!localConnectionTimer){
3740
3724
  clearTimeout(localConnectionTimer);
3741
3725
  localConnectionTimer = setTimeout(function(){
3726
+ fBlocker();
3742
3727
  var flash = $(swfData.ref);
3743
3728
  if(flash[0].offsetWidth > 1 && flash[0].offsetHeight > 1 && location.protocol.indexOf('file:') === 0){
3744
3729
  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");
@@ -3892,12 +3877,23 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3892
3877
  }
3893
3878
  });
3894
3879
 
3880
+
3895
3881
  webshims.onNodeNamesPropertyModify(nodeName, 'preload', function(val){
3896
- var data = getSwfDataFromElem(this);
3882
+ var data, baseData, elem;
3897
3883
 
3898
3884
 
3899
- if(data && bufferSrc(this)){
3900
- queueSwfMethod(this, 'api_preload', [], data);
3885
+ if(bufferSrc(this)){
3886
+ data = getSwfDataFromElem(this);
3887
+ if(data){
3888
+ queueSwfMethod(this, 'api_preload', [], data);
3889
+ } else if(needsLoadPreload && this.paused && !this.error && !$.data(this, 'mediaerror') && !this.readyState && !this.networkState && !this.autoplay && $(this).is(':not(.nonnative-api-active)')){
3890
+ elem = this;
3891
+ baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
3892
+ clearTimeout(baseData.loadTimer);
3893
+ baseData.loadTimer = setTimeout(function(){
3894
+ $(elem).mediaLoad();
3895
+ }, 9);
3896
+ }
3901
3897
  }
3902
3898
  });
3903
3899