webshims-rails 1.10.6 → 1.10.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +8 -8
  2. data/lib/webshims-rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/webshims/polyfiller.js +14 -7
  4. data/vendor/assets/javascripts/webshims/shims/color-picker.js +1 -0
  5. data/vendor/assets/javascripts/webshims/shims/combos/1.js +153 -155
  6. data/vendor/assets/javascripts/webshims/shims/combos/10.js +168 -136
  7. data/vendor/assets/javascripts/webshims/shims/combos/11.js +116 -44
  8. data/vendor/assets/javascripts/webshims/shims/combos/12.js +100 -95
  9. data/vendor/assets/javascripts/webshims/shims/combos/13.js +100 -95
  10. data/vendor/assets/javascripts/webshims/shims/combos/14.js +51 -91
  11. data/vendor/assets/javascripts/webshims/shims/combos/15.js +129 -232
  12. data/vendor/assets/javascripts/webshims/shims/combos/16.js +228 -326
  13. data/vendor/assets/javascripts/webshims/shims/combos/17.js +116 -44
  14. data/vendor/assets/javascripts/webshims/shims/combos/18.js +116 -44
  15. data/vendor/assets/javascripts/webshims/shims/combos/19.js +210 -214
  16. data/vendor/assets/javascripts/webshims/shims/combos/2.js +204 -246
  17. data/vendor/assets/javascripts/webshims/shims/combos/20.js +210 -214
  18. data/vendor/assets/javascripts/webshims/shims/combos/21.js +59 -28
  19. data/vendor/assets/javascripts/webshims/shims/combos/23.js +100 -95
  20. data/vendor/assets/javascripts/webshims/shims/combos/24.js +2 -2
  21. data/vendor/assets/javascripts/webshims/shims/combos/25.js +210 -214
  22. data/vendor/assets/javascripts/webshims/shims/combos/26.js +51 -91
  23. data/vendor/assets/javascripts/webshims/shims/combos/28.js +110 -119
  24. data/vendor/assets/javascripts/webshims/shims/combos/29.js +6 -0
  25. data/vendor/assets/javascripts/webshims/shims/combos/3.js +126 -156
  26. data/vendor/assets/javascripts/webshims/shims/combos/30.js +126 -155
  27. data/vendor/assets/javascripts/webshims/shims/combos/31.js +104 -151
  28. data/vendor/assets/javascripts/webshims/shims/combos/4.js +73 -96
  29. data/vendor/assets/javascripts/webshims/shims/combos/5.js +116 -44
  30. data/vendor/assets/javascripts/webshims/shims/combos/6.js +116 -44
  31. data/vendor/assets/javascripts/webshims/shims/combos/7.js +226 -250
  32. data/vendor/assets/javascripts/webshims/shims/combos/8.js +226 -250
  33. data/vendor/assets/javascripts/webshims/shims/combos/9.js +168 -136
  34. data/vendor/assets/javascripts/webshims/shims/dom-extend.js +51 -91
  35. data/vendor/assets/javascripts/webshims/shims/form-core.js +53 -60
  36. data/vendor/assets/javascripts/webshims/shims/form-message.js +22 -5
  37. data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +87 -30
  38. data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +2 -76
  39. data/vendor/assets/javascripts/webshims/shims/form-validation.js +2 -2
  40. data/vendor/assets/javascripts/webshims/shims/forms-picker.js +1 -1
  41. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-fr.js +18 -8
  42. data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +100 -95
  43. data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +59 -28
  44. data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +9 -2
  45. data/vendor/assets/javascripts/webshims/shims/range-ui.js +29 -14
  46. data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +21 -7
  47. data/vendor/assets/javascripts/webshims/shims/styles/shim.css +30 -15
  48. data/vendor/assets/javascripts/webshims/shims/track-ui.js +6 -0
  49. metadata +2 -2
@@ -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,
@@ -2850,52 +2810,55 @@ webshims.register('filereader', function( $, webshims ){
2850
2810
  });
2851
2811
  webshims.loader.loadList(['mediaelement-native-fix']);
2852
2812
  }
2853
- }
2854
-
2855
- if(hasNative && !options.preferFlash){
2856
- var noSwitch = {
2857
- 1: 1,
2858
- 2: 1
2859
- };
2860
- var switchOptions = function(e){
2861
- var media;
2862
- var parent;
2863
- if(!options.preferFlash &&
2813
+
2814
+ if(!options.preferFlash){
2815
+ var noSwitch = {
2816
+ 1: 1,
2817
+ 2: 1
2818
+ };
2819
+ var switchOptions = function(e){
2820
+ var media, error, parent;
2821
+ if(!options.preferFlash &&
2864
2822
  ($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source:last', parent)[0] == e.target)) &&
2865
- (media = $(e.target).closest('audio, video')) && !noSwitch[media.prop('error')]
2823
+ (media = $(e.target).closest('audio, video')) && !noSwitch[(error = media.prop('error'))]
2866
2824
  ){
2867
- $(function(){
2868
- if(hasSwf && !options.preferFlash){
2869
- loadSwf();
2870
- webshims.ready('WINDOWLOAD '+swfType, function(){
2871
- setTimeout(function(){
2872
- if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
2873
- options.preferFlash = true;
2874
- document.removeEventListener('error', switchOptions, true);
2875
- $('audio, video').each(function(){
2876
- webshims.mediaelement.selectSource(this);
2877
- });
2878
- webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
2879
- }
2880
- }, 9);
2881
- });
2882
- } else{
2883
- document.removeEventListener('error', switchOptions, true);
2825
+ if(error == null){
2826
+ webshims.warn("There was an unspecified error on a mediaelement");
2827
+ return;
2828
+
2884
2829
  }
2885
- });
2886
- }
2887
- };
2888
- document.addEventListener('error', switchOptions, true);
2889
- $('audio, video').each(function(){
2890
- var error = $.prop(this, 'error');
2891
- if(error && !noSwitch[error]){
2892
- switchOptions({target: this});
2893
- return false;
2894
- }
2895
- });
2830
+ $(function(){
2831
+ if(hasSwf && !options.preferFlash){
2832
+ loadSwf();
2833
+ webshims.ready('WINDOWLOAD '+swfType, function(){
2834
+ setTimeout(function(){
2835
+ if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
2836
+ options.preferFlash = true;
2837
+ document.removeEventListener('error', switchOptions, true);
2838
+ $('audio, video').each(function(){
2839
+ webshims.mediaelement.selectSource(this);
2840
+ });
2841
+ webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
2842
+ }
2843
+ }, 9);
2844
+ });
2845
+ } else{
2846
+ document.removeEventListener('error', switchOptions, true);
2847
+ }
2848
+ });
2849
+ }
2850
+ };
2851
+ document.addEventListener('error', switchOptions, true);
2852
+ $('audio, video').each(function(){
2853
+ var error = $.prop(this, 'error');
2854
+ if(error && !noSwitch[error]){
2855
+ switchOptions({target: this});
2856
+ return false;
2857
+ }
2858
+ });
2859
+ }
2896
2860
  }
2897
2861
 
2898
-
2899
2862
  if(Modernizr.track && !bugs.track){
2900
2863
  (function(){
2901
2864
 
@@ -3276,63 +3239,14 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
3276
3239
 
3277
3240
  });
3278
3241
 
3279
- webshims.ready('dom-support', function(){
3280
- if(!supportsLoop){
3281
- webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
3282
- }
3283
-
3284
- ['audio', 'video'].forEach(function(nodeName){
3285
- var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
3286
- prop: {
3287
- value: function(){
3288
- var data = webshims.data(this, 'mediaelement');
3289
- selectSource(this, data);
3290
- if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
3291
- supLoad.prop._supvalue.apply(this, arguments);
3292
- }
3293
- }
3294
- }
3295
- });
3296
- nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
3297
- prop: {
3298
- value: function(type){
3299
- var ret = '';
3300
- if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
3301
- ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
3302
- if(ret == 'no'){
3303
- ret = '';
3304
- }
3305
- }
3306
- if(!ret && hasSwf){
3307
- type = $.trim((type || '').split(';')[0]);
3308
- if(mediaelement.swfMimeTypes.indexOf(type) != -1){
3309
- ret = 'maybe';
3310
- }
3311
- }
3312
- return ret;
3313
- }
3314
- }
3315
- });
3316
- });
3317
- webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
3318
- set: function(){
3319
- var elem = this;
3320
- var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
3321
- clearTimeout(baseData.loadTimer);
3322
- baseData.loadTimer = setTimeout(function(){
3323
- selectSource(elem);
3324
- elem = null;
3325
- }, 9);
3326
- }
3327
- });
3328
- });
3329
-
3242
+ var handleMedia = false;
3330
3243
  var initMediaElements = function(){
3331
3244
  var testFixMedia = function(){
3332
3245
  if(webshims.implement(this, 'mediaelement')){
3333
3246
  selectSource(this);
3334
3247
 
3335
- if(hasNative){
3248
+ //fixes for FF 12 and IE9/10 || does not hurt, if run in other browsers
3249
+ if(hasNative && (!supportsLoop || ('ActiveXObject' in window))){
3336
3250
  var bufferTimer;
3337
3251
  var lastBuffered;
3338
3252
  var elem = this;
@@ -3361,7 +3275,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
3361
3275
  lastBuffered = getBufferedString();
3362
3276
  }
3363
3277
  clearTimeout(bufferTimer);
3364
- bufferTimer = setTimeout(testBuffer, 999);
3278
+ bufferTimer = setTimeout(testBuffer, 400);
3365
3279
  },
3366
3280
  'emptied stalled mediaerror abort suspend': function(e){
3367
3281
  if(e.type == 'emptied'){
@@ -3378,11 +3292,62 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
3378
3292
  }
3379
3293
 
3380
3294
  };
3381
- var handleMedia = false;
3295
+
3382
3296
 
3383
3297
 
3384
3298
  webshims.ready('dom-support', function(){
3385
3299
  handleMedia = true;
3300
+
3301
+ if(!supportsLoop){
3302
+ webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
3303
+ }
3304
+
3305
+ ['audio', 'video'].forEach(function(nodeName){
3306
+ var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
3307
+ prop: {
3308
+ value: function(){
3309
+ var data = webshims.data(this, 'mediaelement');
3310
+ selectSource(this, data);
3311
+ if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
3312
+ supLoad.prop._supvalue.apply(this, arguments);
3313
+ }
3314
+ }
3315
+ }
3316
+ });
3317
+ nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
3318
+ prop: {
3319
+ value: function(type){
3320
+ var ret = '';
3321
+ if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
3322
+ ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
3323
+ if(ret == 'no'){
3324
+ ret = '';
3325
+ }
3326
+ }
3327
+ if(!ret && hasSwf){
3328
+ type = $.trim((type || '').split(';')[0]);
3329
+ if(mediaelement.swfMimeTypes.indexOf(type) != -1){
3330
+ ret = 'maybe';
3331
+ }
3332
+ }
3333
+ return ret;
3334
+ }
3335
+ }
3336
+ });
3337
+ });
3338
+ webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
3339
+ set: function(){
3340
+ var elem = this;
3341
+ var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
3342
+ clearTimeout(baseData.loadTimer);
3343
+ baseData.loadTimer = setTimeout(function(){
3344
+ selectSource(elem);
3345
+ elem = null;
3346
+ }, 9);
3347
+ }
3348
+ });
3349
+
3350
+
3386
3351
  webshims.addReady(function(context, insertedElement){
3387
3352
  var media = $('video, audio', context)
3388
3353
  .add(insertedElement.filter('video, audio'))
@@ -3442,6 +3407,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3442
3407
  var hasNative = Modernizr.audio && Modernizr.video;
3443
3408
  var hasFlash = swfmini.hasFlashPlayerVersion('9.0.115');
3444
3409
  var loadedSwf = 0;
3410
+ var needsLoadPreload = 'ActiveXObject' in window && hasNative;
3445
3411
  var getProps = {
3446
3412
  paused: true,
3447
3413
  ended: false,
@@ -3555,12 +3521,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3555
3521
  data.readyState = readyState;
3556
3522
  };
3557
3523
 
3558
- $.extend($.event.customEvent, {
3559
- updatemediaelementdimensions: true,
3560
- flashblocker: true,
3561
- swfstageresize: true,
3562
- mediaelementapichange: true
3563
- });
3524
+
3564
3525
 
3565
3526
  mediaelement.jarisEvent = {};
3566
3527
  var localConnectionTimer;
@@ -3809,8 +3770,13 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3809
3770
  var isNativeHTML5 = ( event.originalEvent && event.originalEvent.type === event.type );
3810
3771
  if( isNativeHTML5 == (data.activating == 'third') ){
3811
3772
  event.stopImmediatePropagation();
3812
- if(stopEvents[event.type] && data.isActive != data.activating){
3813
- $(event.target).pause();
3773
+
3774
+ if(stopEvents[event.type]){
3775
+ if(data.isActive != data.activating){
3776
+ $(event.target).pause();
3777
+ } else if(isNativeHTML5){
3778
+ ($.prop(event.target, 'pause')._supvalue || $.noop).apply(event.target);
3779
+ }
3814
3780
  }
3815
3781
  }
3816
3782
  };
@@ -3874,15 +3840,18 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3874
3840
  })();
