mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
clean up
This commit is contained in:
parent
6cb6e10083
commit
a3c8e11025
4 changed files with 33 additions and 42 deletions
|
@ -62,8 +62,6 @@ function saveUser(page) {
|
|||
Name: $('#txtUsername', page).val(),
|
||||
Password: $('#txtPassword', page).val()
|
||||
};
|
||||
//user.Name = $('#txtUsername', page).val();
|
||||
//user.Password = $('#txtPassword', page).val();
|
||||
ApiClient.createUser(_user).then(function (user) {
|
||||
user.Policy.EnableAllFolders = $('#chkEnableAllFolders', page).is(':checked');
|
||||
user.Policy.EnabledFolders = [];
|
||||
|
|
|
@ -8,8 +8,8 @@ import globalize from '../../scripts/globalize';
|
|||
import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
|
||||
export default function (view, params, tabContent) {
|
||||
function getPageData(context) {
|
||||
const key = getSavedQueryKey(context);
|
||||
function getPageData() {
|
||||
const key = getSavedQueryKey();
|
||||
let pageData = data[key];
|
||||
|
||||
if (!pageData) {
|
||||
|
@ -38,16 +38,12 @@ export default function (view, params, tabContent) {
|
|||
return pageData;
|
||||
}
|
||||
|
||||
function getQuery(context) {
|
||||
return getPageData(context).query;
|
||||
function getQuery() {
|
||||
return getPageData().query;
|
||||
}
|
||||
|
||||
function getSavedQueryKey(context) {
|
||||
if (!context.savedQueryKey) {
|
||||
context.savedQueryKey = libraryBrowser.getSavedQueryKey('moviecollections');
|
||||
}
|
||||
|
||||
return context.savedQueryKey;
|
||||
function getSavedQueryKey() {
|
||||
return params.topParentId + '-' + 'moviecollections';
|
||||
}
|
||||
|
||||
const onViewStyleChange = () => {
|
||||
|
@ -68,7 +64,7 @@ export default function (view, params, tabContent) {
|
|||
const reloadItems = (page) => {
|
||||
loading.show();
|
||||
isLoading = true;
|
||||
const query = getQuery(page);
|
||||
const query = getQuery();
|
||||
ApiClient.getItems(ApiClient.getCurrentUserId(), query).then((result) => {
|
||||
function onNextPageClick() {
|
||||
if (isLoading) {
|
||||
|
@ -187,7 +183,7 @@ export default function (view, params, tabContent) {
|
|||
const itemsContainer = tabContent.querySelector('.itemsContainer');
|
||||
itemsContainer.innerHTML = html;
|
||||
imageLoader.lazyChildren(itemsContainer);
|
||||
libraryBrowser.saveQueryValues(getSavedQueryKey(page), query);
|
||||
libraryBrowser.saveQueryValues(getSavedQueryKey(), query);
|
||||
loading.hide();
|
||||
isLoading = false;
|
||||
|
||||
|
@ -201,7 +197,7 @@ export default function (view, params, tabContent) {
|
|||
let isLoading = false;
|
||||
|
||||
this.getCurrentViewStyle = function () {
|
||||
return getPageData(tabContent).view;
|
||||
return getPageData().view;
|
||||
};
|
||||
|
||||
const initPage = (tabElement) => {
|
||||
|
@ -224,10 +220,10 @@ export default function (view, params, tabContent) {
|
|||
id: 'PremiereDate,SortName'
|
||||
}],
|
||||
callback: function () {
|
||||
getQuery(tabElement).StartIndex = 0;
|
||||
getQuery().StartIndex = 0;
|
||||
reloadItems(tabElement);
|
||||
},
|
||||
query: getQuery(tabElement),
|
||||
query: getQuery(),
|
||||
button: e.target
|
||||
});
|
||||
});
|
||||
|
@ -237,16 +233,17 @@ export default function (view, params, tabContent) {
|
|||
});
|
||||
btnSelectView.addEventListener('layoutchange', function (e) {
|
||||
const viewStyle = e.detail.viewStyle;
|
||||
getPageData(tabElement).view = viewStyle;
|
||||
libraryBrowser.saveViewSetting(getSavedQueryKey(tabElement), viewStyle);
|
||||
getQuery(tabElement).StartIndex = 0;
|
||||
getPageData().view = viewStyle;
|
||||
libraryBrowser.saveViewSetting(getSavedQueryKey(), viewStyle);
|
||||
getQuery().StartIndex = 0;
|
||||
onViewStyleChange();
|
||||
reloadItems(tabElement);
|
||||
});
|
||||
tabElement.querySelector('.btnNewCollection').addEventListener('click', () => {
|
||||
import('../../components/collectionEditor/collectionEditor').then(({ default: collectionEditor }) => {
|
||||
import('../../components/collectionEditor/collectionEditor').then(({ default: CollectionEditor }) => {
|
||||
const serverId = ApiClient.serverInfo().Id;
|
||||
new collectionEditor({
|
||||
const collectionEditor = new CollectionEditor();
|
||||
collectionEditor.show({
|
||||
items: [],
|
||||
serverId: serverId
|
||||
});
|
||||
|
|
|
@ -36,7 +36,7 @@ export default function (view, params, tabContent) {
|
|||
}
|
||||
|
||||
function getSavedQueryKey() {
|
||||
return libraryBrowser.getSavedQueryKey('moviegenres');
|
||||
return params.topParentId + '-' + 'moviegenres';
|
||||
}
|
||||
|
||||
function getPromise() {
|
||||
|
|
|
@ -11,8 +11,8 @@ import Events from '../../utils/events.ts';
|
|||
import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
|
||||
export default function (view, params, tabContent) {
|
||||
function getPageData(context) {
|
||||
const key = getSavedQueryKey(context);
|
||||
function getPageData() {
|
||||
const key = getSavedQueryKey();
|
||||
let pageData = data[key];
|
||||
|
||||
if (!pageData) {
|
||||
|
@ -40,22 +40,18 @@ export default function (view, params, tabContent) {
|
|||
return pageData;
|
||||
}
|
||||
|
||||
function getQuery(context) {
|
||||
return getPageData(context).query;
|
||||
function getQuery() {
|
||||
return getPageData().query;
|
||||
}
|
||||
|
||||
function getSavedQueryKey(context) {
|
||||
if (!context.savedQueryKey) {
|
||||
context.savedQueryKey = libraryBrowser.getSavedQueryKey('trailers');
|
||||
}
|
||||
|
||||
return context.savedQueryKey;
|
||||
function getSavedQueryKey() {
|
||||
return params.topParentId + '-' + 'trailers';
|
||||
}
|
||||
|
||||
const reloadItems = () => {
|
||||
loading.show();
|
||||
isLoading = true;
|
||||
const query = getQuery(tabContent);
|
||||
const query = getQuery();
|
||||
ApiClient.getItems(ApiClient.getCurrentUserId(), query).then((result) => {
|
||||
function onNextPageClick() {
|
||||
if (isLoading) {
|
||||
|
@ -176,7 +172,7 @@ export default function (view, params, tabContent) {
|
|||
const itemsContainer = tabContent.querySelector('.itemsContainer');
|
||||
itemsContainer.innerHTML = html;
|
||||
imageLoader.lazyChildren(itemsContainer);
|
||||
libraryBrowser.saveQueryValues(getSavedQueryKey(tabContent), query);
|
||||
libraryBrowser.saveQueryValues(getSavedQueryKey(), query);
|
||||
loading.hide();
|
||||
isLoading = false;
|
||||
});
|
||||
|
@ -188,12 +184,12 @@ export default function (view, params, tabContent) {
|
|||
this.showFilterMenu = function () {
|
||||
import('../../components/filterdialog/filterdialog').then(({ default: filterDialogFactory }) => {
|
||||
const filterDialog = new filterDialogFactory({
|
||||
query: getQuery(tabContent),
|
||||
query: getQuery(),
|
||||
mode: 'movies',
|
||||
serverId: ApiClient.serverId()
|
||||
});
|
||||
Events.on(filterDialog, 'filterchange', function () {
|
||||
getQuery(tabContent).StartIndex = 0;
|
||||
getQuery().StartIndex = 0;
|
||||
reloadItems();
|
||||
});
|
||||
filterDialog.show();
|
||||
|
@ -201,7 +197,7 @@ export default function (view, params, tabContent) {
|
|||
};
|
||||
|
||||
this.getCurrentViewStyle = function () {
|
||||
return getPageData(tabContent).view;
|
||||
return getPageData().view;
|
||||
};
|
||||
|
||||
const initPage = (tabElement) => {
|
||||
|
@ -209,7 +205,7 @@ export default function (view, params, tabContent) {
|
|||
const itemsContainer = tabElement.querySelector('.itemsContainer');
|
||||
alphaPickerElement.addEventListener('alphavaluechanged', function (e) {
|
||||
const newValue = e.detail.value;
|
||||
const query = getQuery(tabElement);
|
||||
const query = getQuery();
|
||||
if (newValue === '#') {
|
||||
query.NameLessThan = 'A';
|
||||
delete query.NameStartsWith;
|
||||
|
@ -257,10 +253,10 @@ export default function (view, params, tabContent) {
|
|||
id: 'PremiereDate,SortName'
|
||||
}],
|
||||
callback: function () {
|
||||
getQuery(tabElement).StartIndex = 0;
|
||||
getQuery().StartIndex = 0;
|
||||
reloadItems();
|
||||
},
|
||||
query: getQuery(tabElement),
|
||||
query: getQuery(),
|
||||
button: e.target
|
||||
});
|
||||
});
|
||||
|
@ -270,7 +266,7 @@ export default function (view, params, tabContent) {
|
|||
|
||||
this.renderTab = () => {
|
||||
reloadItems();
|
||||
this.alphaPicker?.updateControls(getQuery(tabContent));
|
||||
this.alphaPicker?.updateControls(getQuery());
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue