mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Apply suggestions
This commit is contained in:
parent
59b851219f
commit
0872f3f001
2 changed files with 23 additions and 30 deletions
|
@ -184,9 +184,9 @@ import 'emby-scroller';
|
||||||
const values = instance.getSortValues();
|
const values = instance.getSortValues();
|
||||||
const sortBy = values.sortBy;
|
const sortBy = values.sortBy;
|
||||||
|
|
||||||
for (let i = 0, length = options.length; i < length; i++) {
|
for (const option of options) {
|
||||||
if (sortBy === options[i].value) {
|
if (sortBy === option.value) {
|
||||||
btnSortText.innerHTML = globalize.translate('SortByValue', options[i].name);
|
btnSortText.innerHTML = globalize.translate('SortByValue', option.name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,18 +407,18 @@ import 'emby-scroller';
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideOrShowAll(elems, hide) {
|
function hideOrShowAll(elems, hide) {
|
||||||
for (let i = 0, length = elems.length; i < length; i++) {
|
for (const elem of elems) {
|
||||||
if (hide) {
|
if (hide) {
|
||||||
elems[i].classList.add('hide');
|
elem.classList.add('hide');
|
||||||
} else {
|
} else {
|
||||||
elems[i].classList.remove('hide');
|
elem.classList.remove('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindAll(elems, eventName, fn) {
|
function bindAll(elems, eventName, fn) {
|
||||||
for (let i = 0, length = elems.length; i < length; i++) {
|
for (const elem of elems) {
|
||||||
elems[i].addEventListener(eventName, fn);
|
elem.addEventListener(eventName, fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -724,16 +724,15 @@ class ItemsView {
|
||||||
|
|
||||||
const btnViewSettings = view.querySelectorAll('.btnViewSettings');
|
const btnViewSettings = view.querySelectorAll('.btnViewSettings');
|
||||||
|
|
||||||
for (let i = 0, length = btnViewSettings.length; i < length; i++) {
|
for (const btnViewSetting of btnViewSettings) {
|
||||||
btnViewSettings[i].addEventListener('click', showViewSettingsMenu.bind(this));
|
btnViewSetting.addEventListener('click', showViewSettingsMenu.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
const filterButtons = view.querySelectorAll('.btnFilter');
|
const filterButtons = view.querySelectorAll('.btnFilter');
|
||||||
this.filterButtons = filterButtons;
|
this.filterButtons = filterButtons;
|
||||||
const hasVisibleFilters = this.getVisibleFilters().length;
|
const hasVisibleFilters = this.getVisibleFilters().length;
|
||||||
|
|
||||||
for (let i = 0, length = filterButtons.length; i < length; i++) {
|
for (const btnFilter of filterButtons) {
|
||||||
const btnFilter = filterButtons[i];
|
|
||||||
btnFilter.addEventListener('click', showFilterMenu.bind(this));
|
btnFilter.addEventListener('click', showFilterMenu.bind(this));
|
||||||
|
|
||||||
if (hasVisibleFilters) {
|
if (hasVisibleFilters) {
|
||||||
|
@ -744,10 +743,9 @@ class ItemsView {
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortButtons = view.querySelectorAll('.btnSort');
|
const sortButtons = view.querySelectorAll('.btnSort');
|
||||||
let i;
|
|
||||||
let length;
|
this.sortButtons = sortButtons;
|
||||||
for (this.sortButtons = sortButtons, i = 0, length = sortButtons.length; i < length; i++) {
|
for (const sortButton of sortButtons) {
|
||||||
const sortButton = sortButtons[i];
|
|
||||||
sortButton.addEventListener('click', showSortMenu.bind(this));
|
sortButton.addEventListener('click', showSortMenu.bind(this));
|
||||||
|
|
||||||
if (params.type !== 'nextup') {
|
if (params.type !== 'nextup') {
|
||||||
|
@ -886,10 +884,9 @@ class ItemsView {
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultSortBy() {
|
getDefaultSortBy() {
|
||||||
const params = this.params;
|
const sortNameOption = this.getNameSortOption(this.params);
|
||||||
const sortNameOption = this.getNameSortOption(params);
|
|
||||||
|
|
||||||
if (params.type) {
|
if (this.params.type) {
|
||||||
return sortNameOption.value;
|
return sortNameOption.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -898,16 +895,15 @@ class ItemsView {
|
||||||
|
|
||||||
getSortMenuOptions() {
|
getSortMenuOptions() {
|
||||||
const sortBy = [];
|
const sortBy = [];
|
||||||
const params = this.params;
|
|
||||||
|
|
||||||
if (params.type === 'Programs') {
|
if (this.params.type === 'Programs') {
|
||||||
sortBy.push({
|
sortBy.push({
|
||||||
name: globalize.translate('AirDate'),
|
name: globalize.translate('AirDate'),
|
||||||
value: 'StartDate,SortName'
|
value: 'StartDate,SortName'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let option = this.getNameSortOption(params);
|
let option = this.getNameSortOption(this.params);
|
||||||
|
|
||||||
if (option) {
|
if (option) {
|
||||||
sortBy.push(option);
|
sortBy.push(option);
|
||||||
|
@ -925,7 +921,7 @@ class ItemsView {
|
||||||
sortBy.push(option);
|
sortBy.push(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.type !== 'Programs') {
|
if (this.params.type !== 'Programs') {
|
||||||
sortBy.push({
|
sortBy.push({
|
||||||
name: globalize.translate('DateAdded'),
|
name: globalize.translate('DateAdded'),
|
||||||
value: 'DateCreated,SortName'
|
value: 'DateCreated,SortName'
|
||||||
|
@ -938,8 +934,8 @@ class ItemsView {
|
||||||
sortBy.push(option);
|
sortBy.push(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!params.type) {
|
if (!this.params.type) {
|
||||||
option = this.getNameSortOption(params);
|
option = this.getNameSortOption(this.params);
|
||||||
sortBy.push({
|
sortBy.push({
|
||||||
name: globalize.translate('Folders'),
|
name: globalize.translate('Folders'),
|
||||||
value: 'IsFolder,' + option.value
|
value: 'IsFolder,' + option.value
|
||||||
|
@ -1054,8 +1050,7 @@ class ItemsView {
|
||||||
const filterButtons = this.filterButtons;
|
const filterButtons = this.filterButtons;
|
||||||
|
|
||||||
if (filterButtons.length) {
|
if (filterButtons.length) {
|
||||||
for (let i = 0, length = filterButtons.length; i < length; i++) {
|
for (const btnFilter of filterButtons) {
|
||||||
const btnFilter = filterButtons[i];
|
|
||||||
let bubble = btnFilter.querySelector('.filterButtonBubble');
|
let bubble = btnFilter.querySelector('.filterButtonBubble');
|
||||||
|
|
||||||
if (!bubble) {
|
if (!bubble) {
|
||||||
|
|
|
@ -34,9 +34,7 @@ function getScreensaverPlugin(isLoggedIn) {
|
||||||
|
|
||||||
const plugins = pluginManager.ofType('screensaver');
|
const plugins = pluginManager.ofType('screensaver');
|
||||||
|
|
||||||
for (let i = 0, length = plugins.length; i < length; i++) {
|
for (const plugin of plugins) {
|
||||||
const plugin = plugins[i];
|
|
||||||
|
|
||||||
if (plugin.id === option) {
|
if (plugin.id === option) {
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue