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
@@ -509,10 +509,15 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
509
509
  if(!$.parseHTML){
510
510
  webshims.error("Webshims needs jQuery 1.8+ to work properly. Please update your jQuery version or downgrade webshims.");
511
511
  }
512
+
513
+ if(webshims.cfg.extendNative == 1){
514
+ 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");
515
+ }
516
+
512
517
  if (!webshims.cfg.no$Switch) {
513
518
  var switch$ = function(){
514
519
  if (window.jQuery && (!window.$ || window.jQuery == window.$) && !window.jQuery.webshims) {
515
- webshims.error("jQuery was included more than once. Make sure to include it only once! Webshims and other Plugins might not work properly.");
520
+ 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..");
516
521
  if (window.$) {
517
522
  window.$ = webshims.$;
518
523
  }
@@ -530,7 +535,10 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
530
535
  };
531
536
  switch$();
532
537
  setTimeout(switch$, 90);
538
+ webshims.ready('DOM', switch$);
533
539
  $(switch$);
540
+ webshims.ready('WINDOWLOAD', switch$);
541
+
534
542
  }
535
543
  // (function(){
536
544
  // var hostNames = {
@@ -638,6 +646,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
638
646
  $(evtDel).off(evt, fn);
639
647
  }
640
648
  });
649
+ return this;
641
650
  };
642
651
 
643
652
  var dataID = '_webshimsLib'+ (Math.round(Math.random() * 1000));
@@ -672,57 +681,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
672
681
  };
673
682
  });
674
683
 
675
- if($.Tween.propHooks._default && $.css){
676
- (function(){
677
- var isjQ8 = false;
678
- try {
679
- isjQ8 = $.css($('<b style="width: 10px" />')[0], 'width', '') == '10px';
680
- } catch(er){
681
- webshims.error(er);
682
- }
683
- var css = isjQ8 ?
684
- function(elem, prop){
685
- return $.css( elem, prop, false, "" );
686
- } :
687
- function(elem, prop){
688
- return $.css( elem, prop, "" );
689
- }
690
- ;
691
-
692
- $.extend($.Tween.propHooks._default, {
693
- get: function( tween ) {
694
- var result;
695
-
696
- if ( (tween.elem[ tween.prop ] != null || havePolyfill[ tween.prop ]) &&
697
- (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
698
- return havePolyfill[ tween.prop ] ? $.prop(tween.elem, tween.prop) : tween.elem[ tween.prop ];
699
- }
700
-
701
- // passing an empty string as a 3rd parameter to .css will automatically
702
- // attempt a parseFloat and fallback to a string if the parse fails
703
- // so, simple values such as "10px" are parsed to Float.
704
- // complex values such as "rotate(1rad)" are returned as is.
705
- result = css( tween.elem, tween.prop );
706
- // Empty strings, null, undefined and "auto" are converted to 0.
707
- return !result || result === "auto" ? 0 : result;
708
- },
709
- set: function( tween ) {
710
- // use step hook for back compat - use cssHook if its there - use .style if its
711
- // available and use plain properties where available
712
- if ( jQuery.fx.step[ tween.prop ] ) {
713
- jQuery.fx.step[ tween.prop ]( tween );
714
- } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
715
- jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
716
- } else if( !havePolyfill[ tween.prop ] ) {
717
- tween.elem[ tween.prop ] = tween.now;
718
- } else {
719
- $.prop(tween.elem, tween.prop, tween.now);
720
- }
721
- }
722
- });
723
- })();
724
- }
725
-
726
684
 
727
685
  ['removeAttr', 'prop', 'attr'].forEach(function(type){
728
686
  olds[type] = $[type];
@@ -1126,48 +1084,50 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1126
1084
  });
1127
1085
  };
1128
1086
  return function(nativeElem, shadowElem, opts){
1129
- opts = opts || {};
1130
- if(nativeElem.jquery){
1131
- nativeElem = nativeElem[0];
1132
- }
1133
- if(shadowElem.jquery){
1134
- shadowElem = shadowElem[0];
1135
- }
1136
- var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
1137
- var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
1138
- var shadowFocusElementData = {};
1139
- if(!opts.shadowFocusElement){
1140
- opts.shadowFocusElement = shadowElem;
1141
- } else if(opts.shadowFocusElement){
1142
- if(opts.shadowFocusElement.jquery){
1143
- opts.shadowFocusElement = opts.shadowFocusElement[0];
1087
+ if(nativeElem && shadowElem){
1088
+ opts = opts || {};
1089
+ if(nativeElem.jquery){
1090
+ nativeElem = nativeElem[0];
1144
1091
  }
1145
- shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
1146
- }
1147
-
1148
- $(nativeElem).on('remove', function(e){
1149
- if (!e.originalEvent) {
1150
- $(shadowElem).remove();
1092
+ if(shadowElem.jquery){
1093
+ shadowElem = shadowElem[0];
1151
1094
  }
1152
- });
1153
-
1154
- nativeData.hasShadow = shadowElem;
1155
- shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
1156
- shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
1157
- nativeElement: nativeElem,
1158
- shadowElement: shadowElem,
1159
- shadowFocusElement: opts.shadowFocusElement
1160
- };
1161
- if(opts.shadowChilds){
1162
- opts.shadowChilds.each(function(){
1163
- elementData(this, 'shadowData', shadowData.shadowData);
1095
+ var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
1096
+ var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
1097
+ var shadowFocusElementData = {};
1098
+ if(!opts.shadowFocusElement){
1099
+ opts.shadowFocusElement = shadowElem;
1100
+ } else if(opts.shadowFocusElement){
1101
+ if(opts.shadowFocusElement.jquery){
1102
+ opts.shadowFocusElement = opts.shadowFocusElement[0];
1103
+ }
1104
+ shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
1105
+ }
1106
+
1107
+ $(nativeElem).on('remove', function(e){
1108
+ if (!e.originalEvent) {
1109
+ $(shadowElem).remove();
1110
+ }
1164
1111
  });
1112
+
1113
+ nativeData.hasShadow = shadowElem;
1114
+ shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
1115
+ shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
1116
+ nativeElement: nativeElem,
1117
+ shadowElement: shadowElem,
1118
+ shadowFocusElement: opts.shadowFocusElement
1119
+ };
1120
+ if(opts.shadowChilds){
1121
+ opts.shadowChilds.each(function(){
1122
+ elementData(this, 'shadowData', shadowData.shadowData);
1123
+ });
1124
+ }
1125
+
1126
+ if(opts.data){
1127
+ shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
1128
+ }
1129
+ opts = null;
1165
1130
  }
1166
-
1167
- if(opts.data){
1168
- shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
1169
- }
1170
- opts = null;
1171
1131
  webshims.docObserve();
1172
1132
  };
1173
1133
  })(),
@@ -1451,7 +1411,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1451
1411
  // register: moduleName:string,
1452
1412
  // callback: callback:function
1453
1413
  // });
1454
- // get/set including removeLang
1414
+ // get/set including remoteLang
1455
1415
  // - webshims.activeLang({
1456
1416
  // module: moduleName:string,
1457
1417
  // callback: callback:function,
@@ -1703,12 +1663,13 @@ webshims.register('form-core', function($, webshims, window, document, undefined
1703
1663
  $.expr[":"][name] = $.expr.filters[name+"-element"];
1704
1664
  });
1705
1665
 
1706
-
1707
- $.expr[":"].focus = function( elem ) {
1666
+ var pseudoFocus = $.expr[":"].focus;
1667
+ $.expr[":"].focus = function(){
1708
1668
  try {
1709
- var doc = elem.ownerDocument;
1710
- return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus());
1711
- } catch(e){}
1669
+ return pseudoFocus.apply(this, arguments);
1670
+ } catch(e){
1671
+ webshims.error(e);
1672
+ }
1712
1673
  return false;
1713
1674
  };
1714
1675
 
@@ -1723,7 +1684,7 @@ webshims.register('form-core', function($, webshims, window, document, undefined
1723
1684
  });
1724
1685
  };
1725
1686
 
1726
-
1687
+ var transClass = ('transitionDelay' in document.documentElement.style) ? '' : ' no-transition';
1727
1688
  webshims.wsPopover = {
1728
1689
  id: 0,
1729
1690
  _create: function(){
@@ -1731,7 +1692,7 @@ webshims.register('form-core', function($, webshims, window, document, undefined
1731
1692
  this.id = webshims.wsPopover.id++;
1732
1693
  this.eventns = '.wsoverlay' + this.id;
1733
1694
  this.timers = {};
1734
- this.element = $('<div class="ws-popover" tabindex="-1"><div class="ws-po-outerbox"><div class="ws-po-arrow"><div class="ws-po-arrowbox" /></div><div class="ws-po-box" /></div></div>');
1695
+ this.element = $('<div class="ws-popover'+transClass+'" tabindex="-1"><div class="ws-po-outerbox"><div class="ws-po-arrow"><div class="ws-po-arrowbox" /></div><div class="ws-po-box" /></div></div>');
1735
1696
  this.contentElement = $('.ws-po-box', this.element);
1736
1697
  this.lastElement = $([]);
1737
1698
  this.bindElement();
@@ -1770,47 +1731,6 @@ webshims.register('form-core', function($, webshims, window, document, undefined
1770
1731
  };
1771
1732
 
1772
1733
 
1773
- /* extension, but also used to fix native implementation workaround/bugfixes */
1774
- (function(){
1775
- var firstEvent,
1776
- invalids = [],
1777
- stopSubmitTimer,
1778
- form
1779
- ;
1780
-
1781
- $(document).on('invalid', function(e){
1782
- if(e.wrongWebkitInvalid){return;}
1783
- var jElm = $(e.target);
1784
-
1785
-
1786
- if(!firstEvent){
1787
- //trigger firstinvalid
1788
- firstEvent = $.Event('firstinvalid');
1789
- firstEvent.isInvalidUIPrevented = e.isDefaultPrevented;
1790
- var firstSystemInvalid = $.Event('firstinvalidsystem');
1791
- $(document).triggerHandler(firstSystemInvalid, {element: e.target, form: e.target.form, isInvalidUIPrevented: e.isDefaultPrevented});
1792
- jElm.trigger(firstEvent);
1793
- }
1794
-
1795
- //if firstinvalid was prevented all invalids will be also prevented
1796
- if( firstEvent && firstEvent.isDefaultPrevented() ){
1797
- e.preventDefault();
1798
- }
1799
- invalids.push(e.target);
1800
- e.extraData = 'fix';
1801
- clearTimeout(stopSubmitTimer);
1802
- stopSubmitTimer = setTimeout(function(){
1803
- var lastEvent = {type: 'lastinvalid', cancelable: false, invalidlist: $(invalids)};
1804
- //reset firstinvalid
1805
- firstEvent = false;
1806
- invalids = [];
1807
- $(e.target).trigger(lastEvent, lastEvent);
1808
- }, 9);
1809
- jElm = null;
1810
- });
1811
- })();
1812
-
1813
-
1814
1734
  webshims.getContentValidationMessage = function(elem, validity, key){
1815
1735
  var message = $(elem).data('errormessage') || elem.getAttribute('x-moz-errormessage') || '';
1816
1736
  if(key && message[key]){
@@ -1844,19 +1764,13 @@ webshims.register('form-core', function($, webshims, window, document, undefined
1844
1764
  };
1845
1765
 
1846
1766
 
1847
- webshims.ready('forms', function(){
1848
- $(document).on('focusin.lazyloadvalidation', function(e){
1849
- if('form' in e.target && $(e.target).is(':invalid')){
1850
- lazyLoad();
1851
- }
1852
- });
1767
+ $(document).on('focusin.lazyloadvalidation', function(e){
1768
+ if('form' in e.target && $(e.target).is(':invalid')){
1769
+ lazyLoad();
1770
+ }
1853
1771
  });
1854
1772
  webshims.ready('WINDOWLOAD', lazyLoad);
1855
- if(options.overrideMessages){
1856
- options.customMessages = true;
1857
- webshims.reTest('form-message');
1858
- webshims.error('overrideMessages is deprecated. use customMessages instead.');
1859
- }
1773
+
1860
1774
  if(options.replaceValidationUI){
1861
1775
  webshims.ready('DOM forms', function(){
1862
1776
  $(document).on('firstinvalid', function(e){
@@ -1867,8 +1781,47 @@ webshims.register('form-core', function($, webshims, window, document, undefined
1867
1781
  });
1868
1782
  });
1869
1783
  }
1870
- });
1784
+
1785
+ /* extension, but also used to fix native implementation workaround/bugfixes */
1786
+ (function(){
1787
+ var firstEvent,
1788
+ invalids = [],
1789
+ stopSubmitTimer,
1790
+ form
1791
+ ;
1792
+
1793
+ $(document).on('invalid', function(e){
1794
+ if(e.wrongWebkitInvalid){return;}
1795
+ var jElm = $(e.target);
1796
+
1797
+
1798
+ if(!firstEvent){
1799
+ //trigger firstinvalid
1800
+ firstEvent = $.Event('firstinvalid');
1801
+ firstEvent.isInvalidUIPrevented = e.isDefaultPrevented;
1802
+ var firstSystemInvalid = $.Event('firstinvalidsystem');
1803
+ $(document).triggerHandler(firstSystemInvalid, {element: e.target, form: e.target.form, isInvalidUIPrevented: e.isDefaultPrevented});
1804
+ jElm.trigger(firstEvent);
1805
+ }
1871
1806
 
1807
+ //if firstinvalid was prevented all invalids will be also prevented
1808
+ if( firstEvent && firstEvent.isDefaultPrevented() ){
1809
+ e.preventDefault();
1810
+ }
1811
+ invalids.push(e.target);
1812
+ e.extraData = 'fix';
1813
+ clearTimeout(stopSubmitTimer);
1814
+ stopSubmitTimer = setTimeout(function(){
1815
+ var lastEvent = {type: 'lastinvalid', cancelable: false, invalidlist: $(invalids)};
1816
+ //reset firstinvalid
1817
+ firstEvent = false;
1818
+ invalids = [];
1819
+ $(e.target).trigger(lastEvent, lastEvent);
1820
+ }, 9);
1821
+ jElm = null;
1822
+ });
1823
+ })();
1824
+ });
1872
1825
 
1873
1826
  webshims.register('form-message', function($, webshims, window, document, undefined, options){
1874
1827
  "use strict";
@@ -1922,8 +1875,15 @@ webshims.register('form-message', function($, webshims, window, document, undefi
1922
1875
  validityMessages.en.rangeOverflow[type] = validityMessages.en.rangeOverflow[type] || 'Value must be at or before {%max}.';
1923
1876
  });
1924
1877
  }
1925
-
1926
- validityMessages['en-US'] = validityMessages['en-US'] || validityMessages.en;
1878
+ if(!validityMessages['en-US']){
1879
+ validityMessages['en-US'] = $.extend(true, {}, validityMessages.en);
1880
+ }
1881
+ if(!validityMessages['en-GB']){
1882
+ validityMessages['en-GB'] = $.extend(true, {}, validityMessages.en);
1883
+ }
1884
+ if(!validityMessages['en-AU']){
1885
+ validityMessages['en-AU'] = $.extend(true, {}, validityMessages.en);
1886
+ }
1927
1887
  validityMessages[''] = validityMessages[''] || validityMessages['en-US'];
1928
1888
 
1929
1889
  validityMessages.de = $.extend(true, {
@@ -2023,12 +1983,22 @@ webshims.register('form-message', function($, webshims, window, document, undefi
2023
1983
 
2024
1984
  webshims.activeLang({
2025
1985
  langObj: validityMessages,
2026
- module: 'form-core',
1986
+ module: 'form-core',
2027
1987
  callback: function(langObj){
2028
-
2029
1988
  currentValidationMessage = langObj;
2030
1989
  }
2031
1990
  });
1991
+ webshims.activeLang({
1992
+ register: 'form-core',
1993
+ callback: function(val){
1994
+ $.each(validityMessages, function(i, val){
1995
+ if(validityMessages[val]){
1996
+ currentValidationMessage = validityMessages[val];
1997
+ return false;
1998
+ }
1999
+ });
2000
+ }
2001
+ });
2032
2002
 
2033
2003
  implementProperties.forEach(function(messageProp){
2034
2004
  webshims.defineNodeNamesProperty(['fieldset', 'output', 'button'], messageProp, {
@@ -2075,6 +2045,7 @@ webshims.register('form-message', function($, webshims, window, document, undefi
2075
2045
 
2076
2046
  });
2077
2047
  });
2048
+
2078
2049
  webshims.register('form-datalist', function($, webshims, window, document, undefined, options){
2079
2050
  "use strict";
2080
2051
  var doc = document;
@@ -2398,52 +2369,55 @@ webshims.register('form-datalist', function($, webshims, window, document, undef
2398
2369
  });
2399
2370
  webshims.loader.loadList(['mediaelement-native-fix']);
2400
2371
  }
2401
- }
2402
-
2403
- if(hasNative && !options.preferFlash){
2404
- var noSwitch = {
2405
- 1: 1,
2406
- 2: 1
2407
- };
2408
- var switchOptions = function(e){
2409
- var media;
2410
- var parent;
2411
- if(!options.preferFlash &&
2372
+
2373
+ if(!options.preferFlash){
2374
+ var noSwitch = {
2375
+ 1: 1,
2376
+ 2: 1
2377
+ };
2378
+ var switchOptions = function(e){
2379
+ var media, error, parent;
2380
+ if(!options.preferFlash &&
2412
2381
  ($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source:last', parent)[0] == e.target)) &&
2413
- (media = $(e.target).closest('audio, video')) && !noSwitch[media.prop('error')]
2382
+ (media = $(e.target).closest('audio, video')) && !noSwitch[(error = media.prop('error'))]
2414
2383
  ){
2415
- $(function(){
2416
- if(hasSwf && !options.preferFlash){
2417
- loadSwf();
2418
- webshims.ready('WINDOWLOAD '+swfType, function(){
2419
- setTimeout(function(){
2420
- if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
2421
- options.preferFlash = true;
2422
- document.removeEventListener('error', switchOptions, true);
2423
- $('audio, video').each(function(){
2424
- webshims.mediaelement.selectSource(this);
2425
- });
2426
- webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
2427
- }
2428
- }, 9);
2429
- });
2430
- } else{
2431
- document.removeEventListener('error', switchOptions, true);
2384
+ if(error == null){
2385
+ webshims.warn("There was an unspecified error on a mediaelement");
2386
+ return;
2387
+
2432
2388
  }
2433
- });
2434
- }
2435
- };
2436
- document.addEventListener('error', switchOptions, true);
2437
- $('audio, video').each(function(){
2438
- var error = $.prop(this, 'error');
2439
- if(error && !noSwitch[error]){
2440
- switchOptions({target: this});
2441
- return false;
2442
- }
2443
- });
2389
+ $(function(){
2390
+ if(hasSwf && !options.preferFlash){
2391
+ loadSwf();
2392
+ webshims.ready('WINDOWLOAD '+swfType, function(){
2393
+ setTimeout(function(){
2394
+ if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
2395
+ options.preferFlash = true;
2396
+ document.removeEventListener('error', switchOptions, true);
2397
+ $('audio, video').each(function(){
2398
+ webshims.mediaelement.selectSource(this);
2399
+ });
2400
+ webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
2401
+ }
2402
+ }, 9);
2403
+ });
2404
+ } else{
2405
+ document.removeEventListener('error', switchOptions, true);
2406
+ }
2407
+ });
2408
+ }
2409
+ };
2410
+ document.addEventListener('error', switchOptions, true);
2411
+ $('audio, video').each(function(){
2412
+ var error = $.prop(this, 'error');
2413
+ if(error && !noSwitch[error]){
2414
+ switchOptions({target: this});
2415
+ return false;
2416
+ }
2417
+ });
2418
+ }
2444
2419
  }
2445
2420
 
2446
-
2447
2421
  if(Modernizr.track && !bugs.track){
2448
2422
  (function(){
2449
2423
 
@@ -2824,63 +2798,14 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
2824
2798
 
2825
2799
  });
2826
2800
 
2827
- webshims.ready('dom-support', function(){
2828
- if(!supportsLoop){
2829
- webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
2830
- }
2831
-
2832
- ['audio', 'video'].forEach(function(nodeName){
2833
- var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
2834
- prop: {
2835
- value: function(){
2836
- var data = webshims.data(this, 'mediaelement');
2837
- selectSource(this, data);
2838
- if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
2839
- supLoad.prop._supvalue.apply(this, arguments);
2840
- }
2841
- }
2842
- }
2843
- });
2844
- nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
2845
- prop: {
2846
- value: function(type){
2847
- var ret = '';
2848
- if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
2849
- ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
2850
- if(ret == 'no'){
2851
- ret = '';
2852
- }
2853
- }
2854
- if(!ret && hasSwf){
2855
- type = $.trim((type || '').split(';')[0]);
2856
- if(mediaelement.swfMimeTypes.indexOf(type) != -1){
2857
- ret = 'maybe';
2858
- }
2859
- }
2860
- return ret;
2861
- }
2862
- }
2863
- });
2864
- });
2865
- webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
2866
- set: function(){
2867
- var elem = this;
2868
- var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
2869
- clearTimeout(baseData.loadTimer);
2870
- baseData.loadTimer = setTimeout(function(){
2871
- selectSource(elem);
2872
- elem = null;
2873
- }, 9);
2874
- }
2875
- });
2876
- });
2877
-
2801
+ var handleMedia = false;
2878
2802
  var initMediaElements = function(){
2879
2803
  var testFixMedia = function(){
2880
2804
  if(webshims.implement(this, 'mediaelement')){
2881
2805
  selectSource(this);
2882
2806
 
2883
- if(hasNative){
2807
+ //fixes for FF 12 and IE9/10 || does not hurt, if run in other browsers
2808
+ if(hasNative && (!supportsLoop || ('ActiveXObject' in window))){
2884
2809
  var bufferTimer;
2885
2810
  var lastBuffered;
2886
2811
  var elem = this;
@@ -2909,7 +2834,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
2909
2834
  lastBuffered = getBufferedString();
2910
2835
  }
2911
2836
  clearTimeout(bufferTimer);
2912
- bufferTimer = setTimeout(testBuffer, 999);
2837
+ bufferTimer = setTimeout(testBuffer, 400);
2913
2838
  },
2914
2839
  'emptied stalled mediaerror abort suspend': function(e){
2915
2840
  if(e.type == 'emptied'){
@@ -2926,11 +2851,62 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
2926
2851
  }
2927
2852
 
2928
2853
  };
2929
- var handleMedia = false;
2854
+
2930
2855
 
2931
2856
 
2932
2857
  webshims.ready('dom-support', function(){
2933
2858
  handleMedia = true;
2859
+
2860
+ if(!supportsLoop){
2861
+ webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
2862
+ }
2863
+
2864
+ ['audio', 'video'].forEach(function(nodeName){
2865
+ var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
2866
+ prop: {
2867
+ value: function(){
2868
+ var data = webshims.data(this, 'mediaelement');
2869
+ selectSource(this, data);
2870
+ if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
2871
+ supLoad.prop._supvalue.apply(this, arguments);
2872
+ }
2873
+ }
2874
+ }
2875
+ });
2876
+ nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
2877
+ prop: {
2878
+ value: function(type){
2879
+ var ret = '';
2880
+ if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
2881
+ ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
2882
+ if(ret == 'no'){
2883
+ ret = '';
2884
+ }
2885
+ }
2886
+ if(!ret && hasSwf){
2887
+ type = $.trim((type || '').split(';')[0]);
2888
+ if(mediaelement.swfMimeTypes.indexOf(type) != -1){
2889
+ ret = 'maybe';
2890
+ }
2891
+ }
2892
+ return ret;
2893
+ }
2894
+ }
2895
+ });
2896
+ });
2897
+ webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
2898
+ set: function(){
2899
+ var elem = this;
2900
+ var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
2901
+ clearTimeout(baseData.loadTimer);
2902
+ baseData.loadTimer = setTimeout(function(){
2903
+ selectSource(elem);
2904
+ elem = null;
2905
+ }, 9);
2906
+ }
2907
+ });
2908
+
2909
+
2934
2910
  webshims.addReady(function(context, insertedElement){
2935
2911
  var media = $('video, audio', context)
2936
2912
  .add(insertedElement.filter('video, audio'))