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