mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
refactor: Use forEach for portability
This commit is contained in:
parent
b81342d23b
commit
fc37f82e52
1 changed files with 8 additions and 8 deletions
|
@ -105,27 +105,27 @@ function onInputCommand(e) {
|
||||||
function saveValues(context, settings, settingsKey, setfilters) {
|
function saveValues(context, settings, settingsKey, setfilters) {
|
||||||
// Video type
|
// Video type
|
||||||
const videoTypes = [];
|
const videoTypes = [];
|
||||||
for (const elem of context.querySelectorAll('.chkVideoTypeFilter')) {
|
context.querySelectorAll('.chkVideoTypeFilter').forEach(elem => {
|
||||||
if (elem.checked) {
|
if (elem.checked) {
|
||||||
videoTypes.push(elem.getAttribute('data-filter'));
|
videoTypes.push(elem.getAttribute('data-filter'));
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// Series status
|
// Series status
|
||||||
const seriesStatuses = [];
|
const seriesStatuses = [];
|
||||||
for (const elem of context.querySelectorAll('.chkSeriesStatus')) {
|
context.querySelectorAll('.chkSeriesStatus').forEach(elem => {
|
||||||
if (elem.checked) {
|
if (elem.checked) {
|
||||||
seriesStatuses.push(elem.getAttribute('data-filter'));
|
seriesStatuses.push(elem.getAttribute('data-filter'));
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// Genres
|
// Genres
|
||||||
const genres = [];
|
const genres = [];
|
||||||
for (const elem of context.querySelectorAll('.chkGenreFilter')) {
|
context.querySelectorAll('.chkGenreFilter').forEach(elem => {
|
||||||
if (elem.checked) {
|
if (elem.checked) {
|
||||||
genres.push(elem.getAttribute('data-filter'));
|
genres.push(elem.getAttribute('data-filter'));
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
if (setfilters) {
|
if (setfilters) {
|
||||||
setfilters((prevState) => ({
|
setfilters((prevState) => ({
|
||||||
|
@ -149,13 +149,13 @@ function saveValues(context, settings, settingsKey, setfilters) {
|
||||||
GenreIds: genres.join(',')
|
GenreIds: genres.join(',')
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
for (const elem of context.querySelectorAll('.simpleFilter')) {
|
context.querySelectorAll('.simpleFilter').forEach(elem => {
|
||||||
if (elem.tagName === 'INPUT') {
|
if (elem.tagName === 'INPUT') {
|
||||||
setBasicFilter(context, settingsKey + '-filter-' + elem.getAttribute('data-settingname'), elem);
|
setBasicFilter(context, settingsKey + '-filter-' + elem.getAttribute('data-settingname'), elem);
|
||||||
} else {
|
} else {
|
||||||
setBasicFilter(context, settingsKey + '-filter-' + elem.getAttribute('data-settingname'), elem.querySelector('input'));
|
setBasicFilter(context, settingsKey + '-filter-' + elem.getAttribute('data-settingname'), elem.querySelector('input'));
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
userSettings.setFilter(settingsKey + '-filter-GenreIds', genres.join(','));
|
userSettings.setFilter(settingsKey + '-filter-GenreIds', genres.join(','));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue