Remove ailiasing this
This commit is contained in:
parent
d8cb606894
commit
ab7fafa891
1 changed files with 23 additions and 24 deletions
|
@ -54,8 +54,8 @@ import 'emby-itemscontainer';
|
||||||
return context.savedQueryKey;
|
return context.savedQueryKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onViewStyleChange() {
|
const onViewStyleChange = () => {
|
||||||
const viewStyle = self.getCurrentViewStyle();
|
const viewStyle = this.getCurrentViewStyle();
|
||||||
const itemsContainer = tabContent.querySelector('.itemsContainer');
|
const itemsContainer = tabContent.querySelector('.itemsContainer');
|
||||||
|
|
||||||
if (viewStyle == 'List') {
|
if (viewStyle == 'List') {
|
||||||
|
@ -67,13 +67,13 @@ import 'emby-itemscontainer';
|
||||||
}
|
}
|
||||||
|
|
||||||
itemsContainer.innerHTML = '';
|
itemsContainer.innerHTML = '';
|
||||||
}
|
};
|
||||||
|
|
||||||
function reloadItems(page) {
|
const reloadItems = (page) => {
|
||||||
loading.show();
|
loading.show();
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
const query = getQuery(page);
|
const query = getQuery(page);
|
||||||
ApiClient.getItems(ApiClient.getCurrentUserId(), query).then(function (result) {
|
ApiClient.getItems(ApiClient.getCurrentUserId(), query).then((result) => {
|
||||||
function onNextPageClick() {
|
function onNextPageClick() {
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return;
|
return;
|
||||||
|
@ -109,7 +109,7 @@ import 'emby-itemscontainer';
|
||||||
sortButton: false,
|
sortButton: false,
|
||||||
filterButton: false
|
filterButton: false
|
||||||
});
|
});
|
||||||
const viewStyle = self.getCurrentViewStyle();
|
const viewStyle = this.getCurrentViewStyle();
|
||||||
if (viewStyle == 'Thumb') {
|
if (viewStyle == 'Thumb') {
|
||||||
html = cardBuilder.getCardsHtml({
|
html = cardBuilder.getCardsHtml({
|
||||||
items: result.Items,
|
items: result.Items,
|
||||||
|
@ -196,25 +196,24 @@ import 'emby-itemscontainer';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFilterControls(tabContent) {
|
const updateFilterControls = (tabContent) => {
|
||||||
const query = getQuery(tabContent);
|
const query = getQuery(tabContent);
|
||||||
|
|
||||||
if (self.alphaPicker) {
|
if (this.alphaPicker) {
|
||||||
self.alphaPicker.value(query.NameStartsWithOrGreater);
|
this.alphaPicker.value(query.NameStartsWithOrGreater);
|
||||||
|
|
||||||
if (query.SortBy.indexOf('SortName') === 0) {
|
if (query.SortBy.indexOf('SortName') === 0) {
|
||||||
self.alphaPicker.visible(true);
|
this.alphaPicker.visible(true);
|
||||||
} else {
|
} else {
|
||||||
self.alphaPicker.visible(false);
|
this.alphaPicker.visible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const self = this;
|
|
||||||
const data = {};
|
const data = {};
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
|
|
||||||
self.showFilterMenu = function () {
|
this.showFilterMenu = function () {
|
||||||
import('components/filterdialog/filterdialog').then(({default: filterDialogFactory}) => {
|
import('components/filterdialog/filterdialog').then(({default: filterDialogFactory}) => {
|
||||||
const filterDialog = new filterDialogFactory({
|
const filterDialog = new filterDialogFactory({
|
||||||
query: getQuery(tabContent),
|
query: getQuery(tabContent),
|
||||||
|
@ -229,11 +228,11 @@ import 'emby-itemscontainer';
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getCurrentViewStyle = function () {
|
this.getCurrentViewStyle = function () {
|
||||||
return getPageData(tabContent).view;
|
return getPageData(tabContent).view;
|
||||||
};
|
};
|
||||||
|
|
||||||
function initPage(tabContent) {
|
const initPage = (tabContent) => {
|
||||||
const alphaPickerElement = tabContent.querySelector('.alphaPicker');
|
const alphaPickerElement = tabContent.querySelector('.alphaPicker');
|
||||||
const itemsContainer = tabContent.querySelector('.itemsContainer');
|
const itemsContainer = tabContent.querySelector('.itemsContainer');
|
||||||
|
|
||||||
|
@ -244,7 +243,7 @@ import 'emby-itemscontainer';
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
reloadItems(tabContent);
|
reloadItems(tabContent);
|
||||||
});
|
});
|
||||||
self.alphaPicker = new AlphaPicker({
|
this.alphaPicker = new AlphaPicker({
|
||||||
element: alphaPickerElement,
|
element: alphaPickerElement,
|
||||||
valueChangeEvent: 'click'
|
valueChangeEvent: 'click'
|
||||||
});
|
});
|
||||||
|
@ -253,8 +252,8 @@ import 'emby-itemscontainer';
|
||||||
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', function () {
|
tabContent.querySelector('.btnFilter').addEventListener('click', () => {
|
||||||
self.showFilterMenu();
|
this.showFilterMenu();
|
||||||
});
|
});
|
||||||
tabContent.querySelector('.btnSort').addEventListener('click', function (e) {
|
tabContent.querySelector('.btnSort').addEventListener('click', function (e) {
|
||||||
libraryBrowser.showSortMenu({
|
libraryBrowser.showSortMenu({
|
||||||
|
@ -286,8 +285,8 @@ import 'emby-itemscontainer';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
const btnSelectView = tabContent.querySelector('.btnSelectView');
|
const btnSelectView = tabContent.querySelector('.btnSelectView');
|
||||||
btnSelectView.addEventListener('click', function (e) {
|
btnSelectView.addEventListener('click', (e) => {
|
||||||
libraryBrowser.showLayoutMenu(e.target, self.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;
|
||||||
|
@ -297,17 +296,17 @@ import 'emby-itemscontainer';
|
||||||
onViewStyleChange();
|
onViewStyleChange();
|
||||||
reloadItems(tabContent);
|
reloadItems(tabContent);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
initPage(tabContent);
|
initPage(tabContent);
|
||||||
onViewStyleChange();
|
onViewStyleChange();
|
||||||
|
|
||||||
self.renderTab = function () {
|
this.renderTab = function () {
|
||||||
reloadItems(tabContent);
|
reloadItems(tabContent);
|
||||||
updateFilterControls(tabContent);
|
updateFilterControls(tabContent);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.destroy = function () {};
|
this.destroy = function () {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-enable indent */
|
/* eslint-enable indent */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue