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
@@ -814,10 +814,15 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
814
814
  if(!$.parseHTML){
815
815
  webshims.error("Webshims needs jQuery 1.8+ to work properly. Please update your jQuery version or downgrade webshims.");
816
816
  }
817
+
818
+ if(webshims.cfg.extendNative == 1){
819
+ 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");
820
+ }
821
+
817
822
  if (!webshims.cfg.no$Switch) {
818
823
  var switch$ = function(){
819
824
  if (window.jQuery && (!window.$ || window.jQuery == window.$) && !window.jQuery.webshims) {
820
- webshims.error("jQuery was included more than once. Make sure to include it only once! Webshims and other Plugins might not work properly.");
825
+ 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..");
821
826
  if (window.$) {
822
827
  window.$ = webshims.$;
823
828
  }
@@ -835,7 +840,10 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
835
840
  };
836
841
  switch$();
837
842
  setTimeout(switch$, 90);
843
+ webshims.ready('DOM', switch$);
838
844
  $(switch$);
845
+ webshims.ready('WINDOWLOAD', switch$);
846
+
839
847
  }
840
848
  // (function(){
841
849
  // var hostNames = {
@@ -943,6 +951,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
943
951
  $(evtDel).off(evt, fn);
944
952
  }
945
953
  });
954
+ return this;
946
955
  };
947
956
 
948
957
  var dataID = '_webshimsLib'+ (Math.round(Math.random() * 1000));
@@ -977,57 +986,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
977
986
  };
978
987
  });
979
988
 
980
- if($.Tween.propHooks._default && $.css){
981
- (function(){
982
- var isjQ8 = false;
983
- try {
984
- isjQ8 = $.css($('<b style="width: 10px" />')[0], 'width', '') == '10px';
985
- } catch(er){
986
- webshims.error(er);
987
- }
988
- var css = isjQ8 ?
989
- function(elem, prop){
990
- return $.css( elem, prop, false, "" );
991
- } :
992
- function(elem, prop){
993
- return $.css( elem, prop, "" );
994
- }
995
- ;
996
-
997
- $.extend($.Tween.propHooks._default, {
998
- get: function( tween ) {
999
- var result;
1000
-
1001
- if ( (tween.elem[ tween.prop ] != null || havePolyfill[ tween.prop ]) &&
1002
- (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
1003
- return havePolyfill[ tween.prop ] ? $.prop(tween.elem, tween.prop) : tween.elem[ tween.prop ];
1004
- }
1005
-
1006
- // passing an empty string as a 3rd parameter to .css will automatically
1007
- // attempt a parseFloat and fallback to a string if the parse fails
1008
- // so, simple values such as "10px" are parsed to Float.
1009
- // complex values such as "rotate(1rad)" are returned as is.
1010
- result = css( tween.elem, tween.prop );
1011
- // Empty strings, null, undefined and "auto" are converted to 0.
1012
- return !result || result === "auto" ? 0 : result;
1013
- },
1014
- set: function( tween ) {
1015
- // use step hook for back compat - use cssHook if its there - use .style if its
1016
- // available and use plain properties where available
1017
- if ( jQuery.fx.step[ tween.prop ] ) {
1018
- jQuery.fx.step[ tween.prop ]( tween );
1019
- } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
1020
- jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
1021
- } else if( !havePolyfill[ tween.prop ] ) {
1022
- tween.elem[ tween.prop ] = tween.now;
1023
- } else {
1024
- $.prop(tween.elem, tween.prop, tween.now);
1025
- }
1026
- }
1027
- });
1028
- })();
1029
- }
1030
-
1031
989
 
1032
990
  ['removeAttr', 'prop', 'attr'].forEach(function(type){
1033
991
  olds[type] = $[type];
@@ -1431,48 +1389,50 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1431
1389
  });
1432
1390
  };
1433
1391
  return function(nativeElem, shadowElem, opts){
1434
- opts = opts || {};
1435
- if(nativeElem.jquery){
1436
- nativeElem = nativeElem[0];
1437
- }
1438
- if(shadowElem.jquery){
1439
- shadowElem = shadowElem[0];
1440
- }
1441
- var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
1442
- var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
1443
- var shadowFocusElementData = {};
1444
- if(!opts.shadowFocusElement){
1445
- opts.shadowFocusElement = shadowElem;
1446
- } else if(opts.shadowFocusElement){
1447
- if(opts.shadowFocusElement.jquery){
1448
- opts.shadowFocusElement = opts.shadowFocusElement[0];
1392
+ if(nativeElem && shadowElem){
1393
+ opts = opts || {};
1394
+ if(nativeElem.jquery){
1395
+ nativeElem = nativeElem[0];
1449
1396
  }
1450
- shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
1451
- }
1452
-
1453
- $(nativeElem).on('remove', function(e){
1454
- if (!e.originalEvent) {
1455
- $(shadowElem).remove();
1397
+ if(shadowElem.jquery){
1398
+ shadowElem = shadowElem[0];
1456
1399
  }
1457
- });
1458
-
1459
- nativeData.hasShadow = shadowElem;
1460
- shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
1461
- shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
1462
- nativeElement: nativeElem,
1463
- shadowElement: shadowElem,
1464
- shadowFocusElement: opts.shadowFocusElement
1465
- };
1466
- if(opts.shadowChilds){
1467
- opts.shadowChilds.each(function(){
1468
- elementData(this, 'shadowData', shadowData.shadowData);
1400
+ var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
1401
+ var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
1402
+ var shadowFocusElementData = {};
1403
+ if(!opts.shadowFocusElement){
1404
+ opts.shadowFocusElement = shadowElem;
1405
+ } else if(opts.shadowFocusElement){
1406
+ if(opts.shadowFocusElement.jquery){
1407
+ opts.shadowFocusElement = opts.shadowFocusElement[0];
1408
+ }
1409
+ shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
1410
+ }
1411
+
1412
+ $(nativeElem).on('remove', function(e){
1413
+ if (!e.originalEvent) {
1414
+ $(shadowElem).remove();
1415
+ }
1469
1416
  });
1417
+
1418
+ nativeData.hasShadow = shadowElem;
1419
+ shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
1420
+ shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
1421
+ nativeElement: nativeElem,
1422
+ shadowElement: shadowElem,
1423
+ shadowFocusElement: opts.shadowFocusElement
1424
+ };
1425
+ if(opts.shadowChilds){
1426
+ opts.shadowChilds.each(function(){
1427
+ elementData(this, 'shadowData', shadowData.shadowData);
1428
+ });
1429
+ }
1430
+
1431
+ if(opts.data){
1432
+ shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
1433
+ }
1434
+ opts = null;
1470
1435
  }
1471
-
1472
- if(opts.data){
1473
- shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
1474
- }
1475
- opts = null;
1476
1436
  webshims.docObserve();
1477
1437
  };
1478
1438
  })(),
@@ -1756,7 +1716,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1756
1716
  // register: moduleName:string,
1757
1717
  // callback: callback:function
1758
1718
  // });
1759
- // get/set including removeLang
1719
+ // get/set including remoteLang
1760
1720
  // - webshims.activeLang({
1761
1721
  // module: moduleName:string,
1762
1722
  // callback: callback:function,
@@ -1965,52 +1925,55 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1965
1925
  });
1966
1926
  webshims.loader.loadList(['mediaelement-native-fix']);
1967
1927
  }
1968
- }
1969
-
1970
- if(hasNative && !options.preferFlash){
1971
- var noSwitch = {
1972
- 1: 1,
1973
- 2: 1
1974
- };
1975
- var switchOptions = function(e){
1976
- var media;
1977
- var parent;
1978
- if(!options.preferFlash &&
1928
+
1929
+ if(!options.preferFlash){
1930
+ var noSwitch = {
1931
+ 1: 1,
1932
+ 2: 1
1933
+ };
1934
+ var switchOptions = function(e){
1935
+ var media, error, parent;
1936
+ if(!options.preferFlash &&
1979
1937
  ($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source:last', parent)[0] == e.target)) &&
1980
- (media = $(e.target).closest('audio, video')) && !noSwitch[media.prop('error')]
1938
+ (media = $(e.target).closest('audio, video')) && !noSwitch[(error = media.prop('error'))]
1981
1939
  ){
1982
- $(function(){
1983
- if(hasSwf && !options.preferFlash){
1984
- loadSwf();
1985
- webshims.ready('WINDOWLOAD '+swfType, function(){
1986
- setTimeout(function(){
1987
- if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
1988
- options.preferFlash = true;
1989
- document.removeEventListener('error', switchOptions, true);
1990
- $('audio, video').each(function(){
1991
- webshims.mediaelement.selectSource(this);
1992
- });
1993
- webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
1994
- }
1995
- }, 9);
1996
- });
1997
- } else{
1998
- document.removeEventListener('error', switchOptions, true);
1940
+ if(error == null){
1941
+ webshims.warn("There was an unspecified error on a mediaelement");
1942
+ return;
1943
+
1999
1944
  }
2000
- });
2001
- }
2002
- };
2003
- document.addEventListener('error', switchOptions, true);
2004
- $('audio, video').each(function(){
2005
- var error = $.prop(this, 'error');
2006
- if(error && !noSwitch[error]){
2007
- switchOptions({target: this});
2008
- return false;
2009
- }
2010
- });
1945
+ $(function(){
1946
+ if(hasSwf && !options.preferFlash){
1947
+ loadSwf();
1948
+ webshims.ready('WINDOWLOAD '+swfType, function(){
1949
+ setTimeout(function(){
1950
+ if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
1951
+ options.preferFlash = true;
1952
+ document.removeEventListener('error', switchOptions, true);
1953
+ $('audio, video').each(function(){
1954
+ webshims.mediaelement.selectSource(this);
1955
+ });
1956
+ webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
1957
+ }
1958
+ }, 9);
1959
+ });
1960
+ } else{
1961
+ document.removeEventListener('error', switchOptions, true);
1962
+ }
1963
+ });
1964
+ }
1965
+ };
1966
+ document.addEventListener('error', switchOptions, true);
1967
+ $('audio, video').each(function(){
1968
+ var error = $.prop(this, 'error');
1969
+ if(error && !noSwitch[error]){
1970
+ switchOptions({target: this});
1971
+ return false;
1972
+ }
1973
+ });
1974
+ }
2011
1975
  }
2012
1976
 
2013
-
2014
1977
  if(Modernizr.track && !bugs.track){
2015
1978
  (function(){
2016
1979
 
@@ -2391,63 +2354,14 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
2391
2354
 
2392
2355
  });
2393
2356
 
2394
- webshims.ready('dom-support', function(){
2395
- if(!supportsLoop){
2396
- webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
2397
- }
2398
-
2399
- ['audio', 'video'].forEach(function(nodeName){
2400
- var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
2401
- prop: {
2402
- value: function(){
2403
- var data = webshims.data(this, 'mediaelement');
2404
- selectSource(this, data);
2405
- if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
2406
- supLoad.prop._supvalue.apply(this, arguments);
2407
- }
2408
- }
2409
- }
2410
- });
2411
- nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
2412
- prop: {
2413
- value: function(type){
2414
- var ret = '';
2415
- if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
2416
- ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
2417
- if(ret == 'no'){
2418
- ret = '';
2419
- }
2420
- }
2421
- if(!ret && hasSwf){
2422
- type = $.trim((type || '').split(';')[0]);
2423
- if(mediaelement.swfMimeTypes.indexOf(type) != -1){
2424
- ret = 'maybe';
2425
- }
2426
- }
2427
- return ret;
2428
- }
2429
- }
2430
- });
2431
- });
2432
- webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
2433
- set: function(){
2434
- var elem = this;
2435
- var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
2436
- clearTimeout(baseData.loadTimer);
2437
- baseData.loadTimer = setTimeout(function(){
2438
- selectSource(elem);
2439
- elem = null;
2440
- }, 9);
2441
- }
2442
- });
2443
- });
2444
-
2357
+ var handleMedia = false;
2445
2358
  var initMediaElements = function(){
2446
2359
  var testFixMedia = function(){
2447
2360
  if(webshims.implement(this, 'mediaelement')){
2448
2361
  selectSource(this);
2449
2362
 
2450
- if(hasNative){
2363
+ //fixes for FF 12 and IE9/10 || does not hurt, if run in other browsers
2364
+ if(hasNative && (!supportsLoop || ('ActiveXObject' in window))){
2451
2365
  var bufferTimer;
2452
2366
  var lastBuffered;
2453
2367
  var elem = this;
@@ -2476,7 +2390,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
2476
2390
  lastBuffered = getBufferedString();
2477
2391
  }
2478
2392
  clearTimeout(bufferTimer);
2479
- bufferTimer = setTimeout(testBuffer, 999);
2393
+ bufferTimer = setTimeout(testBuffer, 400);
2480
2394
  },
2481
2395
  'emptied stalled mediaerror abort suspend': function(e){
2482
2396
  if(e.type == 'emptied'){
@@ -2493,11 +2407,62 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
2493
2407
  }
2494
2408
 
2495
2409
  };
2496
- var handleMedia = false;
2410
+
2497
2411
 
2498
2412
 
2499
2413
  webshims.ready('dom-support', function(){
2500
2414
  handleMedia = true;
2415
+
2416
+ if(!supportsLoop){
2417
+ webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
2418
+ }
2419
+
2420
+ ['audio', 'video'].forEach(function(nodeName){
2421
+ var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
2422
+ prop: {
2423
+ value: function(){
2424
+ var data = webshims.data(this, 'mediaelement');
2425
+ selectSource(this, data);
2426
+ if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
2427
+ supLoad.prop._supvalue.apply(this, arguments);
2428
+ }
2429
+ }
2430
+ }
2431
+ });
2432
+ nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
2433
+ prop: {
2434
+ value: function(type){
2435
+ var ret = '';
2436
+ if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
2437
+ ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
2438
+ if(ret == 'no'){
2439
+ ret = '';
2440
+ }
2441
+ }
2442
+ if(!ret && hasSwf){
2443
+ type = $.trim((type || '').split(';')[0]);
2444
+ if(mediaelement.swfMimeTypes.indexOf(type) != -1){
2445
+ ret = 'maybe';
2446
+ }
2447
+ }
2448
+ return ret;
2449
+ }
2450
+ }
2451
+ });
2452
+ });
2453
+ webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
2454
+ set: function(){
2455
+ var elem = this;
2456
+ var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
2457
+ clearTimeout(baseData.loadTimer);
2458
+ baseData.loadTimer = setTimeout(function(){
2459
+ selectSource(elem);
2460
+ elem = null;
2461
+ }, 9);
2462
+ }
2463
+ });
2464
+
2465
+
2501
2466
  webshims.addReady(function(context, insertedElement){
2502
2467
  var media = $('video, audio', context)
2503
2468
  .add(insertedElement.filter('video, audio'))
@@ -2557,6 +2522,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
2557
2522
  var hasNative = Modernizr.audio && Modernizr.video;
2558
2523
  var hasFlash = swfmini.hasFlashPlayerVersion('9.0.115');
2559
2524
  var loadedSwf = 0;
2525
+ var needsLoadPreload = 'ActiveXObject' in window && hasNative;
2560
2526
  var getProps = {
2561
2527
  paused: true,
2562
2528
  ended: false,
@@ -2670,12 +2636,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
2670
2636
  data.readyState = readyState;
2671
2637
  };
2672
2638
 
2673
- $.extend($.event.customEvent, {
2674
- updatemediaelementdimensions: true,
2675
- flashblocker: true,
2676
- swfstageresize: true,
2677
- mediaelementapichange: true
2678
- });
2639
+
2679
2640
 
2680
2641
  mediaelement.jarisEvent = {};
2681
2642
  var localConnectionTimer;
@@ -2924,8 +2885,13 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
2924
2885
  var isNativeHTML5 = ( event.originalEvent && event.originalEvent.type === event.type );
2925
2886
  if( isNativeHTML5 == (data.activating == 'third') ){
2926
2887
  event.stopImmediatePropagation();
2927
- if(stopEvents[event.type] && data.isActive != data.activating){
2928
- $(event.target).pause();
2888
+
2889
+ if(stopEvents[event.type]){
2890
+ if(data.isActive != data.activating){
2891
+ $(event.target).pause();
2892
+ } else if(isNativeHTML5){
2893
+ ($.prop(event.target, 'pause')._supvalue || $.noop).apply(event.target);
2894
+ }
2929
2895
  }
2930
2896
  }
2931
2897
  };
@@ -2989,15 +2955,18 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
2989
2955
  })();
