agenda-libre-ruby/public/webshims/1.15.9/shims/jme/mediacontrols-lazy.js

1 line
21 KiB
JavaScript
Raw Normal View History

webshims.register("mediacontrols-lazy",function(a,b,c,d,e){"use strict";function f(a){var b,c;a.release===!0&&(a.release=a.set);var d={start:function(){c||(c=!0,a.start&&a.start())},release:function(){c&&(c=!1,a.release&&a.release())},get:function(){return c?void 0:a.get.apply(this,arguments)},set:function(){var c=this,e=arguments;d.start(),clearTimeout(b),b=setTimeout(function(){a.set.apply(c,e)},33)}};return d.fns=a,d}function g(b){var c=a.grep(b,u.chapters),d=c;return c.length>1&&(c=a.grep(c,u.chapters)),c.length?c.length>1&&(c=a.grep(c,u.notDisabled)):c=d,c.length?c.length>1&&(c=a.grep(c,u.activeLang)):c=d,c.length?c.length>1&&(c=a.grep(c,u.activePartialLang)):c=d,c[0]||d[0]||null}function h(a){var b='<li role="presentation">'+this.html.replace("{{startTime}}",a.startTime).replace("{{endTime}}",a.endTime).replace("{{title}}",a.title);return a.list&&a.list.length&&(b+='\n<ul role="presentation">'+a.list.map(h,this).join("\n ")+"</ul>\n"),b+="</li>"}function i(a){var b,c,d,e;if(a.length)for(c=a[0].startTime,d=a[a.length-1].endTime,e=100/(d-c),b=0;b<a.length;b++)a[b].rel=(a[b].endTime-a[b].startTime)*e,b==a.length-1?(a[b].last=!0,a[b].style="overflow: hidden;"):a[b].style="float: left; width: "+a[b].rel+"%;",i(a[b].list)}function j(a){var b="__chaptertree"+a.cues.length;if(a[b])return a[b];var c,d,e,f=[],g=null;for(d=0;d<a.cues.length;d++)c=a.cues[d],g&&g.startTime>c.startTime||(g&&c.startTime>=g.endTime&&(g=g.parent),g&&c.endTime>g.endTime||(e={startTime:c.startTime,endTime:c.endTime,parent:g,list:[],title:c.text,cue:c},g?g.list.push(e):(g=e,f.push(e))));return i(f),a[b]=f,f}var k=a.jme.plugins,l="pseudoClasses",m={play:1,playing:1},n={pause:1,ended:1},o=function(){b.loader.loadList(["range-ui"])},p=function(a){o(),b.ready("range-ui",a)},q={subtitles:1,caption:1},r=function(b){var c=a.map(b,function(a){var b="caption"==a.kind?"caption-type":"subtitle-type",c=a.language;return c=c?' <span class="track-lang">'+c+"</span>":"",'<li class="'+b+'" role="presentation"><button role="menuitemcheckbox" type="button" tabindex="-1">'+a.label+c+"</button></li>"});return'<div><ul role="presentation">'+c.join("")+"</ul></div>"},s=b.domPrefixes,t=b.prefixed;a.fn.wsTouchClick||(a.fn.wsTouchClick=function(){var b="touchAction"in document.documentElement.style,d=!b&&"ontouchstart"in c&&document.addEventListener;return function(c,e){var f,g,h,i,j,k=function(){return i?void 0:e.apply(this,arguments)};return a.isFunction(c)?(e=c,c=!1,this.on("click",k)):this.on("click",c,k),d?(j=function(){i=!1},g=function(b){var c,d;b=b.originalEvent||{},a(this).off("touchend touchcancel",g);var h=b.changedTouches||b.touches;return"touchcancel"==b.type||!f||!h||1!=h.length||(d=h[0],Math.abs(f.x-d.pageX)>40||Math.abs(f.y-d.pageY)>40||Date.now()-f.now>300)?void 0:(b.preventDefault(),i=!0,setTimeout(j,400),c=e.apply(this,arguments))},h=function(b){var d,e;b&&1==b.touches.length&&(d=b.touches[0],e=c?a(d.target).closest(c):a(this),e.length&&(f={x:d.pageX,y:d.pageY,now:Date.now()},e.on("touchend touchcancel",g)))},this.each(function(){this.addEventListener("touchstart",h,!0)})):b&&!c&&this.css("touch-action","manipulation"),this}}()),a.extend(!0,k,{useractivity:{_create:function(a,b,c){c.on({useractive:function(){c.attr("data-useractivity","true")}}).on("userinactive",{idletime:3500},function(){c.attr("data-useractivity","false")}).triggerHandler("userinactive")}},"play-pause":{pseudoClasses:{play:"state-paused",pause:"state-playing"},_create:function(b,c){var d=a.jme.getButtonText(b,[this[l].play,this[l].pause]);c.on("play playing ended pause updateJMEState",function(a){var b=a.type;b=m[b]?1:n[b]?0:c.jmeProp("isPlaying")?1:0,d(b)}).triggerHandler("updateJMEState"),b.wsTouchClick(function(a){c.jmeFn("togglePlay"),a.stopPropagation()})}},"mute-unmute":{pseudoClasses:{mute:"state-mute",unmute:"state-unmute"},_create:function(b,c){var d=a.jme.getButtonText(b,[this[l].mute,this[l].unmute]);c.on("volumechange updateJMEState",function(){d(c.prop("muted")?1:0)}).triggerHandler("updateJMEState"),b.wsTouchClick(function(a){c.prop("muted",!c.prop("muted")),a.stopPropagat