mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fixes #791 - Support server-side playlists
This commit is contained in:
parent
cd1e583fa7
commit
ba247c8a15
33 changed files with 1131 additions and 716 deletions
|
@ -90,7 +90,7 @@
|
|||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
|
||||
if (item.Type == 'BoxSet') {
|
||||
if (item.Type == 'BoxSet' || item.Type == 'Playlist') {
|
||||
$('#fldDelete', page).show();
|
||||
}
|
||||
else if (user.Configuration.EnableContentDeletion &&
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
|
||||
html += pagingHtml;
|
||||
|
||||
$('.itemsContainer', page).html(html).trigger('create').createCardMenus().trigger('itemsrendered');
|
||||
$('.itemsContainer', page).html(html).trigger('create').createCardMenus();
|
||||
|
||||
$('.btnNextPage', page).on('click', function () {
|
||||
query.StartIndex += query.Limit;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{ name: Globalize.translate('HeaderFavoriteMovies'), types: "Movie", id: "favoriteMovies", shape: 'homePageBackdrop', preferThumb: true, showTitle: false },
|
||||
{ name: Globalize.translate('HeaderFavoriteShows'), types: "Series", id: "favoriteShows", shape: 'homePageBackdrop', preferThumb: true, showTitle: false },
|
||||
{ name: Globalize.translate('HeaderFavoriteEpisodes'), types: "Episode", id: "favoriteEpisode", shape: 'homePageBackdrop', preferThumb: false, showTitle: true, showParentTitle: true },
|
||||
{ name: Globalize.translate('HeaderFavoriteGames'), types: "Game", id: "favoriteGames", shape: 'auto', preferThumb: false, showTitle: true },
|
||||
{ name: Globalize.translate('HeaderFavoriteGames'), types: "Game", id: "favoriteGames", shape: 'autohome', preferThumb: false, showTitle: true },
|
||||
{ name: Globalize.translate('HeaderFavoriteAlbums'), types: "MusicAlbum", id: "favoriteAlbums", shape: 'homePageSquare', preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true }
|
||||
];
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
case "channels":
|
||||
imgUrl = "css/images/items/folders/channels.png";
|
||||
break;
|
||||
case "boxsets":
|
||||
default:
|
||||
imgUrl = "css/images/items/folders/folder.png";
|
||||
break;
|
||||
|
|
|
@ -607,7 +607,8 @@
|
|||
centerText: item.Type != "MusicAlbum",
|
||||
showTitle: item.Type == "MusicAlbum" || item.Type == "Game",
|
||||
borderless: item.Type == "Game",
|
||||
context: context
|
||||
context: context,
|
||||
overlayText: item.Type != "MusicAlbum"
|
||||
});
|
||||
|
||||
$('#similarContent', page).html(html).createCardMenus();
|
||||
|
|
|
@ -98,17 +98,38 @@
|
|||
|
||||
var childText;
|
||||
|
||||
if (options.context == "movies") {
|
||||
if (item.Type == 'Playlist') {
|
||||
|
||||
childText = '';
|
||||
|
||||
if (item.CumulativeRunTimeTicks) {
|
||||
|
||||
var minutes = item.CumulativeRunTimeTicks / 600000000;
|
||||
|
||||
minutes = minutes || 1;
|
||||
|
||||
childText += Math.round(minutes) + " min";
|
||||
|
||||
} else {
|
||||
childText += '0 min';
|
||||
}
|
||||
|
||||
//childText += item.ChildCount == 1 ? "1 item" : item.ChildCount + " items";
|
||||
|
||||
counts.push(childText);
|
||||
|
||||
}
|
||||
else if (options.context == "movies") {
|
||||
|
||||
if (item.MovieCount) {
|
||||
|
||||
childText = item.MovieCount == 1 ? "1 Movie" : item.MovieCount + " Movies";
|
||||
childText = item.MovieCount == 1 ? "1 movie" : item.MovieCount + " movies";
|
||||
|
||||
counts.push(childText);
|
||||
}
|
||||
if (item.TrailerCount) {
|
||||
|
||||
childText = item.TrailerCount == 1 ? "1 Trailer" : item.TrailerCount + " Trailers";
|
||||
childText = item.TrailerCount == 1 ? "1 trailer" : item.TrailerCount + " trailers";
|
||||
|
||||
counts.push(childText);
|
||||
}
|
||||
|
@ -117,13 +138,13 @@
|
|||
|
||||
if (item.SeriesCount) {
|
||||
|
||||
childText = item.SeriesCount == 1 ? "1 Show" : item.SeriesCount + " Shows";
|
||||
childText = item.SeriesCount == 1 ? "1 show" : item.SeriesCount + " shows";
|
||||
|
||||
counts.push(childText);
|
||||
}
|
||||
if (item.EpisodeCount) {
|
||||
|
||||
childText = item.EpisodeCount == 1 ? "1 Episode" : item.EpisodeCount + " Episodes";
|
||||
childText = item.EpisodeCount == 1 ? "1 episode" : item.EpisodeCount + " episodes";
|
||||
|
||||
counts.push(childText);
|
||||
}
|
||||
|
@ -132,7 +153,7 @@
|
|||
|
||||
if (item.GameCount) {
|
||||
|
||||
childText = item.GameCount == 1 ? "1 Game" : item.GameCount + " Games";
|
||||
childText = item.GameCount == 1 ? "1 game" : item.GameCount + " games";
|
||||
|
||||
counts.push(childText);
|
||||
}
|
||||
|
@ -140,19 +161,19 @@
|
|||
|
||||
if (item.AlbumCount) {
|
||||
|
||||
childText = item.AlbumCount == 1 ? "1 Album" : item.AlbumCount + " Albums";
|
||||
childText = item.AlbumCount == 1 ? "1 album" : item.AlbumCount + " albums";
|
||||
|
||||
counts.push(childText);
|
||||
}
|
||||
if (item.SongCount) {
|
||||
|
||||
childText = item.SongCount == 1 ? "1 Song" : item.SongCount + " Songs";
|
||||
childText = item.SongCount == 1 ? "1 song" : item.SongCount + " songs";
|
||||
|
||||
counts.push(childText);
|
||||
}
|
||||
if (item.MusicVideoCount) {
|
||||
|
||||
childText = item.MusicVideoCount == 1 ? "1 Music Video" : item.MusicVideoCount + " Music Videos";
|
||||
childText = item.MusicVideoCount == 1 ? "1 music video" : item.MusicVideoCount + " music videos";
|
||||
|
||||
counts.push(childText);
|
||||
}
|
||||
|
@ -360,7 +381,7 @@
|
|||
href += context;
|
||||
}
|
||||
|
||||
if (topParentId == null) {
|
||||
if (topParentId == null && context != 'playlists') {
|
||||
topParentId = LibraryMenu.getTopParentId();
|
||||
}
|
||||
|
||||
|
@ -420,10 +441,16 @@
|
|||
if (item.CollectionType == 'games') {
|
||||
return 'gamesrecommended.html?topParentId=' + item.Id;
|
||||
}
|
||||
if (item.CollectionType == 'playlists') {
|
||||
return 'playlists.html?topParentId=' + item.Id;
|
||||
}
|
||||
if (item.Type == 'CollectionFolder') {
|
||||
return 'itemlist.html?topParentId=' + item.Id + '&parentid=' + item.Id;
|
||||
}
|
||||
|
||||
if (item.Type == "Playlist") {
|
||||
return "playlistedit.html?id=" + id;
|
||||
}
|
||||
if (item.Type == "TvChannel") {
|
||||
return "livetvchannel.html?id=" + id;
|
||||
}
|
||||
|
@ -576,6 +603,12 @@
|
|||
|
||||
outerHtml += '<ul data-role="listview" class="itemsListview">';
|
||||
|
||||
if (options.title) {
|
||||
outerHtml += '<li data-role="list-divider">';
|
||||
outerHtml += options.title;
|
||||
outerHtml += '</li>';
|
||||
}
|
||||
|
||||
var index = 0;
|
||||
var groupTitle = '';
|
||||
|
||||
|
@ -583,15 +616,17 @@
|
|||
|
||||
var html = '';
|
||||
|
||||
var itemGroupTitle = LibraryBrowser.getListViewIndex(item, options.sortBy);
|
||||
if (options.showIndex !== false) {
|
||||
var itemGroupTitle = LibraryBrowser.getListViewIndex(item, options.sortBy);
|
||||
|
||||
if (itemGroupTitle != groupTitle) {
|
||||
if (itemGroupTitle != groupTitle) {
|
||||
|
||||
html += '<li data-role="list-divider">';
|
||||
html += itemGroupTitle;
|
||||
html += '</li>';
|
||||
html += '<li data-role="list-divider">';
|
||||
html += itemGroupTitle;
|
||||
html += '</li>';
|
||||
|
||||
groupTitle = itemGroupTitle;
|
||||
groupTitle = itemGroupTitle;
|
||||
}
|
||||
}
|
||||
|
||||
var dataAttributes = LibraryBrowser.getItemDataAttributes(item, options);
|
||||
|
@ -642,10 +677,18 @@
|
|||
textlines.push(LibraryBrowser.getPosterViewDisplayName(item));
|
||||
|
||||
if (item.Type == 'Game') {
|
||||
textlines.push(item.GameSystem || 'Unknown Gane System');
|
||||
textlines.push(item.GameSystem || 'Unknown Game System');
|
||||
}
|
||||
|
||||
textlines.push(LibraryBrowser.getMiscInfoHtml(item));
|
||||
else if (item.Type == 'MusicGenre') {
|
||||
textlines.push('Music genre');
|
||||
}
|
||||
else if (item.Type == 'MusicArtist') {
|
||||
textlines.push('Music artist');
|
||||
}
|
||||
else {
|
||||
textlines.push(LibraryBrowser.getMiscInfoHtml(item));
|
||||
}
|
||||
|
||||
html += '<h3>';
|
||||
html += textlines[0];
|
||||
|
@ -730,7 +773,7 @@
|
|||
itemCommands.push('trailer');
|
||||
}
|
||||
|
||||
if (item.Type == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist" || item.Type == "MusicGenre") {
|
||||
if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist" || item.Type == "MusicGenre") {
|
||||
itemCommands.push('instantmix');
|
||||
}
|
||||
|
||||
|
@ -738,6 +781,10 @@
|
|||
itemCommands.push('shuffle');
|
||||
}
|
||||
|
||||
if (PlaylistManager.supportsPlaylists(item)) {
|
||||
itemCommands.push('playlist');
|
||||
}
|
||||
|
||||
return itemCommands;
|
||||
},
|
||||
|
||||
|
@ -900,7 +947,18 @@
|
|||
tag: item.ImageTags.Primary
|
||||
});
|
||||
|
||||
} else if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||
}
|
||||
else if (item.ParentPrimaryImageTag) {
|
||||
|
||||
height = 400;
|
||||
|
||||
imgUrl = ApiClient.getImageUrl(item.ParentPrimaryImageItemId, {
|
||||
type: "Primary",
|
||||
height: height,
|
||||
tag: item.ParentPrimaryImageTag
|
||||
});
|
||||
}
|
||||
else if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||
|
||||
height = 220;
|
||||
width = primaryImageAspectRatio ? Math.round(height * primaryImageAspectRatio) : null;
|
||||
|
@ -1000,6 +1058,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (options.showTitle && !options.overlayText) {
|
||||
cssClass += ' bottomPaddedCard';
|
||||
}
|
||||
|
||||
var dataAttributes = LibraryBrowser.getItemDataAttributes(item, options);
|
||||
|
||||
html += '<a' + dataAttributes + ' class="' + cssClass + '" href="' + href + '">';
|
||||
|
@ -1059,13 +1121,24 @@
|
|||
html += '<div class="itemSelectionPanel" onclick="return false;" style="display:none;"><div class="ui-checkbox ui-mini"><label class="ui-btn ui-corner-all ui-btn-inherit ui-btn-icon-left ui-checkbox-off" for="' + chkItemSelectId + '">Select</label><input id="' + chkItemSelectId + '" type="checkbox" class="chkItemSelect" data-enhanced="true" /></div></div>';
|
||||
}
|
||||
|
||||
var footerText = LibraryBrowser.getCardFooterText(item, options, imgUrl, forceName);
|
||||
var progressHtml = options.showProgress === false || item.IsFolder ? '' : LibraryBrowser.getItemProgressBarHtml((item.Type == 'Recording' ? item : item.UserData));
|
||||
|
||||
var footerOverlayed = false;
|
||||
|
||||
if (options.overlayText || (forceName && !options.showTitle)) {
|
||||
html += footerText;
|
||||
html += LibraryBrowser.getCardFooterText(item, options, imgUrl, forceName, 'cardFooter', progressHtml);
|
||||
footerOverlayed = true;
|
||||
}
|
||||
else if (progressHtml) {
|
||||
html += '<div class="cardFooter">';
|
||||
html += "<div class='cardProgress cardText'>";
|
||||
html += progressHtml;
|
||||
html += "</div>";
|
||||
//cardFooter
|
||||
html += "</div>";
|
||||
|
||||
progressHtml = '';
|
||||
}
|
||||
|
||||
// cardContent
|
||||
html += '</div>';
|
||||
|
@ -1074,93 +1147,12 @@
|
|||
html += '</div>';
|
||||
|
||||
if (!options.overlayText && !footerOverlayed) {
|
||||
html += footerText;
|
||||
html += LibraryBrowser.getCardFooterText(item, options, imgUrl, forceName, 'cardFooter outerCardFooter', progressHtml);
|
||||
}
|
||||
|
||||
// cardBox
|
||||
html += '</div>';
|
||||
|
||||
//var progressHtml = options.showProgress === false || item.IsFolder ? '' : LibraryBrowser.getItemProgressBarHtml((item.Type == 'Recording' ? item : item.UserData));
|
||||
|
||||
//if (!options.overlayText) {
|
||||
|
||||
// if (progressHtml) {
|
||||
// html += '<div class="posterItemTextOverlay">';
|
||||
// html += "<div class='posterItemProgress miniPosterItemProgress'>";
|
||||
// html += progressHtml || " ";
|
||||
// html += "</div>";
|
||||
// html += "</div>";
|
||||
// }
|
||||
//}
|
||||
//html += '</div>';
|
||||
|
||||
//var name = LibraryBrowser.getPosterViewDisplayName(item, options.displayAsSpecial);
|
||||
|
||||
//if (!imgUrl && !options.showTitle) {
|
||||
// html += "<div class='posterItemDefaultText'>";
|
||||
// html += htmlEncode(name);
|
||||
// html += "</div>";
|
||||
//}
|
||||
|
||||
//var overlayText = options.overlayText || (forceName && !options.showTitle);
|
||||
|
||||
//if (overlayText) {
|
||||
// html += '<div class="posterItemTextOverlay">';
|
||||
//}
|
||||
|
||||
//cssClass = options.centerText ? "posterItemText posterItemTextCentered" : "posterItemText";
|
||||
|
||||
//var lines = [];
|
||||
|
||||
//if (options.showParentTitle) {
|
||||
|
||||
// lines.push(item.EpisodeTitle ? item.Name : (item.SeriesName || item.Album || item.AlbumArtist || item.GameSystem || ""));
|
||||
//}
|
||||
|
||||
//if (options.showTitle || forceName) {
|
||||
|
||||
// lines.push(htmlEncode(name));
|
||||
//}
|
||||
|
||||
//if (options.showItemCounts) {
|
||||
|
||||
// var itemCountHtml = LibraryBrowser.getItemCountsHtml(options, item);
|
||||
|
||||
// lines.push(itemCountHtml);
|
||||
//}
|
||||
|
||||
//if (options.showPremiereDate && item.PremiereDate) {
|
||||
|
||||
// try {
|
||||
|
||||
// lines.push(LibraryBrowser.getPremiereDateText(item));
|
||||
|
||||
// } catch (err) {
|
||||
// lines.push('');
|
||||
|
||||
// }
|
||||
//}
|
||||
|
||||
//if (options.showYear) {
|
||||
|
||||
// lines.push(item.ProductionYear || '');
|
||||
//}
|
||||
|
||||
//html += LibraryBrowser.getPosterItemTextLines(lines, cssClass, !options.overlayText);
|
||||
|
||||
//if (options.overlayText) {
|
||||
|
||||
// if (progressHtml) {
|
||||
// html += "<div class='posterItemText posterItemProgress'>";
|
||||
// html += progressHtml || " ";
|
||||
// html += "</div>";
|
||||
// }
|
||||
//}
|
||||
|
||||
//if (overlayText) {
|
||||
// html += "</div>";
|
||||
//}
|
||||
|
||||
html += "</a>";
|
||||
|
||||
}
|
||||
|
@ -1168,22 +1160,11 @@
|
|||
return html;
|
||||
},
|
||||
|
||||
getCardFooterText: function (item, options, imgUrl, forceName) {
|
||||
getCardFooterText: function (item, options, imgUrl, forceName, footerClass, progressHtml) {
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<div class="cardFooter">';
|
||||
|
||||
var progressHtml = options.showProgress === false || item.IsFolder ? '' : LibraryBrowser.getItemProgressBarHtml((item.Type == 'Recording' ? item : item.UserData));
|
||||
|
||||
if (!options.overlayText) {
|
||||
|
||||
if (progressHtml) {
|
||||
html += "<div class='cardProgress miniCardProgress'>";
|
||||
html += (progressHtml || " ");
|
||||
html += "</div>";
|
||||
}
|
||||
}
|
||||
html += '<div class="' + footerClass + '">';
|
||||
|
||||
var name = LibraryBrowser.getPosterViewDisplayName(item, options.displayAsSpecial);
|
||||
|
||||
|
@ -1231,7 +1212,7 @@
|
|||
lines.push(item.ProductionYear || '');
|
||||
}
|
||||
|
||||
html += LibraryBrowser.getPosterItemTextLines(lines, cssClass, !options.overlayText);
|
||||
html += LibraryBrowser.getCardTextLines(lines, cssClass, !options.overlayText);
|
||||
|
||||
if (options.overlayText) {
|
||||
|
||||
|
@ -1248,7 +1229,7 @@
|
|||
return html;
|
||||
},
|
||||
|
||||
getPosterItemTextLines: function (lines, cssClass, forceLines) {
|
||||
getCardTextLines: function (lines, cssClass, forceLines) {
|
||||
|
||||
var html = '';
|
||||
|
||||
|
|
|
@ -149,6 +149,18 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
function onAddToPlaylistButtonClick() {
|
||||
|
||||
var id = this.getAttribute('data-itemid');
|
||||
|
||||
PlaylistManager.showPanel([id]);
|
||||
|
||||
// Used by the tab menu, not the slide up
|
||||
$('.tapHoldMenu').popup('close');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function onShuffleButtonClick() {
|
||||
|
||||
var id = this.getAttribute('data-itemid');
|
||||
|
@ -281,6 +293,10 @@
|
|||
html += '<li data-icon="recycle"><a href="#" class="btnShuffle" data-itemid="' + itemId + '">' + Globalize.translate('ButtonShuffle') + '</a></li>';
|
||||
}
|
||||
|
||||
if (commands.indexOf('playlist') != -1) {
|
||||
html += '<li data-icon="plus"><a href="#" class="btnAddToPlaylist" data-itemid="' + itemId + '">' + Globalize.translate('ButtonAddToPlaylist') + '</a></li>';
|
||||
}
|
||||
|
||||
html += '</ul>';
|
||||
|
||||
html += '</div>';
|
||||
|
@ -299,6 +315,7 @@
|
|||
$('.btnInstantMix', elem).on('click', onInstantMixButtonClick);
|
||||
$('.btnShuffle', elem).on('click', onShuffleButtonClick);
|
||||
$('.btnPlayTrailer', elem).on('click', onTrailerButtonClick);
|
||||
$('.btnAddToPlaylist', elem).on('click', onAddToPlaylistButtonClick);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -504,7 +521,8 @@
|
|||
return this.off('.cardHoverMenu')
|
||||
.on('mouseenter.cardHoverMenu', elems, onHoverIn)
|
||||
.on('mouseleave.cardHoverMenu', elems, onHoverOut)
|
||||
.on("touchstart.cardHoverMenu", elems, preventTouchHover);
|
||||
.on("touchstart.cardHoverMenu", elems, preventTouchHover)
|
||||
.trigger('itemsrendered');
|
||||
};
|
||||
|
||||
function toggleSelections(page) {
|
||||
|
@ -613,10 +631,31 @@
|
|||
BoxSetEditor.showPanel(page, selection);
|
||||
}
|
||||
|
||||
function addToPlaylist(page) {
|
||||
|
||||
var selection = getSelectedItems(page);
|
||||
|
||||
if (selection.length < 1) {
|
||||
|
||||
Dashboard.alert({
|
||||
message: Globalize.translate('MessagePleaseSelectOneItem'),
|
||||
title: Globalize.translate('HeaderError')
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
PlaylistManager.showPanel(selection);
|
||||
}
|
||||
|
||||
$(document).on('pageinit', ".libraryPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('.btnAddToPlaylist', page).on('click', function () {
|
||||
addToPlaylist(page);
|
||||
});
|
||||
|
||||
$('.btnMergeVersions', page).on('click', function () {
|
||||
combineVersions(page);
|
||||
});
|
||||
|
|
|
@ -231,7 +231,7 @@
|
|||
|
||||
function getTopParentId() {
|
||||
|
||||
return getParameterByName('topParentId') || sessionStore.getItem('topParentId') || null;
|
||||
return getParameterByName('topParentId') /*|| sessionStore.getItem('topParentId')*/ || null;
|
||||
}
|
||||
|
||||
window.LibraryMenu = {
|
||||
|
@ -298,18 +298,22 @@
|
|||
|
||||
});
|
||||
|
||||
$('.scopedLibraryViewNav a', page).each(function () {
|
||||
var context = getParameterByName('context');
|
||||
|
||||
var src = this.href;
|
||||
if (context !== 'playlists') {
|
||||
$('.scopedLibraryViewNav a', page).each(function () {
|
||||
|
||||
if (src.indexOf('#') != -1) {
|
||||
return;
|
||||
}
|
||||
var src = this.href;
|
||||
|
||||
src = replaceQueryString(src, 'topParentId', id);
|
||||
if (src.indexOf('#') != -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.href = src;
|
||||
});
|
||||
src = replaceQueryString(src, 'topParentId', id);
|
||||
|
||||
this.href = src;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function updateContextText(page) {
|
||||
|
|
|
@ -126,7 +126,7 @@
|
|||
for (var i = 0, length = users.length; i < length; i++) {
|
||||
var user = users[i];
|
||||
|
||||
html += '<div class="card squareCard alternateHover"><div class="cardBox visualCardBox">';
|
||||
html += '<div class="card squareCard alternateHover bottomPaddedCard"><div class="cardBox visualCardBox">';
|
||||
|
||||
html += '<div class="cardScalable">';
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
if (itemType == "MusicGenre" || itemType == "Season" || itemType == "Series" || itemType == "BoxSet" || itemType == "MusicAlbum" || itemType == "MusicArtist") {
|
||||
if (itemType == "MusicGenre" || itemType == "Season" || itemType == "Series" || itemType == "BoxSet" || itemType == "MusicAlbum" || itemType == "MusicArtist" || itemType == "Playlist") {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -347,14 +347,10 @@
|
|||
var firstItem = items[0];
|
||||
var promise;
|
||||
|
||||
if (firstItem.IsFolder) {
|
||||
if (firstItem.Type == "Playlist") {
|
||||
|
||||
promise = self.getItemsForPlayback({
|
||||
ParentId: firstItem.Id,
|
||||
Filters: "IsNotFolder",
|
||||
Recursive: true,
|
||||
SortBy: "SortName",
|
||||
MediaTypes: "Audio,Video"
|
||||
});
|
||||
}
|
||||
else if (firstItem.Type == "MusicArtist") {
|
||||
|
@ -378,6 +374,16 @@
|
|||
MediaTypes: "Audio"
|
||||
});
|
||||
}
|
||||
else if (firstItem.IsFolder) {
|
||||
|
||||
promise = self.getItemsForPlayback({
|
||||
ParentId: firstItem.Id,
|
||||
Filters: "IsNotFolder",
|
||||
Recursive: true,
|
||||
SortBy: "SortName",
|
||||
MediaTypes: "Audio,Video"
|
||||
});
|
||||
}
|
||||
|
||||
if (promise) {
|
||||
promise.done(function (result) {
|
||||
|
@ -801,11 +807,7 @@
|
|||
SortBy: "Random"
|
||||
};
|
||||
|
||||
if (item.IsFolder) {
|
||||
query.ParentId = id;
|
||||
|
||||
}
|
||||
else if (item.Type == "MusicArtist") {
|
||||
if (item.Type == "MusicArtist") {
|
||||
|
||||
query.MediaTypes = "Audio";
|
||||
query.Artists = item.Name;
|
||||
|
@ -816,7 +818,12 @@
|
|||
query.MediaTypes = "Audio";
|
||||
query.Genres = item.Name;
|
||||
|
||||
} else {
|
||||
}
|
||||
else if (item.IsFolder) {
|
||||
query.ParentId = id;
|
||||
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
$('.noItemsMessage', page).show();
|
||||
}
|
||||
|
||||
$('.itemsContainer', page).html(html).trigger('create').createCardMenus().trigger('itemsrendered');
|
||||
$('.itemsContainer', page).html(html).trigger('create').createCardMenus();
|
||||
|
||||
$('.btnNextPage', page).on('click', function () {
|
||||
query.StartIndex += query.Limit;
|
||||
|
@ -333,6 +333,17 @@
|
|||
});
|
||||
});
|
||||
|
||||
function redirectToCollection(id) {
|
||||
|
||||
var context = getParameterByName('context');
|
||||
|
||||
ApiClient.getItem(Dashboard.getCurrentUserId(), id).done(function (item) {
|
||||
|
||||
Dashboard.navigate(LibraryBrowser.getHref(item, context));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function createCollection(page) {
|
||||
|
||||
var url = ApiClient.getUrl("Collections", {
|
||||
|
@ -355,16 +366,9 @@
|
|||
Dashboard.hideLoadingMsg();
|
||||
|
||||
var id = result.Id;
|
||||
var destination = 'itemdetails.html?id=' + id;
|
||||
|
||||
var context = getParameterByName('context');
|
||||
|
||||
if (context) {
|
||||
destination += "&context=" + context;
|
||||
}
|
||||
|
||||
$('.newCollectionPanel', page).panel('toggle');
|
||||
Dashboard.navigate(destination);
|
||||
redirectToCollection(id);
|
||||
|
||||
});
|
||||
}
|
||||
|
@ -384,19 +388,10 @@
|
|||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
var destination = 'itemdetails.html?id=' + id;
|
||||
|
||||
var context = getParameterByName('context');
|
||||
|
||||
if (context) {
|
||||
destination += "&context=" + context;
|
||||
}
|
||||
|
||||
$('.newCollectionPanel', page).panel('toggle');
|
||||
Dashboard.navigate(destination);
|
||||
redirectToCollection(id);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
window.BoxSetEditor = {
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
|
||||
html += pagingHtml;
|
||||
|
||||
$('.itemsContainer', page).html(html).trigger('create').createCardMenus().trigger('itemsrendered');
|
||||
$('.itemsContainer', page).html(html).trigger('create').createCardMenus();
|
||||
|
||||
$('.btnNextPage', page).on('click', function () {
|
||||
query.StartIndex += query.Limit;
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
limit: query.Limit,
|
||||
totalRecordCount: result.TotalRecordCount,
|
||||
viewButton: true,
|
||||
showLimit: false
|
||||
showLimit: false,
|
||||
addSelectionButton: true
|
||||
});
|
||||
|
||||
$('.listTopPaging', page).html(pagingHtml).trigger('create');
|
||||
|
@ -56,7 +57,8 @@
|
|||
showTitle: true,
|
||||
coverImage: true,
|
||||
centerText: true,
|
||||
lazy: true
|
||||
lazy: true,
|
||||
selectionPanel: true
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,8 @@
|
|||
limit: query.Limit,
|
||||
totalRecordCount: result.TotalRecordCount,
|
||||
viewButton: true,
|
||||
showLimit: false
|
||||
showLimit: false,
|
||||
addSelectionButton: true
|
||||
});
|
||||
|
||||
$('.listTopPaging', page).html(pagingHtml).trigger('create');
|
||||
|
@ -48,7 +49,8 @@
|
|||
context: 'music',
|
||||
showTitle: true,
|
||||
showParentTitle: true,
|
||||
lazy: true
|
||||
lazy: true,
|
||||
selectionPanel: true
|
||||
});
|
||||
$('.itemsContainer', page).removeClass('timelineItemsContainer');
|
||||
}
|
||||
|
@ -69,7 +71,8 @@
|
|||
showTitle: true,
|
||||
showParentTitle: true,
|
||||
timeline: true,
|
||||
lazy: true
|
||||
lazy: true,
|
||||
selectionPanel: true
|
||||
});
|
||||
$('.itemsContainer', page).addClass('timelineItemsContainer');
|
||||
}
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
limit: query.Limit,
|
||||
totalRecordCount: result.TotalRecordCount,
|
||||
viewButton: true,
|
||||
showLimit: false
|
||||
showLimit: false,
|
||||
addSelectionButton: true
|
||||
});
|
||||
|
||||
$('.listTopPaging', page).html(pagingHtml).trigger('create');
|
||||
|
@ -56,7 +57,8 @@
|
|||
showTitle: true,
|
||||
coverImage: true,
|
||||
centerText: true,
|
||||
lazy: true
|
||||
lazy: true,
|
||||
selectionPanel: true
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
limit: query.Limit,
|
||||
totalRecordCount: result.TotalRecordCount,
|
||||
viewButton: true,
|
||||
showLimit: false
|
||||
showLimit: false,
|
||||
addSelectionButton: true
|
||||
});
|
||||
|
||||
$('.listTopPaging', page).html(pagingHtml).trigger('create');
|
||||
|
@ -46,7 +47,8 @@
|
|||
context: 'music',
|
||||
showItemCounts: true,
|
||||
centerText: true,
|
||||
lazy: true
|
||||
lazy: true,
|
||||
selectionPanel: true
|
||||
});
|
||||
|
||||
html += pagingHtml;
|
||||
|
|
154
dashboard-ui/scripts/playlistedit.js
Normal file
154
dashboard-ui/scripts/playlistedit.js
Normal file
|
@ -0,0 +1,154 @@
|
|||
(function ($, document) {
|
||||
|
||||
var view = LibraryBrowser.getDefaultItemsView('List', 'List');
|
||||
|
||||
// The base query options
|
||||
var query = {
|
||||
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio",
|
||||
StartIndex: 0
|
||||
};
|
||||
|
||||
function getSavedQueryKey() {
|
||||
|
||||
return 'playlists' + (query.ParentId || '');
|
||||
}
|
||||
|
||||
function reloadItems(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
query.ParentId = getParameterByName('id');
|
||||
|
||||
var promise1 = ApiClient.getJSON(ApiClient.getUrl('Playlists/' + query.ParentId + '/Items', { userId: Dashboard.getCurrentUserId() }));
|
||||
var promise2 = Dashboard.getCurrentUser();
|
||||
var promise3 = ApiClient.getItem(Dashboard.getCurrentUserId(), query.ParentId);
|
||||
|
||||
$.when(promise1, promise2, promise3).done(function (response1, response2, response3) {
|
||||
|
||||
var result = response1[0];
|
||||
var user = response2[0];
|
||||
var item = response3[0];
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
$(document).scrollTop(0);
|
||||
|
||||
var html = '';
|
||||
|
||||
var pagingHtml = LibraryBrowser.getQueryPagingHtml({
|
||||
startIndex: query.StartIndex,
|
||||
limit: query.Limit,
|
||||
totalRecordCount: result.TotalRecordCount,
|
||||
viewButton: true,
|
||||
showLimit: false
|
||||
});
|
||||
|
||||
$('.listTopPaging', page).html(pagingHtml).trigger('create');
|
||||
|
||||
updateFilterControls(page);
|
||||
|
||||
if (result.TotalRecordCount) {
|
||||
|
||||
if (view == "List") {
|
||||
|
||||
html = LibraryBrowser.getListViewHtml({
|
||||
items: result.Items,
|
||||
context: 'playlists',
|
||||
sortBy: query.SortBy,
|
||||
showIndex: false,
|
||||
title: item.Name
|
||||
});
|
||||
}
|
||||
|
||||
html += pagingHtml;
|
||||
$('.noItemsMessage', page).hide();
|
||||
|
||||
} else {
|
||||
|
||||
$('.noItemsMessage', page).show();
|
||||
}
|
||||
|
||||
$('.itemsContainer', page).html(html).trigger('create').createCardMenus();
|
||||
|
||||
$('.btnNextPage', page).on('click', function () {
|
||||
query.StartIndex += query.Limit;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('.btnPreviousPage', page).on('click', function () {
|
||||
query.StartIndex -= query.Limit;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
LibraryBrowser.saveQueryValues(getSavedQueryKey(), query);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
function updateFilterControls(page) {
|
||||
|
||||
// Reset form values using the last used query
|
||||
$('.radioSortBy', page).each(function () {
|
||||
|
||||
this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase();
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
|
||||
$('.radioSortOrder', page).each(function () {
|
||||
|
||||
this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase();
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
|
||||
$('.chkStandardFilter', page).each(function () {
|
||||
|
||||
var filters = "," + (query.Filters || "");
|
||||
var filterName = this.getAttribute('data-filter');
|
||||
|
||||
this.checked = filters.indexOf(',' + filterName) != -1;
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
|
||||
$('#selectView', page).val(view).selectmenu('refresh');
|
||||
|
||||
$('#selectPageSize', page).val(query.Limit).selectmenu('refresh');
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#playlistEditorPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('#selectPageSize', page).on('change', function () {
|
||||
query.Limit = parseInt(this.value);
|
||||
query.StartIndex = 0;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#playlistEditorPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
var limit = LibraryBrowser.getDefaultPageSize();
|
||||
|
||||
// If the default page size has changed, the start index will have to be reset
|
||||
if (limit != query.Limit) {
|
||||
query.Limit = limit;
|
||||
query.StartIndex = 0;
|
||||
}
|
||||
|
||||
var viewkey = getSavedQueryKey();
|
||||
|
||||
LibraryBrowser.loadSavedQueryValues(viewkey, query);
|
||||
reloadItems(page);
|
||||
|
||||
}).on('pageshow', "#playlistEditorPage", function () {
|
||||
|
||||
updateFilterControls(this);
|
||||
|
||||
});
|
||||
|
||||
})(jQuery, document);
|
243
dashboard-ui/scripts/playlistmanager.js
Normal file
243
dashboard-ui/scripts/playlistmanager.js
Normal file
|
@ -0,0 +1,243 @@
|
|||
(function ($, document) {
|
||||
|
||||
var lastPlaylistId = '';
|
||||
|
||||
function redirectToPlaylist(id) {
|
||||
|
||||
var context = getParameterByName('context');
|
||||
|
||||
ApiClient.getItem(Dashboard.getCurrentUserId(), id).done(function (item) {
|
||||
|
||||
Dashboard.navigate(LibraryBrowser.getHref(item, context));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function onAddToPlaylistFormSubmit() {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var panel = $(this).parents('.newPlaylistPanel');
|
||||
|
||||
var playlistId = $('select.selectPlaylistToAddTo', panel).val();
|
||||
|
||||
if (playlistId) {
|
||||
lastPlaylistId = playlistId;
|
||||
addToPlaylist(panel, playlistId);
|
||||
} else {
|
||||
createPlaylist(panel);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getNewPlaylistPanel() {
|
||||
|
||||
$('.newPlaylistPanel').panel('destroy').remove();
|
||||
|
||||
var html = '<div data-role="panel" data-position="right" data-display="overlay" class="newPlaylistPanel" data-position-fixed="true" data-theme="a">';
|
||||
|
||||
html += '<h3>' + Globalize.translate('HeaderAddToPlaylist') + '</h3>';
|
||||
|
||||
html += '<br />';
|
||||
|
||||
html += '<form class="addToPlaylistForm">';
|
||||
|
||||
var selectId = 'selectPlaylistToAddTo' + new Date().getTime();
|
||||
|
||||
html += '<div>';
|
||||
html += '<label for="' + selectId + '">' + Globalize.translate('LabelSelectPlaylist') + '</label>';
|
||||
html += '<select id="' + selectId + '" class="selectPlaylistToAddTo" data-mini="true">';
|
||||
html += '</select>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<br />';
|
||||
|
||||
html += '<div class="fldNewPlaylist" style="display:none;">';
|
||||
html += '<label for="txtNewPlaylistName">' + Globalize.translate('LabelName') + '</label>';
|
||||
html += '<input type="text" id="txtNewPlaylistName" />';
|
||||
html += '</div>';
|
||||
|
||||
html += '<p>';
|
||||
html += '<input class="fldSelectedItemIds" type="hidden" />';
|
||||
html += '<button type="submit" data-icon="plus" data-mini="true" data-theme="b">' + Globalize.translate('ButtonSubmit') + '</button>';
|
||||
html += '</p>';
|
||||
|
||||
html += '</form>';
|
||||
html += '</div>';
|
||||
|
||||
$(document.body).append(html);
|
||||
|
||||
var elem = $('.newPlaylistPanel').panel({}).trigger('create').on("panelclose", function () {
|
||||
|
||||
$(this).off("panelclose").remove();
|
||||
});
|
||||
|
||||
var select = $('#' + selectId, elem).on('change', function () {
|
||||
|
||||
if (this.value) {
|
||||
$('.fldNewPlaylist', elem).hide();
|
||||
$('input', elem).removeAttr('required');
|
||||
} else {
|
||||
$('.fldNewPlaylist', elem).show();
|
||||
$('input', elem).attr('required', 'required');
|
||||
}
|
||||
|
||||
}).trigger('change');
|
||||
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), {
|
||||
|
||||
IncludeItemTypes: 'Playlist',
|
||||
recursive: true,
|
||||
SortBy: 'SortName'
|
||||
|
||||
}).done(function (result) {
|
||||
|
||||
var selectHtml = '<option value="">' + Globalize.translate('OptionNewPlaylist') + '</option>';
|
||||
selectHtml += result.Items.map(function (o) {
|
||||
|
||||
return '<option value="' + o.Id + '">' + o.Name + '</option>';
|
||||
|
||||
}).join('');
|
||||
|
||||
select.html(selectHtml).selectmenu('refresh');
|
||||
|
||||
select.val(lastPlaylistId || '').selectmenu('refresh').trigger('change');
|
||||
});
|
||||
|
||||
$('form', elem).on('submit', onAddToPlaylistFormSubmit);
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
function showNewPlaylistPanel(items) {
|
||||
|
||||
var panel = getNewPlaylistPanel().panel('toggle');
|
||||
|
||||
$('.fldSelectedItemIds', panel).val(items.join(','));
|
||||
|
||||
populatePlaylists(panel);
|
||||
}
|
||||
|
||||
function populatePlaylists(panel) {
|
||||
|
||||
var select = $('select.selectPlaylistToAddTo', panel);
|
||||
|
||||
if (!select.length) {
|
||||
|
||||
$('#txtNewPlaylistName', panel).val('').focus();
|
||||
return;
|
||||
}
|
||||
|
||||
$('.newPlaylistInfo', panel).hide();
|
||||
|
||||
var options = {
|
||||
|
||||
Recursive: true,
|
||||
IncludeItemTypes: "Playlist"
|
||||
};
|
||||
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<option value="">' + Globalize.translate('OptionNewPlaylist') + '</option>';
|
||||
|
||||
html += result.Items.map(function (i) {
|
||||
|
||||
return '<option value="' + i.Id + '">' + i.Name + '</option>';
|
||||
});
|
||||
|
||||
select.html(html).val('').selectmenu('refresh').trigger('change');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//$(document).on('pageinit', ".playlistEditorPage", function () {
|
||||
|
||||
// var page = this;
|
||||
|
||||
// $('.itemsContainer', page).on('itemsrendered', function () {
|
||||
|
||||
// $('.btnNewPlaylist', page).off('click.newplaylistpanel').on('click.newplaylistpanel', function () {
|
||||
|
||||
// showNewPlaylistPanel(page, []);
|
||||
// });
|
||||
|
||||
// });
|
||||
|
||||
// $('#selectPlaylistToAddTo', page).on('change', function () {
|
||||
|
||||
// if (this.value) {
|
||||
// $('.newPlaylistInfo', page).hide();
|
||||
// $('#txtNewPlaylistName', page).removeAttr('required');
|
||||
// } else {
|
||||
// $('.newPlaylistInfo', page).show();
|
||||
// $('#txtNewPlaylistName', page).attr('required', 'required');
|
||||
// }
|
||||
// });
|
||||
//});
|
||||
|
||||
function createPlaylist(panel) {
|
||||
|
||||
var url = ApiClient.getUrl("Playlists", {
|
||||
|
||||
Name: $('#txtNewPlaylistName', panel).val(),
|
||||
Ids: $('.fldSelectedItemIds', panel).val() || '',
|
||||
userId: Dashboard.getCurrentUserId()
|
||||
|
||||
});
|
||||
|
||||
ApiClient.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
dataType: "json"
|
||||
|
||||
}).done(function (result) {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
var id = result.Id;
|
||||
|
||||
panel.panel('toggle');
|
||||
redirectToPlaylist(id);
|
||||
});
|
||||
}
|
||||
|
||||
function addToPlaylist(panel, id) {
|
||||
|
||||
var url = ApiClient.getUrl("Playlists/" + id + "/Items", {
|
||||
|
||||
Ids: $('.fldSelectedItemIds', panel).val() || ''
|
||||
});
|
||||
|
||||
ApiClient.ajax({
|
||||
type: "POST",
|
||||
url: url
|
||||
|
||||
}).done(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
panel.panel('toggle');
|
||||
Dashboard.alert(Globalize.translate('MessageAddedToPlaylistSuccess'));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
window.PlaylistManager = {
|
||||
|
||||
showPanel: function (items) {
|
||||
showNewPlaylistPanel(items);
|
||||
},
|
||||
|
||||
supportsPlaylists: function (item) {
|
||||
|
||||
if (item.Type == 'Playlist') {
|
||||
return false;
|
||||
}
|
||||
return item.MediaType == "Audio" || item.MediaType == "Video" || item.Type == "MusicAlbum" || item.Type == "MusicArtist" || item.Type == "MusicGenre" || item.Type == "Series" || item.Type == "Season";
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery, document);
|
206
dashboard-ui/scripts/playlists.js
Normal file
206
dashboard-ui/scripts/playlists.js
Normal file
|
@ -0,0 +1,206 @@
|
|||
(function ($, document) {
|
||||
|
||||
var view = LibraryBrowser.getDefaultItemsView('Poster', 'List');
|
||||
|
||||
// The base query options
|
||||
var query = {
|
||||
|
||||
SortBy: "SortName",
|
||||
SortOrder: "Ascending",
|
||||
IncludeItemTypes: "Playlist",
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio,SortName,CumulativeRunTimeTicks",
|
||||
StartIndex: 0
|
||||
};
|
||||
|
||||
function getSavedQueryKey() {
|
||||
|
||||
return 'playlists' + (query.ParentId || '');
|
||||
}
|
||||
|
||||
function reloadItems(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var promise1 = ApiClient.getItems(Dashboard.getCurrentUserId(), query);
|
||||
var promise2 = Dashboard.getCurrentUser();
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
|
||||
var result = response1[0];
|
||||
var user = response2[0];
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
$(document).scrollTop(0);
|
||||
|
||||
var html = '';
|
||||
|
||||
var pagingHtml = LibraryBrowser.getQueryPagingHtml({
|
||||
startIndex: query.StartIndex,
|
||||
limit: query.Limit,
|
||||
totalRecordCount: result.TotalRecordCount,
|
||||
viewButton: true,
|
||||
showLimit: false
|
||||
});
|
||||
|
||||
$('.listTopPaging', page).html(pagingHtml).trigger('create');
|
||||
|
||||
updateFilterControls(page);
|
||||
|
||||
if (result.TotalRecordCount) {
|
||||
|
||||
if (view == "List") {
|
||||
|
||||
html = LibraryBrowser.getListViewHtml({
|
||||
items: result.Items,
|
||||
context: 'playlists',
|
||||
sortBy: query.SortBy
|
||||
});
|
||||
}
|
||||
else if (view == "Poster") {
|
||||
html = LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
shape: "square",
|
||||
context: 'playlists',
|
||||
showTitle: true,
|
||||
lazy: true,
|
||||
coverImage: true,
|
||||
showItemCounts: true
|
||||
});
|
||||
}
|
||||
|
||||
html += pagingHtml;
|
||||
$('.noItemsMessage', page).hide();
|
||||
|
||||
} else {
|
||||
|
||||
$('.noItemsMessage', page).show();
|
||||
}
|
||||
|
||||
$('.itemsContainer', page).html(html).trigger('create').createCardMenus();
|
||||
|
||||
$('.btnNextPage', page).on('click', function () {
|
||||
query.StartIndex += query.Limit;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('.btnPreviousPage', page).on('click', function () {
|
||||
query.StartIndex -= query.Limit;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
LibraryBrowser.saveQueryValues(getSavedQueryKey(), query);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
function updateFilterControls(page) {
|
||||
|
||||
// Reset form values using the last used query
|
||||
$('.radioSortBy', page).each(function () {
|
||||
|
||||
this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase();
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
|
||||
$('.radioSortOrder', page).each(function () {
|
||||
|
||||
this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase();
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
|
||||
$('.chkStandardFilter', page).each(function () {
|
||||
|
||||
var filters = "," + (query.Filters || "");
|
||||
var filterName = this.getAttribute('data-filter');
|
||||
|
||||
this.checked = filters.indexOf(',' + filterName) != -1;
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
|
||||
$('#selectView', page).val(view).selectmenu('refresh');
|
||||
|
||||
$('#selectPageSize', page).val(query.Limit).selectmenu('refresh');
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#playlistsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('.radioSortBy', this).on('click', function () {
|
||||
query.SortBy = this.getAttribute('data-sortby');
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('.radioSortOrder', this).on('click', function () {
|
||||
query.SortOrder = this.getAttribute('data-sortorder');
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('.chkStandardFilter', this).on('change', function () {
|
||||
|
||||
var filterName = this.getAttribute('data-filter');
|
||||
var filters = query.Filters || "";
|
||||
|
||||
filters = (',' + filters).replace(',' + filterName, '').substring(1);
|
||||
|
||||
if (this.checked) {
|
||||
filters = filters ? (filters + ',' + filterName) : filterName;
|
||||
}
|
||||
|
||||
query.StartIndex = 0;
|
||||
query.Filters = filters;
|
||||
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('#selectView', this).on('change', function () {
|
||||
|
||||
view = this.value;
|
||||
|
||||
reloadItems(page);
|
||||
|
||||
LibraryBrowser.saveViewSetting(getSavedQueryKey(), view);
|
||||
});
|
||||
|
||||
$('#selectPageSize', page).on('change', function () {
|
||||
query.Limit = parseInt(this.value);
|
||||
query.StartIndex = 0;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#playlistsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
var limit = LibraryBrowser.getDefaultPageSize();
|
||||
|
||||
// If the default page size has changed, the start index will have to be reset
|
||||
if (limit != query.Limit) {
|
||||
query.Limit = limit;
|
||||
query.StartIndex = 0;
|
||||
}
|
||||
|
||||
var viewkey = getSavedQueryKey();
|
||||
|
||||
LibraryBrowser.loadSavedQueryValues(viewkey, query);
|
||||
|
||||
LibraryBrowser.getSavedViewSetting(viewkey).done(function (val) {
|
||||
|
||||
if (val) {
|
||||
$('#selectView', page).val(val).selectmenu('refresh').trigger('change');
|
||||
} else {
|
||||
reloadItems(page);
|
||||
}
|
||||
});
|
||||
|
||||
}).on('pageshow', "#playlistsPage", function () {
|
||||
|
||||
updateFilterControls(this);
|
||||
|
||||
});
|
||||
|
||||
})(jQuery, document);
|
|
@ -59,7 +59,7 @@
|
|||
var href = plugin.externalUrl ? plugin.externalUrl : "addplugin.html?name=" + encodeURIComponent(plugin.name) + "&guid=" + plugin.guid;
|
||||
var target = plugin.externalUrl ? ' target="_blank"' : '';
|
||||
|
||||
html += "<div class='card backdropCard alternateHover'>";
|
||||
html += "<div class='card backdropCard alternateHover bottomPaddedCard'>";
|
||||
|
||||
html += '<div class="cardBox visualCardBox">';
|
||||
html += '<div class="cardScalable">';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue