vendor/assets/javascripts/webshims/shims/combos/25.js in webshims-rails-1.14.3 vs vendor/assets/javascripts/webshims/shims/combos/25.js in webshims-rails-1.14.4
- old
+ new
@@ -60,11 +60,11 @@
webshims.register('dom-extend', function($, webshims, window, document, undefined){
"use strict";
var supportHrefNormalized = !('hrefNormalized' in $.support) || $.support.hrefNormalized;
var supportGetSetAttribute = !('getSetAttribute' in $.support) || $.support.getSetAttribute;
var has = Object.prototype.hasOwnProperty;
- webshims.assumeARIA = supportGetSetAttribute || Modernizr.canvas || Modernizr.video || Modernizr.boxsizing;
+ webshims.assumeARIA = true;
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
}
@@ -79,19 +79,10 @@
if (window.$) {
window.$ = webshims.$;
}
window.jQuery = webshims.$;
}
- if(webshims.M != Modernizr){
- webshims.error("Modernizr was included more than once. Make sure to include it only once! Webshims and other scripts might not work properly.");
- for(var i in Modernizr){
- if(!(i in webshims.M)){
- webshims.M[i] = Modernizr[i];
- }
- }
- Modernizr = webshims.M;
- }
};
switch$();
setTimeout(switch$, 90);
webshims.ready('DOM', switch$);
$(switch$);
@@ -416,11 +407,11 @@
var extendNativeValue = (function(){
var UNKNOWN = webshims.getPrototypeOf(document.createElement('foobar'));
//see also: https://github.com/lojjic/PIE/issues/40 | https://prototype.lighthouseapp.com/projects/8886/tickets/1107-ie8-fatal-crash-when-prototypejs-is-loaded-with-rounded-cornershtc
- var isExtendNativeSave = Modernizr.advancedObjectProperties && Modernizr.objectAccessor;
+ var isExtendNativeSave = webshims.support.advancedObjectProperties && webshims.support.objectAccessor;
return function(nodeName, prop, desc){
var elem , elemProto;
if( isExtendNativeSave && (elem = document.createElement(nodeName)) && (elemProto = webshims.getPrototypeOf(elem)) && UNKNOWN !== elemProto && ( !elem[prop] || !has.call(elem, prop) ) ){
var sup = elem[prop];
desc._supvalue = function(){
@@ -727,11 +718,11 @@
docObserve.handler({type: 'boxsizing'});
}
});
}
webshims.ready('WINDOWLOAD', this.test);
- $(document).on('updatelayout.webshim pageinit popupafteropen panelbeforeopen tabsactivate collapsibleexpand shown.bs.modal shown.bs.collapse slid.bs.carousel', this.handler);
+ $(document).on('updatelayout.webshim pageinit popupafteropen panelbeforeopen tabsactivate collapsibleexpand shown.bs.modal shown.bs.collapse slid.bs.carousel playerdimensionchange', this.handler);
$(window).on('resize', this.handler);
}
}
};
@@ -1691,11 +1682,12 @@
;webshims.register('mediaelement-jaris', function($, webshims, window, document, undefined, options){
"use strict";
var mediaelement = webshims.mediaelement;
var swfmini = window.swfmini;
- var hasNative = Modernizr.audio && Modernizr.video;
+ var support = webshims.support;
+ var hasNative = support.mediaelement;
var hasFlash = swfmini.hasFlashPlayerVersion('9.0.115');
var loadedSwf = 0;
var needsLoadPreload = 'ActiveXObject' in window && hasNative;
var getProps = {
paused: true,
@@ -1740,24 +1732,26 @@
activating: 'html5',
wasSwfReady: false,
_bufferedEnd: 0,
_bufferedStart: 0,
currentTime: 0,
+ lastCalledTime: -500,
_ppFlag: undefined,
_calledMeta: false,
- lastDuration: 0
+ lastDuration: 0,
+ _timeDif: 0.3
}, getProps, getSetProps);
var getSwfDataFromElem = function(elem){
try {
(elem.nodeName);
} catch(er){
return null;
}
var data = webshims.data(elem, 'mediaelement');
- return (data && data.isActive== 'third') ? data : null;
+ return (data && data.isActive == 'third') ? data : null;
};
var trigger = function(elem, evt){
evt = $.Event(evt);
evt.preventDefault();
@@ -1884,10 +1878,18 @@
trigger(data._elem, 'durationchange');
}
if(!data._calledMeta){
trigger(data._elem, 'loadedmetadata');
}
+
+ if(data.duration > 1 && data.duration < 140){
+ data._timeDif = 0.2;
+ } else if(data.duration < 600) {
+ data._timeDif = 0.25;
+ } else {
+ data._timeDif = 0.30;
+ }
}
data._calledMeta = true;
},
onBuffering: function(jaris, data){
if(data.ended){
@@ -1895,34 +1897,42 @@
}
setReadyState(1, data);
trigger(data._elem, 'waiting');
},
onTimeUpdate: function(jaris, data){
+ var timeDif = data.currentTime - data.lastCalledTime;
if(data.ended){
data.ended = false;
}
if(data.readyState < 3){
setReadyState(3, data);
trigger(data._elem, 'playing');
}
if(data.seeking){
callSeeked(data);
}
- trigger(data._elem, 'timeupdate');
+
+ if(timeDif > data._timeDif || timeDif < -0.3){
+ data.lastCalledTime = data.currentTime;
+ $.event.trigger('timeupdate', undefined, data._elem, true);
+ }
+
},
onProgress: function(jaris, data){
if(data.ended){
data.ended = false;
}
if(!data.duration || isNaN(data.duration)){
return;
}
var percentage = jaris.loaded / jaris.total;
+
if(percentage > 0.02 && percentage < 0.2){
setReadyState(3, data);
} else if(percentage > 0.2){
- if(percentage > 0.99){
+ if(percentage > 0.95){
+ percentage = 1;
data.networkState = 1;
}
setReadyState(4, data);
}
if(data._bufferedEnd && (data._bufferedEnd > percentage)){
@@ -2060,11 +2070,11 @@
if(hasNative){
var stopEvents = {
play: 1,
playing: 1
};
- var hideEvtArray = ['play', 'pause', 'playing', 'canplay', 'progress', 'waiting', 'ended', 'loadedmetadata', 'durationchange', 'emptied'];
+ var hideEvtArray = ['play', 'pause', 'playing', 'loadstart', 'canplay', 'progress', 'waiting', 'ended', 'loadedmetadata', 'durationchange', 'emptied'];
var hidevents = hideEvtArray.map(function(evt){
return evt +'.webshimspolyfill';
}).join(' ');
var hidePlayerEvents = function(event){
@@ -2120,11 +2130,11 @@
};
var resetSwfProps = (function(){
- var resetProtoProps = ['_calledMeta', 'lastDuration', '_bufferedEnd', '_bufferedStart', '_ppFlag', 'currentSrc', 'currentTime', 'duration', 'ended', 'networkState', 'paused', 'seeking', 'videoHeight', 'videoWidth'];
+ var resetProtoProps = ['_calledMeta', 'lastDuration', '_bufferedEnd', 'lastCalledTime', '_bufferedStart', '_ppFlag', 'currentSrc', 'currentTime', 'duration', 'ended', 'networkState', 'paused', 'seeking', 'videoHeight', 'videoWidth'];
var len = resetProtoProps.length;
return function(data){
if(!data){return;}
clearTimeout(data._seekedTimer);
@@ -2240,11 +2250,11 @@
data.shadowElem.css(ret);
ret.width = data.shadowElem.height() * ratio;
ret.height = ret.width / ratio;
}
- if(!Modernizr.video){
+ if(!webshims.support.mediaelement){
ret.width = data.shadowElem.width();
ret.height = data.shadowElem.height();
}
}
}
@@ -2379,18 +2389,20 @@
var box;
if(data && data.swfCreated){
mediaelement.setActive(elem, 'third', data);
- data.currentSrc = canPlaySrc.srcProp;
+ data.currentSrc = '';
data.shadowElem.html('<div id="'+ elemId +'">');
data.api = false;
data.actionQueue = [];
box = data.shadowElem;
resetSwfProps(data);
+ data.currentSrc = canPlaySrc.srcProp;
+
} else {
$(document.getElementById('wrapper-'+ elemId )).remove();
box = $('<div class="polyfill-'+ (elemNodeName) +' polyfill-mediaelement '+ webshims.shadowClass +'" id="wrapper-'+ elemId +'"><div id="'+ elemId +'"></div>')
.css({
position: 'relative',
@@ -2497,11 +2509,11 @@
} else {
setTimeout(onReady, 9);
}
} else {
data.currentTime = jaris.position;
-
+
if(data.api){
if(!data._calledMeta && isNaN(jaris.duration) && data.duration != jaris.duration && isNaN(data.duration)){
onEvent.onDataInitialized(jaris, data);
}
@@ -2572,11 +2584,12 @@
flash = null;
}, 8000);
}
}
});
-
+
+ trigger(data._elem, 'loadstart');
};
var queueSwfMethod = function(elem, fn, args, data){
data = data || getSwfDataFromElem(elem);
@@ -2740,11 +2753,11 @@
}
});
mediaSup = webshims.defineNodeNameProperties(nodeName, descs, 'prop');
- if(!Modernizr.mediaDefaultMuted){
+ if(!support.mediaDefaultMuted){
webshims.defineNodeNameProperties(nodeName, {
defaultMuted: {
get: function(){
return $.attr(this, 'muted') != null;
},
@@ -2779,21 +2792,21 @@
var i, len, prop;
var ret = oldClean.apply(this, arguments);
if(elems && (len = elems.length) && loadedSwf){
for(i = 0; i < len; i++){
- if(flashNames[elems[i].nodeName] && 'api_pause' in elems[i]){
+ if(flashNames[elems[i].nodeName] && 'api_destroy' in elems[i]){
loadedSwf--;
try {
- elems[i].api_pause();
+ elems[i].api_destroy();
if(elems[i].readyState == 4){
for (prop in elems[i]) {
if (!noRemove[prop] && !objElem[prop] && typeof elems[i][prop] == "function") {
elems[i][prop] = null;
}
}
}
- } catch(er){}
+ } catch(er){console.log(er);}
}
}
}
return ret;