mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
This commit is contained in:
commit
042679efe6
10 changed files with 754 additions and 80 deletions
|
@ -1,11 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title></title>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="boxsetPage" data-role="page" class="page libraryPage" data-theme="a">
|
||||
<div data-role="content" style="padding-top: 0;">
|
||||
|
||||
<h1 id="seriesName" style="padding-left: 10px; margin: 0;" class="hide"></h1>
|
||||
<h1 id="itemName" style="padding-left: 10px; margin: 0;"></h1>
|
||||
|
||||
<div style="padding: 10px;">
|
||||
<div class="itemImageBlock">
|
||||
<div id="itemMedia" style="position: relative;">
|
||||
<div id="itemImage"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="itemDetailBlock">
|
||||
|
||||
<p id="itemTagline" style="font-style: italic;"></p>
|
||||
<p id="itemOverview"></p>
|
||||
<p id="itemCommunityRating"></p>
|
||||
<p id="itemMiscInfo" style="color: #ddd; font-size: 14px;"></p>
|
||||
|
||||
<p id="itemGenres">
|
||||
</p>
|
||||
|
||||
<p id="itemStudios">
|
||||
</p>
|
||||
<p id="itemRatings">
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
BIN
dashboard-ui/css/images/media/language.png
Normal file
BIN
dashboard-ui/css/images/media/language.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 738 B |
Binary file not shown.
Before Width: | Height: | Size: 857 B After Width: | Height: | Size: 651 B |
|
@ -832,8 +832,10 @@ progress {
|
|||
width: auto !important;
|
||||
}
|
||||
|
||||
.vjs-quality-button div {
|
||||
background: red !important;
|
||||
.vjs-default-skin .vjs-menu-button.vjs-quality-button div {
|
||||
background: url("images/media/quality.png");
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
.vjs-chapter-button div {
|
||||
|
@ -867,7 +869,7 @@ progress {
|
|||
}
|
||||
|
||||
.vjs-subtitle-button div {
|
||||
background: green !important;
|
||||
background-position: -25px -75px !important;
|
||||
}
|
||||
|
||||
.vjs-subtitle-button.vjs-menu-button ul {
|
||||
|
@ -883,8 +885,10 @@ progress {
|
|||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.vjs-language-button div {
|
||||
background: yellow !important;
|
||||
.vjs-default-skin .vjs-menu-button.vjs-language-button div {
|
||||
background: url("images/media/language.png") !important;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
.vjs-language-button.vjs-menu-button ul {
|
||||
|
|
|
@ -1 +1,351 @@
|
|||
|
||||
var BoxsetPage = {
|
||||
|
||||
onPageShow: function () {
|
||||
|
||||
BoxsetPage.reload();
|
||||
},
|
||||
|
||||
onPageHide: function () {
|
||||
|
||||
BoxsetPage.item = null;
|
||||
},
|
||||
|
||||
reload: function () {
|
||||
var id = getParameterByName('id');
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getItem(Dashboard.getCurrentUserId(), id).done(BoxsetPage.renderItem);
|
||||
},
|
||||
|
||||
renderItem: function (item) {
|
||||
|
||||
BoxsetPage.item = item;
|
||||
|
||||
var page = $.mobile.activePage;
|
||||
|
||||
BoxsetPage.item = item;
|
||||
|
||||
var name = item.Name;
|
||||
|
||||
if (item.IndexNumber != null) {
|
||||
name = item.IndexNumber + " - " + name;
|
||||
}
|
||||
if (item.ParentIndexNumber != null) {
|
||||
name = item.ParentIndexNumber + "." + name;
|
||||
}
|
||||
|
||||
Dashboard.setPageTitle(name);
|
||||
|
||||
BoxsetPage.renderImage(item);
|
||||
BoxsetPage.renderOverviewBlock(item);
|
||||
|
||||
$('#itemName', page).html(name);
|
||||
|
||||
if (item.SeriesName || item.Album) {
|
||||
var series_name = item.SeriesName || item.Album;
|
||||
$('#seriesName', page).html(series_name).show();
|
||||
}
|
||||
|
||||
BoxsetPage.renderFav(item);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
},
|
||||
|
||||
renderImage: function (item) {
|
||||
|
||||
var page = $.mobile.activePage;
|
||||
|
||||
var imageTags = item.ImageTags || {};
|
||||
|
||||
var html = '';
|
||||
|
||||
var url;
|
||||
var useBackgroundColor;
|
||||
|
||||
if (imageTags.Primary) {
|
||||
|
||||
url = ApiClient.getImageUrl(item.Id, {
|
||||
type: "Primary",
|
||||
width: 800,
|
||||
tag: item.ImageTags.Primary
|
||||
});
|
||||
}
|
||||
else if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
|
||||
url = ApiClient.getImageUrl(item.Id, {
|
||||
type: "Backdrop",
|
||||
width: 800,
|
||||
tag: item.BackdropImageTags[0]
|
||||
});
|
||||
}
|
||||
else if (imageTags.Thumb) {
|
||||
|
||||
url = ApiClient.getImageUrl(item.Id, {
|
||||
type: "Thumb",
|
||||
width: 800,
|
||||
tag: item.ImageTags.Thumb
|
||||
});
|
||||
}
|
||||
else if (imageTags.Disc) {
|
||||
|
||||
url = ApiClient.getImageUrl(item.Id, {
|
||||
type: "Disc",
|
||||
width: 800,
|
||||
tag: item.ImageTags.Disc
|
||||
});
|
||||
}
|
||||
else if (item.MediaType == "Audio") {
|
||||
url = "css/images/items/detail/audio.png";
|
||||
useBackgroundColor = true;
|
||||
}
|
||||
else if (item.MediaType == "Game") {
|
||||
url = "css/images/items/detail/game.png";
|
||||
useBackgroundColor = true;
|
||||
}
|
||||
else {
|
||||
url = "css/images/items/detail/video.png";
|
||||
useBackgroundColor = true;
|
||||
}
|
||||
|
||||
if (url) {
|
||||
|
||||
var style = useBackgroundColor ? "background-color:" + LibraryBrowser.getMetroColor(item.Id) + ";" : "";
|
||||
|
||||
html += "<img class='itemDetailImage' src='" + url + "' style='" + style + "' />";
|
||||
}
|
||||
|
||||
$('#itemImage', page).html(html);
|
||||
},
|
||||
|
||||
renderOverviewBlock: function (item) {
|
||||
|
||||
var page = $.mobile.activePage;
|
||||
|
||||
if (item.Taglines && item.Taglines.length) {
|
||||
$('#itemTagline', page).html(item.Taglines[0]).show();
|
||||
} else {
|
||||
$('#itemTagline', page).hide();
|
||||
}
|
||||
|
||||
if (item.Overview || item.OverviewHtml) {
|
||||
var overview = item.OverviewHtml || item.Overview;
|
||||
|
||||
$('#itemOverview', page).html(overview).show();
|
||||
$('#itemOverview a').each(function () {
|
||||
$(this).attr("target", "_blank");
|
||||
});
|
||||
} else {
|
||||
$('#itemOverview', page).hide();
|
||||
}
|
||||
|
||||
if (item.CommunityRating) {
|
||||
$('#itemCommunityRating', page).html(BoxsetPage.getStarRating(item)).show().attr('title', item.CommunityRating);
|
||||
} else {
|
||||
$('#itemCommunityRating', page).hide();
|
||||
}
|
||||
|
||||
var miscInfo = [];
|
||||
|
||||
if (item.ProductionYear) {
|
||||
miscInfo.push(item.ProductionYear);
|
||||
}
|
||||
|
||||
if (item.OfficialRating) {
|
||||
miscInfo.push(item.OfficialRating);
|
||||
}
|
||||
|
||||
if (item.RunTimeTicks) {
|
||||
|
||||
var minutes = item.RunTimeTicks / 600000000;
|
||||
|
||||
minutes = minutes || 1;
|
||||
|
||||
miscInfo.push(parseInt(minutes) + "min");
|
||||
}
|
||||
|
||||
if (item.DisplayMediaType) {
|
||||
miscInfo.push(item.DisplayMediaType);
|
||||
}
|
||||
|
||||
if (item.VideoFormat && item.VideoFormat !== 'Standard') {
|
||||
miscInfo.push(item.VideoFormat);
|
||||
}
|
||||
|
||||
$('#itemMiscInfo', page).html(miscInfo.join(' '));
|
||||
|
||||
BoxsetPage.renderGenres(item);
|
||||
BoxsetPage.renderStudios(item);
|
||||
},
|
||||
|
||||
renderGenres: function (item) {
|
||||
|
||||
var page = $.mobile.activePage;
|
||||
|
||||
if (item.Genres && item.Genres.length) {
|
||||
var elem = $('#itemGenres', page).show();
|
||||
|
||||
var html = 'Genres: ';
|
||||
|
||||
for (var i = 0, length = item.Genres.length; i < length; i++) {
|
||||
|
||||
if (i > 0) {
|
||||
html += ' / ';
|
||||
}
|
||||
|
||||
html += '<a href="itembynamedetails.html?genre=' + item.Genres[i] + '">' + item.Genres[i] + '</a>';
|
||||
}
|
||||
|
||||
elem.html(html).trigger('create');
|
||||
|
||||
|
||||
} else {
|
||||
$('#itemGenres', page).hide();
|
||||
}
|
||||
},
|
||||
|
||||
renderStudios: function (item) {
|
||||
|
||||
var page = $.mobile.activePage;
|
||||
|
||||
if (item.Studios && item.Studios.length) {
|
||||
var elem = $('#itemStudios', page).show();
|
||||
|
||||
var html = 'Studios: ';
|
||||
|
||||
for (var i = 0, length = item.Studios.length; i < length; i++) {
|
||||
|
||||
if (i > 0) {
|
||||
html += ' / ';
|
||||
}
|
||||
|
||||
html += '<a href="itembynamedetails.html?studio=' + item.Studios[i] + '">' + item.Studios[i] + '</a>';
|
||||
}
|
||||
|
||||
elem.html(html).trigger('create');
|
||||
|
||||
|
||||
} else {
|
||||
$('#itemStudios', page).hide();
|
||||
}
|
||||
},
|
||||
|
||||
getStarRating: function (item) {
|
||||
var rating = item.CommunityRating;
|
||||
|
||||
var html = "";
|
||||
for (var i = 1; i <= 10; 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;
|
||||
},
|
||||
|
||||
renderFav: function (item) {
|
||||
var html = '';
|
||||
var page = $.mobile.activePage;
|
||||
|
||||
var userData = item.UserData || {};
|
||||
|
||||
if (typeof userData.Likes == "undefined") {
|
||||
html += '<div class="userItemRating"><img class="imgUserItemRating" src="css/images/userdata/thumbs_down_off.png" alt="Dislike" title="Dislike" onclick="BoxsetPage.setDislike();" /></div>';
|
||||
html += '<div class="userItemRating"><img class="imgUserItemRating" src="css/images/userdata/thumbs_up_off.png" alt="Like" title="Like" onclick="BoxsetPage.setLike();" /></div>';
|
||||
} else if (userData.Likes) {
|
||||
html += '<div class="userItemRating"><img class="imgUserItemRating" src="css/images/userdata/thumbs_down_off.png" alt="Dislike" title="Dislike" onclick="BoxsetPage.setDislike();" /></div>';
|
||||
html += '<div class="userItemRating"><img class="imgUserItemRating" src="css/images/userdata/thumbs_up_on.png" alt="Liked" title="Like" onclick="BoxsetPage.clearLike();" /></div>';
|
||||
} else {
|
||||
html += '<div class="userItemRating"><img class="imgUserItemRating" src="css/images/userdata/thumbs_down_on.png" alt="Dislike" title="Dislike" onclick="BoxsetPage.clearLike();" /></div>';
|
||||
html += '<div class="userItemRating"><img class="imgUserItemRating" src="css/images/userdata/thumbs_up_off.png" alt="Like" title="Like" onclick="BoxsetPage.setLike();" /></div>';
|
||||
}
|
||||
|
||||
if (userData.IsFavorite) {
|
||||
html += '<div class="userItemRating"><img class="imgUserItemRating" src="css/images/userdata/heart_on.png" alt="Favorite" title="Favorite" onclick="BoxsetPage.setFavorite();" /></div>';
|
||||
} else {
|
||||
html += '<div class="userItemRating"><img class="imgUserItemRating" src="css/images/userdata/heart_off.png" alt="Favorite" title="Favorite" onclick="BoxsetPage.setFavorite();" /></div>';
|
||||
}
|
||||
|
||||
//played/unplayed
|
||||
if (userData.Played) {
|
||||
html += '<div class="userItemRating"><img class="imgUserItemRating" src="css/images/userdata/played.png" alt="Played" title="Played" onclick="BoxsetPage.setPlayed();" /></div>';
|
||||
} else {
|
||||
html += '<div class="userItemRating"><img class="imgUserItemRating" src="css/images/userdata/unplayed.png" alt="Unplayed" title="Unplayed" onclick="BoxsetPage.setPlayed();" /></div>';
|
||||
}
|
||||
|
||||
$('#itemRatings', page).html(html);
|
||||
},
|
||||
|
||||
setFavorite: function () {
|
||||
var item = BoxsetPage.item;
|
||||
|
||||
item.UserData = item.UserData || {};
|
||||
|
||||
var setting = !item.UserData.IsFavorite;
|
||||
item.UserData.IsFavorite = setting;
|
||||
|
||||
ApiClient.updateFavoriteStatus(Dashboard.getCurrentUserId(), item.Id, setting);
|
||||
|
||||
BoxsetPage.renderFav(item);
|
||||
},
|
||||
|
||||
setLike: function () {
|
||||
|
||||
var item = BoxsetPage.item;
|
||||
|
||||
item.UserData = item.UserData || {};
|
||||
|
||||
item.UserData.Likes = true;
|
||||
|
||||
ApiClient.updateUserItemRating(Dashboard.getCurrentUserId(), item.Id, true);
|
||||
|
||||
BoxsetPage.renderFav(item);
|
||||
},
|
||||
|
||||
clearLike: function () {
|
||||
|
||||
var item = BoxsetPage.item;
|
||||
|
||||
item.UserData = item.UserData || {};
|
||||
|
||||
item.UserData.Likes = undefined;
|
||||
|
||||
ApiClient.clearUserItemRating(Dashboard.getCurrentUserId(), item.Id);
|
||||
|
||||
BoxsetPage.renderFav(item);
|
||||
},
|
||||
|
||||
setDislike: function () {
|
||||
var item = BoxsetPage.item;
|
||||
|
||||
item.UserData = item.UserData || {};
|
||||
|
||||
item.UserData.Likes = false;
|
||||
|
||||
ApiClient.updateUserItemRating(Dashboard.getCurrentUserId(), item.Id, false);
|
||||
|
||||
BoxsetPage.renderFav(item);
|
||||
},
|
||||
|
||||
setPlayed: function () {
|
||||
var item = BoxsetPage.item;
|
||||
|
||||
item.UserData = item.UserData || {};
|
||||
|
||||
var setting = !item.UserData.Played;
|
||||
item.UserData.Played = setting;
|
||||
|
||||
ApiClient.updatePlayedStatus(Dashboard.getCurrentUserId(), item.Id, setting);
|
||||
|
||||
BoxsetPage.renderFav(item);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$(document).on('pageshow', "#boxsetPage", BoxsetPage.onPageShow).on('pagehide', "#boxsetPage", BoxsetPage.onPageHide);
|
||||
|
|
|
@ -161,7 +161,7 @@
|
|||
|
||||
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 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');
|
||||
|
||||
|
@ -257,8 +257,12 @@
|
|||
getMetroColor: function (str) {
|
||||
|
||||
if (str) {
|
||||
var char = str.substr(0, 1).charCodeAt();
|
||||
var index = String(char).substr(char.length, 1);
|
||||
var char = String(str.substr(0, 1).charCodeAt());
|
||||
var sum = 0;
|
||||
for (var i = 0; i < char.length; i++) {
|
||||
sum += parseInt(char.charAt(i));
|
||||
}
|
||||
var index = String(sum).substr(-1);
|
||||
|
||||
return LibraryBrowser.metroColors[index];
|
||||
} else {
|
||||
|
|
|
@ -179,6 +179,37 @@
|
|||
var screenHeight = Math.min(screen.height, screen.width);
|
||||
|
||||
var volume = localStorage.getItem("volume") || 0.5;
|
||||
var user = Dashboard.getCurrentUser();
|
||||
var defaults = {languageIndex: null, subtitleIndex: null};
|
||||
|
||||
var user_config = user.Configuration || {};
|
||||
if (item.MediaStreams && item.MediaStreams.length) {
|
||||
$.each(item.MediaStreams, function (i, stream) {
|
||||
//get default subtitle stream
|
||||
if (stream.Type == "Subtitle") {
|
||||
if (user_config.UseForcedSubtitlesOnly == true && user_config.SubtitleLanguagePreference && !defaults.subtitleIndex) {
|
||||
if (stream.Language == user_config.SubtitleLanguagePreference && stream.IsForced == true) {
|
||||
defaults.subtitleIndex = i;
|
||||
}
|
||||
}else if (user_config.SubtitleLanguagePreference && !defaults.subtitleIndex) {
|
||||
if (stream.Language == user_config.SubtitleLanguagePreference) {
|
||||
defaults.subtitleIndex = i;
|
||||
}
|
||||
}else if (user_config.UseForcedSubtitlesOnly == true && !defaults.subtitleIndex) {
|
||||
if (stream.IsForced == true) {
|
||||
defaults.subtitleIndex = i;
|
||||
}
|
||||
}
|
||||
}else if (stream.Type == "Audio") {
|
||||
//get default language stream
|
||||
if (user_config.AudioLanguagePreference && !defaults.languageIndex) {
|
||||
if (stream.Language == user_config.AudioLanguagePreference) {
|
||||
defaults.languageIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var baseParams = {
|
||||
audioChannels: 2,
|
||||
|
@ -186,7 +217,9 @@
|
|||
videoBitrate: 1500000,
|
||||
maxWidth: screenWidth,
|
||||
maxHeight: screenHeight,
|
||||
StartTimeTicks: 0
|
||||
StartTimeTicks: 0,
|
||||
SubtitleStreamIndex: null,
|
||||
AudioStreamIndex: null
|
||||
};
|
||||
|
||||
if (typeof (startPosition) != "undefined") {
|
||||
|
@ -235,7 +268,7 @@
|
|||
{ type: "video/ogg", src: ogvVideoUrl }]
|
||||
).volume(volume);
|
||||
|
||||
videoJSextension.setup_video($('#videoWindow'), item);
|
||||
videoJSextension.setup_video($('#videoWindow'), item, defaults);
|
||||
|
||||
(this).addEvent("loadstart", function () {
|
||||
$(".vjs-remaining-time-display").hide();
|
||||
|
@ -276,7 +309,7 @@
|
|||
|
||||
ApiClient.reportPlaybackStopped(Dashboard.getCurrentUserId(), item_id, positionTicks);
|
||||
|
||||
clearTimeout(progressInterval);
|
||||
clearTimeout(MediaPlayer.progressInterval);
|
||||
|
||||
if (player.techName == "html5") {
|
||||
player.tag.src = "";
|
||||
|
@ -302,7 +335,7 @@
|
|||
},
|
||||
|
||||
updateProgress: function () {
|
||||
progressInterval = setInterval(function () {
|
||||
MediaPlayer.progressInterval = setInterval(function () {
|
||||
var player = _V_("videoWindow");
|
||||
|
||||
var startTimeTicks = player.tag.src.match(new RegExp("StartTimeTicks=[0-9]+", "g"));
|
||||
|
|
|
@ -1 +1,157 @@
|
|||
|
||||
(function ($, document) {
|
||||
|
||||
// The base query options
|
||||
var query = {
|
||||
|
||||
SortBy: "SortName",
|
||||
SortOrder: "Ascending",
|
||||
IncludeItemTypes: "Episode",
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio,SeriesInfo"
|
||||
};
|
||||
|
||||
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> </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 = "itemdetails.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) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
|
||||
$('#items', page).html(LibraryBrowser.getEpisodePosterViewHtml({
|
||||
|
||||
items: result.Items,
|
||||
useAverageAspectRatio: true
|
||||
|
||||
}))/*.html(getTableHtml(result.Items)).trigger('create')*/;
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#tvShowsPage", 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.Filters = filters;
|
||||
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshow', "#tvShowsPage", function () {
|
||||
|
||||
reloadItems(this);
|
||||
|
||||
// Reset form values using the last used query
|
||||
$('.radioSortBy', this).each(function () {
|
||||
|
||||
this.checked = query.SortBy == this.getAttribute('data-sortby');
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
|
||||
$('.radioSortOrder', this).each(function () {
|
||||
|
||||
this.checked = query.SortOrder == this.getAttribute('data-sortorder');
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
|
||||
$('.chkStandardFilter', this).each(function () {
|
||||
|
||||
var filters = "," + (query.Filters || "");
|
||||
var filterName = this.getAttribute('data-filter');
|
||||
|
||||
this.checked = filters.indexOf(',' + filterName) != -1;
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
});
|
||||
|
||||
})(jQuery, document);
|
|
@ -6,7 +6,7 @@ var videoJSextension = {
|
|||
a mandatory jQuery object of the <video> element we are setting up the
|
||||
videojs video for.
|
||||
*/
|
||||
setup_video: function ($video, item) {
|
||||
setup_video: function ($video, item, defaults) {
|
||||
|
||||
// Add the stop button.
|
||||
_V_.merge(_V_.ControlBar.prototype.options.components, { StopButton: {} });
|
||||
|
@ -18,6 +18,10 @@ var videoJSextension = {
|
|||
vjs_source = {},
|
||||
vjs_chapters = [], // This will be an array of arrays of objects, see the video.js api documentation for myPlayer.src()
|
||||
vjs_chapter = {};
|
||||
vjs_languages = [], // This will be an array of arrays of objects, see the video.js api documentation for myPlayer.src()
|
||||
vjs_language = {};
|
||||
vjs_subtitles = [], // This will be an array of arrays of objects, see the video.js api documentation for myPlayer.src()
|
||||
vjs_subtitle = {};
|
||||
|
||||
// Determine this video's default res (it might not have the globally determined default available)
|
||||
default_res = available_res[0];
|
||||
|
@ -67,53 +71,63 @@ var videoJSextension = {
|
|||
}
|
||||
|
||||
|
||||
//chceck if langauges exist and add language selector
|
||||
if (item.Chapters && item.Chapters.length) {
|
||||
// Put together the videojs source arrays for each available chapter
|
||||
$.each(item.Chapters, function (i, chapter) {
|
||||
//chceck if langauges exist and add language selector also subtitles
|
||||
if (item.MediaStreams && item.MediaStreams.length) {
|
||||
var subCount = 1;
|
||||
var langCount = 1;
|
||||
var defaultLanguageIndex = defaults.languageIndex || 1;
|
||||
var defaultSubtitleIndex = defaults.subtitleIndex || 0;
|
||||
|
||||
vjs_chapters[i] = [];
|
||||
// Put together the videojs source arrays for each available language and subtitle
|
||||
$.each(item.MediaStreams, function (i, stream) {
|
||||
var language = stream.Language || '';
|
||||
|
||||
vjs_chapter = {};
|
||||
vjs_chapter.Name = chapter.Name + " (" + ticks_to_human(chapter.StartPositionTicks) + ")";
|
||||
vjs_chapter.StartPositionTicks = chapter.StartPositionTicks;
|
||||
if (stream.Type == "Audio") {
|
||||
vjs_languages[i] = [];
|
||||
vjs_language = {};
|
||||
|
||||
vjs_chapters[i].push(vjs_chapter);
|
||||
vjs_language.Name = langCount + ": " + language + " " + stream.Codec + " " + stream.Channels + "ch";
|
||||
vjs_language.index = i;
|
||||
|
||||
vjs_languages[i].push(vjs_language);
|
||||
|
||||
langCount++;
|
||||
}else if (stream.Type == "Subtitle") {
|
||||
vjs_subtitles[i] = [];
|
||||
vjs_subtitle = {};
|
||||
|
||||
vjs_subtitle.Name = subCount + ": " + language;
|
||||
vjs_subtitle.index = i;
|
||||
|
||||
vjs_subtitles[i].push(vjs_subtitle);
|
||||
|
||||
subCount++;
|
||||
}
|
||||
});
|
||||
|
||||
_V_.LanguageSelectorButton = _V_.LanguageSelector.extend({
|
||||
buttonText: '',
|
||||
Chapters: vjs_chapters
|
||||
});
|
||||
if (vjs_languages.length) {
|
||||
|
||||
// Add the chapter selector button.
|
||||
_V_.merge(_V_.ControlBar.prototype.options.components, { LanguageSelectorButton: {} });
|
||||
}
|
||||
_V_.LanguageSelectorButton = _V_.LanguageSelector.extend({
|
||||
buttonText: vjs_languages[defaultLanguageIndex][0].Name,
|
||||
Languages: vjs_languages
|
||||
});
|
||||
|
||||
// Add the language selector button.
|
||||
_V_.merge(_V_.ControlBar.prototype.options.components, { LanguageSelectorButton: {} });
|
||||
}
|
||||
|
||||
//chceck if subtitles exist and add subtitle selector
|
||||
if (item.Chapters && item.Chapters.length) {
|
||||
// Put together the videojs source arrays for each available chapter
|
||||
$.each(item.Chapters, function (i, chapter) {
|
||||
if (vjs_subtitles.length) {
|
||||
vjs_subtitles[0] = [];
|
||||
vjs_subtitles[0].push({Name: "Off", index: ''});
|
||||
_V_.SubtitleSelectorButton = _V_.SubtitleSelector.extend({
|
||||
buttonText: vjs_subtitles[defaultSubtitleIndex][0].Name,
|
||||
Subtitles: vjs_subtitles
|
||||
});
|
||||
|
||||
vjs_chapters[i] = [];
|
||||
// Add the subtitle selector button.
|
||||
_V_.merge(_V_.ControlBar.prototype.options.components, { SubtitleSelectorButton: {} });
|
||||
}
|
||||
|
||||
vjs_chapter = {};
|
||||
vjs_chapter.Name = chapter.Name + " (" + ticks_to_human(chapter.StartPositionTicks) + ")";
|
||||
vjs_chapter.StartPositionTicks = chapter.StartPositionTicks;
|
||||
|
||||
vjs_chapters[i].push(vjs_chapter);
|
||||
|
||||
});
|
||||
|
||||
_V_.SubtitleSelectorButton = _V_.SubtitleSelector.extend({
|
||||
buttonText: '',
|
||||
Chapters: vjs_chapters
|
||||
});
|
||||
|
||||
// Add the chapter selector button.
|
||||
_V_.merge(_V_.ControlBar.prototype.options.components, { SubtitleSelectorButton: {} });
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -292,6 +306,7 @@ _V_.ResolutionMenuItem = _V_.MenuItem.extend({
|
|||
this.play();
|
||||
});
|
||||
} else {
|
||||
newSrc += "&StartTimeTicks=0";
|
||||
this.player.src(newSrc).one('loadedmetadata', function () {
|
||||
this.currentTime(current_time);
|
||||
this.play();
|
||||
|
@ -548,6 +563,9 @@ _V_.SubtitleSelector = _V_.Button.extend({
|
|||
|
||||
this._super(player, options);
|
||||
|
||||
// Save the starting subtitle track as a property of the player object
|
||||
player.options.currentSubtitle = this.buttonText;
|
||||
|
||||
this.menu = this.createMenu();
|
||||
|
||||
if (this.items.length === 0) {
|
||||
|
@ -598,11 +616,12 @@ _V_.SubtitleSelector = _V_.Button.extend({
|
|||
var items = [];
|
||||
|
||||
this.each(this.Subtitles, function (subtitle) {
|
||||
|
||||
items.push(new _V_.SubtitleMenuItem(this.player, {
|
||||
label: subtitle[0].Name,
|
||||
src: subtitle
|
||||
}));
|
||||
if (subtitle && subtitle.length) {
|
||||
items.push(new _V_.SubtitleMenuItem(this.player, {
|
||||
label: subtitle[0].Name,
|
||||
src: subtitle
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
return items;
|
||||
|
@ -654,7 +673,7 @@ _V_.SubtitleMenuItem = _V_.MenuItem.extend({
|
|||
init: function (player, options) {
|
||||
|
||||
// Modify options for parent MenuItem class's init.
|
||||
//options.selected = ( options.label === player.options.currentResolution );
|
||||
options.selected = ( options.label === player.options.currentSubtitle );
|
||||
this._super(player, options);
|
||||
|
||||
this.player.addEvent('changeSubtitle', _V_.proxy(this, this.update));
|
||||
|
@ -668,17 +687,17 @@ _V_.SubtitleMenuItem = _V_.MenuItem.extend({
|
|||
|
||||
var current_time = this.player.currentTime();
|
||||
|
||||
// Set the button text to the newly chosen quality
|
||||
// Set the button text to the newly chosen subtitle
|
||||
jQuery(this.player.controlBar.el).find('.vjs-quality-text').html(this.options.label);
|
||||
|
||||
// Change the source and make sure we don't start the video over
|
||||
var currentSrc = this.player.tag.src;
|
||||
var src = parse_src_url(currentSrc);
|
||||
|
||||
|
||||
var newSrc = "/mediabrowser/" + src.Type + "/" + src.item_id + "/stream." + src.stream + "?audioChannels=" + src.audioChannels + "&audioBitrate=" + src.audioBitrate +
|
||||
"&videoBitrate=" + src.videoBitrate + "&maxWidth=" + src.maxWidth + "&maxHeight=" + src.maxHeight +
|
||||
"&videoCodec=" + src.videoCodec + "&audioCodec=" + src.audioCodec;
|
||||
"&videoCodec=" + src.videoCodec + "&audioCodec=" + src.audioCodec +
|
||||
"&AudioStreamIndex=" + src.AudioStreamIndex + "&SubtitleStreamIndex=" + this.options.src[0].index;
|
||||
|
||||
if (this.player.duration() == "Infinity") {
|
||||
if (currentSrc.indexOf("StartTimeTicks") >= 0) {
|
||||
|
@ -694,6 +713,7 @@ _V_.SubtitleMenuItem = _V_.MenuItem.extend({
|
|||
this.play();
|
||||
});
|
||||
} else {
|
||||
newSrc += "&StartTimeTicks=0";
|
||||
this.player.src(newSrc).one('loadedmetadata', function () {
|
||||
this.currentTime(current_time);
|
||||
this.play();
|
||||
|
@ -733,6 +753,9 @@ _V_.LanguageSelector = _V_.Button.extend({
|
|||
|
||||
this._super(player, options);
|
||||
|
||||
// Save the starting language as a property of the player object
|
||||
player.options.currentLanguage = this.buttonText;
|
||||
|
||||
this.menu = this.createMenu();
|
||||
|
||||
if (this.items.length === 0) {
|
||||
|
@ -783,11 +806,12 @@ _V_.LanguageSelector = _V_.Button.extend({
|
|||
var items = [];
|
||||
|
||||
this.each(this.Languages, function (language) {
|
||||
|
||||
items.push(new _V_.LanguageMenuItem(this.player, {
|
||||
label: language[0].Name,
|
||||
src: language
|
||||
}));
|
||||
if (language && language.length) {
|
||||
items.push(new _V_.LanguageMenuItem(this.player, {
|
||||
label: language[0].Name,
|
||||
src: language
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
return items;
|
||||
|
@ -839,20 +863,26 @@ _V_.LanguageMenuItem = _V_.MenuItem.extend({
|
|||
init: function (player, options) {
|
||||
|
||||
// Modify options for parent MenuItem class's init.
|
||||
//options.selected = ( options.label === player.options.currentResolution );
|
||||
options.selected = ( options.label === player.options.currentLanguage );
|
||||
this._super(player, options);
|
||||
|
||||
this.player.addEvent('changeLanguage', _V_.proxy(this, this.update));
|
||||
},
|
||||
|
||||
onClick: function () {
|
||||
// Check that we are changing to a new subtitle (not the one we are already on)
|
||||
|
||||
// Check that we are changing to a new language (not the one we are already on)
|
||||
if (this.options.label === this.player.options.currentLanguage)
|
||||
return;
|
||||
|
||||
// Change the source and make sure we don't start the video over
|
||||
var currentSrc = this.player.tag.src;
|
||||
var src = parse_src_url(currentSrc);
|
||||
|
||||
var newSrc = "/mediabrowser/" + src.Type + "/" + src.item_id + "/stream." + src.stream + "?audioChannels=" + src.audioChannels + "&audioBitrate=" + src.audioBitrate +
|
||||
"&videoBitrate=" + src.videoBitrate + "&maxWidth=" + src.maxWidth + "&maxHeight=" + src.maxHeight +
|
||||
"&videoCodec=" + src.videoCodec + "&audioCodec=" + src.audioCodec;
|
||||
"&videoCodec=" + src.videoCodec + "&audioCodec=" + src.audioCodec +
|
||||
"&AudioStreamIndex=" + this.options.src[0].index + "&SubtitleStreamIndex=" + src.SubtitleStreamIndex;
|
||||
|
||||
if (this.player.duration() == "Infinity") {
|
||||
if (currentSrc.indexOf("StartTimeTicks") >= 0) {
|
||||
|
@ -868,6 +898,7 @@ _V_.LanguageMenuItem = _V_.MenuItem.extend({
|
|||
this.play();
|
||||
});
|
||||
} else {
|
||||
newSrc += "&StartTimeTicks=0";
|
||||
this.player.src(newSrc).one('loadedmetadata', function () {
|
||||
this.currentTime(current_time);
|
||||
this.play();
|
||||
|
|
|
@ -1,14 +1,81 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Media Browser</title>
|
||||
<title>Media Browser</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="tvShowsPage" data-role="page" class="page libraryPage noLogoPage" data-theme="a">
|
||||
<h1 class="libraryPageHeader"><a href="index.html" class="imageLink">
|
||||
<img src="css/images/home.png"></a>TV Shows</h1>
|
||||
<div data-role="content">
|
||||
</div>
|
||||
</div>
|
||||
<div id="tvShowsPage" data-role="page" class="page libraryPage noLogoPage" data-theme="a">
|
||||
<h1 class="libraryPageHeader"><a href="index.html" class="imageLink">
|
||||
<img src="css/images/home.png"></a>TV Shows</h1>
|
||||
<div data-role="content">
|
||||
<div data-role="controlgroup" data-type="horizontal" class="libraryViewNav" data-mini="true">
|
||||
<a href="tvrecommended.html" data-role="button" class="ui-btn-active">Recommended</a>
|
||||
<a href="tvshows.html" data-role="button">Shows</a>
|
||||
<a href="#" data-role="button">Genres</a>
|
||||
<a href="#" data-role="button">Actors</a>
|
||||
</div>
|
||||
<div class="viewSettings">
|
||||
<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>
|
||||
</div>
|
||||
<div id="items"></div>
|
||||
</div>
|
||||
<div data-role="panel" id="sortPanel" data-position="right" data-display="overlay" data-theme="b" data-position-fixed="true">
|
||||
|
||||
<form>
|
||||
<div id="sortpanel">
|
||||
<fieldset data-role="controlgroup">
|
||||
<legend>
|
||||
<h3>Sort By:</h3>
|
||||
</legend>
|
||||
|
||||
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioSortName" value="on" checked="checked" data-sortby="SortName">
|
||||
<label for="radioSortName">Name</label>
|
||||
|
||||
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioCommunityRating" value="off" data-sortby="CommunityRating">
|
||||
<label for="radioCommunityRating">Community Rating</label>
|
||||
|
||||
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioDateCreated" value="off" data-sortby="DateCreated">
|
||||
<label for="radioDateCreated">Date Added</label>
|
||||
|
||||
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioPremiereDate" value="off" data-sortby="PremiereDate">
|
||||
<label for="radioPremiereDate">Premiere Date</label>
|
||||
|
||||
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioRuntime" value="off" data-sortby="Runtime">
|
||||
<label for="radioRuntime">Runtime</label>
|
||||
</fieldset>
|
||||
|
||||
<fieldset data-role="controlgroup">
|
||||
<legend>
|
||||
<h3>Sort Order:</h3>
|
||||
</legend>
|
||||
|
||||
<input class="radioSortOrder" data-theme="c" type="radio" name="radioSortOrder" id="radioAscending" value="on" checked="checked" data-sortorder="Ascending">
|
||||
<label for="radioAscending">Ascending</label>
|
||||
|
||||
<input class="radioSortOrder" data-theme="c" type="radio" name="radioSortOrder" id="radioDescending" value="off" data-sortorder="Descending">
|
||||
<label for="radioDescending">Descending</label>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div data-role="panel" id="filterPanel" data-position="right" data-display="overlay" data-theme="b" data-position-fixed="true">
|
||||
<form>
|
||||
<fieldset data-role="controlgroup">
|
||||
<legend>
|
||||
<h3>Filters:</h3>
|
||||
</legend>
|
||||
<input class="chkStandardFilter" type="checkbox" name="chkIsFavorite" id="chkIsFavorite" data-theme="c" data-filter="IsFavorite">
|
||||
<label for="chkIsFavorite">Favorite</label>
|
||||
|
||||
<input class="chkStandardFilter" type="checkbox" name="chkLikes" id="chkLikes" data-theme="c" data-filter="Likes">
|
||||
<label for="chkLikes">Likes</label>
|
||||
|
||||
<input class="chkStandardFilter" type="checkbox" name="chkDislikes" id="chkDislikes" data-theme="c" data-filter="Dislikes">
|
||||
<label for="chkDislikes">Dislikes</label>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue