filesbox/web/dist/design/designstatic/common/js/plyr.js

4 lines
42 KiB
JavaScript
Raw Permalink Normal View History

2024-07-26 06:10:54 +00:00
(function(u,p){"use strict";typeof module=="object"&&typeof module.exports=="object"?module.exports=p(u,document):typeof define=="function"&&define.amd?define([],function(){return p(u,document)}):u.plyr=p(u,document)})(typeof window!="undefined"?window:this,function(u,p){"use strict";function D(){var r,t,s,l=navigator.userAgent,d=navigator.appName,m=""+parseFloat(navigator.appVersion),x=parseInt(navigator.appVersion,10),k=!1,T=!1,R=!1,q=!1;return navigator.appVersion.indexOf("Windows NT")!==-1&&navigator.appVersion.indexOf("rv:11")!==-1?(k=!0,d="IE",m="11"):(t=l.indexOf("MSIE"))!==-1?(k=!0,d="IE",m=l.substring(t+5)):(t=l.indexOf("Chrome"))!==-1?(R=!0,d="Chrome",m=l.substring(t+7)):(t=l.indexOf("Safari"))!==-1?(q=!0,d="Safari",m=l.substring(t+7),(t=l.indexOf("Version"))!==-1&&(m=l.substring(t+8))):(t=l.indexOf("Firefox"))!==-1?(T=!0,d="Firefox",m=l.substring(t+8)):(r=l.lastIndexOf(" ")+1)<(t=l.lastIndexOf("/"))&&(d=l.substring(r,t),m=l.substring(t+1),d.toLowerCase()===d.toUpperCase()&&(d=navigator.appName)),(s=m.indexOf(";"))!==-1&&(m=m.substring(0,s)),(s=m.indexOf(" "))!==-1&&(m=m.substring(0,s)),x=parseInt(""+m,10),isNaN(x)&&(m=""+parseFloat(navigator.appVersion),x=parseInt(navigator.appVersion,10)),{name:d,version:x,isIE:k,isFirefox:T,isChrome:R,isSafari:q,isIos:/(iPad|iPhone|iPod)/g.test(navigator.platform),isIphone:/(iPhone|iPod)/g.test(navigator.userAgent),isTouch:"ontouchstart"in p.documentElement}}function re(r,t){var s=r.media;if(r.type==="video")switch(t){case"video/webm":return!(!s.canPlayType||!s.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/,""));case"video/mp4":return!(!s.canPlayType||!s.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/,""));case"video/ogg":return!(!s.canPlayType||!s.canPlayType('video/ogg; codecs="theora"').replace(/no/,""))}else if(r.type==="audio")switch(t){case"audio/mpeg":return!(!s.canPlayType||!s.canPlayType("audio/mpeg;").replace(/no/,""));case"audio/ogg":return!(!s.canPlayType||!s.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/,""));case"audio/wav":return!(!s.canPlayType||!s.canPlayType('audio/wav; codecs="1"').replace(/no/,""))}return!1}function de(r){if(!p.querySelectorAll('script[src="'+r+'"]').length){var t=p.createElement("script");t.src=r;var s=p.getElementsByTagName("script")[0];s.parentNode.insertBefore(t,s)}}function v(r,t){return Array.prototype.indexOf&&r.indexOf(t)!==-1}function Fe(r,t,s){return r.replace(new RegExp(t.replace(/([.*+?\^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),s)}function Ae(r,t){r.length||(r=[r]);for(var s=r.length-1;s>=0;s--){var l=s>0?t.cloneNode(!0):t,d=r[s],m=d.parentNode,x=d.nextSibling;return l.appendChild(d),x?m.insertBefore(l,x):m.appendChild(l),l}}function X(r){r&&r.parentNode.removeChild(r)}function Ie(r,t){r.insertBefore(t,r.firstChild)}function Ne(r,t){for(var s in t)r.setAttribute(s,i.boolean(t[s])&&t[s]?"":t[s])}function Pe(r,t,s){var l=p.createElement(r);Ne(l,s),Ie(t,l)}function Ge(r){return r.replace(".","")}function g(r,t,s){if(r)if(r.classList)r.classList[s?"add":"remove"](t);else{var l=(" "+r.className+" ").replace(/\s+/g," ").replace(" "+t+" ","");r.className=l+(s?" "+t:"")}}function W(r,t){return!!r&&(r.classList?r.classList.contains(t):new RegExp("(\\s|^)"+t+"(\\s|$)").test(r.className))}function Me(r,t){var s=Element.prototype,l=s.matches||s.webkitMatchesSelector||s.mozMatchesSelector||s.msMatchesSelector||function(d){return[].indexOf.call(p.querySelectorAll(d),this)!==-1};return l.call(r,t)}function V(r,t,s,l,d){h(r,t,function(m){s&&s.apply(r,[m]),l.apply(r,[m])},d)}function Oe(r,t,s,l,d){var m=t.split(" ");if(i.boolean(d)||(d=!1),r instanceof NodeList)for(var x=0;x<r.length;x++)r[x]instanceof Node&&Oe(r[x],arguments[1],arguments[2],arguments[3]);else for(var k=0;k<m.length;k++)r[l?"addEventListener":"removeEventListener"](m[k],s,d)}function h(r,t,s,l){r&&Oe(r,t,s,!0,l)}function Le(r,t,s,l){if(r&&t){i.boolean(s)||(s=!1);var d=new CustomEvent(t,{bubbles:s,detail:l});r.dispatchEvent(d)}}function $(r,t){if(r)return t=i.boolean(t)?t:!r.getAttribute("aria-pressed"),r.setAttribute("aria-pressed",t),t}
`;b.indexOf(F+F)===-1&&(F=b.indexOf("\r\r")!==-1?"\r":`
`),A=b.split(F+F);for(var L=0;L<A.length;L++){y=A[L],e.captions[L]=[];var ne=y.split(F),U=0;ne[U].indexOf(":")===-1&&(U=1),e.captions[L]=[ne[U],ne[U+1]]}e.captions.shift(),N("Successfully loaded the caption file via AJAX")}else te(t.logPrefix+"There was a problem loading the caption file via AJAX")},_.open("get",a,!0),_.send()}}else g(e.container,t.classes.captions.enabled)}}function T(n){var a=w(t.selectors.captions),o=p.createElement("span");a.innerHTML="",i.undefined(n)&&(n=""),i.string(n)?o.innerHTML=n.trim():o.appendChild(n),a.appendChild(o),a.offsetHeight}function R(n){function a(S,C){var I=[];I=S.split(" --> ");for(var _=0;_<I.length;_++)I[_]=I[_].replace(/(\d+:\d+:\d+\.\d+).*/,"$1");return f(I[C])}function o(S){return a(S,0)}function c(S){return a(S,1)}function f(S){if(S==null)return 0;var C,I=[],_=[];return I=S.split(","),_=I[0].split(":"),C=Math.floor(60*_[0]*60)+Math.floor(60*_[1])+Math.floor(_[2])}if(!e.usingTextTracks&&e.type==="video"&&e.supported.full&&(e.subcount=0,n=i.number(n)?n:e.media.currentTime,e.captions[e.subcount])){for(;c(e.captions[e.subcount][0])<n.toFixed(1);)if(e.subcount++,e.subcount>e.captions.length-1){e.subcount=e.captions.length-1;break}e.media.currentTime.toFixed(1)>=o(e.captions[e.subcount][0])&&e.media.currentTime.toFixed(1)<=c(e.captions[e.subcount][0])?(e.currentCaption=e.captions[e.subcount][1],T(e.currentCaption)):T()}}function q(){if(e.buttons.captions){g(e.container,t.classes.captions.enabled,!0);var n=e.storage.captionsEnabled;i.boolean(n)||(n=t.captions.defaultActive),n&&(g(e.container,t.classes.captions.active,!0),$(e.buttons.captions,!0))}}function P(n){return e.container.querySelectorAll(n)}function w(n){return P(n)[0]}function fe(){try{return u.self!==u.top}catch(n){return!0}}function Q(){function n(f){f.which===9&&e.isFullscreen&&(f.target!==c||f.shiftKey?f.target===o&&f.shiftKey&&(f.preventDefault(),c.focus()):(f.preventDefault(),o.focus()))}var a=P("input:not([disabled]), button:not([disabled])"),o=a[0],c=a[a.length-1];h(e.container,"keydown",n)}function H(n,a){if(i.string(a))Pe(n,e.media,{src:a});else if(a.constructor===Array)for(var o=a.length-1;o>=0;o--)Pe(n,e.media,a[o])}function Y(){if(t.loadSprite){var n=d();n.absolute?(N("AJAX loading absolute SVG sprite"+(e.browser.isIE?" (due to IE)":"")),je(n.url,"sprite-plyr")):N("Sprite will be used as external resource directly")}var a=t.html;N("Injecting custom controls"),a||(a=m()),a=Fe(a,"{seektime}",t.seekTime),a=Fe(a,"{id}",Math.floor(1e4*Math.random()));var o;if(i.string(t.selectors.controls.container)&&(o=p.querySelector(t.selectors.controls.container)),i.htmlElement(o)||(o=e.container),o.insertAdjacentHTML("beforeend",a),t.tooltips.controls)for(var c=P([t.selectors.controls.wrapper," ",t.selectors.labels," .",t.classes.hidden].join("")),f=c.length-1;f>=0;f--){var S=c[f];g(S,t.classes.hidden,!1),g(S,t.classes.tooltip,!0)}}function ye(){try{return e.controls=w(t.selectors.controls.wrapper),e.buttons={},e.buttons.seek=w(t.selectors.buttons.seek),e.buttons.play=P(t.selectors.buttons.play),e.buttons.pause=w(t.selectors.buttons.pause),e.buttons.restart=w(t.selectors.buttons.restart),e.buttons.rewind=w(t.selectors.buttons.rewind),e.buttons.forward=w(t.selectors.buttons.forward),e.buttons.fullscreen=w(t.selectors.buttons.fullscreen),e.buttons.mute=w(t.selectors.buttons.mute),e.buttons.captions=w(t.selectors.buttons.captions),e.progress={},e.progress.container=w(t.selectors.progress.container),e.progress.buffer={},e.progress.buffer.bar=w(t.selectors.progress.buffer),e.progress.buffer.text=e.progress.buffer.bar&&e.progress.buffer.bar.getElementsByTagName("span")[0],e.progress.played=w(t.selectors.progress.played),e.progress.tooltip=e.progress.container&&e.progress.container.querySelector("."+t.classes.tooltip),e.volume={},e.volume.input=w(t.selectors.volume.input),e.volume.display=w(t.selectors.volume.display),e.duration=w(t.selectors.duration),e.currentTime=w(t.selectors.currentTime),e.seekTime=P(t.selectors.seekTime),!0}catch(n){return te("It looks like there is a problem with your controls HTML"),oe(!0),!1}}function z(){