1 line
No EOL
748 B
JavaScript
1 line
No EOL
748 B
JavaScript
function onAutoTimeProgress(){var start=parseInt(this.getAttribute("data-starttime")),end=parseInt(this.getAttribute("data-endtime")),end=(Date.now()-start)/(end-start)*100,end=Math.min(100,end);end=Math.max(0,end),this.querySelector(".itemProgressBarForeground").style.width=end+"%"}class EmbyProgressBar extends HTMLDivElement{constructor(){return super()}connectedCallback(){this.timeInterval&&clearInterval(this.timeInterval),"time"===this.getAttribute("data-automode")&&(this.timeInterval=setInterval(onAutoTimeProgress.bind(this),6e4))}disconnectedCallback(){this.timeInterval&&(clearInterval(this.timeInterval),this.timeInterval=null)}}customElements.define("emby-progressbar",EmbyProgressBar,{extends:"div"});export default EmbyProgressBar; |