mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 10:58:20 -07:00
Fix code smells
This commit is contained in:
parent
1a0789f7b9
commit
2d97a56f51
@ -13,7 +13,7 @@ import template from './dialog.template.html';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function showDialog(options, template) {
|
||||
function showDialog(options) {
|
||||
const dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
@ -129,9 +129,7 @@ import template from './dialog.template.html';
|
||||
options = text;
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
showDialog(options, template).then(resolve, reject);
|
||||
});
|
||||
return showDialog(options);
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1092,17 +1092,17 @@ function Guide(options) {
|
||||
}
|
||||
}
|
||||
|
||||
const context = options.element;
|
||||
const guideContext = options.element;
|
||||
|
||||
context.classList.add('tvguide');
|
||||
guideContext.classList.add('tvguide');
|
||||
|
||||
context.innerHTML = globalize.translateHtml(template, 'core');
|
||||
guideContext.innerHTML = globalize.translateHtml(template, 'core');
|
||||
|
||||
const programGrid = context.querySelector('.programGrid');
|
||||
const timeslotHeaders = context.querySelector('.timeslotHeaders');
|
||||
const programGrid = guideContext.querySelector('.programGrid');
|
||||
const timeslotHeaders = guideContext.querySelector('.timeslotHeaders');
|
||||
|
||||
if (layoutManager.tv) {
|
||||
dom.addEventListener(context.querySelector('.guideVerticalScroller'), 'focus', onScrollerFocus, {
|
||||
dom.addEventListener(guideContext.querySelector('.guideVerticalScroller'), 'focus', onScrollerFocus, {
|
||||
capture: true,
|
||||
passive: true
|
||||
});
|
||||
@ -1111,43 +1111,43 @@ function Guide(options) {
|
||||
}
|
||||
|
||||
if (browser.iOS || browser.osx) {
|
||||
context.querySelector('.channelsContainer').classList.add('noRubberBanding');
|
||||
guideContext.querySelector('.channelsContainer').classList.add('noRubberBanding');
|
||||
|
||||
programGrid.classList.add('noRubberBanding');
|
||||
}
|
||||
|
||||
dom.addEventListener(programGrid, 'scroll', function (e) {
|
||||
onProgramGridScroll(context, this, timeslotHeaders);
|
||||
onProgramGridScroll(guideContext, this, timeslotHeaders);
|
||||
}, {
|
||||
passive: true
|
||||
});
|
||||
|
||||
dom.addEventListener(timeslotHeaders, 'scroll', function () {
|
||||
onTimeslotHeadersScroll(context, this);
|
||||
onTimeslotHeadersScroll(guideContext, this);
|
||||
}, {
|
||||
passive: true
|
||||
});
|
||||
|
||||
programGrid.addEventListener('click', onProgramGridClick);
|
||||
|
||||
context.querySelector('.btnNextPage').addEventListener('click', function () {
|
||||
guideContext.querySelector('.btnNextPage').addEventListener('click', function () {
|
||||
currentStartIndex += currentChannelLimit;
|
||||
reloadPage(context);
|
||||
reloadPage(guideContext);
|
||||
restartAutoRefresh();
|
||||
});
|
||||
|
||||
context.querySelector('.btnPreviousPage').addEventListener('click', function () {
|
||||
guideContext.querySelector('.btnPreviousPage').addEventListener('click', function () {
|
||||
currentStartIndex = Math.max(currentStartIndex - currentChannelLimit, 0);
|
||||
reloadPage(context);
|
||||
reloadPage(guideContext);
|
||||
restartAutoRefresh();
|
||||
});
|
||||
|
||||
context.querySelector('.btnGuideViewSettings').addEventListener('click', function () {
|
||||
guideContext.querySelector('.btnGuideViewSettings').addEventListener('click', function () {
|
||||
showViewSettings(self);
|
||||
restartAutoRefresh();
|
||||
});
|
||||
|
||||
context.querySelector('.guideDateTabs').addEventListener('tabchange', function (e) {
|
||||
guideContext.querySelector('.guideDateTabs').addEventListener('tabchange', function (e) {
|
||||
const allTabButtons = e.target.querySelectorAll('.guide-date-tab-button');
|
||||
|
||||
const tabButton = allTabButtons[parseInt(e.detail.selectedTabIndex)];
|
||||
@ -1176,12 +1176,12 @@ function Guide(options) {
|
||||
let startTimeOfDayMs = (date.getHours() * 60 * 60 * 1000);
|
||||
startTimeOfDayMs += (date.getMinutes() * 60 * 1000);
|
||||
|
||||
changeDate(context, date, scrollToTimeMs, scrollToTimeMs, startTimeOfDayMs, false);
|
||||
changeDate(guideContext, date, scrollToTimeMs, scrollToTimeMs, startTimeOfDayMs, false);
|
||||
}
|
||||
});
|
||||
|
||||
setScrollEvents(context, true);
|
||||
itemShortcuts.on(context);
|
||||
setScrollEvents(guideContext, true);
|
||||
itemShortcuts.on(guideContext);
|
||||
|
||||
Events.trigger(self, 'load');
|
||||
|
||||
|
@ -163,7 +163,7 @@ import template from './itemMediaInfo.template.html';
|
||||
return `<span class="mediaInfoLabel">${label}</span><span class="mediaInfoAttribute">${value}</span>`;
|
||||
}
|
||||
|
||||
function loadMediaInfo(itemId, serverId, template) {
|
||||
function loadMediaInfo(itemId, serverId) {
|
||||
const apiClient = ServerConnections.getApiClient(serverId);
|
||||
return apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(item => {
|
||||
const dialogOptions = {
|
||||
@ -195,9 +195,7 @@ import template from './itemMediaInfo.template.html';
|
||||
|
||||
export function show(itemId, serverId) {
|
||||
loading.show();
|
||||
return new Promise((resolve, reject) => {
|
||||
loadMediaInfo(itemId, serverId, template).then(resolve, reject);
|
||||
});
|
||||
return loadMediaInfo(itemId, serverId);
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -28,7 +28,7 @@ export default (() => {
|
||||
txtInput.value = options.value || '';
|
||||
}
|
||||
|
||||
function showDialog(options, template) {
|
||||
function showDialog(options) {
|
||||
const dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
@ -117,15 +117,13 @@ export default (() => {
|
||||
};
|
||||
} else {
|
||||
return options => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
title: '',
|
||||
text: options
|
||||
};
|
||||
}
|
||||
showDialog(options, template).then(resolve, reject);
|
||||
});
|
||||
return showDialog(options);
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
@ -375,7 +375,7 @@ function onOpenUploadMenu(e) {
|
||||
});
|
||||
}
|
||||
|
||||
function showEditorInternal(itemId, serverId, template) {
|
||||
function showEditorInternal(itemId, serverId) {
|
||||
hasChanges = false;
|
||||
|
||||
const apiClient = ServerConnections.getApiClient(serverId);
|
||||
@ -454,9 +454,7 @@ function showEditorInternal(itemId, serverId, template) {
|
||||
function showEditor(itemId, serverId) {
|
||||
loading.show();
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
showEditorInternal(itemId, serverId, template).then(resolve, reject);
|
||||
});
|
||||
return showEditorInternal(itemId, serverId);
|
||||
}
|
||||
|
||||
export default {
|
||||
|
Loading…
Reference in New Issue
Block a user