2990
2956
 
2991
2957
  var setElementDimension = function(data, hasControls){
2958
+ var cAttr;
2992
2959
  var elem = data._elem;
2993
2960
  var box = data.shadowElem;
2961
+
2994
2962
  $(elem)[hasControls ? 'addClass' : 'removeClass']('webshims-controls');
2995
2963
  if(data._elemNodeName == 'audio' && !hasControls){
2996
2964
  box.css({width: 0, height: 0});
2997
2965
  } else {
2966
+
2998
2967
  box.css({
2999
- width: elem.style.width || $(elem).width(),
3000
- height: elem.style.height || $(elem).height()
2968
+ width: elem.style.width || ((cAttr = $(elem).attr('width')) && cAttr+'px') || $(elem).width(),
2969
+ height: elem.style.height|| ((cAttr = $(elem).attr('height')) && cAttr+'px') || $(elem).height()
3001
2970
  });
3002
2971
  }
3003
2972
  };
@@ -3026,7 +2995,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3026
2995
  replaceVar = function(val){
3027
2996
  return (val.replace) ? val.replace(regs.A, '%26').replace(regs.a, '%26').replace(regs.e, '%3D').replace(regs.q, '%3F') : val;
3028
2997
  };
3029
-
2998
+
3030
2999
  mediaelement.createSWF = function( elem, canPlaySrc, data ){
3031
3000
  if(!hasFlash){
3032
3001
  setTimeout(function(){
@@ -3034,7 +3003,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3034
3003
  }, 1);
3035
3004
  return;
3036
3005
  }
3037
-
3006
+
3038
3007
  if(loadedSwf < 1){
3039
3008
  loadedSwf = 1;
3040
3009
  } else {
@@ -3045,7 +3014,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3045
3014
  }
3046
3015
 
3047
3016
  if($.attr(elem, 'height') || $.attr(elem, 'width')){
3048
- webshims.warn("width or height content attributes used. Webshims only uses CSS (computed styles or inline styles) to detect size of a video/audio");
3017
+ 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.");
3049
3018
  }
3050
3019
 
3051
3020
  var isRtmp = canPlaySrc.type == 'audio/rtmp' || canPlaySrc.type == 'video/rtmp';
@@ -3142,6 +3111,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3142
3111
  }
3143
3112
  }
3144
3113
  }));
3114
+
3145
3115
  setElementDimension(data, hasControls);
3146
3116
 
3147
3117
  box.insertBefore(elem);
@@ -3151,16 +3121,31 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3151
3121
  }
3152
3122
 
3153
3123
  webshims.addShadowDom(elem, box);
3124
+ if(!webshims.data(elem, 'mediaelement')){
3125
+ webshims.data(elem, 'mediaelement', data);
3126
+ }
3154
3127
  addMediaToStopEvents(elem);
3128
+
3155
3129
  mediaelement.setActive(elem, 'third', data);
3130
+
3156
3131
  $(elem)
3157
3132
  .on({'updatemediaelementdimensions': setDimension})
3158
3133
  .onWSOff('updateshadowdom', setDimension)
3134
+ .on('remove', function(e){
3135
+ if(!e.originalEvent && mediaelement.jarisEvent[data.id] && mediaelement.jarisEvent[data.id].elem == elem){
3136
+ delete mediaelement.jarisEvent[data.id];
3137
+ clearTimeout(localConnectionTimer);
3138
+ clearTimeout(data.flashBlock);
3139
+ }
3140
+ box.remove();
3141
+ })
3159
3142
  ;
3160
3143
  }
3161
3144
 
3162
- if(!mediaelement.jarisEvent[data.id]){
3145
+
3146
+ if(!mediaelement.jarisEvent[data.id] || mediaelement.jarisEvent[data.id].elem != elem){
3163
3147
  mediaelement.jarisEvent[data.id] = function(jaris){
3148
+
3164
3149
  if(jaris.type == 'ready'){
3165
3150
  var onReady = function(){
3166
3151
  if(data.api){
@@ -3193,8 +3178,8 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3193
3178
  }
3194
3179
  data.duration = jaris.duration;
3195
3180
  }
3196
-
3197
3181
  };
3182
+ mediaelement.jarisEvent[data.id].elem = elem;
3198
3183
  }
3199
3184
 
3200
3185
  $.extend(vars,
@@ -3220,27 +3205,27 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3220
3205
  clearTimeout(data.flashBlock);
3221
3206
 
3222
3207
  swfmini.embedSWF(playerSwfPath, elemId, "100%", "100%", "9.0.115", false, vars, params, attrs, function(swfData){
3223
-
3224
3208
  if(swfData.success){
3225
-
3226
- data.api = swfData.ref;
3227
-
3228
- if(!hasControls){
3229
- $(swfData.ref).attr('tabindex', '-1').css('outline', 'none');
3230
- }
3231
-
3232
- data.flashBlock = setTimeout(function(){
3209
+ var fBlocker = function(){
3233
3210
  if((!swfData.ref.parentNode && box[0].parentNode) || swfData.ref.style.display == "none"){
3234
3211
  box.addClass('flashblocker-assumed');
3235
3212
  $(elem).trigger('flashblocker');
3236
3213
  webshims.warn("flashblocker assumed");
3237
3214
  }
3238
3215
  $(swfData.ref).css({'minHeight': '2px', 'minWidth': '2px', display: 'block'});
3239
- }, 9);
3216
+ };
3217
+ data.api = swfData.ref;
3218
+
3219
+ if(!hasControls){
3220
+ $(swfData.ref).attr('tabindex', '-1').css('outline', 'none');
3221
+ }
3222
+
3223
+ data.flashBlock = setTimeout(fBlocker, 99);
3240
3224
 
3241
3225
  if(!localConnectionTimer){
3242
3226
  clearTimeout(localConnectionTimer);
3243
3227
  localConnectionTimer = setTimeout(function(){
3228
+ fBlocker();
3244
3229
  var flash = $(swfData.ref);
3245
3230
  if(flash[0].offsetWidth > 1 && flash[0].offsetHeight > 1 && location.protocol.indexOf('file:') === 0){
3246
3231
  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");
@@ -3394,12 +3379,23 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
3394
3379
  }
3395
3380
  });
3396
3381
 
3382
+
3397
3383
  webshims.onNodeNamesPropertyModify(nodeName, 'preload', function(val){
3398
- var data = getSwfDataFromElem(this);
3384
+ var data, baseData, elem;
3399
3385
 
3400
3386
 
3401
- if(data && bufferSrc(this)){
3402
- queueSwfMethod(this, 'api_preload', [], data);
3387
+ if(bufferSrc(this)){
3388
+ data = getSwfDataFromElem(this);
3389
+ if(data){
3390
+ queueSwfMethod(this, 'api_preload', [], data);
3391
+ } else if(needsLoadPreload && this.paused && !this.error && !$.data(this, 'mediaerror') && !this.readyState && !this.networkState && !this.autoplay && $(this).is(':not(.nonnative-api-active)')){
3392
+ elem = this;
3393
+ baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
3394
+ clearTimeout(baseData.loadTimer);
3395
+ baseData.loadTimer = setTimeout(function(){
3396
+ $(elem).mediaLoad();
3397
+ }, 9);
3398
+ }
3403
3399
  }
3404
3400
  });
3405
3401