1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

fix: eslint no-shadow errors

This commit is contained in:
Aimekram 2022-10-16 16:04:37 +02:00
parent 6a93a2eb29
commit 832b9eaf4d
30 changed files with 273 additions and 271 deletions

View file

@ -535,13 +535,13 @@ class AppRouter {
} }
if (item === 'list') { if (item === 'list') {
let url = '#/list.html?serverId=' + options.serverId + '&type=' + options.itemTypes; let urlForList = '#/list.html?serverId=' + options.serverId + '&type=' + options.itemTypes;
if (options.isFavorite) { if (options.isFavorite) {
url += '&IsFavorite=true'; urlForList += '&IsFavorite=true';
} }
return url; return urlForList;
} }
if (item === 'livetv') { if (item === 'livetv') {

View file

@ -132,14 +132,14 @@ import './backdrop.scss';
} }
let hasInternalBackdrop; let hasInternalBackdrop;
function internalBackdrop(enabled) { function internalBackdrop(isEnabled) {
hasInternalBackdrop = enabled; hasInternalBackdrop = isEnabled;
setBackgroundContainerBackgroundEnabled(); setBackgroundContainerBackgroundEnabled();
} }
let hasExternalBackdrop; let hasExternalBackdrop;
export function externalBackdrop(enabled) { export function externalBackdrop(isEnabled) {
hasExternalBackdrop = enabled; hasExternalBackdrop = isEnabled;
setBackgroundContainerBackgroundEnabled(); setBackgroundContainerBackgroundEnabled();
} }

View file

@ -105,8 +105,8 @@ export default class channelMapper {
return html; return html;
} }
function initEditor(dlg, options) { function initEditor(dlg, initOptions) {
getChannelMappingOptions(options.serverId, options.providerId).then(result => { getChannelMappingOptions(initOptions.serverId, initOptions.providerId).then(result => {
currentMappingOptions = result; currentMappingOptions = result;
const channelsElement = dlg.querySelector('.channels'); const channelsElement = dlg.querySelector('.channels');
channelsElement.innerHTML = result.TunerChannels.map(channel => { channelsElement.innerHTML = result.TunerChannels.map(channel => {

View file

@ -251,8 +251,8 @@ class DirectoryBrowser {
} }
Promise.all([getSystemInfo(), getDefaultPath(options)]).then( Promise.all([getSystemInfo(), getDefaultPath(options)]).then(
responses => { responses => {
const systemInfo = responses[0]; const fetchedSystemInfo = responses[0];
const initialPath = responses[1]; const fetchedInitialPath = responses[1];
const dlg = dialogHelper.createDialog({ const dlg = dialogHelper.createDialog({
size: 'small', size: 'small',
removeOnClose: true, removeOnClose: true,
@ -270,7 +270,7 @@ class DirectoryBrowser {
html += escapeHtml(options.header || '') || globalize.translate('HeaderSelectPath'); html += escapeHtml(options.header || '') || globalize.translate('HeaderSelectPath');
html += '</h3>'; html += '</h3>';
html += '</div>'; html += '</div>';
html += getEditorHtml(options, systemInfo); html += getEditorHtml(options, fetchedSystemInfo);
dlg.innerHTML = html; dlg.innerHTML = html;
initEditor(dlg, options, fileOptions); initEditor(dlg, options, fileOptions);
dlg.addEventListener('close', onDialogClosed); dlg.addEventListener('close', onDialogClosed);
@ -279,13 +279,13 @@ class DirectoryBrowser {
dialogHelper.close(dlg); dialogHelper.close(dlg);
}); });
this.currentDialog = dlg; this.currentDialog = dlg;
dlg.querySelector('#txtDirectoryPickerPath').value = initialPath; dlg.querySelector('#txtDirectoryPickerPath').value = fetchedInitialPath;
const txtNetworkPath = dlg.querySelector('#txtNetworkPath'); const txtNetworkPath = dlg.querySelector('#txtNetworkPath');
if (txtNetworkPath) { if (txtNetworkPath) {
txtNetworkPath.value = options.networkSharePath || ''; txtNetworkPath.value = options.networkSharePath || '';
} }
if (!options.pathReadOnly) { if (!options.pathReadOnly) {
refreshDirectoryBrowser(dlg, initialPath, fileOptions, true); refreshDirectoryBrowser(dlg, fetchedInitialPath, fileOptions, true);
} }
} }
); );

View file

@ -429,7 +429,7 @@ function Guide(options) {
return '<span class="material-icons programIcon timerIcon fiber_manual_record" aria-hidden="true"></span>'; return '<span class="material-icons programIcon timerIcon fiber_manual_record" aria-hidden="true"></span>';
} }
function getChannelProgramsHtml(context, date, channel, programs, options, listInfo) { function getChannelProgramsHtml(context, date, channel, programs, programOptions, listInfo) {
let html = ''; let html = '';
const startMs = date.getTime(); const startMs = date.getTime();
@ -542,21 +542,21 @@ function Guide(options) {
html += '<div class="guideProgramNameText">' + escapeHtml(program.Name); html += '<div class="guideProgramNameText">' + escapeHtml(program.Name);
let indicatorHtml = null; let indicatorHtml = null;
if (program.IsLive && options.showLiveIndicator) { if (program.IsLive && programOptions.showLiveIndicator) {
indicatorHtml = '<span class="liveTvProgram guideProgramIndicator">' + globalize.translate('Live') + '</span>'; indicatorHtml = '<span class="liveTvProgram guideProgramIndicator">' + globalize.translate('Live') + '</span>';
} else if (program.IsPremiere && options.showPremiereIndicator) { } else if (program.IsPremiere && programOptions.showPremiereIndicator) {
indicatorHtml = '<span class="premiereTvProgram guideProgramIndicator">' + globalize.translate('Premiere') + '</span>'; indicatorHtml = '<span class="premiereTvProgram guideProgramIndicator">' + globalize.translate('Premiere') + '</span>';
} else if (program.IsSeries && !program.IsRepeat && options.showNewIndicator) { } else if (program.IsSeries && !program.IsRepeat && programOptions.showNewIndicator) {
indicatorHtml = '<span class="newTvProgram guideProgramIndicator">' + globalize.translate('New') + '</span>'; indicatorHtml = '<span class="newTvProgram guideProgramIndicator">' + globalize.translate('New') + '</span>';
} else if (program.IsSeries && program.IsRepeat && options.showRepeatIndicator) { } else if (program.IsSeries && program.IsRepeat && programOptions.showRepeatIndicator) {
indicatorHtml = '<span class="repeatTvProgram guideProgramIndicator">' + globalize.translate('Repeat') + '</span>'; indicatorHtml = '<span class="repeatTvProgram guideProgramIndicator">' + globalize.translate('Repeat') + '</span>';
} }
html += indicatorHtml || ''; html += indicatorHtml || '';
if ((program.EpisodeTitle && options.showEpisodeTitle)) { if ((program.EpisodeTitle && programOptions.showEpisodeTitle)) {
html += '<div class="guideProgramSecondaryInfo">'; html += '<div class="guideProgramSecondaryInfo">';
if (program.EpisodeTitle && options.showEpisodeTitle) { if (program.EpisodeTitle && programOptions.showEpisodeTitle) {
html += '<span class="programSecondaryTitle">' + escapeHtml(program.EpisodeTitle) + '</span>'; html += '<span class="programSecondaryTitle">' + escapeHtml(program.EpisodeTitle) + '</span>';
} }
html += '</div>'; html += '</div>';
@ -564,7 +564,7 @@ function Guide(options) {
html += '</div>'; html += '</div>';
if (program.IsHD && options.showHdIcon) { if (program.IsHD && programOptions.showHdIcon) {
if (layoutManager.tv) { if (layoutManager.tv) {
html += '<div class="programIcon guide-programTextIcon guide-programTextIcon-tv">HD</div>'; html += '<div class="programIcon guide-programTextIcon guide-programTextIcon-tv">HD</div>';
} else { } else {
@ -633,7 +633,7 @@ function Guide(options) {
imageLoader.lazyChildren(channelList); imageLoader.lazyChildren(channelList);
} }
function renderPrograms(context, date, channels, programs, options) { function renderPrograms(context, date, channels, programs, programOptions) {
const listInfo = { const listInfo = {
startIndex: 0 startIndex: 0
}; };
@ -641,7 +641,7 @@ function Guide(options) {
const html = []; const html = [];
for (const channel of channels) { for (const channel of channels) {
html.push(getChannelProgramsHtml(context, date, channel, programs, options, listInfo)); html.push(getChannelProgramsHtml(context, date, channel, programs, programOptions, listInfo));
} }
programGrid.innerHTML = html.join(''); programGrid.innerHTML = html.join('');

View file

@ -39,8 +39,8 @@ import template from './imageeditor.template.html';
reloadItem(page, item, apiClient, focusContext); reloadItem(page, item, apiClient, focusContext);
} else { } else {
apiClient = ServerConnections.getApiClient(currentItem.ServerId); apiClient = ServerConnections.getApiClient(currentItem.ServerId);
apiClient.getItem(apiClient.getCurrentUserId(), currentItem.Id).then(function (item) { apiClient.getItem(apiClient.getCurrentUserId(), currentItem.Id).then(function (itemToReload) {
reloadItem(page, item, apiClient, focusContext); reloadItem(page, itemToReload, apiClient, focusContext);
}); });
} }
} }

View file

@ -47,7 +47,7 @@ import '../elements/emby-button/emby-button';
return true; return true;
} }
function configureSwipeTabs(view, tabsElem) { function configureSwipeTabs(view, currentElement) {
if (!browser.touch) { if (!browser.touch) {
return; return;
} }
@ -55,13 +55,13 @@ import '../elements/emby-button/emby-button';
// implement without hammer // implement without hammer
const onSwipeLeft = function (e, target) { const onSwipeLeft = function (e, target) {
if (allowSwipe(target) && view.contains(target)) { if (allowSwipe(target) && view.contains(target)) {
tabsElem.selectNext(); currentElement.selectNext();
} }
}; };
const onSwipeRight = function (e, target) { const onSwipeRight = function (e, target) {
if (allowSwipe(target) && view.contains(target)) { if (allowSwipe(target) && view.contains(target)) {
tabsElem.selectPrevious(); currentElement.selectPrevious();
} }
}; };

View file

@ -98,9 +98,9 @@ function hideOsd() {
} }
} }
function setIcon(iconElement, icon) { function setIcon(iconHtmlElement, icon) {
iconElement.classList.remove('brightness_high', 'brightness_medium', 'brightness_low'); iconHtmlElement.classList.remove('brightness_high', 'brightness_medium', 'brightness_low');
iconElement.classList.add(icon); iconHtmlElement.classList.add(icon);
} }
function updateElementsFromPlayer(brightness) { function updateElementsFromPlayer(brightness) {

View file

@ -1764,9 +1764,9 @@ class PlaybackManager {
MediaTypes: 'Photo,Video', MediaTypes: 'Photo,Video',
Limit: UNLIMITED_ITEMS Limit: UNLIMITED_ITEMS
}).then(function (result) { }).then(function (result) {
const items = result.Items; const playbackItems = result.Items;
let index = items.map(function (i) { let index = playbackItems.map(function (i) {
return i.Id; return i.Id;
}).indexOf(firstItem.Id); }).indexOf(firstItem.Id);

View file

@ -251,8 +251,8 @@ import toast from './toast/toast';
} else if (action === 'playmenu') { } else if (action === 'playmenu') {
showPlayMenu(card, target); showPlayMenu(card, target);
} else if (action === 'edit') { } else if (action === 'edit') {
getItem(target).then(item => { getItem(target).then(itemToEdit => {
editItem(item, serverId); editItem(itemToEdit, serverId);
}); });
} else if (action === 'playtrailer') { } else if (action === 'playtrailer') {
getItem(target).then(playTrailer); getItem(target).then(playTrailer);
@ -293,21 +293,21 @@ import toast from './toast/toast';
const apiClient = ServerConnections.getApiClient(serverId); const apiClient = ServerConnections.getApiClient(serverId);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const serverId = apiClient.serverInfo().Id; const myServerId = apiClient.serverInfo().Id;
if (item.Type === 'Timer') { if (item.Type === 'Timer') {
if (item.ProgramId) { if (item.ProgramId) {
import('./recordingcreator/recordingcreator').then(({default: recordingCreator}) => { import('./recordingcreator/recordingcreator').then(({default: recordingCreator}) => {
recordingCreator.show(item.ProgramId, serverId).then(resolve, reject); recordingCreator.show(item.ProgramId, myServerId).then(resolve, reject);
}); });
} else { } else {
import('./recordingcreator/recordingeditor').then(({default: recordingEditor}) => { import('./recordingcreator/recordingeditor').then(({default: recordingEditor}) => {
recordingEditor.show(item.Id, serverId).then(resolve, reject); recordingEditor.show(item.Id, myServerId).then(resolve, reject);
}); });
} }
} else { } else {
import('./metadataEditor/metadataEditor').then(({default: metadataEditor}) => { import('./metadataEditor/metadataEditor').then(({default: metadataEditor}) => {
metadataEditor.show(item.Id, serverId).then(resolve, reject); metadataEditor.show(item.Id, myServerId).then(resolve, reject);
}); });
} }
}); });

View file

@ -141,11 +141,11 @@ export default function (options) {
* Creates the HTML markup for the dialog and the OSD. * Creates the HTML markup for the dialog and the OSD.
* @param {Object} options - Options used to create the dialog and slideshow. * @param {Object} options - Options used to create the dialog and slideshow.
*/ */
function createElements(options) { function createElements(slideshowOptions) {
currentOptions = options; currentOptions = slideshowOptions;
dialog = dialogHelper.createDialog({ dialog = dialogHelper.createDialog({
exitAnimationDuration: options.interactive ? 400 : 800, exitAnimationDuration: slideshowOptions.interactive ? 400 : 800,
size: 'fullscreen', size: 'fullscreen',
autoFocus: false, autoFocus: false,
scrollY: false, scrollY: false,
@ -159,7 +159,7 @@ export default function (options) {
html += '<div class="slideshowSwiperContainer"><div class="swiper-wrapper"></div></div>'; html += '<div class="slideshowSwiperContainer"><div class="swiper-wrapper"></div></div>';
if (options.interactive && !layoutManager.tv) { if (slideshowOptions.interactive && !layoutManager.tv) {
const actionButtonsOnTop = layoutManager.mobile; const actionButtonsOnTop = layoutManager.mobile;
html += getIcon('keyboard_arrow_left', 'btnSlideshowPrevious slideshowButton hide-mouse-idle-tv', false); html += getIcon('keyboard_arrow_left', 'btnSlideshowPrevious slideshowButton hide-mouse-idle-tv', false);
@ -169,7 +169,7 @@ export default function (options) {
if (actionButtonsOnTop) { if (actionButtonsOnTop) {
html += getIcon('play_arrow', 'btnSlideshowPause slideshowButton', true); html += getIcon('play_arrow', 'btnSlideshowPause slideshowButton', true);
if (appHost.supports('filedownload') && options.user && options.user.Policy.EnableContentDownloading) { if (appHost.supports('filedownload') && slideshowOptions.user && slideshowOptions.user.Policy.EnableContentDownloading) {
html += getIcon('file_download', 'btnDownload slideshowButton', true); html += getIcon('file_download', 'btnDownload slideshowButton', true);
} }
if (appHost.supports('sharing')) { if (appHost.supports('sharing')) {
@ -187,7 +187,7 @@ export default function (options) {
html += '<div class="slideshowBottomBar hide">'; html += '<div class="slideshowBottomBar hide">';
html += getIcon('play_arrow', 'btnSlideshowPause slideshowButton', true, true); html += getIcon('play_arrow', 'btnSlideshowPause slideshowButton', true, true);
if (appHost.supports('filedownload') && options.user && options.user.Policy.EnableContentDownloading) { if (appHost.supports('filedownload') && slideshowOptions.user && slideshowOptions.user.Policy.EnableContentDownloading) {
html += getIcon('file_download', 'btnDownload slideshowButton', true); html += getIcon('file_download', 'btnDownload slideshowButton', true);
} }
if (appHost.supports('sharing')) { if (appHost.supports('sharing')) {
@ -206,7 +206,7 @@ export default function (options) {
dialog.innerHTML = html; dialog.innerHTML = html;
if (options.interactive && !layoutManager.tv) { if (slideshowOptions.interactive && !layoutManager.tv) {
dialog.querySelector('.btnSlideshowExit').addEventListener('click', function () { dialog.querySelector('.btnSlideshowExit').addEventListener('click', function () {
dialogHelper.close(dialog); dialogHelper.close(dialog);
}); });
@ -331,7 +331,7 @@ export default function (options) {
* @param {HTMLElement} dialog - Element containing the dialog. * @param {HTMLElement} dialog - Element containing the dialog.
* @param {Object} options - Options used to initialize the Swiper instance. * @param {Object} options - Options used to initialize the Swiper instance.
*/ */
function loadSwiper(dialog, options) { function loadSwiper(dialogElement, swiperOptions) {
let slides; let slides;
if (currentOptions.slides) { if (currentOptions.slides) {
slides = currentOptions.slides; slides = currentOptions.slides;
@ -344,7 +344,7 @@ export default function (options) {
// eslint-disable-next-line import/no-unresolved // eslint-disable-next-line import/no-unresolved
import('swiper/bundle').then(({ Swiper }) => { import('swiper/bundle').then(({ Swiper }) => {
swiperInstance = new Swiper(dialog.querySelector('.slideshowSwiperContainer'), { swiperInstance = new Swiper(dialogElement.querySelector('.slideshowSwiperContainer'), {
direction: 'horizontal', direction: 'horizontal',
// Loop is disabled due to the virtual slides option not supporting it. // Loop is disabled due to the virtual slides option not supporting it.
loop: false, loop: false,
@ -352,14 +352,14 @@ export default function (options) {
minRatio: 1, minRatio: 1,
toggle: true toggle: true
}, },
autoplay: !options.interactive || !!options.autoplay, autoplay: !swiperOptions.interactive || !!swiperOptions.autoplay,
keyboard: { keyboard: {
enabled: true enabled: true
}, },
preloadImages: true, preloadImages: true,
slidesPerView: 1, slidesPerView: 1,
slidesPerColumn: 1, slidesPerColumn: 1,
initialSlide: options.startIndex || 0, initialSlide: swiperOptions.startIndex || 0,
speed: 240, speed: 240,
navigation: { navigation: {
nextEl: '.btnSlideshowNext', nextEl: '.btnSlideshowNext',

View file

@ -12,6 +12,43 @@ import './style.scss';
import Dashboard from '../../utils/dashboard'; import Dashboard from '../../utils/dashboard';
import Events from '../../utils/events.ts'; import Events from '../../utils/events.ts';
function getTunerName(providerId) {
switch (providerId.toLowerCase()) {
case 'm3u':
return 'M3U Playlist';
case 'hdhomerun':
return 'HDHomerun';
case 'satip':
return 'DVB';
default:
return 'Unknown';
}
}
function refreshTunerDevices(page, providerInfo, devices) {
let html = '';
for (let i = 0, length = devices.length; i < length; i++) {
const device = devices[i];
html += '<div class="listItem">';
const enabledTuners = providerInfo.EnabledTuners || [];
const isChecked = providerInfo.EnableAllTuners || enabledTuners.indexOf(device.Id) !== -1;
const checkedAttribute = isChecked ? ' checked' : '';
html += '<label class="checkboxContainer listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" data-id="' + device.Id + '" class="chkTuner" ' + checkedAttribute + '/><span></span></label>';
html += '<div class="listItemBody two-line">';
html += '<div class="listItemBodyText">';
html += device.FriendlyName || getTunerName(device.Type);
html += '</div>';
html += '<div class="listItemBodyText secondary">';
html += device.Url;
html += '</div>';
html += '</div>';
html += '</div>';
}
page.querySelector('.tunerList').innerHTML = html;
}
export default function (page, providerId, options) { export default function (page, providerId, options) {
function reload() { function reload() {
loading.show(); loading.show();
@ -202,43 +239,6 @@ export default function (page, providerId, options) {
}); });
} }
function getTunerName(providerId) {
switch (providerId.toLowerCase()) {
case 'm3u':
return 'M3U Playlist';
case 'hdhomerun':
return 'HDHomerun';
case 'satip':
return 'DVB';
default:
return 'Unknown';
}
}
function refreshTunerDevices(page, providerInfo, devices) {
let html = '';
for (let i = 0, length = devices.length; i < length; i++) {
const device = devices[i];
html += '<div class="listItem">';
const enabledTuners = providerInfo.EnabledTuners || [];
const isChecked = providerInfo.EnableAllTuners || enabledTuners.indexOf(device.Id) !== -1;
const checkedAttribute = isChecked ? ' checked' : '';
html += '<label class="checkboxContainer listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" data-id="' + device.Id + '" class="chkTuner" ' + checkedAttribute + '/><span></span></label>';
html += '<div class="listItemBody two-line">';
html += '<div class="listItemBodyText">';
html += device.FriendlyName || getTunerName(device.Type);
html += '</div>';
html += '<div class="listItemBodyText secondary">';
html += device.Url;
html += '</div>';
html += '</div>';
html += '</div>';
}
page.querySelector('.tunerList').innerHTML = html;
}
let listingsId; let listingsId;
const self = this; const self = this;

View file

@ -8,6 +8,62 @@ import '../../elements/emby-button/paper-icon-button-light';
import Dashboard from '../../utils/dashboard'; import Dashboard from '../../utils/dashboard';
import Events from '../../utils/events.ts'; import Events from '../../utils/events.ts';
function getTunerName(providerId) {
switch (providerId.toLowerCase()) {
case 'm3u':
return 'M3U Playlist';
case 'hdhomerun':
return 'HDHomerun';
case 'satip':
return 'DVB';
default:
return 'Unknown';
}
}
function refreshTunerDevices(page, providerInfo, devices) {
let html = '';
for (let i = 0, length = devices.length; i < length; i++) {
const device = devices[i];
html += '<div class="listItem">';
const enabledTuners = providerInfo.EnabledTuners || [];
const isChecked = providerInfo.EnableAllTuners || enabledTuners.indexOf(device.Id) !== -1;
const checkedAttribute = isChecked ? ' checked' : '';
html += '<label class="listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" class="chkTuner" data-id="' + device.Id + '" ' + checkedAttribute + '><span></span></label>';
html += '<div class="listItemBody two-line">';
html += '<div class="listItemBodyText">';
html += device.FriendlyName || getTunerName(device.Type);
html += '</div>';
html += '<div class="listItemBodyText secondary">';
html += device.Url;
html += '</div>';
html += '</div>';
html += '</div>';
}
page.querySelector('.tunerList').innerHTML = html;
}
function onSelectPathClick(e) {
const page = $(e.target).parents('.xmltvForm')[0];
import('../directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
const picker = new DirectoryBrowser();
picker.show({
includeFiles: true,
callback: function (path) {
if (path) {
const txtPath = page.querySelector('.txtPath');
txtPath.value = path;
txtPath.focus();
}
picker.close();
}
});
});
}
export default function (page, providerId, options) { export default function (page, providerId, options) {
function getListingProvider(config, id) { function getListingProvider(config, id) {
if (config && id) { if (config && id) {
@ -105,62 +161,6 @@ export default function (page, providerId, options) {
}); });
} }
function getTunerName(providerId) {
switch (providerId.toLowerCase()) {
case 'm3u':
return 'M3U Playlist';
case 'hdhomerun':
return 'HDHomerun';
case 'satip':
return 'DVB';
default:
return 'Unknown';
}
}
function refreshTunerDevices(page, providerInfo, devices) {
let html = '';
for (let i = 0, length = devices.length; i < length; i++) {
const device = devices[i];
html += '<div class="listItem">';
const enabledTuners = providerInfo.EnabledTuners || [];
const isChecked = providerInfo.EnableAllTuners || enabledTuners.indexOf(device.Id) !== -1;
const checkedAttribute = isChecked ? ' checked' : '';
html += '<label class="listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" class="chkTuner" data-id="' + device.Id + '" ' + checkedAttribute + '><span></span></label>';
html += '<div class="listItemBody two-line">';
html += '<div class="listItemBodyText">';
html += device.FriendlyName || getTunerName(device.Type);
html += '</div>';
html += '<div class="listItemBodyText secondary">';
html += device.Url;
html += '</div>';
html += '</div>';
html += '</div>';
}
page.querySelector('.tunerList').innerHTML = html;
}
function onSelectPathClick(e) {
const page = $(e.target).parents('.xmltvForm')[0];
import('../directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
const picker = new DirectoryBrowser();
picker.show({
includeFiles: true,
callback: function (path) {
if (path) {
const txtPath = page.querySelector('.txtPath');
txtPath.value = path;
txtPath.focus();
}
picker.close();
}
});
});
}
const self = this; const self = this;
self.submit = function () { self.submit = function () {

View file

@ -289,8 +289,8 @@ import alert from '../../components/alert';
libraryMenu.setTabs('playback', 0, getTabs); libraryMenu.setTabs('playback', 0, getTabs);
const page = this; const page = this;
ApiClient.getNamedConfiguration('encoding').then(function (config) { ApiClient.getNamedConfiguration('encoding').then(function (config) {
ApiClient.getSystemInfo().then(function (systemInfo) { ApiClient.getSystemInfo().then(function (fetchedSystemInfo) {
loadPage(page, config, systemInfo); loadPage(page, config, fetchedSystemInfo);
}); });
}); });
}); });

View file

@ -770,7 +770,7 @@ function renderLinks(page, item) {
} }
} }
function renderDetailImage(elem, item, imageLoader) { function renderDetailImage(elem, item, loader) {
const itemArray = []; const itemArray = [];
itemArray.push(item); itemArray.push(item);
const cardHtml = cardBuilder.getCardsHtml(itemArray, { const cardHtml = cardBuilder.getCardsHtml(itemArray, {
@ -787,7 +787,7 @@ function renderDetailImage(elem, item, imageLoader) {
}); });
elem.innerHTML = cardHtml; elem.innerHTML = cardHtml;
imageLoader.lazyChildren(elem); loader.lazyChildren(elem);
// Avoid breaking the design by preventing focus of the poster using the keyboard. // Avoid breaking the design by preventing focus of the poster using the keyboard.
elem.querySelector('a, button').tabIndex = -1; elem.querySelector('a, button').tabIndex = -1;
@ -1881,28 +1881,28 @@ export default function (view, params) {
return params.serverId ? ServerConnections.getApiClient(params.serverId) : ApiClient; return params.serverId ? ServerConnections.getApiClient(params.serverId) : ApiClient;
} }
function reload(instance, page, params) { function reload(instance, page, pageParams) {
loading.show(); loading.show();
const apiClient = getApiClient(); const apiClient = getApiClient();
Promise.all([getPromise(apiClient, params), apiClient.getCurrentUser()]).then(([item, user]) => { Promise.all([getPromise(apiClient, pageParams), apiClient.getCurrentUser()]).then(([item, user]) => {
currentItem = item; currentItem = item;
reloadFromItem(instance, page, params, item, user); reloadFromItem(instance, page, pageParams, item, user);
}).catch((error) => { }).catch((error) => {
console.error('failed to get item or current user: ', error); console.error('failed to get item or current user: ', error);
}); });
} }
function splitVersions(instance, page, apiClient, params) { function splitVersions(instance, page, apiClient, pageParams) {
confirm('Are you sure you wish to split the media sources into separate items?', 'Split Media Apart').then(function () { confirm('Are you sure you wish to split the media sources into separate items?', 'Split Media Apart').then(function () {
loading.show(); loading.show();
apiClient.ajax({ apiClient.ajax({
type: 'DELETE', type: 'DELETE',
url: apiClient.getUrl('Videos/' + params.id + '/AlternateSources') url: apiClient.getUrl('Videos/' + pageParams.id + '/AlternateSources')
}).then(function () { }).then(function () {
loading.hide(); loading.hide();
reload(instance, page, params); reload(instance, page, pageParams);
}); });
}); });
} }

View file

@ -206,8 +206,8 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
return getPageData(tabContent).view; return getPageData(tabContent).view;
}; };
const initPage = (tabContent) => { const initPage = (tabElement) => {
tabContent.querySelector('.btnSort').addEventListener('click', function (e) { tabElement.querySelector('.btnSort').addEventListener('click', function (e) {
libraryBrowser.showSortMenu({ libraryBrowser.showSortMenu({
items: [{ items: [{
name: globalize.translate('Name'), name: globalize.translate('Name'),
@ -226,26 +226,26 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
id: 'PremiereDate,SortName' id: 'PremiereDate,SortName'
}], }],
callback: function () { callback: function () {
getQuery(tabContent).StartIndex = 0; getQuery(tabElement).StartIndex = 0;
reloadItems(tabContent); reloadItems(tabElement);
}, },
query: getQuery(tabContent), query: getQuery(tabElement),
button: e.target button: e.target
}); });
}); });
const btnSelectView = tabContent.querySelector('.btnSelectView'); const btnSelectView = tabElement.querySelector('.btnSelectView');
btnSelectView.addEventListener('click', (e) => { btnSelectView.addEventListener('click', (e) => {
libraryBrowser.showLayoutMenu(e.target, this.getCurrentViewStyle(), 'List,Poster,PosterCard,Thumb,ThumbCard'.split(',')); libraryBrowser.showLayoutMenu(e.target, this.getCurrentViewStyle(), 'List,Poster,PosterCard,Thumb,ThumbCard'.split(','));
}); });
btnSelectView.addEventListener('layoutchange', function (e) { btnSelectView.addEventListener('layoutchange', function (e) {
const viewStyle = e.detail.viewStyle; const viewStyle = e.detail.viewStyle;
getPageData(tabContent).view = viewStyle; getPageData(tabElement).view = viewStyle;
libraryBrowser.saveViewSetting(getSavedQueryKey(tabContent), viewStyle); libraryBrowser.saveViewSetting(getSavedQueryKey(tabElement), viewStyle);
getQuery(tabContent).StartIndex = 0; getQuery(tabElement).StartIndex = 0;
onViewStyleChange(); onViewStyleChange();
reloadItems(tabContent); reloadItems(tabElement);
}); });
tabContent.querySelector('.btnNewCollection').addEventListener('click', () => { tabElement.querySelector('.btnNewCollection').addEventListener('click', () => {
import('../../components/collectionEditor/collectionEditor').then(({default: collectionEditor}) => { import('../../components/collectionEditor/collectionEditor').then(({default: collectionEditor}) => {
const serverId = ApiClient.serverInfo().Id; const serverId = ApiClient.serverInfo().Id;
new collectionEditor({ new collectionEditor({

View file

@ -166,11 +166,11 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
return html; return html;
}; };
const initPage = (tabContent) => { const initPage = (tabElement) => {
itemsContainer.fetchData = fetchData; itemsContainer.fetchData = fetchData;
itemsContainer.getItemsHtml = getItemsHtml; itemsContainer.getItemsHtml = getItemsHtml;
itemsContainer.afterRefresh = afterRefresh; itemsContainer.afterRefresh = afterRefresh;
const alphaPickerElement = tabContent.querySelector('.alphaPicker'); const alphaPickerElement = tabElement.querySelector('.alphaPicker');
if (alphaPickerElement) { if (alphaPickerElement) {
alphaPickerElement.addEventListener('alphavaluechanged', function (e) { alphaPickerElement.addEventListener('alphavaluechanged', function (e) {
@ -190,19 +190,19 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
valueChangeEvent: 'click' valueChangeEvent: 'click'
}); });
tabContent.querySelector('.alphaPicker').classList.add('alphabetPicker-right'); tabElement.querySelector('.alphaPicker').classList.add('alphabetPicker-right');
alphaPickerElement.classList.add('alphaPicker-fixed-right'); alphaPickerElement.classList.add('alphaPicker-fixed-right');
itemsContainer.classList.add('padded-right-withalphapicker'); itemsContainer.classList.add('padded-right-withalphapicker');
} }
const btnFilter = tabContent.querySelector('.btnFilter'); const btnFilter = tabElement.querySelector('.btnFilter');
if (btnFilter) { if (btnFilter) {
btnFilter.addEventListener('click', () => { btnFilter.addEventListener('click', () => {
this.showFilterMenu(); this.showFilterMenu();
}); });
} }
const btnSort = tabContent.querySelector('.btnSort'); const btnSort = tabElement.querySelector('.btnSort');
if (btnSort) { if (btnSort) {
btnSort.addEventListener('click', function (e) { btnSort.addEventListener('click', function (e) {
@ -248,7 +248,7 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
}); });
}); });
} }
const btnSelectView = tabContent.querySelector('.btnSelectView'); const btnSelectView = tabElement.querySelector('.btnSelectView');
btnSelectView.addEventListener('click', (e) => { btnSelectView.addEventListener('click', (e) => {
libraryBrowser.showLayoutMenu(e.target, this.getCurrentViewStyle(), 'Banner,List,Poster,PosterCard,Thumb,ThumbCard'.split(',')); libraryBrowser.showLayoutMenu(e.target, this.getCurrentViewStyle(), 'Banner,List,Poster,PosterCard,Thumb,ThumbCard'.split(','));
}); });
@ -260,7 +260,7 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
itemsContainer.refreshItems(); itemsContainer.refreshItems();
}); });
tabContent.querySelector('.btnShuffle').addEventListener('click', shuffle); tabElement.querySelector('.btnShuffle').addEventListener('click', shuffle);
}; };
let itemsContainer = tabContent.querySelector('.itemsContainer'); let itemsContainer = tabContent.querySelector('.itemsContainer');

View file

@ -206,12 +206,12 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
return getPageData(tabContent).view; return getPageData(tabContent).view;
}; };
const initPage = (tabContent) => { const initPage = (tabElement) => {
const alphaPickerElement = tabContent.querySelector('.alphaPicker'); const alphaPickerElement = tabElement.querySelector('.alphaPicker');
const itemsContainer = tabContent.querySelector('.itemsContainer'); const itemsContainer = tabElement.querySelector('.itemsContainer');
alphaPickerElement.addEventListener('alphavaluechanged', function (e) { alphaPickerElement.addEventListener('alphavaluechanged', function (e) {
const newValue = e.detail.value; const newValue = e.detail.value;
const query = getQuery(tabContent); const query = getQuery(tabElement);
if (newValue === '#') { if (newValue === '#') {
query.NameLessThan = 'A'; query.NameLessThan = 'A';
delete query.NameStartsWith; delete query.NameStartsWith;
@ -227,14 +227,14 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
valueChangeEvent: 'click' valueChangeEvent: 'click'
}); });
tabContent.querySelector('.alphaPicker').classList.add('alphabetPicker-right'); tabElement.querySelector('.alphaPicker').classList.add('alphabetPicker-right');
alphaPickerElement.classList.add('alphaPicker-fixed-right'); alphaPickerElement.classList.add('alphaPicker-fixed-right');
itemsContainer.classList.add('padded-right-withalphapicker'); itemsContainer.classList.add('padded-right-withalphapicker');
tabContent.querySelector('.btnFilter').addEventListener('click', () => { tabElement.querySelector('.btnFilter').addEventListener('click', () => {
this.showFilterMenu(); this.showFilterMenu();
}); });
tabContent.querySelector('.btnSort').addEventListener('click', function (e) { tabElement.querySelector('.btnSort').addEventListener('click', function (e) {
libraryBrowser.showSortMenu({ libraryBrowser.showSortMenu({
items: [{ items: [{
name: globalize.translate('Name'), name: globalize.translate('Name'),
@ -259,10 +259,10 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
id: 'PremiereDate,SortName' id: 'PremiereDate,SortName'
}], }],
callback: function () { callback: function () {
getQuery(tabContent).StartIndex = 0; getQuery(tabElement).StartIndex = 0;
reloadItems(); reloadItems();
}, },
query: getQuery(tabContent), query: getQuery(tabElement),
button: e.target button: e.target
}); });
}); });

View file

@ -210,9 +210,9 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
return getPageData().view; return getPageData().view;
}; };
const initPage = (tabContent) => { const initPage = (tabElement) => {
const alphaPickerElement = tabContent.querySelector('.alphaPicker'); const alphaPickerElement = tabElement.querySelector('.alphaPicker');
const itemsContainer = tabContent.querySelector('.itemsContainer'); const itemsContainer = tabElement.querySelector('.itemsContainer');
alphaPickerElement.addEventListener('alphavaluechanged', function (e) { alphaPickerElement.addEventListener('alphavaluechanged', function (e) {
const newValue = e.detail.value; const newValue = e.detail.value;
@ -233,15 +233,15 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
valueChangeEvent: 'click' valueChangeEvent: 'click'
}); });
tabContent.querySelector('.alphaPicker').classList.add('alphabetPicker-right'); tabElement.querySelector('.alphaPicker').classList.add('alphabetPicker-right');
alphaPickerElement.classList.add('alphaPicker-fixed-right'); alphaPickerElement.classList.add('alphaPicker-fixed-right');
itemsContainer.classList.add('padded-right-withalphapicker'); itemsContainer.classList.add('padded-right-withalphapicker');
tabContent.querySelector('.btnFilter').addEventListener('click', () => { tabElement.querySelector('.btnFilter').addEventListener('click', () => {
this.showFilterMenu(); this.showFilterMenu();
}); });
tabContent.querySelector('.btnSort').addEventListener('click', (e) => { tabElement.querySelector('.btnSort').addEventListener('click', (e) => {
libraryBrowser.showSortMenu({ libraryBrowser.showSortMenu({
items: [{ items: [{
name: globalize.translate('Name'), name: globalize.translate('Name'),
@ -274,7 +274,7 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
}); });
}); });
const btnSelectView = tabContent.querySelector('.btnSelectView'); const btnSelectView = tabElement.querySelector('.btnSelectView');
btnSelectView.addEventListener('click', (e) => { btnSelectView.addEventListener('click', (e) => {
libraryBrowser.showLayoutMenu(e.target, this.getCurrentViewStyle(), 'List,Poster,PosterCard'.split(',')); libraryBrowser.showLayoutMenu(e.target, this.getCurrentViewStyle(), 'List,Poster,PosterCard'.split(','));
}); });
@ -288,8 +288,8 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
reloadItems(); reloadItems();
}); });
tabContent.querySelector('.btnPlayAll').addEventListener('click', playAll); tabElement.querySelector('.btnPlayAll').addEventListener('click', playAll);
tabContent.querySelector('.btnShuffle').addEventListener('click', shuffle); tabElement.querySelector('.btnShuffle').addEventListener('click', shuffle);
}; };
initPage(tabContent); initPage(tabContent);

View file

@ -190,13 +190,13 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
return getPageData(tabContent).view; return getPageData(tabContent).view;
}; };
const initPage = (tabContent) => { const initPage = (tabElement) => {
const alphaPickerElement = tabContent.querySelector('.alphaPicker'); const alphaPickerElement = tabElement.querySelector('.alphaPicker');
const itemsContainer = tabContent.querySelector('.itemsContainer'); const itemsContainer = tabElement.querySelector('.itemsContainer');
alphaPickerElement.addEventListener('alphavaluechanged', function (e) { alphaPickerElement.addEventListener('alphavaluechanged', function (e) {
const newValue = e.detail.value; const newValue = e.detail.value;
const query = getQuery(tabContent); const query = getQuery(tabElement);
if (newValue === '#') { if (newValue === '#') {
query.NameLessThan = 'A'; query.NameLessThan = 'A';
delete query.NameStartsWith; delete query.NameStartsWith;
@ -205,31 +205,31 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
delete query.NameLessThan; delete query.NameLessThan;
} }
query.StartIndex = 0; query.StartIndex = 0;
reloadItems(tabContent); reloadItems(tabElement);
}); });
this.alphaPicker = new AlphaPicker({ this.alphaPicker = new AlphaPicker({
element: alphaPickerElement, element: alphaPickerElement,
valueChangeEvent: 'click' valueChangeEvent: 'click'
}); });
tabContent.querySelector('.alphaPicker').classList.add('alphabetPicker-right'); tabElement.querySelector('.alphaPicker').classList.add('alphabetPicker-right');
alphaPickerElement.classList.add('alphaPicker-fixed-right'); alphaPickerElement.classList.add('alphaPicker-fixed-right');
itemsContainer.classList.add('padded-right-withalphapicker'); itemsContainer.classList.add('padded-right-withalphapicker');
tabContent.querySelector('.btnFilter').addEventListener('click', () => { tabElement.querySelector('.btnFilter').addEventListener('click', () => {
this.showFilterMenu(); this.showFilterMenu();
}); });
const btnSelectView = tabContent.querySelector('.btnSelectView'); const btnSelectView = tabElement.querySelector('.btnSelectView');
btnSelectView.addEventListener('click', (e) => { btnSelectView.addEventListener('click', (e) => {
libraryBrowser.showLayoutMenu(e.target, this.getCurrentViewStyle(), 'List,Poster,PosterCard'.split(',')); libraryBrowser.showLayoutMenu(e.target, this.getCurrentViewStyle(), 'List,Poster,PosterCard'.split(','));
}); });
btnSelectView.addEventListener('layoutchange', function (e) { btnSelectView.addEventListener('layoutchange', function (e) {
const viewStyle = e.detail.viewStyle; const viewStyle = e.detail.viewStyle;
getPageData(tabContent).view = viewStyle; getPageData(tabElement).view = viewStyle;
libraryBrowser.saveViewSetting(getSavedQueryKey(tabContent), viewStyle); libraryBrowser.saveViewSetting(getSavedQueryKey(tabElement), viewStyle);
getQuery(tabContent).StartIndex = 0; getQuery(tabElement).StartIndex = 0;
onViewStyleChange(); onViewStyleChange();
reloadItems(tabContent); reloadItems(tabElement);
}); });
}; };

View file

@ -226,7 +226,7 @@ import Dashboard from '../../utils/dashboard';
loadSuggestionsTab(view, tabContent, params.topParentId); loadSuggestionsTab(view, tabContent, params.topParentId);
} }
function enableScrollX() { function enableScrollXmobile() {
return browser.mobile; return browser.mobile;
} }
@ -362,7 +362,7 @@ import Dashboard from '../../utils/dashboard';
const containers = tabContent.querySelectorAll('.itemsContainer'); const containers = tabContent.querySelectorAll('.itemsContainer');
for (let i = 0, length = containers.length; i < length; i++) { for (let i = 0, length = containers.length; i < length; i++) {
setScrollClasses(containers[i], enableScrollX()); setScrollClasses(containers[i], enableScrollXmobile());
} }
}; };

View file

@ -159,11 +159,11 @@ export default function (view, params, tabContent) {
return getPageData(tabContent).view; return getPageData(tabContent).view;
}; };
function initPage(tabContent) { function initPage(tabElement) {
tabContent.querySelector('.btnFilter').addEventListener('click', function () { tabElement.querySelector('.btnFilter').addEventListener('click', function () {
self.showFilterMenu(); self.showFilterMenu();
}); });
tabContent.querySelector('.btnSort').addEventListener('click', function (e) { tabElement.querySelector('.btnSort').addEventListener('click', function (e) {
libraryBrowser.showSortMenu({ libraryBrowser.showSortMenu({
items: [{ items: [{
name: globalize.translate('OptionTrackName'), name: globalize.translate('OptionTrackName'),
@ -197,14 +197,14 @@ export default function (view, params, tabContent) {
id: 'Random,SortName' id: 'Random,SortName'
}], }],
callback: function () { callback: function () {
getQuery(tabContent).StartIndex = 0; getQuery(tabElement).StartIndex = 0;
reloadItems(tabContent); reloadItems(tabElement);
}, },
query: getQuery(tabContent), query: getQuery(tabElement),
button: e.target button: e.target
}); });
}); });
tabContent.querySelector('.btnShuffle').addEventListener('click', shuffle); tabElement.querySelector('.btnShuffle').addEventListener('click', shuffle);
} }
initPage(tabContent); initPage(tabContent);

View file

@ -190,11 +190,11 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
return getPageData(tabContent).view; return getPageData(tabContent).view;
}; };
function initPage(tabContent) { function initPage(tabElement) {
tabContent.querySelector('.btnFilter').addEventListener('click', function () { tabElement.querySelector('.btnFilter').addEventListener('click', function () {
self.showFilterMenu(); self.showFilterMenu();
}); });
tabContent.querySelector('.btnSort').addEventListener('click', function (e) { tabElement.querySelector('.btnSort').addEventListener('click', function (e) {
libraryBrowser.showSortMenu({ libraryBrowser.showSortMenu({
items: [{ items: [{
name: globalize.translate('Name'), name: globalize.translate('Name'),
@ -222,22 +222,22 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
id: 'Runtime,SeriesSortName,SortName' id: 'Runtime,SeriesSortName,SortName'
}], }],
callback: function () { callback: function () {
reloadItems(tabContent); reloadItems(tabElement);
}, },
query: getQuery(tabContent), query: getQuery(tabElement),
button: e.target button: e.target
}); });
}); });
const btnSelectView = tabContent.querySelector('.btnSelectView'); const btnSelectView = tabElement.querySelector('.btnSelectView');
btnSelectView.addEventListener('click', function (e) { btnSelectView.addEventListener('click', function (e) {
libraryBrowser.showLayoutMenu(e.target, self.getCurrentViewStyle(), 'List,Poster,PosterCard'.split(',')); libraryBrowser.showLayoutMenu(e.target, self.getCurrentViewStyle(), 'List,Poster,PosterCard'.split(','));
}); });
btnSelectView.addEventListener('layoutchange', function (e) { btnSelectView.addEventListener('layoutchange', function (e) {
const viewStyle = e.detail.viewStyle; const viewStyle = e.detail.viewStyle;
getPageData(tabContent).view = viewStyle; getPageData(tabElement).view = viewStyle;
libraryBrowser.saveViewSetting(getSavedQueryKey(tabContent), viewStyle); libraryBrowser.saveViewSetting(getSavedQueryKey(tabElement), viewStyle);
onViewStyleChange(); onViewStyleChange();
reloadItems(tabContent); reloadItems(tabElement);
}); });
} }

View file

@ -219,13 +219,13 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
return getPageData(tabContent).view; return getPageData(tabContent).view;
}; };
const initPage = (tabContent) => { const initPage = (tabElement) => {
const alphaPickerElement = tabContent.querySelector('.alphaPicker'); const alphaPickerElement = tabElement.querySelector('.alphaPicker');
const itemsContainer = tabContent.querySelector('.itemsContainer'); const itemsContainer = tabElement.querySelector('.itemsContainer');
alphaPickerElement.addEventListener('alphavaluechanged', function (e) { alphaPickerElement.addEventListener('alphavaluechanged', function (e) {
const newValue = e.detail.value; const newValue = e.detail.value;
const query = getQuery(tabContent); const query = getQuery(tabElement);
if (newValue === '#') { if (newValue === '#') {
query.NameLessThan = 'A'; query.NameLessThan = 'A';
delete query.NameStartsWith; delete query.NameStartsWith;
@ -234,21 +234,21 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
delete query.NameLessThan; delete query.NameLessThan;
} }
query.StartIndex = 0; query.StartIndex = 0;
reloadItems(tabContent); reloadItems(tabElement);
}); });
this.alphaPicker = new AlphaPicker({ this.alphaPicker = new AlphaPicker({
element: alphaPickerElement, element: alphaPickerElement,
valueChangeEvent: 'click' valueChangeEvent: 'click'
}); });
tabContent.querySelector('.alphaPicker').classList.add('alphabetPicker-right'); tabElement.querySelector('.alphaPicker').classList.add('alphabetPicker-right');
alphaPickerElement.classList.add('alphaPicker-fixed-right'); alphaPickerElement.classList.add('alphaPicker-fixed-right');
itemsContainer.classList.add('padded-right-withalphapicker'); itemsContainer.classList.add('padded-right-withalphapicker');
tabContent.querySelector('.btnFilter').addEventListener('click', () => { tabElement.querySelector('.btnFilter').addEventListener('click', () => {
this.showFilterMenu(); this.showFilterMenu();
}); });
tabContent.querySelector('.btnSort').addEventListener('click', function (e) { tabElement.querySelector('.btnSort').addEventListener('click', function (e) {
libraryBrowser.showSortMenu({ libraryBrowser.showSortMenu({
items: [{ items: [{
name: globalize.translate('Name'), name: globalize.translate('Name'),
@ -276,24 +276,24 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
id: 'PremiereDate,SortName' id: 'PremiereDate,SortName'
}], }],
callback: function () { callback: function () {
getQuery(tabContent).StartIndex = 0; getQuery(tabElement).StartIndex = 0;
reloadItems(tabContent); reloadItems(tabElement);
}, },
query: getQuery(tabContent), query: getQuery(tabElement),
button: e.target button: e.target
}); });
}); });
const btnSelectView = tabContent.querySelector('.btnSelectView'); const btnSelectView = tabElement.querySelector('.btnSelectView');
btnSelectView.addEventListener('click', (e) => { btnSelectView.addEventListener('click', (e) => {
libraryBrowser.showLayoutMenu(e.target, this.getCurrentViewStyle(), 'Banner,List,Poster,PosterCard,Thumb,ThumbCard'.split(',')); libraryBrowser.showLayoutMenu(e.target, this.getCurrentViewStyle(), 'Banner,List,Poster,PosterCard,Thumb,ThumbCard'.split(','));
}); });
btnSelectView.addEventListener('layoutchange', function (e) { btnSelectView.addEventListener('layoutchange', function (e) {
const viewStyle = e.detail.viewStyle; const viewStyle = e.detail.viewStyle;
getPageData(tabContent).view = viewStyle; getPageData(tabElement).view = viewStyle;
libraryBrowser.saveViewSetting(getSavedQueryKey(tabContent), viewStyle); libraryBrowser.saveViewSetting(getSavedQueryKey(tabElement), viewStyle);
getQuery(tabContent).StartIndex = 0; getQuery(tabElement).StartIndex = 0;
onViewStyleChange(); onViewStyleChange();
reloadItems(tabContent); reloadItems(tabElement);
}); });
}; };

View file

@ -155,9 +155,9 @@ import './emby-scroller.scss';
} }
}; };
function loadScrollButtons(scroller) { function loadScrollButtons(buttonsScroller) {
import('../emby-scrollbuttons/emby-scrollbuttons').then(() => { import('../emby-scrollbuttons/emby-scrollbuttons').then(() => {
scroller.insertAdjacentHTML('beforebegin', '<div is="emby-scrollbuttons" class="emby-scrollbuttons padded-right"></div>'); buttonsScroller.insertAdjacentHTML('beforebegin', '<div is="emby-scrollbuttons" class="emby-scrollbuttons padded-right"></div>');
}); });
} }

View file

@ -4,6 +4,17 @@ import '../emby-input/emby-input';
/* eslint-disable indent */ /* eslint-disable indent */
function calculateOffset(textarea) {
const style = window.getComputedStyle(textarea, null);
const props = ['paddingTop', 'paddingBottom'];
let offset = 0;
for (let i = 0; i < props.length; i++) {
offset += parseInt(style[props[i]]);
}
return offset;
}
function autoGrow(textarea, maxLines) { function autoGrow(textarea, maxLines) {
const self = this; const self = this;
@ -16,16 +27,7 @@ import '../emby-input/emby-input';
* @param textarea * @param textarea
* @returns {number} * @returns {number}
*/ */
self.getOffset = function (textarea) { self.getOffset = calculateOffset(textarea);
const style = window.getComputedStyle(textarea, null);
const props = ['paddingTop', 'paddingBottom'];
let offset = 0;
for (let i = 0; i < props.length; i++) {
offset += parseInt(style[props[i]]);
}
return offset;
};
let offset; let offset;
function reset() { function reset() {

View file

@ -980,9 +980,9 @@ class ChromecastPlayer {
const instance = this; const instance = this;
apiClient.getItem(userId, item.Id).then(function (item) { apiClient.getItem(userId, item.Id).then(function (fetchedItem) {
instance.playWithCommand({ instance.playWithCommand({
items: [item] items: [fetchedItem]
}, 'Shuffle'); }, 'Shuffle');
}); });
} }
@ -993,9 +993,9 @@ class ChromecastPlayer {
const instance = this; const instance = this;
apiClient.getItem(userId, item.Id).then(function (item) { apiClient.getItem(userId, item.Id).then(function (fetchedItem) {
instance.playWithCommand({ instance.playWithCommand({
items: [item] items: [fetchedItem]
}, 'InstantMix'); }, 'InstantMix');
}); });
} }

View file

@ -1346,13 +1346,13 @@ function tryRemoveElement(elem) {
return import('./style.scss').then(() => { return import('./style.scss').then(() => {
loading.show(); loading.show();
const dlg = document.createElement('div'); const newdlg = document.createElement('div');
dlg.setAttribute('dir', 'ltr'); newdlg.setAttribute('dir', 'ltr');
dlg.classList.add('videoPlayerContainer'); newdlg.classList.add('videoPlayerContainer');
if (options.fullscreen) { if (options.fullscreen) {
dlg.classList.add('videoPlayerContainer-onTop'); newdlg.classList.add('videoPlayerContainer-onTop');
} }
let html = ''; let html = '';
@ -1371,8 +1371,8 @@ function tryRemoveElement(elem) {
html += '</video>'; html += '</video>';
dlg.innerHTML = html; newdlg.innerHTML = html;
const videoElement = dlg.querySelector('video'); const videoElement = newdlg.querySelector('video');
videoElement.volume = getSavedVolume(); videoElement.volume = getSavedVolume();
videoElement.addEventListener('timeupdate', this.onTimeUpdate); videoElement.addEventListener('timeupdate', this.onTimeUpdate);
@ -1388,8 +1388,8 @@ function tryRemoveElement(elem) {
videoElement.poster = options.backdropUrl; videoElement.poster = options.backdropUrl;
} }
document.body.insertBefore(dlg, document.body.firstChild); document.body.insertBefore(newdlg, document.body.firstChild);
this.#videoDialog = dlg; this.#videoDialog = newdlg;
this.#mediaElement = videoElement; this.#mediaElement = videoElement;
delete this.forcedFullscreen; delete this.forcedFullscreen;
@ -1408,7 +1408,7 @@ function tryRemoveElement(elem) {
// don't animate on smart tv's, too slow // don't animate on smart tv's, too slow
if (!browser.slow && browser.supportsCssAnimation()) { if (!browser.slow && browser.supportsCssAnimation()) {
return zoomIn(dlg).then(function () { return zoomIn(newdlg).then(function () {
return videoElement; return videoElement;
}); });
} }

View file

@ -32,26 +32,26 @@ function createMediaElement(instance, options) {
import('./style.scss').then(() => { import('./style.scss').then(() => {
loading.show(); loading.show();
const dlg = document.createElement('div'); const newdlg = document.createElement('div');
dlg.classList.add('youtubePlayerContainer'); newdlg.classList.add('youtubePlayerContainer');
if (options.fullscreen) { if (options.fullscreen) {
dlg.classList.add('onTop'); newdlg.classList.add('onTop');
} }
dlg.innerHTML = '<div id="player"></div>'; newdlg.innerHTML = '<div id="player"></div>';
const videoElement = dlg.querySelector('#player'); const videoElement = newdlg.querySelector('#player');
document.body.insertBefore(dlg, document.body.firstChild); document.body.insertBefore(newdlg, document.body.firstChild);
instance.videoDialog = dlg; instance.videoDialog = newdlg;
if (options.fullscreen) { if (options.fullscreen) {
document.body.classList.add('hide-scroll'); document.body.classList.add('hide-scroll');
} }
if (options.fullscreen && dlg.animate && !browser.slow) { if (options.fullscreen && newdlg.animate && !browser.slow) {
zoomIn(dlg, 1).onfinish = function () { zoomIn(newdlg, 1).onfinish = function () {
resolve(videoElement); resolve(videoElement);
}; };
} else { } else {

View file

@ -264,7 +264,7 @@ function runInputLoop() {
} }
// Iterate through the buttons to see if Left thumbstick, DPad, A and B are pressed. // Iterate through the buttons to see if Left thumbstick, DPad, A and B are pressed.
const buttons = gamepad.buttons; const buttons = gamepad.buttons;
for (let j = 0, len = buttons.length; j < len; j++) { for (let j = 0, buttonsLen = buttons.length; j < buttonsLen; j++) {
if (ProcessedButtons.indexOf(j) !== -1) { if (ProcessedButtons.indexOf(j) !== -1) {
if (buttons[j].pressed) { if (buttons[j].pressed) {
switch (j) { switch (j) {