Code hygiene

This commit is contained in:
Erik Thuning 2023-01-09 16:59:36 +01:00
parent 069d746871
commit b8467ee8ec

@ -181,7 +181,7 @@
choiceList=[], defaultIndex=0) {
const wrapper = createElement('div', {'id': `${name}-select`,
'class': 'select'});
if(choiceList.length == 0) {
if(choiceList.length === 0) {
return wrapper;
}
wrapper.createChild('button',
@ -199,9 +199,9 @@
}
function randString(length) {
var pool = 'abcdefghijklmnopqrstuvwxyz1234567890';
var out = '';
for(var i=0; i<length; i++) {
let pool = 'abcdefghijklmnopqrstuvwxyz1234567890';
let out = '';
for(let i=0; i<length; ++i) {
out += pool.charAt(Math.floor(Math.random() * pool.length));
}
return out;
@ -797,7 +797,7 @@
const inc = buffer.width / control.duration;
const buffered = control.buffered;
for(let i = 0; i < buffered.length; i++) {
for(let i = 0; i < buffered.length; ++i) {
const start = buffered.start(i) * inc;
const end = buffered.end(i) * inc;
const width = end - start;
@ -862,7 +862,6 @@
}
});
}
//¤¤¤
}
/*
@ -1016,7 +1015,6 @@
['Av']);
this._subtitleChoices = list.querySelectorAll('button');
console.log('foo', this._subtitleChoices);
this._subtitleChoices.forEach((button) => {
button.addEventListener('click', (event) => {
const choice = event.currentTarget.dataset.choice;
@ -1025,7 +1023,7 @@
}
current.dataset.subtitlesState = choice;
const length = this._mainSource.textTracks.length;
for(let i=0; i<length; i++) {
for(let i=0; i<length; ++i) {
const track = this._mainSource.textTracks[i];
if(choice !== 'off' && track.label === choice) {
track.mode = 'showing';
@ -1159,7 +1157,7 @@
*/
syncSources() {
this._sources.forEach((source) => {
if(source == this._controlSource) {
if(source === this._controlSource) {
return;
}
source.currentTime = this._controlSource.currentTime;
@ -1184,7 +1182,7 @@
switchIcons(newMainParent);
let oldTrackLabel = null;
for(let i=0; i<this._mainSource.textTracks.length; i++) {
for(let i=0; i<this._mainSource.textTracks.length; ++i) {
const track = this._mainSource.textTracks[i];
if(track.mode === "showing") {
track.mode = "disabled";
@ -1193,7 +1191,7 @@
}
}
if(oldTrackLabel !== null) {
for(let i=0; i<newMain.textTracks.length; i++) {
for(let i=0; i<newMain.textTracks.length; ++i) {
const track = newMain.textTracks[i];
if(track.label === oldTrackLabel) {
track.mode = "showing";