3875
3841
 
3876
3842
  var setElementDimension = function(data, hasControls){
3843
+ var cAttr;
3877
3844
  var elem = data._elem;
3878
3845
  var box = data.shadowElem;
3846
+
3879
3847
  $(elem)[hasControls ? 'addClass' : 'removeClass']('webshims-controls');
3880
3848
  if(data._elemNodeName == 'audio' && !hasControls){
3881
3849
  box.css({width: 0, height: 0});
3882
3850
  } else {
3851
+
3883
3852
  box.css({
3884
- width: elem.style.width || $(elem).width(),
3885
- height: elem.style.height || $(elem).height()
3853
+ width: elem.style.width || ((cAttr = $(elem).attr('width')) && cAttr+'px') || $(elem).width(),
3854
+ height: elem.style.height|| ((cAttr = $(elem).attr('height')) && cAttr+'px') || $(elem).height()
3886
3855
  });
3887
3856
  }
3888
3857
  };
@@ -3911,7 +3880,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3911
3880
  replaceVar = function(val){
3912
3881
  return (val.replace) ? val.replace(regs.A, '%26').replace(regs.a, '%26').replace(regs.e, '%3D').replace(regs.q, '%3F') : val;
3913
3882
  };
3914
-
3883
+
3915
3884
  mediaelement.createSWF = function( elem, canPlaySrc, data ){
3916
3885
  if(!hasFlash){
3917
3886
  setTimeout(function(){
@@ -3919,7 +3888,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3919
3888
  }, 1);
3920
3889
  return;
3921
3890
  }
3922
-
3891
+
3923
3892
  if(loadedSwf < 1){
3924
3893
  loadedSwf = 1;
3925
3894
  } else {
@@ -3930,7 +3899,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3930
3899
  }
3931
3900
 
3932
3901
  if($.attr(elem, 'height') || $.attr(elem, 'width')){
3933
- webshims.warn("width or height content attributes used. Webshims only uses CSS (computed styles or inline styles) to detect size of a video/audio");
3902
+ 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.");
3934
3903
  }
3935
3904
 
3936
3905
  var isRtmp = canPlaySrc.type == 'audio/rtmp' || canPlaySrc.type == 'video/rtmp';
@@ -4027,6 +3996,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
4027
3996
  }
4028
3997
  }
4029
3998
  }));
3999
+
4030
4000
  setElementDimension(data, hasControls);
4031
4001
 
4032
4002
  box.insertBefore(elem);
@@ -4036,16 +4006,31 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
4036
4006
  }
4037
4007
 
4038
4008
  webshims.addShadowDom(elem, box);
4009
+ if(!webshims.data(elem, 'mediaelement')){
4010
+ webshims.data(elem, 'mediaelement', data);
4011
+ }
4039
4012
  addMediaToStopEvents(elem);
4013
+
4040
4014
  mediaelement.setActive(elem, 'third', data);
4015
+
4041
4016
  $(elem)
4042
4017
  .on({'updatemediaelementdimensions': setDimension})
4043
4018
  .onWSOff('updateshadowdom', setDimension)
4019
+ .on('remove', function(e){
4020
+ if(!e.originalEvent && mediaelement.jarisEvent[data.id] && mediaelement.jarisEvent[data.id].elem == elem){
4021
+ delete mediaelement.jarisEvent[data.id];
4022
+ clearTimeout(localConnectionTimer);
4023
+ clearTimeout(data.flashBlock);
4024
+ }
4025
+ box.remove();
4026
+ })
4044
4027
  ;
4045
4028
  }
4046
4029
 
4047
- if(!mediaelement.jarisEvent[data.id]){
4030
+
4031
+ if(!mediaelement.jarisEvent[data.id] || mediaelement.jarisEvent[data.id].elem != elem){
4048
4032
  mediaelement.jarisEvent[data.id] = function(jaris){
4033
+
4049
4034
  if(jaris.type == 'ready'){
4050
4035
  var onReady = function(){
4051
4036
  if(data.api){
@@ -4078,8 +4063,8 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
4078
4063
  }
4079
4064
  data.duration = jaris.duration;
4080
4065
  }
4081
-
4082
4066
  };
4067
+ mediaelement.jarisEvent[data.id].elem = elem;
4083
4068
  }
4084
4069
 
4085
4070
  $.extend(vars,
@@ -4105,27 +4090,27 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
4105
4090
  clearTimeout(data.flashBlock);
4106
4091
 
4107
4092
  swfmini.embedSWF(playerSwfPath, elemId, "100%", "100%", "9.0.115", false, vars, params, attrs, function(swfData){
4108
-
4109
4093
  if(swfData.success){
4110
-
4111
- data.api = swfData.ref;
4112
-
4113
- if(!hasControls){
4114
- $(swfData.ref).attr('tabindex', '-1').css('outline', 'none');
4115
- }
4116
-
4117
- data.flashBlock = setTimeout(function(){
4094
+ var fBlocker = function(){
4118
4095
  if((!swfData.ref.parentNode && box[0].parentNode) || swfData.ref.style.display == "none"){
4119
4096
  box.addClass('flashblocker-assumed');
4120
4097
  $(elem).trigger('flashblocker');
4121
4098
  webshims.warn("flashblocker assumed");
4122
4099
  }
4123
4100
  $(swfData.ref).css({'minHeight': '2px', 'minWidth': '2px', display: 'block'});
4124
- }, 9);
4101
+ };
4102
+ data.api = swfData.ref;
4103
+
4104
+ if(!hasControls){
4105
+ $(swfData.ref).attr('tabindex', '-1').css('outline', 'none');
4106
+ }
4107
+
4108
+ data.flashBlock = setTimeout(fBlocker, 99);
4125
4109
 
4126
4110
  if(!localConnectionTimer){
4127
4111
  clearTimeout(localConnectionTimer);
4128
4112
  localConnectionTimer = setTimeout(function(){
4113
+ fBlocker();
4129
4114
  var flash = $(swfData.ref);
4130
4115
  if(flash[0].offsetWidth > 1 && flash[0].offsetHeight > 1 && location.protocol.indexOf('file:') === 0){
4131
4116
  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");
@@ -4279,12 +4264,23 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
4279
4264
  }
4280
4265
  });
4281
4266
 
4267
+
4282
4268
  webshims.onNodeNamesPropertyModify(nodeName, 'preload', function(val){
4283
- var data = getSwfDataFromElem(this);
4269
+ var data, baseData, elem;
4284
4270
 
4285
4271
 
4286
- if(data && bufferSrc(this)){
4287
- queueSwfMethod(this, 'api_preload', [], data);
4272
+ if(bufferSrc(this)){
4273
+ data = getSwfDataFromElem(this);
4274
+ if(data){
4275
+ queueSwfMethod(this, 'api_preload', [], data);
4276
+ } else if(needsLoadPreload && this.paused && !this.error && !$.data(this, 'mediaerror') && !this.readyState && !this.networkState && !this.autoplay && $(this).is(':not(.nonnative-api-active)')){
4277
+ elem = this;
4278
+ baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
4279
+ clearTimeout(baseData.loadTimer);
4280
+ baseData.loadTimer = setTimeout(function(){
4281
+ $(elem).mediaLoad();
4282
+ }, 9);
4283
+ }
4288
4284
  }
4289
4285
  });
4290
4286