fixes #944 - Add card views

This commit is contained in:
Luke Pulverenti 2014-11-10 22:41:19 -05:00
parent a1535a341b
commit c6064c9e96
27 changed files with 321 additions and 69 deletions

View File

@ -90,8 +90,9 @@
}
.visualCardBox-b {
border-radius: 3px;
background: rgb(51, 51, 51);
border: 1px solid rgb(31, 31, 31);
border-radius: 3px;
}
.cardScalable {

View File

@ -489,10 +489,10 @@ h1 .imageLink {
.mediaLocationsHeader .ui-btn {
position: absolute;
right: -6px;
right: -3px;
margin-top: 0 !important;
margin-bottom: 0 !important;
top: 6px;
top: 4px;
}
#ulDirectoryPickerList a {

View File

@ -47,8 +47,9 @@
<div>
<label for="selectView">${LabelView}</label>
<select id="selectView">
<option value="Poster">${OptionPoster}</option>
<option value="List">${OptionList}</option>
<option value="Poster">${OptionPoster}</option>
<option value="PosterCard">${OptionPosterCard}</option>
</select>
</div>
<br />

View File

@ -38,8 +38,9 @@
<div>
<label for="selectView">${LabelView}</label>
<select id="selectView">
<option value="Poster">${OptionPoster}</option>
<option value="List">${OptionList}</option>
<option value="Poster">${OptionPoster}</option>
<option value="PosterCard">${OptionPosterCard}</option>
</select>
</div>
<br />

View File

@ -35,6 +35,15 @@
<div class="tabView viewTab">
<div>
<label for="selectView">${LabelView}</label>
<select id="selectView">
<option value="Poster">${OptionPoster}</option>
<option value="Thumb">${OptionThumb}</option>
<option value="ThumbCard">${OptionThumbCard}</option>
</select>
</div>
<br />
<div>
<label for="selectPageSize">${LabelPageSize}</label>
<select id="selectPageSize"></select>

View File

@ -49,10 +49,11 @@
<div>
<label for="selectView">${LabelView}</label>
<select id="selectView">
<option value="Thumb">${OptionThumb}</option>
<option value="Poster">${OptionPoster}</option>
<option value="Banner">${OptionBanner}</option>
<option value="List">${OptionList}</option>
<option value="Poster">${OptionPoster}</option>
<option value="Thumb">${OptionThumb}</option>
<option value="ThumbCard">${OptionThumbCard}</option>
<option value="Timeline">${OptionTimeline}</option>
</select>
</div>

View File

@ -43,8 +43,9 @@
<div>
<label for="selectView">${LabelView}</label>
<select id="selectView">
<option value="Poster">${OptionPoster}</option>
<option value="List">${OptionList}</option>
<option value="Poster">${OptionPoster}</option>
<option value="PosterCard">${OptionPosterCard}</option>
</select>
</div>
<br />

View File

@ -43,8 +43,9 @@
<div>
<label for="selectView">${LabelView}</label>
<select id="selectView">
<option value="Poster">${OptionPoster}</option>
<option value="List">${OptionList}</option>
<option value="Poster">${OptionPoster}</option>
<option value="PosterCard">${OptionPosterCard}</option>
<option value="Timeline">${OptionTimeline}</option>
</select>
</div>

View File

@ -42,8 +42,9 @@
<div>
<label for="selectView">${LabelView}</label>
<select id="selectView">
<option value="Poster">${OptionPoster}</option>
<option value="List">${OptionList}</option>
<option value="Poster">${OptionPoster}</option>
<option value="PosterCard">${OptionPosterCard}</option>
</select>
</div>
<br />

View File

@ -59,11 +59,21 @@
showTitle: true,
showParentTitle: true,
overlayText: true,
selectionPanel: true,
lazy: true,
context: 'tv'
});
}
else if (view == "PosterCard") {
html += LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "backdrop",
showTitle: true,
showParentTitle: true,
lazy: true,
context: 'tv',
cardLayout: true
});
}
html += pagingHtml;

View File

@ -61,6 +61,17 @@
centerText: true
});
}
else if (view == "PosterCard") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "auto",
context: 'games',
showTitle: true,
showParentTitle: true,
cardLayout: true
});
}
html += pagingHtml;

View File

@ -10,7 +10,7 @@
var options = {
IncludeItemTypes: "Game",
Limit: 8,
Limit: 18,
Fields: "PrimaryImageAspectRatio",
ParentId: parentId
};
@ -33,7 +33,7 @@
SortBy: "DatePlayed",
SortOrder: "Descending",
MediaTypes: "Game",
Limit: 8,
Limit: 18,
Recursive: true,
Filters: "IsPlayed",
Fields: "ItemCounts,AudioInfo,PrimaryImageAspectRatio",

View File

@ -1217,7 +1217,7 @@
cssClass += ' itemWithAction';
}
html += '<a' + dataAttributes + ' class="' + cssClass + '" href="' + href + '"' + defaultActionAttribute + '>';
html += '<div' + dataAttributes + ' class="' + cssClass + '">';
var style = "";
@ -1250,7 +1250,7 @@
html += '<div class="cardScalable">';
html += '<div class="cardPadder"></div>';
html += '<div class="cardContent">';
html += '<a class="cardContent" href="' + href + '"' + defaultActionAttribute + '>';
html += '<div class="' + imageCssClass + '" style="' + style + '"' + dataSrc + '></div>';
html += '<div class="cardOverlayTarget"></div>';
@ -1292,7 +1292,7 @@
}
// cardContent
html += '</div>';
html += '</a>';
// cardScalable
html += '</div>';
@ -1304,7 +1304,7 @@
// cardBox
html += '</div>';
html += "</a>";
html += "</div>";
}
@ -1317,6 +1317,12 @@
html += '<div class="' + footerClass + '">';
if (options.cardLayout) {
html += '<div class="cardText" style="text-align:right; float:right;">';
html += '<button class="listviewMenuButton" type="button" data-inline="true" data-iconpos="notext" data-icon="ellipsis-v" style="margin: 4px 0 0;"></button>';
html += "</div>";
}
var name = LibraryBrowser.getPosterViewDisplayName(item, options.displayAsSpecial);
if (!imgUrl && !options.showTitle) {
@ -1346,6 +1352,19 @@
lines.push(itemCountHtml);
}
if (options.showSongCount) {
var songLine = '';
if (item.SongCount) {
songLine = item.SongCount == 1 ?
Globalize.translate('ValueOneSong') :
Globalize.translate('ValueSongCount', item.SongCount);
}
lines.push(songLine);
}
if (options.showPremiereDate && item.PremiereDate) {
try {
@ -1363,6 +1382,18 @@
lines.push(item.ProductionYear || '');
}
if (options.showSeriesYear) {
if (item.Status == "Continuing") {
lines.push(Globalize.translate('ValueSeriesYearToPresent', item.ProductionYear || ''));
} else {
lines.push(item.ProductionYear || '');
}
}
html += LibraryBrowser.getCardTextLines(lines, cssClass, !options.overlayText);
if (options.overlayText) {

View File

@ -319,7 +319,7 @@
var displayContextItem = card;
if ($(card).hasClass('listviewMenuButton')) {
card = $(card).parents('.listItem')[0];
card = $(card).parents('.listItem,.card')[0];
}
var itemId = card.getAttribute('data-itemid');
@ -342,7 +342,7 @@
html += '<ul data-role="listview" style="min-width: 240px;">';
html += '<li data-role="list-divider">' + Globalize.translate('HeaderMenu') + '</li>';
var href = card.getAttribute('data-href') || card.href;
var href = card.getAttribute('data-href') || card.href || $('a', card).attr('href');
if (commands.indexOf('playlist') != -1) {
html += '<li data-icon="plus"><a href="#" class="btnAddToPlaylist" data-itemid="' + itemId + '">' + Globalize.translate('ButtonAddToPlaylist') + '</a></li>';

View File

@ -97,7 +97,7 @@
html += '</p><ul class="mediaFolderLocations" data-inset="true" data-role="listview" data-split-icon="minus">';
html += '<li data-role="list-divider" class="mediaLocationsHeader">' + Globalize.translate('HeaderMediaLocations');
html += '<button type="button" data-icon="plus" data-mini="true" data-inline="true" data-iconpos="notext" onclick="MediaLibraryPage.addMediaLocation(' + index + ');"></button>';
html += '<button type="button" data-icon="plus" data-mini="true" data-iconpos="notext" data-inline="true" onclick="MediaLibraryPage.addMediaLocation(' + index + ');">' + Globalize.translate('ButtonAdd') + '</button>';
html += '</li>';
for (var i = 0, length = virtualFolder.Locations.length; i < length; i++) {

View File

@ -1119,7 +1119,8 @@
html += '<source type="application/x-mpegURL" src="' + hlsVideoUrl + '" />';
}
var mp4BeforeWebm = self.getVideoTranscodingExtension() != '.webm';
// Live streams seem to function better with mp4
var mp4BeforeWebm = self.getVideoTranscodingExtension() != '.webm' || !mediaSource.RunTimeTicks;
if (mp4BeforeWebm) {
html += '<source type="video/mp4" src="' + mp4VideoUrl + '" />';

View File

@ -1,5 +1,7 @@
(function ($, document) {
var view = LibraryBrowser.getDefaultItemsView('Thumb', 'Thumb');
// The base query options
var query = {
@ -39,6 +41,7 @@
updateFilterControls(page);
if (view == "Thumb") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "backdrop",
@ -47,6 +50,32 @@
showItemCounts: true,
centerText: true
});
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
else if (view == "ThumbCard") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "backdrop",
preferThumb: true,
context: 'movies',
showItemCounts: true,
cardLayout: true,
showTitle: true
});
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
else if (view == "Poster") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "portrait",
context: 'movies',
centerText: true,
showItemCounts: true,
lazy: true
});
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
html += pagingHtml;
@ -71,6 +100,7 @@
function updateFilterControls(page) {
$('#selectPageSize', page).val(query.Limit).selectmenu('refresh');
$('#selectView', page).val(view).selectmenu('refresh');
}
$(document).on('pageinit', "#movieGenresPage", function () {
@ -100,8 +130,27 @@
reloadItems(page);
});
$('#selectView', this).on('change', function () {
view = this.value;
if (view == "Timeline") {
query.SortBy = "PremiereDate";
query.SortOrder = "Descending";
query.StartIndex = 0;
$('#radioPremiereDate', page)[0].click();
} else {
reloadItems(page);
}
LibraryBrowser.saveViewSetting(getSavedQueryKey(), view);
});
}).on('pagebeforeshow', "#movieGenresPage", function () {
var page = this;
query.ParentId = LibraryMenu.getTopParentId();
var limit = LibraryBrowser.getDefaultPageSize();
@ -112,9 +161,18 @@
query.StartIndex = 0;
}
LibraryBrowser.loadSavedQueryValues(getSavedQueryKey(), query);
var viewkey = getSavedQueryKey();
reloadItems(this);
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', "#movieGenresPage", function () {

View File

@ -50,13 +50,26 @@
shape: "backdrop",
preferThumb: true,
context: 'movies',
selectionPanel: true,
lazy: true,
overlayText: true,
showTitle: false
});
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
else if (view == "ThumbCard") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "backdrop",
preferThumb: true,
context: 'movies',
lazy: true,
showTitle: true,
cardLayout: true,
showYear: true
});
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
else if (view == "Banner") {
html = LibraryBrowser.getPosterViewHtml({
@ -84,7 +97,6 @@
context: 'movies',
showTitle: false,
centerText: true,
selectionPanel: true,
lazy: true,
overlayText: true
});
@ -98,7 +110,6 @@
showTitle: true,
timeline: true,
centerText: true,
selectionPanel: true,
lazy: true
});
$('.itemsContainer', page).addClass('timelineItemsContainer');

View File

@ -60,10 +60,23 @@
showTitle: true,
coverImage: true,
centerText: true,
lazy: true,
selectionPanel: true
lazy: true
});
}
else if (view == "PosterCard") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "square",
context: 'music',
showTitle: true,
coverImage: true,
lazy: true,
cardLayout: true,
showSongCount: true
});
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
html += pagingHtml;

View File

@ -49,8 +49,21 @@
context: 'music',
showTitle: true,
showParentTitle: true,
lazy: true
});
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
else if (view == "PosterCard") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "square",
context: 'music',
showTitle: true,
coverImage: true,
showParentTitle: true,
lazy: true,
selectionPanel: true
cardLayout: true
});
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
@ -71,8 +84,7 @@
showTitle: true,
showParentTitle: true,
timeline: true,
lazy: true,
selectionPanel: true
lazy: true
});
$('.itemsContainer', page).addClass('timelineItemsContainer');
}

View File

@ -60,10 +60,23 @@
showTitle: true,
coverImage: true,
centerText: true,
lazy: true,
selectionPanel: true
lazy: true
});
}
else if (view == "PosterCard") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "square",
context: 'music',
showTitle: true,
coverImage: true,
lazy: true,
cardLayout: true,
showSongCount: true
});
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
html += pagingHtml;

View File

@ -47,8 +47,7 @@
context: 'music',
showItemCounts: true,
centerText: true,
lazy: true,
selectionPanel: true
lazy: true
});
html += pagingHtml;

View File

@ -1,5 +1,7 @@
(function ($, document) {
var view = LibraryBrowser.getDefaultItemsView('Thumb', 'Thumb');
// The base query options
var query = {
@ -39,17 +41,41 @@
updateFilterControls(page);
html += LibraryBrowser.getPosterViewHtml({
if (view == "Thumb") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "backdrop",
showTitle: false,
context: 'tv',
preferThumb: true,
context: 'tv',
showItemCounts: true,
centerText: true,
lazy: true
centerText: true
});
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
else if (view == "ThumbCard") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "backdrop",
preferThumb: true,
context: 'tv',
showItemCounts: true,
cardLayout: true,
showTitle: true
});
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
else if (view == "Poster") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "portrait",
context: 'tv',
centerText: true,
showItemCounts: true,
lazy: true
});
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
html += pagingHtml;
@ -89,6 +115,7 @@
}).checkboxradio('refresh');
$('#selectPageSize', page).val(query.Limit).selectmenu('refresh');
$('#selectView', page).val(view).selectmenu('refresh');
}
$(document).on('pageinit', "#tvGenresPage", function () {
@ -118,9 +145,28 @@
reloadItems(page);
});
$('#selectView', this).on('change', function () {
view = this.value;
if (view == "Timeline") {
query.SortBy = "PremiereDate";
query.SortOrder = "Descending";
query.StartIndex = 0;
$('#radioPremiereDate', page)[0].click();
} else {
reloadItems(page);
}
LibraryBrowser.saveViewSetting(getSavedQueryKey(), view);
});
}).on('pagebeforeshow', "#tvGenresPage", function () {
query.ParentId = LibraryMenu.getTopParentId();
var page = this;
var limit = LibraryBrowser.getDefaultPageSize();
@ -130,9 +176,17 @@
query.StartIndex = 0;
}
LibraryBrowser.loadSavedQueryValues(getSavedQueryKey(), query);
var viewkey = getSavedQueryKey();
LibraryBrowser.loadSavedQueryValues(viewkey, query);
reloadItems(this);
LibraryBrowser.getSavedViewSetting(viewkey).done(function (val) {
if (val) {
$('#selectView', page).val(val).selectmenu('refresh').trigger('change');
} else {
reloadItems(page);
}
});
}).on('pageshow', "#tvGenresPage", function () {

View File

@ -53,6 +53,20 @@
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
else if (view == "ThumbCard") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "backdrop",
preferThumb: true,
context: 'tv',
lazy: true,
cardLayout: true,
showTitle: true,
showSeriesYear: true
});
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
else if (view == "Banner") {
html = LibraryBrowser.getPosterViewHtml({

View File

@ -139,7 +139,6 @@
html += '<div class="cardFooter">';
html += '<div class="cardText" style="text-align:right; float:right;">';
html += '<button class="btnUserMenu" type="button" data-inline="true" data-iconpos="notext" data-icon="ellipsis-v" style="margin: 2px 0 0;"></button>';
html += "</div>";

View File

@ -33,6 +33,15 @@
<div class="tabView viewTab">
<div>
<label for="selectView">${LabelView}</label>
<select id="selectView">
<option value="Poster">${OptionPoster}</option>
<option value="Thumb">${OptionThumb}</option>
<option value="ThumbCard">${OptionThumbCard}</option>
</select>
</div>
<br />
<div>
<label for="selectPageSize">${LabelPageSize}</label>
<select id="selectPageSize"></select>

View File

@ -39,10 +39,11 @@
<div>
<label for="selectView">${LabelView}</label>
<select id="selectView">
<option value="Thumb">${OptionThumb}</option>
<option value="Poster">${OptionPoster}</option>
<option value="Banner">${OptionBanner}</option>
<option value="List">${OptionList}</option>
<option value="Poster">${OptionPoster}</option>
<option value="Thumb">${OptionThumb}</option>
<option value="ThumbCard">${OptionThumbCard}</option>
</select>
</div>
<br />