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') {
let url = '#/list.html?serverId=' + options.serverId + '&type=' + options.itemTypes;
let urlForList = '#/list.html?serverId=' + options.serverId + '&type=' + options.itemTypes;
if (options.isFavorite) {
url += '&IsFavorite=true';
urlForList += '&IsFavorite=true';
}
return url;
return urlForList;
}
if (item === 'livetv') {

View file

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

View file

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

View file

@ -251,8 +251,8 @@ class DirectoryBrowser {
}
Promise.all([getSystemInfo(), getDefaultPath(options)]).then(
responses => {
const systemInfo = responses[0];
const initialPath = responses[1];
const fetchedSystemInfo = responses[0];
const fetchedInitialPath = responses[1];
const dlg = dialogHelper.createDialog({
size: 'small',
removeOnClose: true,
@ -270,7 +270,7 @@ class DirectoryBrowser {
html += escapeHtml(options.header || '') || globalize.translate('HeaderSelectPath');
html += '</h3>';
html += '</div>';
html += getEditorHtml(options, systemInfo);
html += getEditorHtml(options, fetchedSystemInfo);
dlg.innerHTML = html;
initEditor(dlg, options, fileOptions);
dlg.addEventListener('close', onDialogClosed);
@ -279,13 +279,13 @@ class DirectoryBrowser {
dialogHelper.close(dlg);
});
this.currentDialog = dlg;
dlg.querySelector('#txtDirectoryPickerPath').value = initialPath;
dlg.querySelector('#txtDirectoryPickerPath').value = fetchedInitialPath;
const txtNetworkPath = dlg.querySelector('#txtNetworkPath');
if (txtNetworkPath) {
txtNetworkPath.value = options.networkSharePath || '';
}
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>';
}
function getChannelProgramsHtml(context, date, channel, programs, options, listInfo) {
function getChannelProgramsHtml(context, date, channel, programs, programOptions, listInfo) {
let html = '';
const startMs = date.getTime();
@ -542,21 +542,21 @@ function Guide(options) {
html += '<div class="guideProgramNameText">' + escapeHtml(program.Name);
let indicatorHtml = null;
if (program.IsLive && options.showLiveIndicator) {
if (program.IsLive && programOptions.showLiveIndicator) {
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>';
} 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>';
} 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>';
}
html += indicatorHtml || '';
if ((program.EpisodeTitle && options.showEpisodeTitle)) {
if ((program.EpisodeTitle && programOptions.showEpisodeTitle)) {
html += '<div class="guideProgramSecondaryInfo">';
if (program.EpisodeTitle && options.showEpisodeTitle) {
if (program.EpisodeTitle && programOptions.showEpisodeTitle) {
html += '<span class="programSecondaryTitle">' + escapeHtml(program.EpisodeTitle) + '</span>';
}
html += '</div>';
@ -564,7 +564,7 @@ function Guide(options) {
html += '</div>';
if (program.IsHD && options.showHdIcon) {
if (program.IsHD && programOptions.showHdIcon) {
if (layoutManager.tv) {
html += '<div class="programIcon guide-programTextIcon guide-programTextIcon-tv">HD</div>';
} else {
@ -633,7 +633,7 @@ function Guide(options) {
imageLoader.lazyChildren(channelList);
}
function renderPrograms(context, date, channels, programs, options) {
function renderPrograms(context, date, channels, programs, programOptions) {
const listInfo = {
startIndex: 0
};
@ -641,7 +641,7 @@ function Guide(options) {
const html = [];
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('');

View file

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

View file

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

View file

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

View file

@ -1764,9 +1764,9 @@ class PlaybackManager {
MediaTypes: 'Photo,Video',
Limit: UNLIMITED_ITEMS
}).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;
}).indexOf(firstItem.Id);

View file

@ -251,8 +251,8 @@ import toast from './toast/toast';
} else if (action === 'playmenu') {
showPlayMenu(card, target);
} else if (action === 'edit') {
getItem(target).then(item => {
editItem(item, serverId);
getItem(target).then(itemToEdit => {
editItem(itemToEdit, serverId);
});
} else if (action === 'playtrailer') {
getItem(target).then(playTrailer);
@ -293,21 +293,21 @@ import toast from './toast/toast';
const apiClient = ServerConnections.getApiClient(serverId);
return new Promise((resolve, reject) => {
const serverId = apiClient.serverInfo().Id;
const myServerId = apiClient.serverInfo().Id;
if (item.Type === 'Timer') {
if (item.ProgramId) {
import('./recordingcreator/recordingcreator').then(({default: recordingCreator}) => {
recordingCreator.show(item.ProgramId, serverId).then(resolve, reject);
recordingCreator.show(item.ProgramId, myServerId).then(resolve, reject);
});
} else {
import('./recordingcreator/recordingeditor').then(({default: recordingEditor}) => {
recordingEditor.show(item.Id, serverId).then(resolve, reject);
recordingEditor.show(item.Id, myServerId).then(resolve, reject);
});
}
} else {
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.
* @param {Object} options - Options used to create the dialog and slideshow.
*/
function createElements(options) {
currentOptions = options;
function createElements(slideshowOptions) {
currentOptions = slideshowOptions;
dialog = dialogHelper.createDialog({
exitAnimationDuration: options.interactive ? 400 : 800,
exitAnimationDuration: slideshowOptions.interactive ? 400 : 800,
size: 'fullscreen',
autoFocus: false,
scrollY: false,
@ -159,7 +159,7 @@ export default function (options) {
html += '<div class="slideshowSwiperContainer"><div class="swiper-wrapper"></div></div>';
if (options.interactive && !layoutManager.tv) {
if (slideshowOptions.interactive && !layoutManager.tv) {
const actionButtonsOnTop = layoutManager.mobile;
html += getIcon('keyboard_arrow_left', 'btnSlideshowPrevious slideshowButton hide-mouse-idle-tv', false);
@ -169,7 +169,7 @@ export default function (options) {
if (actionButtonsOnTop) {
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);
}
if (appHost.supports('sharing')) {
@ -187,7 +187,7 @@ export default function (options) {
html += '<div class="slideshowBottomBar hide">';
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);
}
if (appHost.supports('sharing')) {
@ -206,7 +206,7 @@ export default function (options) {
dialog.innerHTML = html;
if (options.interactive && !layoutManager.tv) {
if (slideshowOptions.interactive && !layoutManager.tv) {
dialog.querySelector('.btnSlideshowExit').addEventListener('click', function () {
dialogHelper.close(dialog);
});
@ -331,7 +331,7 @@ export default function (options) {
* @param {HTMLElement} dialog - Element containing the dialog.
* @param {Object} options - Options used to initialize the Swiper instance.
*/
function loadSwiper(dialog, options) {
function loadSwiper(dialogElement, swiperOptions) {
let slides;
if (currentOptions.slides) {
slides = currentOptions.slides;
@ -344,7 +344,7 @@ export default function (options) {
// eslint-disable-next-line import/no-unresolved
import('swiper/bundle').then(({ Swiper }) => {
swiperInstance = new Swiper(dialog.querySelector('.slideshowSwiperContainer'), {
swiperInstance = new Swiper(dialogElement.querySelector('.slideshowSwiperContainer'), {
direction: 'horizontal',
// Loop is disabled due to the virtual slides option not supporting it.
loop: false,
@ -352,14 +352,14 @@ export default function (options) {
minRatio: 1,
toggle: true
},
autoplay: !options.interactive || !!options.autoplay,
autoplay: !swiperOptions.interactive || !!swiperOptions.autoplay,
keyboard: {
enabled: true
},
preloadImages: true,
slidesPerView: 1,
slidesPerColumn: 1,
initialSlide: options.startIndex || 0,
initialSlide: swiperOptions.startIndex || 0,
speed: 240,
navigation: {
nextEl: '.btnSlideshowNext',

View file

@ -12,6 +12,43 @@ import './style.scss';
import Dashboard from '../../utils/dashboard';
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) {
function reload() {
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;
const self = this;

View file

@ -8,6 +8,62 @@ import '../../elements/emby-button/paper-icon-button-light';
import Dashboard from '../../utils/dashboard';
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) {
function getListingProvider(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;
self.submit = function () {

View file

@ -289,8 +289,8 @@ import alert from '../../components/alert';
libraryMenu.setTabs('playback', 0, getTabs);
const page = this;
ApiClient.getNamedConfiguration('encoding').then(function (config) {
ApiClient.getSystemInfo().then(function (systemInfo) {
loadPage(page, config, systemInfo);
ApiClient.getSystemInfo().then(function (fetchedSystemInfo) {
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 = [];
itemArray.push(item);
const cardHtml = cardBuilder.getCardsHtml(itemArray, {
@ -787,7 +787,7 @@ function renderDetailImage(elem, item, imageLoader) {
});
elem.innerHTML = cardHtml;
imageLoader.lazyChildren(elem);
loader.lazyChildren(elem);
// Avoid breaking the design by preventing focus of the poster using the keyboard.
elem.querySelector('a, button').tabIndex = -1;
@ -1881,28 +1881,28 @@ export default function (view, params) {
return params.serverId ? ServerConnections.getApiClient(params.serverId) : ApiClient;
}
function reload(instance, page, params) {
function reload(instance, page, pageParams) {
loading.show();
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;
reloadFromItem(instance, page, params, item, user);
reloadFromItem(instance, page, pageParams, item, user);
}).catch((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 () {
loading.show();
apiClient.ajax({
type: 'DELETE',
url: apiClient.getUrl('Videos/' + params.id + '/AlternateSources')
url: apiClient.getUrl('Videos/' + pageParams.id + '/AlternateSources')
}).then(function () {
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;
};
const initPage = (tabContent) => {
tabContent.querySelector('.btnSort').addEventListener('click', function (e) {
const initPage = (tabElement) => {
tabElement.querySelector('.btnSort').addEventListener('click', function (e) {
libraryBrowser.showSortMenu({
items: [{
name: globalize.translate('Name'),
@ -226,26 +226,26 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
id: 'PremiereDate,SortName'
}],
callback: function () {
getQuery(tabContent).StartIndex = 0;
reloadItems(tabContent);
getQuery(tabElement).StartIndex = 0;
reloadItems(tabElement);
},
query: getQuery(tabContent),
query: getQuery(tabElement),
button: e.target
});
});
const btnSelectView = tabContent.querySelector('.btnSelectView');
const btnSelectView = tabElement.querySelector('.btnSelectView');
btnSelectView.addEventListener('click', (e) => {
libraryBrowser.showLayoutMenu(e.target, this.getCurrentViewStyle(), 'List,Poster,PosterCard,Thumb,ThumbCard'.split(','));
});
btnSelectView.addEventListener('layoutchange', function (e) {
const viewStyle = e.detail.viewStyle;
getPageData(tabContent).view = viewStyle;
libraryBrowser.saveViewSetting(getSavedQueryKey(tabContent), viewStyle);
getQuery(tabContent).StartIndex = 0;
getPageData(tabElement).view = viewStyle;
libraryBrowser.saveViewSetting(getSavedQueryKey(tabElement), viewStyle);
getQuery(tabElement).StartIndex = 0;
onViewStyleChange();
reloadItems(tabContent);
reloadItems(tabElement);
});
tabContent.querySelector('.btnNewCollection').addEventListener('click', () => {
tabElement.querySelector('.btnNewCollection').addEventListener('click', () => {
import('../../components/collectionEditor/collectionEditor').then(({default: collectionEditor}) => {
const serverId = ApiClient.serverInfo().Id;
new collectionEditor({

View file

@ -166,11 +166,11 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
return html;
};
const initPage = (tabContent) => {
const initPage = (tabElement) => {
itemsContainer.fetchData = fetchData;
itemsContainer.getItemsHtml = getItemsHtml;
itemsContainer.afterRefresh = afterRefresh;
const alphaPickerElement = tabContent.querySelector('.alphaPicker');
const alphaPickerElement = tabElement.querySelector('.alphaPicker');
if (alphaPickerElement) {
alphaPickerElement.addEventListener('alphavaluechanged', function (e) {
@ -190,19 +190,19 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
valueChangeEvent: 'click'
});
tabContent.querySelector('.alphaPicker').classList.add('alphabetPicker-right');
tabElement.querySelector('.alphaPicker').classList.add('alphabetPicker-right');
alphaPickerElement.classList.add('alphaPicker-fixed-right');
itemsContainer.classList.add('padded-right-withalphapicker');
}
const btnFilter = tabContent.querySelector('.btnFilter');
const btnFilter = tabElement.querySelector('.btnFilter');
if (btnFilter) {
btnFilter.addEventListener('click', () => {
this.showFilterMenu();
});
}
const btnSort = tabContent.querySelector('.btnSort');
const btnSort = tabElement.querySelector('.btnSort');
if (btnSort) {
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) => {
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();
});
tabContent.querySelector('.btnShuffle').addEventListener('click', shuffle);
tabElement.querySelector('.btnShuffle').addEventListener('click', shuffle);
};
let itemsContainer = tabContent.querySelector('.itemsContainer');

View file

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

View file

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

View file

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

View file

@ -226,7 +226,7 @@ import Dashboard from '../../utils/dashboard';
loadSuggestionsTab(view, tabContent, params.topParentId);
}
function enableScrollX() {
function enableScrollXmobile() {
return browser.mobile;
}
@ -362,7 +362,7 @@ import Dashboard from '../../utils/dashboard';
const containers = tabContent.querySelectorAll('.itemsContainer');
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;
};
function initPage(tabContent) {
tabContent.querySelector('.btnFilter').addEventListener('click', function () {
function initPage(tabElement) {
tabElement.querySelector('.btnFilter').addEventListener('click', function () {
self.showFilterMenu();
});
tabContent.querySelector('.btnSort').addEventListener('click', function (e) {
tabElement.querySelector('.btnSort').addEventListener('click', function (e) {
libraryBrowser.showSortMenu({
items: [{
name: globalize.translate('OptionTrackName'),
@ -197,14 +197,14 @@ export default function (view, params, tabContent) {
id: 'Random,SortName'
}],
callback: function () {
getQuery(tabContent).StartIndex = 0;
reloadItems(tabContent);
getQuery(tabElement).StartIndex = 0;
reloadItems(tabElement);
},
query: getQuery(tabContent),
query: getQuery(tabElement),
button: e.target
});
});
tabContent.querySelector('.btnShuffle').addEventListener('click', shuffle);
tabElement.querySelector('.btnShuffle').addEventListener('click', shuffle);
}
initPage(tabContent);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -264,7 +264,7 @@ function runInputLoop() {
}
// Iterate through the buttons to see if Left thumbstick, DPad, A and B are pressed.
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 (buttons[j].pressed) {
switch (j) {