This commit is contained in:
Techywarrior 2013-04-10 23:22:52 -07:00
commit 358df5f81c
11 changed files with 360 additions and 208 deletions

View File

@ -34,7 +34,7 @@
<p id="itemOverview"></p> <p id="itemOverview"></p>
<p id="itemRatings"></p> <p id="itemRatings"></p>
<p id="itemCommunityRating"></p> <p id="itemCommunityRating"></p>
<p id="itemMiscInfo" style="color: #ddd; font-size: 14px;"></p> <p id="itemMiscInfo" class="itemMiscInfo"></p>
<p id="itemGenres"></p> <p id="itemGenres"></p>
<p id="itemStudios"></p> <p id="itemStudios"></p>

View File

@ -20,7 +20,6 @@
} }
.libraryPage, .itemListContent { .libraryPage, .itemListContent {
background: #262626!important;
background: #494949 url(images/bgflip.png) repeat-x!important; background: #494949 url(images/bgflip.png) repeat-x!important;
background-attachment: fixed!important; background-attachment: fixed!important;
} }
@ -29,6 +28,10 @@
color: #fff; color: #fff;
} }
.listPage {
background: #262626!important;
}
.listHeader { .listHeader {
margin-top: 1em; margin-top: 1em;
margin-bottom: 5px; margin-bottom: 5px;
@ -106,7 +109,7 @@
@media all and (min-width: 650px) { @media all and (min-width: 650px) {
.libraryPage .ui-content { .libraryPage .ui-content {
padding: 15px 30px 100px; padding: 10px 15px 100px;
} }
} }
@ -158,6 +161,11 @@
padding: 0 10px; padding: 0 10px;
} }
.itemMiscInfo {
color: #ddd;
font-size: 14px;
}
.mediaInfoStream { .mediaInfoStream {
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
@ -189,6 +197,7 @@
background-color: #008FBB; background-color: #008FBB;
padding: 3px 10px; padding: 3px 10px;
border-bottom-left-radius: 10px; border-bottom-left-radius: 10px;
color: #fff;
} }
/* Firefox and Polyfill */ /* Firefox and Polyfill */
@ -196,13 +205,8 @@
border: solid #222222 1px; border: solid #222222 1px;
background: #444444 !important; /* !important only needed in polyfill */ background: #444444 !important; /* !important only needed in polyfill */
border-radius: 0!important; border-radius: 0!important;
height: 12px; height: 14px;
opacity: .7; opacity: .7;
position: absolute;
left: 10%;
right: 10%;
bottom: 61px;
width: 80%;
} }
/* Chrome */ /* Chrome */
@ -235,3 +239,91 @@
background-image: -ms-linear-gradient( center bottom, rgb(43,194,83) 37%, rgb(84,240,84) 69% ); background-image: -ms-linear-gradient( center bottom, rgb(43,194,83) 37%, rgb(84,240,84) 69% );
background-image: -o-linear-gradient( center bottom, rgb(43,194,83) 37%, rgb(84,240,84) 69% ); background-image: -o-linear-gradient( center bottom, rgb(43,194,83) 37%, rgb(84,240,84) 69% );
} }
.posterDetailViewItem {
background: #333;
padding: 10px 10px 3px;
margin: 3px 0;
text-shadow: none;
cursor: pointer;
font-weight: normal!important;
display: block;
font-size: 14px;
position: relative;
}
.posterDetailViewItem .starRating {
width: 15px;
height: 13px;
}
.posterDetailViewImage {
max-height: 90px;
max-width: 47%;
}
.posterDetailViewItem p {
margin: .75em 0;
}
.posterDetailViewItem .imgUserItemRating {
height: 18px;
width: 18px;
}
.posterDetailViewContentContainer {
display: inline-block;
width: 50%;
padding-left: 10px;
color: #fff;
text-align: left;
vertical-align: top;
}
.posterDetailViewName {
font-weight: bold;
}
.posterDetailViewItem .userDataIcons {
display: none;
}
@media all and (min-width: 850px) {
.posterDetailViewItem {
width: 46%;
display: inline-block;
margin-left: 3px;
margin-right: 3px;
}
.posterDetailViewImage {
max-height: 140px;
}
}
@media all and (min-width: 1200px) {
.posterDetailViewItem {
width: 31%;
}
.posterDetailViewItem .userDataIcons {
display: block;
}
}
@media all and (min-width: 1440px) {
.posterDetailViewImage {
max-height: 170px;
}
}
@media all and (min-width: 1920px) {
.posterDetailViewItem {
width: 31.5%;
}
.posterDetailViewImage {
max-height: 200px;
}
}

