le-player
Version:
The best HTML5 video player made for Lectoriy.
1 lines • 5.31 kB
JavaScript
!function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return t[i].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="/dist/js/",e(0)}({0:function(t,e,n){t.exports=n(73)},2:function(t,e){t.exports=$},73:function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),a=n(2),c=i(a),u=window.lePlayer,p=u.getComponent("Component"),d=u.getComponent("Icon"),h=u.secondsToTime,f=function(t){function e(t,n){o(this,e),n=c.default.extend({},{strokeDasharray:293,size:98},n);var i=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i._circleElement=i.element.find("svg circle"),i}return s(e,t),l(e,[{key:"createElement",value:function(){var t=this.options,e=t.strokeDasharray,n=t.size,i=('\n\t\t\t<div class="leplayer-next__play leplayer-play-button">\n <svg height="100%" version="1.1" viewBox="0 0 '+n+" "+n+'" class="leplayer-next__svg-spinner">\n <circle cx="'+-n/2+'" cy="'+n/2+'" fill-opacity="0" r="46.5" stroke="currentColor" stroke-dasharray="'+e+'" stroke-dashoffset="'+-1*e+'" stroke-width="6" transform="rotate(-90)">\n </circle>\n </svg>\n\t\t\t\t<div class="leplayer-next__button leplayer-play-button__button">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t').trim();return this.element=(0,c.default)("<div />").html(i).contents(),this.element.find(".leplayer-next__button").append(new d(this.player,{iconName:"play"}).element),this.element}},{key:"startAnimation",value:function(t){this._circleElement.stop().animate({"stroke-dashoffset":-2*this.options.strokeDasharray},this.options.timeout,t)}},{key:"stopAnimation",value:function(){this._circleElement.stop()}},{key:"radial",set:function(t){this._radial=t,this._circleElement.css("stroke-dashoffset",-(t+1)*this.options.strokeDasharray)},get:function(){return this._radial}}]),e}(p),y=function(t){function e(t,n){o(this,e),n=c.default.extend({},{title:"",description:"",timeout:1e4,auto:!1,fn:function(){}},n);var i=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return i.cancelButton=i.element.find(".leplayer-next__cancel"),i.player.on("play",function(){return i.hide()}),i.player.on("loadstart",function(){return i.hide()}),i.player.on("ended",function(){return i.show()}),i.player.on("timeupdate",function(){i.player.ended||i.hide()}),i.progressButton.element.on("click",i.next.bind(i)),i.cancelButton.on("click",i.cancel.bind(i)),i}return s(e,t),l(e,[{key:"createElement",value:function(){var t=this.options,e=t.timeout,n=t.title,i=t.description,o=t.poster,r=t.auto,s=t.time,l=('\n\t\t\t<div class="leplayer-next">\n <div class="leplayer-next__head">Следующее видео</div>\n\t\t\t\t<div class="leplayer-next__box">\n\t\t\t\t\t<div class="leplayer-next__poster">\n\t\t\t\t\t\t<div class="leplayer-next__mini-title">'+n+'</div>\n\t\t\t\t\t\t<div class="leplayer-next__cancel" role="button">Отмена</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="leplayer-next__content">\n <div class="leplayer-next__title">'+n+'</div>\n <div class="leplayer-next__description">'+i+"</div>\n "+(s?'<div class="leplayer-next__time">'+h(s)+"</div>":"")+"\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t").trim();return this.progressButton=new f(this.player,{timeout:e}),this.element=(0,c.default)("<div />").html(l).contents(),this.element.find(".leplayer-next__poster").append(this.progressButton.element),null!=o&&this.element.find(".leplayer-next__poster").css({"background-image":"url("+o+")"}),r&&this.addClass("leplayer-next--auto"),this.element}},{key:"cancel",value:function(){clearTimeout(this._timeout),this.removeClass("leplayer-next--auto")}},{key:"next",value:function(){null!=this.options.url?window.location=this.options.url:this.options.fn&&c.default.isFunction(this.options.fn)&&this.options.fn(this)}},{key:"show",value:function(){var t=this;this.cancelled||(this.element.show(),this.options.auto&&(this.progressButton.startAnimation(),clearTimeout(this._timeout),this._timeout=setTimeout(function(){return t.next()},this.options.timeout)))}},{key:"hide",value:function(){this.element.hide(),this.options.auto&&(this.progressButton.stopAnimation(),this.progressButton.radial=0,clearTimeout(this._timeout))}}]),e}(p);u.plugin("next",function(t){this._nextComponent=new y(this,t),this.innerElement.append(this._nextComponent.element)})}});