vendor/assets/javascripts/webshims/shims/combos/12.js in webshims-rails-1.10.10 vs vendor/assets/javascripts/webshims/shims/combos/12.js in webshims-rails-1.10.11

- old
+ new

@@ -163,56 +163,10 @@ } return r; } - /* Functions to abstract and display alternative content - */ - function displayAltContent(obj) { - if (ua.ie && ua.win && obj.readyState != 4) { - // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, - // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work - var el = createElement("div"); - obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content - el.parentNode.replaceChild(abstractAltContent(obj), el); - obj.style.display = "none"; - (function(){ - if (obj.readyState == 4) { - obj.parentNode.removeChild(obj); - } - else { - setTimeout(arguments.callee, 10); - } - })(); - } - else { - obj.parentNode.replaceChild(abstractAltContent(obj), obj); - } - } - - function abstractAltContent(obj) { - var ac = createElement("div"); - if (ua.win && ua.ie) { - ac.innerHTML = obj.innerHTML; - } - else { - var nestedObj = obj.getElementsByTagName(OBJECT)[0]; - if (nestedObj) { - var c = nestedObj.childNodes; - if (c) { - var cl = c.length; - for (var i = 0; i < cl; i++) { - if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) { - ac.appendChild(c[i].cloneNode(true)); - } - } - } - } - } - return ac; - } - /* Cross-browser dynamic SWF creation */ function createSWF(attObj, parObj, id) { var r, el = getElementById(id); if (ua.wk && ua.wk < 312) { return r; } @@ -509,11 +463,12 @@ webshims.mediaelement.loadSwf = true; webshims.reTest([swfType], hasNative); } }); }; - var options = webshims.cfg.mediaelement; + var wsCfg = webshims.cfg; + var options = wsCfg.mediaelement; var hasFullTrackSupport; var hasSwf; if(!options){ webshims.error("mediaelement wasn't implemented but loaded"); return; @@ -596,11 +551,11 @@ } })(); } hasFullTrackSupport = Modernizr.track && !bugs.track; -webshims.register('mediaelement-core', function($, webshims, window, document, undefined){ +webshims.register('mediaelement-core', function($, webshims, window, document, undefined, options){ hasSwf = swfmini.hasFlashPlayerVersion('9.0.115'); $('html').addClass(hasSwf ? 'swf' : 'no-swf'); var mediaelement = webshims.mediaelement; mediaelement.parseRtmp = function(data){ @@ -680,15 +635,25 @@ var hasYt = !hasSwf && ('postMessage' in window) && hasNative; var loadTrackUi = function(){ if(loadTrackUi.loaded){return;} loadTrackUi.loaded = true; - webshims.ready('WINDOWLOAD', function(){ - loadThird(); - webshims.loader.loadList(['track-ui']); - }); + if(!options.noAutoTrack){ + webshims.ready('WINDOWLOAD', function(){ + loadThird(); + webshims.loader.loadList(['track-ui']); + }); + } }; +// var loadMediaGroup = function(){ +// if(!loadMediaGroup.loaded){ +// loadMediaGroup.loaded = true; +// webshims.ready(window.MediaController ? 'WINDOWLOAD' : 'DOM', function(){ +// webshims.loader.loadList(['mediagroup']); +// }); +// } +// }; var loadYt = (function(){ var loaded; return function(){ if(loaded || !hasYt){return;} loaded = true; @@ -709,10 +674,15 @@ webshims.addPolyfill('mediaelement-yt', { test: !hasYt, d: ['dom-support'] }); + +// webshims.addModule('mediagroup', { +// d: ['mediaelement', 'dom-support'] +// }); + mediaelement.mimeTypes = { audio: { //ogm shouldn´t be used! 'audio/ogg': ['ogg','oga', 'ogm'], 'audio/ogg;codecs="opus"': 'opus', @@ -1007,21 +977,20 @@ } } }; - - webshims.ready('dom-support', function(){ handleMedia = true; if(!supportsLoop){ webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop'); } ['audio', 'video'].forEach(function(nodeName){ - var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', { + var supLoad, supController; + supLoad = webshims.defineNodeNameProperty(nodeName, 'load', { prop: { value: function(){ var data = webshims.data(this, 'mediaelement'); selectSource(this, data); if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){ @@ -1048,11 +1017,63 @@ } return ret; } } }); + +// supController = webshims.defineNodeNameProperty(nodeName, 'controller', { +// prop: { +// get: function(type){ +// if(!loadMediaGroup.loaded){ +// loadMediaGroup(); +// } +// if(mediaelement.controller){ +// return mediaelement.controller[nodeName].get.apply(this, arguments); +// } +// return supController.prop._supget && supController.prop._supget.apply(this, arguments); +// }, +// set: function(){ +// var that = this; +// var args = arguments; +// if(!loadMediaGroup.loaded){ +// loadMediaGroup(); +// } +// if(mediaelement.controller){ +// return mediaelement.controller[nodeName].set.apply(that, args); +// } else { +// webshims.ready('mediagroup', function(){ +// mediaelement.controller[nodeName].set.apply(that, args); +// }); +// } +// return supController.prop._supset && supController.prop._supset.apply(this, arguments); +// } +// } +// }); + +// webshims.ready('mediagroup', function(){ +// mediaelement.controller[nodeName].sup = supController; +// }); }); + +// webshims.onNodeNamesPropertyModify(['audio', 'video'], ['mediaGroup'], { +// set: function(){ +// var that = this; +// var args = arguments; +// if(!loadMediaGroup.loaded){ +// loadMediaGroup(); +// } +// if(mediaelement.mediagroup){ +// mediaelement.mediagroup.set.apply(that, args); +// } else { +// webshims.ready('mediagroup', function(){ +// mediaelement.mediagroup.set.apply(that, args); +// }); +// } +// }, +// initAttr: true +// }); + webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], { set: function(){ var elem = this; var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {}); clearTimeout(baseData.loadTimer); @@ -1070,10 +1091,13 @@ .each(testFixMedia) ; if(!loadTrackUi.loaded && $('track', media).length){ loadTrackUi(); } +// if(!loadMediaGroup.loaded && this.getAttribute('mediagroup')){ +// loadMediaGroup(); +// } media = null; }); }); if(hasNative && !handleMedia){ @@ -1084,12 +1108,9 @@ .each(function(){ if(!mediaelement.canNativePlaySrces(this)){ loadThird(); handleMedia = true; return false; - } - if((!hasFullTrackSupport || webshims.modules.track.options.override) && !loadTrackUi.loaded && $('track', this).length){ - loadTrackUi(); } }) ; } }); \ No newline at end of file