View File

@ -472,7 +472,7 @@ form, .readOnlyContent {
bottom: 28px; bottom: 28px;
} }
.posterViewItem:hover, .userItem:hover { .posterViewItem:hover, .userItem:hover, .posterDetailViewItem:hover {
-moz-box-shadow: 0 0 20px 3px #2572EB; -moz-box-shadow: 0 0 20px 3px #2572EB;
-webkit-box-shadow: 0 0 20px 3px #2572EB; -webkit-box-shadow: 0 0 20px 3px #2572EB;
box-shadow: 0 0 20px 3px #2572EB; box-shadow: 0 0 20px 3px #2572EB;

View File

@ -15,7 +15,7 @@
</div> </div>
<div class="itemDetailBlock"> <div class="itemDetailBlock">
<h1 id="itemName" style="margin-top: 0;"></h1> <p id="itemMiscInfo" class="itemMiscInfo"></p>
<p id="itemOverview"></p> <p id="itemOverview"></p>
<p id="itemRatings"></p> <p id="itemRatings"></p>

View File

@ -36,7 +36,7 @@
<p id="itemOverview"></p> <p id="itemOverview"></p>
<p id="itemRatings"></p> <p id="itemRatings"></p>
<p id="itemCommunityRating"></p> <p id="itemCommunityRating"></p>
<p id="itemMiscInfo" style="color: #ddd; font-size: 14px;"></p> <p id="itemMiscInfo" class="itemMiscInfo"></p>
<p id="itemGenres"></p> <p id="itemGenres"></p>
<p id="itemStudios"></p> <p id="itemStudios"></p>

View File

@ -4,7 +4,7 @@
<title>Media Browser</title> <title>Media Browser</title>
</head> </head>
<body> <body>
<div id="moviesPage" data-role="page" class="page libraryPage noLogoPage" data-theme="a"> <div id="moviesPage" data-role="page" class="page libraryPage noLogoPage listPage" data-theme="a">
<h1 class="libraryPageHeader"><a href="index.html" class="imageLink"> <h1 class="libraryPageHeader"><a href="index.html" class="imageLink">
<img src="css/images/home.png"></a>Movies</h1> <img src="css/images/home.png"></a>Movies</h1>
<div data-role="content"> <div data-role="content">
@ -19,6 +19,7 @@
<div class="viewSettings"> <div class="viewSettings">
<div style="display: inline-block;"> <div style="display: inline-block;">
<select data-mini="true" data-inline="true" id="selectView" name="selectView"> <select data-mini="true" data-inline="true" id="selectView" name="selectView">
<option value="Tile">Tile</option>
<option value="Poster">Poster</option> <option value="Poster">Poster</option>
<option value="Grid">Grid</option> <option value="Grid">Grid</option>
</select> </select>

View File

@ -10,6 +10,135 @@
return 25; return 25;
}, },
getPosterDetailViewHtml: function (options) {
var items = options.items;
var primaryImageAspectRatio = options.useAverageAspectRatio ? LibraryBrowser.getAveragePrimaryImageAspectRatio(items) : null;
var html = '';
for (var i = 0, length = items.length; i < length; i++) {
var item = items[i];
html += '<a class="posterDetailViewItem" href="' + LibraryBrowser.getHref(item) + '">';
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
html += "<img class='posterDetailViewImage' src='" + ApiClient.getImageUrl(item.Id, {
type: "Backdrop",
height: 198,
width: 352,
tag: item.BackdropImageTags[0]
}) + "' />";
}
else if (options.preferBackdrop && item.ImageTags && item.ImageTags.Thumb) {
html += "<img class='posterDetailViewImage' src='" + ApiClient.getImageUrl(item.Id, {
type: "Thumb",
height: 198,
width: 352,
tag: item.ImageTags.Thumb
}) + "' />";
}
else if (item.ImageTags && item.ImageTags.Primary) {
var height = 300;
var width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
html += "<img class='posterDetailViewImage' src='" + ApiClient.getImageUrl(item.Id, {
type: "Primary",
height: height,
width: width,
tag: item.ImageTags.Primary
}) + "' />";
}
else if (item.BackdropImageTags && item.BackdropImageTags.length) {
html += "<img class='posterDetailViewImage' src='" + ApiClient.getImageUrl(item.Id, {
type: "Backdrop",
height: 198,
width: 352,
tag: item.BackdropImageTags[0]
}) + "' />";
}
else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") {
html += "<img class='posterDetailViewImage' style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/audio.png' />";
}
else if (item.MediaType == "Video" || item.Type == "Season" || item.Type == "Series") {
html += "<img class='posterDetailViewImage' style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/video.png' />";
}
else {
html += "<img class='posterDetailViewImage' style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/collection.png' />";
}
html += '<div class="posterDetailViewContentContainer">';
if (item.SeriesName || item.Album) {
var seriesName = item.SeriesName || item.Album;
html += '<div class="posterDetailViewName">' + seriesName + '</div>';
}
var name = item.Name;
if (item.IndexNumber != null) {
name = item.IndexNumber + " - " + name;
}
if (item.ParentIndexNumber != null) {
name = item.ParentIndexNumber + "." + name;
}
html += '<div class="posterDetailViewName">' + name + '</div>';
if (item.CommunityRating) {
html += '<p>' + LibraryBrowser.getFiveStarRatingHtml(item) + '</p>';
}
html += '<p class="itemMiscInfo">' + LibraryBrowser.getMiscInfoHtml(item, false) + '</p>';
html += '<p class="userDataIcons">' + LibraryBrowser.getUserDataIconsHtml(item) + '</p>';
if (item.PlayedPercentage || (item.UserData && item.UserData.PlaybackPositionTicks)) {
html += '<p>' + LibraryBrowser.getProgressBarHtml(item) + '</p>';
}
html += '</div>';
html += LibraryBrowser.getNewIndicatorHtml(item);
html += "</a>";
}
return html;
},
getHref: function (item) {
if (item.url) {
return item.url;
}
if (item.Type == "Series") {
return "tvseries.html?id=" + item.Id;
}
if (item.Type == "BoxSet") {
return "boxset.html?id=" + item.Id;
}
return item.IsFolder ? (item.Id ? "itemList.html?parentId=" + item.Id : "#") : "itemdetails.html?id=" + item.Id;
},
getPosterViewHtml: function (options) { getPosterViewHtml: function (options) {
var items = options.items; var items = options.items;
@ -23,13 +152,11 @@
var hasPrimaryImage = item.ImageTags && item.ImageTags.Primary; var hasPrimaryImage = item.ImageTags && item.ImageTags.Primary;
var href = item.url || (item.IsFolder ? (item.Id ? "itemList.html?parentId=" + item.Id : "#") : "itemdetails.html?id=" + item.Id);
var showText = options.showTitle || !hasPrimaryImage; var showText = options.showTitle || !hasPrimaryImage;
var cssClass = showText ? "posterViewItem" : "posterViewItem posterViewItemWithNoText"; var cssClass = showText ? "posterViewItem" : "posterViewItem posterViewItemWithNoText";
html += "<div class='" + cssClass + "'><a href='" + href + "'>"; html += "<div class='" + cssClass + "'><a href='" + LibraryBrowser.getHref(item) + "'>";
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) { if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
html += "<img src='" + ApiClient.getImageUrl(item.Id, { html += "<img src='" + ApiClient.getImageUrl(item.Id, {
@ -84,8 +211,6 @@
html += LibraryBrowser.getNewIndicatorHtml(item); html += LibraryBrowser.getNewIndicatorHtml(item);
} }
html += LibraryBrowser.getProgressBarHtml(item);
html += "</a></div>"; html += "</a></div>";
} }
@ -105,13 +230,11 @@
var hasPrimaryImage = item.ImageTags && item.ImageTags.Primary; var hasPrimaryImage = item.ImageTags && item.ImageTags.Primary;
var href = item.url || (item.IsFolder ? (item.Id ? "itemList.html?parentId=" + item.Id : "#") : "itemdetails.html?id=" + item.Id);
var showText = options.showTitle || !hasPrimaryImage || (item.Type !== 'Movie' && item.Type !== 'Series' && item.Type !== 'Season' && item.Type !== 'Trailer'); var showText = options.showTitle || !hasPrimaryImage || (item.Type !== 'Movie' && item.Type !== 'Series' && item.Type !== 'Season' && item.Type !== 'Trailer');
var cssClass = showText ? "posterViewItem posterViewItemWithDualText" : "posterViewItem posterViewItemWithNoText"; var cssClass = showText ? "posterViewItem posterViewItemWithDualText" : "posterViewItem posterViewItemWithNoText";
html += "<div class='" + cssClass + "'><a href='" + href + "'>"; html += "<div class='" + cssClass + "'><a href='" + LibraryBrowser.getHref(item) + "'>";
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) { if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
html += "<img src='" + ApiClient.getImageUrl(item.Id, { html += "<img src='" + ApiClient.getImageUrl(item.Id, {
@ -165,8 +288,6 @@
html += LibraryBrowser.getNewIndicatorHtml(item); html += LibraryBrowser.getNewIndicatorHtml(item);
} }
html += LibraryBrowser.getProgressBarHtml(item);
html += "</a></div>"; html += "</a></div>";
} }
@ -186,13 +307,11 @@
var hasPrimaryImage = item.ImageTags && item.ImageTags.Primary; var hasPrimaryImage = item.ImageTags && item.ImageTags.Primary;
var href = item.url || ("boxset.html?id=" + item.Id);
var showText = options.showTitle || !hasPrimaryImage || (item.Type !== 'Movie' && item.Type !== 'Series' && item.Type !== 'Season' && item.Type !== 'Trailer'); var showText = options.showTitle || !hasPrimaryImage || (item.Type !== 'Movie' && item.Type !== 'Series' && item.Type !== 'Season' && item.Type !== 'Trailer');
var cssClass = showText ? "posterViewItem posterViewItemWithDualText" : "posterViewItem posterViewItemWithNoText"; var cssClass = showText ? "posterViewItem posterViewItemWithDualText" : "posterViewItem posterViewItemWithNoText";
html += "<div class='" + cssClass + "'><a href='" + href + "'>"; html += "<div class='" + cssClass + "'><a href='" + LibraryBrowser.getHref(item) + "'>";
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) { if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
html += "<img src='" + ApiClient.getImageUrl(item.Id, { html += "<img src='" + ApiClient.getImageUrl(item.Id, {
@ -244,88 +363,6 @@
return html; return html;
}, },
getSeriesPosterViewHtml: function (options) {
var items = options.items;
var primaryImageAspectRatio = options.useAverageAspectRatio ? LibraryBrowser.getAveragePrimaryImageAspectRatio(items) : null;
var html = "";
for (var i = 0, length = items.length; i < length; i++) {
var item = items[i];
var hasPrimaryImage = item.ImageTags && item.ImageTags.Primary;
var href = item.url || "tvseries.html?id=" + item.Id;
var showText = options.showTitle || !hasPrimaryImage;
var cssClass = showText ? "posterViewItem" : "posterViewItem posterViewItemWithNoText";
html += "<div class='" + cssClass + "'><a href='" + href + "'>";
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
type: "Backdrop",
height: 198,
width: 352,
tag: item.BackdropImageTags[0]
}) + "' />";
} else if (hasPrimaryImage) {
var height = 300;
var width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
type: "Primary",
height: height,
width: width,
tag: item.ImageTags.Primary
}) + "' />";
} else if (item.BackdropImageTags && item.BackdropImageTags.length) {
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
type: "Backdrop",
height: 198,
width: 352,
tag: item.BackdropImageTags[0]
}) + "' />";
}
else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") {
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/audio.png' />";
}
else if (item.MediaType == "Video" || item.Type == "Season" || item.Type == "Series") {
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/video.png' />";
}
else {
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/collection.png' />";
}
if (showText) {
html += "<div class='posterViewItemText'>";
html += item.Name;
html += "</div>";
}
if (options.showNewIndicator !== false) {
html += LibraryBrowser.getNewIndicatorHtml(item);
}
html += LibraryBrowser.getProgressBarHtml(item);
html += "</a></div>";
}
return html;
},
getNewIndicatorHtml: function (item) { getNewIndicatorHtml: function (item) {
if (item.RecentlyAddedItemCount) { if (item.RecentlyAddedItemCount) {
@ -346,11 +383,20 @@
getProgressBarHtml: function (item) { getProgressBarHtml: function (item) {
return '';
var html = ''; var html = '';
if (item.PlayedPercentage && item.PlayedPercentage < 100) { var tooltip;
html += '<progress class="itemProgress" min="0" max="100" value="' + item.PlayedPercentage + '"></progress>';
if (item.PlayedPercentage) {
tooltip = parseInt(item.PlayedPercentage) + '% watched';
html += '<progress class="itemProgress" min="0" max="100" value="' + item.PlayedPercentage + '" title="' + tooltip + '"></progress>';
}
else if (item.UserData && item.UserData.PlaybackPositionTicks && item.RunTimeTicks) {
tooltip = DashboardPage.getDisplayText(item.UserData.PlaybackPositionTicks) + " / " + DashboardPage.getDisplayText(item.RunTimeTicks);
html += '<progress class="itemProgress" min="0" max="100" value="' + (item.UserData.PlaybackPositionTicks / item.RunTimeTicks) + '" title="' + tooltip + '"></progress>';
} }
return html; return html;
@ -504,6 +550,26 @@
return html; return html;
}, },
getFiveStarRatingHtml: function (item) {
var rating = item.CommunityRating / 2;
var html = "";
for (var i = 1; i <= 5; i++) {
if (rating < i - 1) {
html += "<div class='starRating emptyStarRating'></div>";
}
else if (rating < i) {
html += "<div class='starRating halfStarRating'></div>";
}
else {
html += "<div class='starRating'></div>";
}
}
return html;
},
getUserDataIconsHtml: function (item) { getUserDataIconsHtml: function (item) {
var html = ''; var html = '';
@ -515,29 +581,29 @@
if (item.MediaType) { if (item.MediaType) {
if (userData.Played) { if (userData.Played) {
html += '<img data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgPlayed" src="css/images/userdata/played.png" alt="Played" title="Played" onclick="LibraryBrowser.markPlayed(this);" />'; html += '<img data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgPlayed" src="css/images/userdata/played.png" alt="Played" title="Played" onclick="LibraryBrowser.markPlayed(this);return false;" />';
} else { } else {
html += '<img data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgPlayedOff" src="css/images/userdata/unplayed.png" alt="Played" title="Played" onclick="LibraryBrowser.markPlayed(this);" />'; html += '<img data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgPlayedOff" src="css/images/userdata/unplayed.png" alt="Played" title="Played" onclick="LibraryBrowser.markPlayed(this);return false;" />';
} }
} }
if (typeof userData.Likes == "undefined") { if (typeof userData.Likes == "undefined") {
html += '<img onclick="LibraryBrowser.markDislike(this);" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgDislikeOff" src="css/images/userdata/thumbs_down_off.png" alt="Dislike" title="Dislike" />'; html += '<img onclick="LibraryBrowser.markDislike(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgDislikeOff" src="css/images/userdata/thumbs_down_off.png" alt="Dislike" title="Dislike" />';
html += '<img onclick="LibraryBrowser.markLike(this);" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgLikeOff" src="css/images/userdata/thumbs_up_off.png" alt="Like" title="Like" />'; html += '<img onclick="LibraryBrowser.markLike(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgLikeOff" src="css/images/userdata/thumbs_up_off.png" alt="Like" title="Like" />';
} }
else if (userData.Likes) { else if (userData.Likes) {
html += '<img onclick="LibraryBrowser.markDislike(this);" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgDislikeOff" src="css/images/userdata/thumbs_down_off.png" alt="Dislike" title="Dislike" />'; html += '<img onclick="LibraryBrowser.markDislike(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgDislikeOff" src="css/images/userdata/thumbs_down_off.png" alt="Dislike" title="Dislike" />';
html += '<img onclick="LibraryBrowser.markLike(this);" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgLike" src="css/images/userdata/thumbs_up_on.png" alt="Like" title="Like" />'; html += '<img onclick="LibraryBrowser.markLike(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgLike" src="css/images/userdata/thumbs_up_on.png" alt="Like" title="Like" />';
} }
else { else {
html += '<img onclick="LibraryBrowser.markDislike(this);" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgDislike" src="css/images/userdata/thumbs_down_on.png" alt="Dislike" title="Dislike" />'; html += '<img onclick="LibraryBrowser.markDislike(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgDislike" src="css/images/userdata/thumbs_down_on.png" alt="Dislike" title="Dislike" />';
html += '<img onclick="LibraryBrowser.markLike(this);" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgLikeOff" src="css/images/userdata/thumbs_up_off.png" alt="Like" title="Like" />'; html += '<img onclick="LibraryBrowser.markLike(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgLikeOff" src="css/images/userdata/thumbs_up_off.png" alt="Like" title="Like" />';
} }
if (userData.IsFavorite) { if (userData.IsFavorite) {
html += '<img onclick="LibraryBrowser.markFavorite(this);" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgFavorite" src="css/images/userdata/heart_on.png" alt="Favorite" title="Favorite" />'; html += '<img onclick="LibraryBrowser.markFavorite(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgFavorite" src="css/images/userdata/heart_on.png" alt="Favorite" title="Favorite" />';
} else { } else {
html += '<img onclick="LibraryBrowser.markFavorite(this);" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgFavoriteOff" src="css/images/userdata/heart_off.png" alt="Favorite" title="Favorite" />'; html += '<img onclick="LibraryBrowser.markFavorite(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgFavoriteOff" src="css/images/userdata/heart_off.png" alt="Favorite" title="Favorite" />';
} }
return html; return html;
@ -720,7 +786,7 @@
return html; return html;
}, },
getMiscInfoHtml: function (item) { getMiscInfoHtml: function (item, includeMediaInfo) {
var miscInfo = []; var miscInfo = [];
@ -741,6 +807,7 @@
miscInfo.push(parseInt(minutes) + "min"); miscInfo.push(parseInt(minutes) + "min");
} }
if (includeMediaInfo !== false) {
if (item.DisplayMediaType) { if (item.DisplayMediaType) {
miscInfo.push(item.DisplayMediaType); miscInfo.push(item.DisplayMediaType);
} }
@ -748,6 +815,8 @@
if (item.VideoFormat && item.VideoFormat !== 'Standard') { if (item.VideoFormat && item.VideoFormat !== 'Standard') {
miscInfo.push(item.VideoFormat); miscInfo.push(item.VideoFormat);
} }
}
return miscInfo.join('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'); return miscInfo.join('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
}, },

View File

@ -1,6 +1,6 @@
(function ($, document) { (function ($, document) {
var view = "Poster"; var view = "Tile";
// The base query options // The base query options
var query = { var query = {
@ -129,7 +129,14 @@
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount); html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
} }
if (view == "Poster") { if (view == "Tile") {
html += LibraryBrowser.getPosterDetailViewHtml({
items: result.Items,
useAverageAspectRatio: true,
preferBackdrop: true
});
}
else if (view == "Poster") {
html += LibraryBrowser.getPosterViewHtml({ html += LibraryBrowser.getPosterViewHtml({
items: result.Items, items: result.Items,
useAverageAspectRatio: true useAverageAspectRatio: true

View File

@ -1,5 +1,7 @@
(function ($, document) { (function ($, document) {
var view = "Tile";
// The base query options // The base query options
var query = { var query = {
@ -7,91 +9,57 @@
SortOrder: "Ascending", SortOrder: "Ascending",
IncludeItemTypes: "Series", IncludeItemTypes: "Series",
Recursive: true, Recursive: true,
Fields: "PrimaryImageAspectRatio,SeriesInfo,ItemCounts,DateCreated" Fields: "PrimaryImageAspectRatio,SeriesInfo,ItemCounts,DateCreated",
Limit: LibraryBrowser.getDetaultPageSize(),
StartIndex: 0
}; };
function getTableHtml(items) {
var html = '<div class="libraryItemsGridContainer"><table data-role="table" data-mode="reflow" class="ui-responsive table-stroke libraryItemsGrid">';
html += '<thead>';
html += '<tr>';
html += '<th>&nbsp;</th>';
html += '<th>Name</th>';
html += '<th>Year</th>';
html += '<th>Official Rating</th>';
html += '<th>Runtime</th>';
html += '<th>Community Rating</th>';
html += '</tr>';
html += '</thead>';
html += '<tbody>';
for (var i = 0, length = items.length; i < length; i++) {
html += getRowHtml(items[i]);
}
html += '</tbody>';
html += '</table></div>';
return html;
}
function getRowHtml(item) {
var html = '<tr>';
html += '<td>';
var url = "tvseries.html?id=" + item.Id;
var imageTags = item.ImageTags;
html += '<a href="' + url + '">';
if (imageTags.Primary) {
html += '<img class="libraryGridImage" src="' + ApiClient.getImageUrl(item.Id, {
type: "Primary",
height: 150,
tag: item.ImageTags.Primary
}) + '" />';
}
else {
html += '<img class="libraryGridImage" style="background:' + LibraryBrowser.getMetroColor(item.Id) + ';" src="css/images/items/list/collection.png" />';
}
html += '</a></td>';
html += '<td><a href="' + url + '">' + item.Name + '</a></td>';
html += '<td>' + (item.ProductionYear || "") + '</td>';
html += '<td>' + (item.OfficialRating || "") + '</td>';
html += '<td>' + (item.RunTimeTicks || "") + '</td>';
html += '<td>' + (item.CommunityRating || "") + '</td>';
html += '</tr>';
return html;
}
function reloadItems(page) { function reloadItems(page) {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
$('#items', page).html(LibraryBrowser.getSeriesPosterViewHtml({ var html = '';
var showPaging = result.TotalRecordCount > query.Limit;
if (showPaging) {
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
}
if (view == "Tile") {
html += LibraryBrowser.getPosterDetailViewHtml({
items: result.Items,
useAverageAspectRatio: true,
preferBackdrop: true
});
}
else if (view == "Poster") {
html += LibraryBrowser.getPosterViewHtml({
items: result.Items, items: result.Items,
useAverageAspectRatio: true useAverageAspectRatio: true
});
}
else if (view == "Grid") {
html += getTableHtml(result);
}
}))/*.html(getTableHtml(result.Items)).trigger('create')*/; if (showPaging) {
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
}
var elem = $('#items', page);
// cleanup existing event handlers
$('select', elem).off('change');
elem.html(html).trigger('create');
$('select', elem).on('change', function () {
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;
reloadItems(page);
});
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
}); });
@ -159,6 +127,13 @@
reloadItems(page); reloadItems(page);
}); });
$('#selectView', this).on('change', function () {
view = this.value;
reloadItems(page);
});
}).on('pagebeforeshow', "#tvShowsPage", function () { }).on('pagebeforeshow', "#tvShowsPage", function () {
reloadItems(this); reloadItems(this);
@ -204,6 +179,8 @@
this.checked = filters.indexOf(',' + filterName) != -1; this.checked = filters.indexOf(',' + filterName) != -1;
}).checkboxradio('refresh'); }).checkboxradio('refresh');
$('#selectView', this).val(view).selectmenu('refresh');
}); });
})(jQuery, document); })(jQuery, document);

View File

@ -31,7 +31,7 @@
<p id="itemOverview"></p> <p id="itemOverview"></p>
<p id="itemRatings"></p> <p id="itemRatings"></p>
<p id="itemCommunityRating"></p> <p id="itemCommunityRating"></p>
<p id="itemMiscInfo" style="color: #ddd; font-size: 14px;"></p> <p id="itemMiscInfo" class="itemMiscInfo"></p>
<p id="itemGenres"></p> <p id="itemGenres"></p>
<p id="itemStudios"></p> <p id="itemStudios"></p>

View File

@ -4,7 +4,7 @@
<title>Media Browser</title> <title>Media Browser</title>
</head> </head>
<body> <body>
<div id="tvShowsPage" data-role="page" class="page libraryPage noLogoPage" data-theme="a"> <div id="tvShowsPage" data-role="page" class="page libraryPage noLogoPage listPage" data-theme="a">
<h1 class="libraryPageHeader"><a href="index.html" class="imageLink"> <h1 class="libraryPageHeader"><a href="index.html" class="imageLink">
<img src="css/images/home.png"></a>TV Shows</h1> <img src="css/images/home.png"></a>TV Shows</h1>
<div data-role="content"> <div data-role="content">
@ -15,6 +15,12 @@
<a href="#" data-role="button">Actors</a> <a href="#" data-role="button">Actors</a>
</div> </div>
<div class="viewSettings"> <div class="viewSettings">
<div style="display: inline-block;">
<select data-mini="true" data-inline="true" id="selectView" name="selectView">
<option value="Tile">Tile</option>
<option value="Poster">Poster</option>
</select>
</div>
<button data-mini="true" data-icon="sort" data-inline="true" onclick="$('#sortPanel', $.mobile.activePage).panel( 'toggle' );">Sort</button> <button data-mini="true" data-icon="sort" data-inline="true" onclick="$('#sortPanel', $.mobile.activePage).panel( 'toggle' );">Sort</button>
<button data-mini="true" data-icon="filter" data-inline="true" onclick="$('#filterPanel', $.mobile.activePage).panel( 'toggle' );">Filter</button> <button data-mini="true" data-icon="filter" data-inline="true" onclick="$('#filterPanel', $.mobile.activePage).panel( 'toggle' );">Filter</button>
</div> </div>