mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #4552 from rqres/fix-codesmell-for-of
Refactor `for` loops to `for-of` loops
This commit is contained in:
commit
01acfeb3ac
2 changed files with 11 additions and 14 deletions
|
@ -679,9 +679,8 @@ function getCardTextLines(lines, cssClass, forceLines, isOuterFooter, cardLayout
|
||||||
|
|
||||||
let valid = 0;
|
let valid = 0;
|
||||||
|
|
||||||
for (let i = 0; i < lines.length; i++) {
|
for (const text of lines) {
|
||||||
let currentCssClass = cssClass;
|
let currentCssClass = cssClass;
|
||||||
const text = lines[i];
|
|
||||||
|
|
||||||
if (valid > 0 && isOuterFooter) {
|
if (valid > 0 && isOuterFooter) {
|
||||||
currentCssClass += ' cardText-secondary';
|
currentCssClass += ' cardText-secondary';
|
||||||
|
@ -862,8 +861,8 @@ function getCardFooterText(item, apiClient, options, footerClass, progressHtml,
|
||||||
|
|
||||||
if (options.textLines) {
|
if (options.textLines) {
|
||||||
const additionalLines = options.textLines(item);
|
const additionalLines = options.textLines(item);
|
||||||
for (let i = 0; i < additionalLines.length; i++) {
|
for (const additionalLine of additionalLines) {
|
||||||
lines.push(additionalLines[i]);
|
lines.push(additionalLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1721,8 +1720,7 @@ export function onTimerCreated(programId, newTimerId, itemsContainer) {
|
||||||
export function onTimerCancelled(timerId, itemsContainer) {
|
export function onTimerCancelled(timerId, itemsContainer) {
|
||||||
const cells = itemsContainer.querySelectorAll('.card[data-timerid="' + timerId + '"]');
|
const cells = itemsContainer.querySelectorAll('.card[data-timerid="' + timerId + '"]');
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i++) {
|
for (const cell of cells) {
|
||||||
const cell = cells[i];
|
|
||||||
const icon = cell.querySelector('.timerIndicator');
|
const icon = cell.querySelector('.timerIndicator');
|
||||||
if (icon) {
|
if (icon) {
|
||||||
icon.parentNode.removeChild(icon);
|
icon.parentNode.removeChild(icon);
|
||||||
|
@ -1739,8 +1737,7 @@ export function onTimerCancelled(timerId, itemsContainer) {
|
||||||
export function onSeriesTimerCancelled(cancelledTimerId, itemsContainer) {
|
export function onSeriesTimerCancelled(cancelledTimerId, itemsContainer) {
|
||||||
const cells = itemsContainer.querySelectorAll('.card[data-seriestimerid="' + cancelledTimerId + '"]');
|
const cells = itemsContainer.querySelectorAll('.card[data-seriestimerid="' + cancelledTimerId + '"]');
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i++) {
|
for (const cell of cells) {
|
||||||
const cell = cells[i];
|
|
||||||
const icon = cell.querySelector('.timerIndicator');
|
const icon = cell.querySelector('.timerIndicator');
|
||||||
if (icon) {
|
if (icon) {
|
||||||
icon.parentNode.removeChild(icon);
|
icon.parentNode.removeChild(icon);
|
||||||
|
|
|
@ -100,10 +100,10 @@ export function loadSections(elem, apiClient, user, userSettings) {
|
||||||
|
|
||||||
export function destroySections(elem) {
|
export function destroySections(elem) {
|
||||||
const elems = elem.querySelectorAll('.itemsContainer');
|
const elems = elem.querySelectorAll('.itemsContainer');
|
||||||
for (let i = 0; i < elems.length; i++) {
|
for (const e of elems) {
|
||||||
elems[i].fetchData = null;
|
e.fetchData = null;
|
||||||
elems[i].parentContainer = null;
|
e.parentContainer = null;
|
||||||
elems[i].getItemsHtml = null;
|
e.getItemsHtml = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
elem.innerHTML = '';
|
elem.innerHTML = '';
|
||||||
|
@ -111,8 +111,8 @@ export function destroySections(elem) {
|
||||||
|
|
||||||
export function pause(elem) {
|
export function pause(elem) {
|
||||||
const elems = elem.querySelectorAll('.itemsContainer');
|
const elems = elem.querySelectorAll('.itemsContainer');
|
||||||
for (let i = 0; i < elems.length; i++) {
|
for (const e of elems) {
|
||||||
elems[i].pause();
|
e.pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue