flowplayer-files
Version:
Flowplayer js and css files for v2.5.9 after the reboot of flowplayer
2 lines (1 loc) • 10.1 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t=t||self).flowplayer=t.flowplayer||{},t.flowplayer.subtitles_html=e())}(this,(function(){"use strict";var t=[].slice;function e(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];for(var i in e)t[i]=e[i];return t}function n(t,e,n){for(var r=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);r.length;){if(null==t)return n;var i=r.shift();if("string"!=typeof i)return n;t=t[i]}return null==t?n:t}function r(e){return t.call(e)}function i(t,e){if(function(t){switch(t){case"":case"anonymous":case"use-credentials":return!0;default:console.warn("Invalid(crossorigin: %s) must be one of '', 'anonymous', or 'use-credentials'\nhttps://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes",t)}}(e=e||"anonymous"),t.crossOrigin!=e)return t.attr("crossorigin",e),t}function o(t){var e=document.createElement("a");return e.href=t,e.origin}function a(t,e){var n=document.createElement("track");n.className="fp-track renderable",n.kind="metadata",n.id=["fp",e.lang].join("-");var r=n.track;for(var a in"string"!=typeof e.crossorigin&&function(t,e){try{return t.src.indexOf("blob:"),o(t.src)!==o(e)}catch(t){return console.error(t),!0}}(t,e.src)&&(i(t),e.crossorigin=t.attr("crossorigin")),"crossorigin"in e&&i(t,e.crossorigin),e)n[a]=e[a];return r.mode="hidden",n.onload=function(){},r.oncuechange=function(e){t.emit(e.type,{track:e.target})},t.appendChild(n),n}var s=!!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(t){}return t}()&&{passive:!0},c=["touchstart","touchmove"];function u(t){return t.emit=function(n,r,i){i=i||{};var o=function(t){var e=document.createEvent("Event");return e.initEvent(t,!1,!0),e}(n);return r&&e(o,{data:r||{}}),t.dispatchEvent(o),!1===i.return_self?o:t},t.on=function(e,n){return"string"==typeof e&&(e=e.split(" ")),e.forEach((function(e){return function(t){return~c.indexOf(t)}(e)?t.addEventListener(e,n,s):t.addEventListener(e,n)})),t},t.off=function(e,n){return t.removeEventListener(e,n),t},t.one=t.once=function(e,n){return t.on(e,(function r(i){t.off(e,r),n(i)}))},t}var f=Array.isArray,l="undefined"!=typeof window&&u(window),d="undefined"!=typeof document&&u(document),p=["span","a","em","p","i"],v=p.concat(["div","strong","video","img","ol","ul","li","script"]);function m(t,e,n){var r=g(document.createElement(t));if(f(e)&&(n=e,e=!1),f(n)||(n=[n]),r.append(n.filter((function(t){return t}))),"object"!=typeof e)return r;for(var i in e)i in r?r[i]=e[i]:r.setAttribute(i,e[i]);return r}function g(t){return void 0===t||function(t){return t&&t.__flowplayer__}(t)?t:function(t){var e=t.tagName;t.__flowplayer__=1,t.find=function(e){var n=t.querySelector(e);return n?g(n):n},t.html=function(e){return t.innerHTML=e,t},t.empty=function(){return t.innerHTML="",t},t.offset=function(){var e={top:0,left:0},n=t;do{e.left+=n.offsetLeft||0,e.top+=n.offsetTop||0}while(n=n.offsetParent);return e},t.innerWidth=function(){var e=getComputedStyle(t);return t.clientWidth-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)};var n=t.insert=function(e,n){return f(n)?n.map((function(n){return t.insert(e,n)}))[0]:g(n="string"==typeof n?t.insertAdjacentHTML(e,n):t.insertAdjacentElement?t.insertAdjacentElement(e,n):t.appendChild(n))};return t.append=n.bind(t,"beforeend"),t.prepend=n.bind(t,"afterbegin"),t.css=function(e,n){if("object"==typeof e){for(var r in e)t.css(r,e[r]);return t}return void 0===n?getComputedStyle(t)[e]:(1*n&&(n+="px"),t.style[e]=n,t)},t.show=function(){return t.css({display:~p.indexOf(e)?"inline":"block"})},t.hide=function(){return t.css({display:"none"})},t.remove=function(){var e=t.parentNode;e&&e.removeChild(t)},t.attr=function(e,n){return null==n?t.getAttribute(e):(t.setAttribute(e,n),t)},t.txt=function(e){return t.textContent=e,t},t.fp=function(e){return t.addClass("fp-"+e)},t.addClass=function(e){return e.split(" ").forEach((function(e){t.hasClass(e)||(t.className+=(t.className?" ":"")+e)})),t},t.removeClass=function(e){e=e.split(" ");var n=t.className.split(" ");return t.className=n.filter((function(t){return!~e.indexOf(t)})).join(" "),t},t.toggleClass=function(e,n){return void 0===n&&(n=!t.hasClass(e)),n?t.addClass(e):t.removeClass(e)},t.findAll=function(e){return r(t.querySelectorAll(e))},t.hasClass=function(e){return~t.className.split(" ").indexOf(e)},t}(u(t))}function h(t,e){if("string"==typeof t&&"<"==t[0])return m(t.slice(1,-1),e);if("string"!=typeof t)return g(t);var n=e instanceof HTMLElement&&e.querySelector(".fp-"+t)||document.querySelector(t);return n?g(n):void 0}function y(t){var e=h.div("fp-captions");return e.on(["click","touchend"],(function(e){t.emit(e.type)})),e.onrender=function(t){e.empty(),t.forEach((function(t){var n=document.createElement("pre");n.className="fp-cue",n.appendChild(t.getCueAsHTML()),e.appendChild(n)}))},e}function b(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function E(t){var e,n,r=b("svg");return r.setAttribute("viewBox",t.coords),t.name&&r.setAttribute("class",t.name),t.title&&r.setAttribute("title",t.title),t.title&&r.setAttribute("aria-label",t.title),r.setAttribute("tabindex","0"),r.setAttribute("focusable","true"),r.appendChild((e=t.link,(n=b("use")).setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e),n)),h(r)}h.window=l,h.document=d,h.el=m,v.forEach((function(t){h[t]=function(e,n){return"string"==typeof e&&(e={class:e}),m(t,e,n)}}));var x={TOGGLE_OPEN:"menu:toggle:open",RENDER:"menu:render",PUSH:"menu:push"},C={ON:"fp-on",INVIS:"fp-invis"};function w(t,n,r){var i=r.id||"menu-"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5);return r=r||{},t.attr("role","button").attr("aria-haspopup","true").attr("aria-expanded","false").attr("aria-controls",i).attr("aria-label",r.title),r.options=r.options||[],r.id=i,w._interface(t,n,function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.slice(1).reduce((function(t,n){return e(t,n)}),t[0]||{})}({},r))}return w.title=function(t){return h("<h3>").txt(t)},w.close=function(t){return h.span("fp-close").on("click",t).html("×")},w.option=function(t,e){var n=this,r=h("<li>").attr("tabindex","0").attr("role","menuitem"),i=n._attrs;t.icon&&r.append(E(t.icon)),r.append(h("<span>").txt(t.text)),r.on("click",(function(r){i.multi||n.options().forEach(w.off),n.activate(e),"function"==typeof t.onclick&&t.onclick(r,t,e,n)})),r.idx=e,n.append(r)},w._interface=function(t,e,r){t.addClass("fp-menu-container");var i=h("<ul>").attr("id",r.id).addClass("fp-menu").attr("role","menu");return r.icons&&i.addClass("fp-icons"),i._attrs=r,t.on("click",(function(t){setTimeout((function(){if(!t.defaultPrevented)return i.hasClass(C.ON)?e.emit(x.TOGGLE_OPEN,{menu:i,open:!1}):void e.emit(x.TOGGLE_OPEN,{menu:i,open:!0})}),0)})),i.on("mouseleave",(function(){e.emit(x.TOGGLE_OPEN,{menu:i,open:!1})})),e.on(x.TOGGLE_OPEN,(function(r){if(n(r,"data.menu")!==i)return i.toggleClass(C.ON,!1),t.attr("aria-expanded","false");var o=n(r,"data.open",!1);if(i.toggleClass(C.ON,o),t.attr("aria-expanded",o?"true":"false"),e.hasClass("is-accessibility"))if(o){var a=i.options()[0];a&&a.focus()}else t.focus()})),i.push=function(t){return i._attrs.options=n(i,"_attrs.options",[]),i._attrs.options.push(t),i.render()},i.select=function(t){return i.render(i.options.filter(t))},i.render=function(e){var n=i._attrs;return i.empty(),i.prepend(w.close()),n.title&&i.prepend(w.title(n.title)),n.options=e||n.options,n.options.forEach(w.option,i),t.toggleClass(C.INVIS,0==n.options.length),i._activate(),i},i.close=function(){i.hasClass(C.ON)&&e.emit(x.TOGGLE_OPEN,{menu:i,open:!1})},i._activate=function(){i.options().forEach((function(t){t.toggleClass(C.ON,t.idx===i.idx)}))},i.options=function(){return[].slice.call(i.querySelectorAll("li"))},i.activate=function(t,e){void 0===i.idx||i.idx!==t||e?i.idx=t:delete i.idx,i._activate()},i.deactivate=function(){i.activate(i.idx)},i.render(r.options),t.appendChild(i),i},w.on=function(t){return t.addClass(C.ON),t},w.off=function(t){return t.removeClass(C.ON),t},w.CONTAINER_CLASS="fp-menu",w.Events=x,w.States=C,function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});var n=t.flowplayer;return"function"==typeof n?(n(e),e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e),e)}(window,(function(t,i,o){if(function(){try{return"function"==typeof VTTCue.prototype.getCueAsHTML}catch(t){return!1}}()){var s=o._subtitles={tracks:[],trackEles:[],activeTracks:[],view:y(o),select:function(t){var e=s.activeTracks.slice(0);if(s.activeTracks.length=0,~e.indexOf(t))return s.btn.toggle(!1),s.view.onrender([]);s.btn.toggle(!0),s.activeTracks.push(t),o.emit("cuechange",{track:t})}};e(s,function(t,e){if(0!=t.reaper){var n=h.span("fp-cc fp-menu-container").attr("tabindex","0").txt(e._t("cc.button","CC")),r=w(n,t,{title:e._t("cc.menu_title","Subtitles"),options:[]});return n.on("click",(function(t){1===r.options().length&&(t.preventDefault(),r.options().shift().emit("click"))})),n.toggle=function(t){this.toggleClass("fp-color-text",t)},t.controls&&t.controls.append(n),{btn:n,menu:r}}}(i,o)),o.on("mount",(function(){if(!i.controls)return i.ui.appendChild(s.view);i.controls.insertAdjacentElement("beforebegin",s.view),i.controls.appendChild(s.btn)})),o.on("config",(function(t){var e=n(t,"data.subtitles.tracks",[]);if(s.tracks!==e){s.tracks=e,s.trackEles=s.tracks.map((function(t){return a(o,t)})),s.menu.render(s.trackEles.map((function(t){var e=t.track;return{text:e.label,onclick:s.select.bind(0,e)}})));var r=s.trackEles.filter((function(t){return t.default}));if(1==r.length){var i=r[0];s.select(i.track),s.menu.activate(s.trackEles.indexOf(i),!0)}s.btn.toggle(1==r.length)}})),o.on("cuechange",(function(t){var e=n(t,"data.track");if(~s.activeTracks.indexOf(e)){var i=r(n(e,"activeCues",[]));s.view.onrender(i)}}))}}))}));