Formatting

This commit is contained in:
Erik Thuning 2022-10-27 14:30:05 +02:00
parent 3be3acc90f
commit a84e1ff781

@ -156,13 +156,16 @@
if(typeof HTMLElement.prototype.createChild === 'undefined') {
HTMLElement.prototype.createChild = createChild;
} else {
throw new Error("HTMLElement.prototype.createChild already exists. This will require a patch.");
throw new Error(
"HTMLElement.prototype.createChild already exists. "
+ "This will require a patch.");
}
function createIcon(hrefs, attributes={}) {
const alternatives = [];
for(let i=0; i<hrefs.length; ++i) {
const icon = createSVGElement('use', {'href': `#${hrefs[i]}-icon`});
const icon = createSVGElement('use',
{'href': `#${hrefs[i]}-icon`});
if(i>0) {
icon.setAttribute('class', 'hidden');
}
@ -272,7 +275,8 @@
this.initSidebar(sidebar);
this._playlistUI.push(sidebar);
const controlRoot = this._root.createChild('div', {'id': 'controls'});
const controlRoot = this._root.createChild('div',
{'id': 'controls'});
this.initProgressBar(controlRoot.createChild(
'div', {'id': 'progress-container'}));
this.initLeftControls(controlRoot.createChild(
@ -438,11 +442,12 @@
'data-title_alt_en': 'Unmute'},
[createIcon(['volume', 'mute'])]);
const volumeSlider = parent.createChild('input', {'id': 'volume',
'type': 'range',
'min': '0',
'max': '1',
'step': '0.01'});
const volumeSlider = parent.createChild('input',
{'id': 'volume',
'type': 'range',
'min': '0',
'max': '1',
'step': '0.01'});
volumeSlider.value = 1;
volumeButton.addEventListener('click', (event) => {
@ -657,7 +662,9 @@
.createChild('a', {'href': item.link});
link.createChild('img', {'src': item.thumb});
link.createChild('span', {'class': 'title'}, [item.title]);
link.createChild('span', {'class': 'desc'}, [item.description]);
link.createChild('span',
{'class': 'desc'},
[item.description]);
}
this.showPlaylistUI(true);
this.setActivePlaylistItem();
@ -753,7 +760,8 @@
*/
formatTime(time) {
var hours = (Math.floor(time / 3600) + '').padStart(2, '0');
var minutes = (Math.floor((time % 3600) / 60) + '').padStart(2, '0');
var minutes = (Math.floor((time % 3600) / 60)
+ '').padStart(2, '0');
var seconds = (Math.round(time % 60) + '').padStart(2, '0');
if(this._presentation.duration > 3600) {
return hours +':'+ minutes +':'+ seconds;