mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix prefer for-of errors
This commit is contained in:
parent
ef719c45f4
commit
1b03cd79eb
11 changed files with 26 additions and 47 deletions
|
@ -23,8 +23,7 @@ function populateLanguages(parent) {
|
||||||
function populateLanguagesIntoSelect(select, languages) {
|
function populateLanguagesIntoSelect(select, languages) {
|
||||||
let html = '';
|
let html = '';
|
||||||
html += "<option value=''></option>";
|
html += "<option value=''></option>";
|
||||||
for (let i = 0; i < languages.length; i++) {
|
for (const culture of languages) {
|
||||||
const culture = languages[i];
|
|
||||||
html += `<option value='${culture.TwoLetterISOLanguageName}'>${culture.DisplayName}</option>`;
|
html += `<option value='${culture.TwoLetterISOLanguageName}'>${culture.DisplayName}</option>`;
|
||||||
}
|
}
|
||||||
select.innerHTML = html;
|
select.innerHTML = html;
|
||||||
|
@ -32,8 +31,7 @@ function populateLanguagesIntoSelect(select, languages) {
|
||||||
|
|
||||||
function populateLanguagesIntoList(element, languages) {
|
function populateLanguagesIntoList(element, languages) {
|
||||||
let html = '';
|
let html = '';
|
||||||
for (let i = 0; i < languages.length; i++) {
|
for (const culture of languages) {
|
||||||
const culture = languages[i];
|
|
||||||
html += `<label><input type="checkbox" is="emby-checkbox" class="chkSubtitleLanguage" data-lang="${culture.ThreeLetterISOLanguageName.toLowerCase()}" /><span>${culture.DisplayName}</span></label>`;
|
html += `<label><input type="checkbox" is="emby-checkbox" class="chkSubtitleLanguage" data-lang="${culture.ThreeLetterISOLanguageName.toLowerCase()}" /><span>${culture.DisplayName}</span></label>`;
|
||||||
}
|
}
|
||||||
element.innerHTML = html;
|
element.innerHTML = html;
|
||||||
|
@ -43,8 +41,7 @@ function populateCountries(select) {
|
||||||
return ApiClient.getCountries().then(allCountries => {
|
return ApiClient.getCountries().then(allCountries => {
|
||||||
let html = '';
|
let html = '';
|
||||||
html += "<option value=''></option>";
|
html += "<option value=''></option>";
|
||||||
for (let i = 0; i < allCountries.length; i++) {
|
for (const culture of allCountries) {
|
||||||
const culture = allCountries[i];
|
|
||||||
html += `<option value='${culture.TwoLetterISORegionName}'>${culture.DisplayName}</option>`;
|
html += `<option value='${culture.TwoLetterISORegionName}'>${culture.DisplayName}</option>`;
|
||||||
}
|
}
|
||||||
select.innerHTML = html;
|
select.innerHTML = html;
|
||||||
|
@ -109,8 +106,7 @@ function renderMetadataSavers(page, metadataSavers) {
|
||||||
}
|
}
|
||||||
html += `<h3 class="checkboxListLabel">${globalize.translate('LabelMetadataSavers')}</h3>`;
|
html += `<h3 class="checkboxListLabel">${globalize.translate('LabelMetadataSavers')}</h3>`;
|
||||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||||
for (let i = 0; i < metadataSavers.length; i++) {
|
for (const plugin of metadataSavers) {
|
||||||
const plugin = metadataSavers[i];
|
|
||||||
html += `<label><input type="checkbox" data-defaultenabled="${plugin.DefaultEnabled}" is="emby-checkbox" class="chkMetadataSaver" data-pluginname="${escapeHtml(plugin.Name)}" ${false}><span>${escapeHtml(plugin.Name)}</span></label>`;
|
html += `<label><input type="checkbox" data-defaultenabled="${plugin.DefaultEnabled}" is="emby-checkbox" class="chkMetadataSaver" data-pluginname="${escapeHtml(plugin.Name)}" ${false}><span>${escapeHtml(plugin.Name)}</span></label>`;
|
||||||
}
|
}
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
@ -157,8 +153,7 @@ function getMetadataFetchersForTypeHtml(availableTypeOptions, libraryOptionsForT
|
||||||
|
|
||||||
function getTypeOptions(allOptions, type) {
|
function getTypeOptions(allOptions, type) {
|
||||||
const allTypeOptions = allOptions.TypeOptions || [];
|
const allTypeOptions = allOptions.TypeOptions || [];
|
||||||
for (let i = 0; i < allTypeOptions.length; i++) {
|
for (const typeOptions of allTypeOptions) {
|
||||||
const typeOptions = allTypeOptions[i];
|
|
||||||
if (typeOptions.Type === type) return typeOptions;
|
if (typeOptions.Type === type) return typeOptions;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -167,8 +162,7 @@ function getTypeOptions(allOptions, type) {
|
||||||
function renderMetadataFetchers(page, availableOptions, libraryOptions) {
|
function renderMetadataFetchers(page, availableOptions, libraryOptions) {
|
||||||
let html = '';
|
let html = '';
|
||||||
const elem = page.querySelector('.metadataFetchers');
|
const elem = page.querySelector('.metadataFetchers');
|
||||||
for (let i = 0; i < availableOptions.TypeOptions.length; i++) {
|
for (const availableTypeOptions of availableOptions.TypeOptions) {
|
||||||
const availableTypeOptions = availableOptions.TypeOptions[i];
|
|
||||||
html += getMetadataFetchersForTypeHtml(availableTypeOptions, getTypeOptions(libraryOptions, availableTypeOptions.Type) || {});
|
html += getMetadataFetchersForTypeHtml(availableTypeOptions, getTypeOptions(libraryOptions, availableTypeOptions.Type) || {});
|
||||||
}
|
}
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
@ -262,8 +256,7 @@ function getImageFetchersForTypeHtml(availableTypeOptions, libraryOptionsForType
|
||||||
function renderImageFetchers(page, availableOptions, libraryOptions) {
|
function renderImageFetchers(page, availableOptions, libraryOptions) {
|
||||||
let html = '';
|
let html = '';
|
||||||
const elem = page.querySelector('.imageFetchers');
|
const elem = page.querySelector('.imageFetchers');
|
||||||
for (let i = 0; i < availableOptions.TypeOptions.length; i++) {
|
for (const availableTypeOptions of availableOptions.TypeOptions) {
|
||||||
const availableTypeOptions = availableOptions.TypeOptions[i];
|
|
||||||
html += getImageFetchersForTypeHtml(availableTypeOptions, getTypeOptions(libraryOptions, availableTypeOptions.Type) || {});
|
html += getImageFetchersForTypeHtml(availableTypeOptions, getTypeOptions(libraryOptions, availableTypeOptions.Type) || {});
|
||||||
}
|
}
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
@ -454,8 +447,7 @@ function setSubtitleFetchersIntoOptions(parent, options) {
|
||||||
|
|
||||||
function setMetadataFetchersIntoOptions(parent, options) {
|
function setMetadataFetchersIntoOptions(parent, options) {
|
||||||
const sections = parent.querySelectorAll('.metadataFetcher');
|
const sections = parent.querySelectorAll('.metadataFetcher');
|
||||||
for (let i = 0; i < sections.length; i++) {
|
for (const section of sections) {
|
||||||
const section = sections[i];
|
|
||||||
const type = section.getAttribute('data-type');
|
const type = section.getAttribute('data-type');
|
||||||
let typeOptions = getTypeOptions(options, type);
|
let typeOptions = getTypeOptions(options, type);
|
||||||
if (!typeOptions) {
|
if (!typeOptions) {
|
||||||
|
@ -478,8 +470,7 @@ function setMetadataFetchersIntoOptions(parent, options) {
|
||||||
|
|
||||||
function setImageFetchersIntoOptions(parent, options) {
|
function setImageFetchersIntoOptions(parent, options) {
|
||||||
const sections = parent.querySelectorAll('.imageFetcher');
|
const sections = parent.querySelectorAll('.imageFetcher');
|
||||||
for (let i = 0; i < sections.length; i++) {
|
for (const section of sections) {
|
||||||
const section = sections[i];
|
|
||||||
const type = section.getAttribute('data-type');
|
const type = section.getAttribute('data-type');
|
||||||
let typeOptions = getTypeOptions(options, type);
|
let typeOptions = getTypeOptions(options, type);
|
||||||
if (!typeOptions) {
|
if (!typeOptions) {
|
||||||
|
@ -503,8 +494,7 @@ function setImageFetchersIntoOptions(parent, options) {
|
||||||
|
|
||||||
function setImageOptionsIntoOptions(options) {
|
function setImageOptionsIntoOptions(options) {
|
||||||
const originalTypeOptions = (currentLibraryOptions || {}).TypeOptions || [];
|
const originalTypeOptions = (currentLibraryOptions || {}).TypeOptions || [];
|
||||||
for (let i = 0; i < originalTypeOptions.length; i++) {
|
for (const originalTypeOption of originalTypeOptions) {
|
||||||
const originalTypeOption = originalTypeOptions[i];
|
|
||||||
let typeOptions = getTypeOptions(options, originalTypeOption.Type);
|
let typeOptions = getTypeOptions(options, originalTypeOption.Type);
|
||||||
|
|
||||||
if (!typeOptions) {
|
if (!typeOptions) {
|
||||||
|
|
|
@ -955,8 +955,7 @@ function populatePeople(context, people) {
|
||||||
|
|
||||||
function getLockedFieldsHtml(fields, currentFields) {
|
function getLockedFieldsHtml(fields, currentFields) {
|
||||||
let html = '';
|
let html = '';
|
||||||
for (let i = 0; i < fields.length; i++) {
|
for (const field of fields) {
|
||||||
const field = fields[i];
|
|
||||||
const name = field.name;
|
const name = field.name;
|
||||||
const value = field.value || field.name;
|
const value = field.value || field.name;
|
||||||
const checkedHtml = currentFields.indexOf(value) === -1 ? ' checked' : '';
|
const checkedHtml = currentFields.indexOf(value) === -1 ? ' checked' : '';
|
||||||
|
|
|
@ -853,11 +853,9 @@ class PlaybackManager {
|
||||||
user: user
|
user: user
|
||||||
});
|
});
|
||||||
|
|
||||||
for (let i = 0; i < responses.length; i++) {
|
for (const subTargets of responses) {
|
||||||
const subTargets = responses[i];
|
for (const subTarget of subTargets) {
|
||||||
|
targets.push(subTarget);
|
||||||
for (let j = 0; j < subTargets.length; j++) {
|
|
||||||
targets.push(subTargets[j]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,7 @@ function populateVersions(packageInfo, page, installedPlugin) {
|
||||||
return b.timestamp < a.timestamp ? -1 : 1;
|
return b.timestamp < a.timestamp ? -1 : 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
for (let i = 0; i < packageInfo.versions.length; i++) {
|
for (const version of packageInfo.versions) {
|
||||||
const version = packageInfo.versions[i];
|
|
||||||
html += '<option value="' + version.version + '">' + globalize.translate('PluginFromRepo', version.version, version.repositoryName) + '</option>';
|
html += '<option value="' + version.version + '">' + globalize.translate('PluginFromRepo', version.version, version.repositoryName) + '</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,7 @@ function populateList(options) {
|
||||||
let currentCategory = null;
|
let currentCategory = null;
|
||||||
let html = '';
|
let html = '';
|
||||||
|
|
||||||
for (let i = 0; i < availablePlugins.length; i++) {
|
for (const plugin of availablePlugins) {
|
||||||
const plugin = availablePlugins[i];
|
|
||||||
const category = plugin.categoryDisplayName;
|
const category = plugin.categoryDisplayName;
|
||||||
if (category != currentCategory) {
|
if (category != currentCategory) {
|
||||||
if (currentCategory) {
|
if (currentCategory) {
|
||||||
|
|
|
@ -133,8 +133,7 @@ function updateTaskButton(elem, state) {
|
||||||
|
|
||||||
export default function(view) {
|
export default function(view) {
|
||||||
function updateTasks(tasks) {
|
function updateTasks(tasks) {
|
||||||
for (let i = 0; i < tasks.length; i++) {
|
for (const task of tasks) {
|
||||||
const task = tasks[i];
|
|
||||||
view.querySelector('#taskProgress' + task.Id).innerHTML = getTaskProgressHtml(task);
|
view.querySelector('#taskProgress' + task.Id).innerHTML = getTaskProgressHtml(task);
|
||||||
updateTaskButton(view.querySelector('#btnTask' + task.Id), task.State);
|
updateTaskButton(view.querySelector('#btnTask' + task.Id), task.State);
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,9 +135,7 @@ function showManualForm(context, showCancel, focusPassword) {
|
||||||
function loadUserList(context, apiClient, users) {
|
function loadUserList(context, apiClient, users) {
|
||||||
let html = '';
|
let html = '';
|
||||||
|
|
||||||
for (let i = 0; i < users.length; i++) {
|
for (const user of users) {
|
||||||
const user = users[i];
|
|
||||||
|
|
||||||
// TODO move card creation code to Card component
|
// TODO move card creation code to Card component
|
||||||
let cssClass = 'card squareCard scalableCard squareCard-scalable';
|
let cssClass = 'card squareCard scalableCard squareCard-scalable';
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@ function calculateOffset(textarea) {
|
||||||
const props = ['paddingTop', 'paddingBottom'];
|
const props = ['paddingTop', 'paddingBottom'];
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
|
|
||||||
for (let i = 0; i < props.length; i++) {
|
for (const prop of props) {
|
||||||
offset += parseInt(style[props[i]], 10);
|
offset += parseInt(style[prop], 10);
|
||||||
}
|
}
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,9 @@ function onOpen() {
|
||||||
const playerId = localStorage.getItem('autocastPlayerId');
|
const playerId = localStorage.getItem('autocastPlayerId');
|
||||||
|
|
||||||
playbackManager.getTargets().then(function (targets) {
|
playbackManager.getTargets().then(function (targets) {
|
||||||
for (let i = 0; i < targets.length; i++) {
|
for (const target of targets) {
|
||||||
if (targets[i].id == playerId) {
|
if (target.id == playerId) {
|
||||||
playbackManager.trySetActivePlayer(targets[i].playerName, targets[i]);
|
playbackManager.trySetActivePlayer(target.playerName, target);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,8 +167,8 @@ function supportsCssAnimation(allowPrefix) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (animation === false && allowPrefix) {
|
if (animation === false && allowPrefix) {
|
||||||
for (let i = 0; i < domPrefixes.length; i++) {
|
for (const domPrefix of domPrefixes) {
|
||||||
if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) {
|
if (elm.style[domPrefix + 'AnimationName'] !== undefined) {
|
||||||
animation = true;
|
animation = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -591,13 +591,10 @@ function getToolsLinkHtml(item) {
|
||||||
|
|
||||||
function getToolsMenuHtml(apiClient) {
|
function getToolsMenuHtml(apiClient) {
|
||||||
return getToolsMenuLinks(apiClient).then(function (items) {
|
return getToolsMenuLinks(apiClient).then(function (items) {
|
||||||
let item;
|
|
||||||
let menuHtml = '';
|
let menuHtml = '';
|
||||||
menuHtml += '<div class="drawerContent">';
|
menuHtml += '<div class="drawerContent">';
|
||||||
|
|
||||||
for (let i = 0; i < items.length; i++) {
|
for (const item of items) {
|
||||||
item = items[i];
|
|
||||||
|
|
||||||
if (item.href) {
|
if (item.href) {
|
||||||
menuHtml += getToolsLinkHtml(item);
|
menuHtml += getToolsLinkHtml(item);
|
||||||
} else if (item.name) {
|
} else if (item.name) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue