mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
convert playlist page
This commit is contained in:
parent
b971acb33a
commit
0d9c8e71fe
@ -37,6 +37,10 @@
|
||||
contain: strict;
|
||||
}
|
||||
|
||||
.layout-tv .vertical-wrap .card {
|
||||
contain: layout style;
|
||||
}
|
||||
|
||||
.card, .card:focus {
|
||||
font-weight: inherit !important;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div id="playlistsPage" data-dom-cache="true" data-role="page" class="page libraryPage noSecondaryNavPage" data-require="scripts/playlists,emby-itemscontainer" data-title="${HeaderPlaylists}">
|
||||
<div id="playlistsPage" data-dom-cache="true" data-role="page" class="page libraryPage noSecondaryNavPage" data-title="${HeaderPlaylists}">
|
||||
|
||||
<div data-role="content">
|
||||
<div class="viewSettings">
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div is="emby-itemscontainer" id="items" class="itemsContainer paddedItemsContainer" style="text-align:center;"></div>
|
||||
<div is="emby-itemscontainer" id="items" class="itemsContainer paddedItemsContainer centered"></div>
|
||||
<div class="noItemsMessage hide" style="text-align: center;">
|
||||
<p>${MessageNoPlaylistsAvailable}</p>
|
||||
</div>
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
function updateEncoder(form) {
|
||||
|
||||
return ApiClient.getSystemInfo().then(function(systemInfo) {
|
||||
return ApiClient.getSystemInfo().then(function (systemInfo) {
|
||||
|
||||
if (systemInfo.EncoderLocationType == "External") {
|
||||
return;
|
||||
@ -118,8 +118,10 @@
|
||||
|
||||
if (this.value == 'Custom') {
|
||||
page.querySelector('.fldEncoderPath').classList.remove('hide');
|
||||
page.querySelector('.txtEncoderPath').setAttribute('required', 'required');
|
||||
} else {
|
||||
page.querySelector('.fldEncoderPath').classList.add('hide');
|
||||
page.querySelector('.txtEncoderPath').removeAttribute('required');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
define(['listView'], function (listView) {
|
||||
define(['listView', 'cardBuilder', 'libraryBrowser', 'emby-itemscontainer'], function (listView, cardBuilder, libraryBrowser) {
|
||||
|
||||
return function (view, params) {
|
||||
|
||||
var data = {};
|
||||
function getPageData() {
|
||||
var key = getSavedQueryKey();
|
||||
function getPageData(context) {
|
||||
var key = getSavedQueryKey(context);
|
||||
var pageData = data[key];
|
||||
|
||||
if (!pageData) {
|
||||
@ -25,30 +27,52 @@
|
||||
return pageData;
|
||||
}
|
||||
|
||||
function getQuery() {
|
||||
function getQuery(context) {
|
||||
|
||||
return getPageData().query;
|
||||
return getPageData(context).query;
|
||||
}
|
||||
|
||||
function getSavedQueryKey() {
|
||||
function getSavedQueryKey(context) {
|
||||
|
||||
return LibraryBrowser.getSavedQueryKey();
|
||||
if (!context.savedQueryKey) {
|
||||
context.savedQueryKey = libraryBrowser.getSavedQueryKey();
|
||||
}
|
||||
return context.savedQueryKey;
|
||||
}
|
||||
|
||||
function showLoadingMessage(page) {
|
||||
function showLoadingMessage() {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
}
|
||||
|
||||
function hideLoadingMessage(page) {
|
||||
function hideLoadingMessage() {
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
function reloadItems(page) {
|
||||
function onViewStyleChange() {
|
||||
|
||||
showLoadingMessage(page);
|
||||
var viewStyle = getPageData(view).view;
|
||||
|
||||
var query = getQuery();
|
||||
var itemsContainer = view.querySelector('.itemsContainer');
|
||||
|
||||
if (viewStyle == "List") {
|
||||
|
||||
itemsContainer.classList.add('vertical-list');
|
||||
itemsContainer.classList.remove('vertical-wrap');
|
||||
}
|
||||
else {
|
||||
|
||||
itemsContainer.classList.remove('vertical-list');
|
||||
itemsContainer.classList.add('vertical-wrap');
|
||||
}
|
||||
itemsContainer.innerHTML = '';
|
||||
}
|
||||
|
||||
function reloadItems() {
|
||||
|
||||
showLoadingMessage();
|
||||
|
||||
var query = getQuery(view);
|
||||
var promise1 = ApiClient.getItems(Dashboard.getCurrentUserId(), query);
|
||||
var promise2 = Dashboard.getCurrentUser();
|
||||
|
||||
@ -61,9 +85,9 @@
|
||||
window.scrollTo(0, 0);
|
||||
|
||||
var html = '';
|
||||
var view = getPageData().view;
|
||||
var viewStyle = getPageData(view).view;
|
||||
|
||||
page.querySelector('.listTopPaging').innerHTML = LibraryBrowser.getQueryPagingHtml({
|
||||
view.querySelector('.listTopPaging').innerHTML = LibraryBrowser.getQueryPagingHtml({
|
||||
startIndex: query.StartIndex,
|
||||
limit: query.Limit,
|
||||
totalRecordCount: result.TotalRecordCount,
|
||||
@ -72,21 +96,21 @@
|
||||
updatePageSizeSetting: false,
|
||||
addLayoutButton: true,
|
||||
layouts: 'List,Poster,PosterCard,Thumb,ThumbCard',
|
||||
currentLayout: view
|
||||
currentLayout: viewStyle
|
||||
|
||||
});
|
||||
|
||||
if (result.TotalRecordCount) {
|
||||
|
||||
if (view == "List") {
|
||||
if (viewStyle == "List") {
|
||||
|
||||
html = listView.getListViewHtml({
|
||||
items: result.Items,
|
||||
sortBy: query.SortBy
|
||||
});
|
||||
}
|
||||
else if (view == "PosterCard") {
|
||||
html = LibraryBrowser.getPosterViewHtml({
|
||||
else if (viewStyle == "PosterCard") {
|
||||
html = cardBuilder.getCardsHtml({
|
||||
items: result.Items,
|
||||
shape: "square",
|
||||
showTitle: true,
|
||||
@ -96,8 +120,8 @@
|
||||
cardLayout: true
|
||||
});
|
||||
}
|
||||
else if (view == "Thumb") {
|
||||
html = LibraryBrowser.getPosterViewHtml({
|
||||
else if (viewStyle == "Thumb") {
|
||||
html = cardBuilder.getCardsHtml({
|
||||
items: result.Items,
|
||||
shape: "backdrop",
|
||||
showTitle: true,
|
||||
@ -107,8 +131,8 @@
|
||||
overlayPlayButton: true
|
||||
});
|
||||
}
|
||||
else if (view == "ThumbCard") {
|
||||
html = LibraryBrowser.getPosterViewHtml({
|
||||
else if (viewStyle == "ThumbCard") {
|
||||
html = cardBuilder.getCardsHtml({
|
||||
items: result.Items,
|
||||
shape: "backdrop",
|
||||
showTitle: true,
|
||||
@ -120,7 +144,7 @@
|
||||
}
|
||||
else {
|
||||
// Poster
|
||||
html = LibraryBrowser.getPosterViewHtml({
|
||||
html = cardBuilder.getCardsHtml({
|
||||
items: result.Items,
|
||||
shape: "square",
|
||||
showTitle: true,
|
||||
@ -132,53 +156,55 @@
|
||||
});
|
||||
}
|
||||
|
||||
page.querySelector('.noItemsMessage').classList.add('hide');
|
||||
view.querySelector('.noItemsMessage').classList.add('hide');
|
||||
|
||||
} else {
|
||||
|
||||
page.querySelector('.noItemsMessage').classList.remove('hide');
|
||||
view.querySelector('.noItemsMessage').classList.remove('hide');
|
||||
}
|
||||
|
||||
var elem = page.querySelector('.itemsContainer');
|
||||
var elem = view.querySelector('.itemsContainer');
|
||||
elem.innerHTML = html;
|
||||
ImageLoader.lazyChildren(elem);
|
||||
|
||||
var btnNextPage = page.querySelector('.btnNextPage');
|
||||
var btnNextPage = view.querySelector('.btnNextPage');
|
||||
if (btnNextPage) {
|
||||
btnNextPage.addEventListener('click', function () {
|
||||
query.StartIndex += query.Limit;
|
||||
reloadItems(page);
|
||||
reloadItems();
|
||||
});
|
||||
}
|
||||
|
||||
var btnPreviousPage = page.querySelector('.btnPreviousPage');
|
||||
var btnPreviousPage = view.querySelector('.btnPreviousPage');
|
||||
if (btnPreviousPage) {
|
||||
btnPreviousPage.addEventListener('click', function () {
|
||||
query.StartIndex -= query.Limit;
|
||||
reloadItems(page);
|
||||
reloadItems();
|
||||
});
|
||||
}
|
||||
|
||||
var btnChangeLayout = page.querySelector('.btnChangeLayout');
|
||||
var btnChangeLayout = view.querySelector('.btnChangeLayout');
|
||||
if (btnChangeLayout) {
|
||||
btnChangeLayout.addEventListener('layoutchange', function (e) {
|
||||
var layout = e.detail.viewStyle;
|
||||
getPageData().view = layout;
|
||||
LibraryBrowser.saveViewSetting(getSavedQueryKey(), layout);
|
||||
reloadItems(page);
|
||||
getPageData(view).view = layout;
|
||||
LibraryBrowser.saveViewSetting(getSavedQueryKey(view), layout);
|
||||
onViewStyleChange();
|
||||
reloadItems();
|
||||
});
|
||||
}
|
||||
|
||||
LibraryBrowser.saveQueryValues(getSavedQueryKey(), query);
|
||||
LibraryBrowser.saveQueryValues(getSavedQueryKey(view), query);
|
||||
|
||||
hideLoadingMessage(page);
|
||||
hideLoadingMessage();
|
||||
});
|
||||
}
|
||||
|
||||
pageIdOn('pagebeforeshow', "playlistsPage", function () {
|
||||
|
||||
var page = this;
|
||||
reloadItems(page);
|
||||
view.addEventListener('viewbeforeshow', function() {
|
||||
reloadItems();
|
||||
});
|
||||
|
||||
onViewStyleChange();
|
||||
|
||||
};
|
||||
});
|
@ -2497,7 +2497,8 @@ var AppInfo = {};
|
||||
path: '/playlists.html',
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
transition: 'fade'
|
||||
transition: 'fade',
|
||||
controller: 'scripts/playlists'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
|
Loading…
Reference in New Issue
Block a user