migrate emby-progressbar, itemrefreshindicator, progressring and slider to ES6 modules

This commit is contained in:
Cameron 2020-07-08 16:55:53 +01:00
parent 1f8ce6e6f4
commit 61af6779e5
5 changed files with 91 additions and 69 deletions

View file

@ -1,20 +1,19 @@
define([], function() {
'use strict';
/* eslint-disable indent */
var ProgressBarPrototype = Object.create(HTMLDivElement.prototype);
let ProgressBarPrototype = Object.create(HTMLDivElement.prototype);
function onAutoTimeProgress() {
var start = parseInt(this.getAttribute('data-starttime'));
var end = parseInt(this.getAttribute('data-endtime'));
const start = parseInt(this.getAttribute('data-starttime'));
const end = parseInt(this.getAttribute('data-endtime'));
var now = new Date().getTime();
var total = end - start;
var pct = 100 * ((now - start) / total);
const now = new Date().getTime();
const total = end - start;
let pct = 100 * ((now - start) / total);
pct = Math.min(100, pct);
pct = Math.max(0, pct);
var itemProgressBarForeground = this.querySelector('.itemProgressBarForeground');
const itemProgressBarForeground = this.querySelector('.itemProgressBarForeground');
itemProgressBarForeground.style.width = pct + '%';
}
@ -39,4 +38,5 @@ define([], function() {
prototype: ProgressBarPrototype,
extends: 'div'
});
});
/* eslint-enable indent */