mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
added movie and tv genre pages
This commit is contained in:
parent
ceb6dffddb
commit
6f3b88353e
17 changed files with 294 additions and 90 deletions
48
ApiClient.js
48
ApiClient.js
|
@ -1498,7 +1498,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Gets items based on a query, typicall for children of a folder
|
||||
* Gets items based on a query, typically for children of a folder
|
||||
* @param {String} userId
|
||||
* @param {Object} options
|
||||
* Options accepts the following properties:
|
||||
|
@ -1529,6 +1529,52 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
Gets genres from an item
|
||||
*/
|
||||
self.getGenres = function (userId, options) {
|
||||
|
||||
if (!userId) {
|
||||
throw new Error("null userId");
|
||||
}
|
||||
|
||||
var parentId = options.parentId || "root";
|
||||
|
||||
// Don't put these on the query string
|
||||
delete options.parentId;
|
||||
|
||||
var url = self.getUrl("Users/" + userId + "/Items/" + parentId + "/Genres", options);
|
||||
|
||||
return self.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
dataType: "json"
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
Gets studios from an item
|
||||
*/
|
||||
self.getStudios = function (userId, options) {
|
||||
|
||||
if (!userId) {
|
||||
throw new Error("null userId");
|
||||
}
|
||||
|
||||
var parentId = options.parentId || "root";
|
||||
|
||||
// Don't put these on the query string
|
||||
delete options.parentId;
|
||||
|
||||
var url = self.getUrl("Users/" + userId + "/Items/" + parentId + "/Studios", options);
|
||||
|
||||
return self.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
dataType: "json"
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets local trailers for an item
|
||||
*/
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<a href="moviesrecommended.html" data-role="button">Suggested</a>
|
||||
<a href="movies.html" data-role="button">Movies</a>
|
||||
<a href="boxsets.html" data-role="button" class="ui-btn-active">Box Sets</a>
|
||||
<a href="#" data-role="button">Genres</a>
|
||||
<a href="moviegenres.html" data-role="button">Genres</a>
|
||||
<a href="#" data-role="button">Actors</a>
|
||||
<a href="#" data-role="button">Directors</a>
|
||||
</div>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<a href="moviesrecommended.html" data-role="button">Suggested</a>
|
||||
<a href="movies.html" data-role="button">Movies</a>
|
||||
<a href="boxsets.html" data-role="button" class="ui-btn-active">Box Sets</a>
|
||||
<a href="#" data-role="button">Genres</a>
|
||||
<a href="moviegenres.html" data-role="button">Genres</a>
|
||||
<a href="#" data-role="button">Actors</a>
|
||||
<a href="#" data-role="button">Directors</a>
|
||||
</div>
|
||||
|
|
25
dashboard-ui/moviegenres.html
Normal file
25
dashboard-ui/moviegenres.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Media Browser</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="movieGenresPage" data-role="page" class="page libraryPage noLogoPage listPage" data-theme="a">
|
||||
<h1 class="libraryPageHeader"><a href="index.html" class="imageLink">
|
||||
<img src="css/images/home.png"></a>Movies</h1>
|
||||
<div data-role="content">
|
||||
<div data-role="controlgroup" data-type="horizontal" class="libraryViewNav" data-mini="true">
|
||||
<a href="moviesrecommended.html" data-role="button">Suggested</a>
|
||||
<a href="movies.html" data-role="button">Movies</a>
|
||||
<a href="boxsets.html" data-role="button">Box Sets</a>
|
||||
<a href="moviegenres.html" data-role="button" class="ui-btn-active">Genres</a>
|
||||
<a href="#" data-role="button">Actors</a>
|
||||
<a href="#" data-role="button">Directors</a>
|
||||
</div>
|
||||
<div class="viewSettings">
|
||||
</div>
|
||||
<div id="items"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -12,7 +12,7 @@
|
|||
<a href="moviesrecommended.html" data-role="button">Suggested</a>
|
||||
<a href="movies.html" data-role="button" class="ui-btn-active">Movies</a>
|
||||
<a href="boxsets.html" data-role="button">Box Sets</a>
|
||||
<a href="#" data-role="button">Genres</a>
|
||||
<a href="moviegenres.html" data-role="button">Genres</a>
|
||||
<a href="#" data-role="button">Actors</a>
|
||||
<a href="#" data-role="button">Directors</a>
|
||||
</div>
|
||||
|
@ -31,7 +31,6 @@
|
|||
<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>
|
||||
<strong>Sort By:</strong>
|
||||
|
@ -73,7 +72,6 @@
|
|||
<input class="radioSortOrder" data-theme="c" type="radio" name="radioSortOrder" id="radioDescending" value="off" data-sortorder="Descending" data-mini="true">
|
||||
<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">
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<a href="moviesrecommended.html" data-role="button" class="ui-btn-active">Suggested</a>
|
||||
<a href="movies.html" data-role="button">Movies</a>
|
||||
<a href="boxsets.html" data-role="button">Box Sets</a>
|
||||
<a href="#" data-role="button">Genres</a>
|
||||
<a href="moviegenres.html" data-role="button">Genres</a>
|
||||
<a href="#" data-role="button">Actors</a>
|
||||
<a href="#" data-role="button">Directors</a>
|
||||
</div>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
SortOrder: "Ascending",
|
||||
IncludeItemTypes: "BoxSet",
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio,ItemCounts,ItemCounts,DateCreated",
|
||||
Fields: "PrimaryImageAspectRatio,ItemCounts,ItemCounts,DateCreated,UserData",
|
||||
Limit: LibraryBrowser.getDetaultPageSize(),
|
||||
StartIndex: 0
|
||||
};
|
||||
|
@ -36,12 +36,7 @@
|
|||
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
|
||||
}
|
||||
|
||||
var elem = $('#items', page);
|
||||
|
||||
// cleanup existing event handlers
|
||||
$('select', elem).off('change');
|
||||
|
||||
elem.html(html).trigger('create');
|
||||
var elem = $('#items', page).html(html).trigger('create');
|
||||
|
||||
$('select', elem).on('change', function () {
|
||||
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;
|
||||
|
|
|
@ -104,12 +104,21 @@
|
|||
html += '<p>' + LibraryBrowser.getFiveStarRatingHtml(item) + '</p>';
|
||||
}
|
||||
|
||||
var childText;
|
||||
|
||||
if (item.Type == "BoxSet") {
|
||||
|
||||
var movies = item.ChildCount == 1 ? "1 Movie" : item.ChildCount + " Movies";
|
||||
childText = item.ChildCount == 1 ? "1 Movie" : item.ChildCount + " Movies";
|
||||
|
||||
html += '<p class="itemMiscInfo">' + movies + '</p>';
|
||||
} else {
|
||||
html += '<p class="itemMiscInfo">' + childText + '</p>';
|
||||
}
|
||||
else if (item.Type == "Genre" || item.Type == "Studio" || item.Type == "Person") {
|
||||
|
||||
childText = item.ChildCount == 1 ? "1 " + options.countNameSingular : item.ChildCount + " " + options.countNamePlural;
|
||||
|
||||
html += '<p class="itemMiscInfo">' + childText + '</p>';
|
||||
}
|
||||
else {
|
||||
html += '<p class="itemMiscInfo">' + LibraryBrowser.getMiscInfoHtml(item, false) + '</p>';
|
||||
}
|
||||
|
||||
|
|
60
dashboard-ui/scripts/moviegenres.js
Normal file
60
dashboard-ui/scripts/moviegenres.js
Normal file
|
@ -0,0 +1,60 @@
|
|||
(function ($, document) {
|
||||
|
||||
// The base query options
|
||||
var query = {
|
||||
|
||||
SortBy: "SortName",
|
||||
SortOrder: "Ascending",
|
||||
IncludeItemTypes: "Movie",
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio,ItemCounts,DateCreated,UserData",
|
||||
Limit: LibraryBrowser.getDetaultPageSize(),
|
||||
StartIndex: 0
|
||||
};
|
||||
|
||||
function reloadItems(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getGenres(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
|
||||
var html = '';
|
||||
|
||||
var showPaging = result.TotalRecordCount > query.Limit;
|
||||
|
||||
if (showPaging) {
|
||||
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true);
|
||||
}
|
||||
|
||||
html += LibraryBrowser.getPosterDetailViewHtml({
|
||||
items: result.Items,
|
||||
useAverageAspectRatio: true,
|
||||
countNameSingular: "Movie",
|
||||
countNamePlural: "Movies"
|
||||
});
|
||||
|
||||
if (showPaging) {
|
||||
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
|
||||
}
|
||||
|
||||
var elem = $('#items', page).html(html).trigger('create');
|
||||
|
||||
$('select', elem).on('change', function () {
|
||||
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', "#movieGenresPage", function () {
|
||||
|
||||
reloadItems(this);
|
||||
|
||||
}).on('pageshow', "#movieGenresPage", function () {
|
||||
|
||||
|
||||
});
|
||||
|
||||
})(jQuery, document);
|
|
@ -46,12 +46,7 @@
|
|||
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
|
||||
}
|
||||
|
||||
var elem = $('#items', page);
|
||||
|
||||
// cleanup existing event handlers
|
||||
$('select', elem).off('change');
|
||||
|
||||
elem.html(html).trigger('create');
|
||||
var elem = $('#items', page).html(html).trigger('create');
|
||||
|
||||
$('select', elem).on('change', function () {
|
||||
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;
|
||||
|
|
60
dashboard-ui/scripts/tvgenres.js
Normal file
60
dashboard-ui/scripts/tvgenres.js
Normal file
|
@ -0,0 +1,60 @@
|
|||
(function ($, document) {
|
||||
|
||||
// The base query options
|
||||
var query = {
|
||||
|
||||
SortBy: "SortName",
|
||||
SortOrder: "Ascending",
|
||||
IncludeItemTypes: "Series",
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio,ItemCounts,DateCreated,UserData",
|
||||
Limit: LibraryBrowser.getDetaultPageSize(),
|
||||
StartIndex: 0
|
||||
};
|
||||
|
||||
function reloadItems(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getGenres(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
|
||||
var html = '';
|
||||
|
||||
var showPaging = result.TotalRecordCount > query.Limit;
|
||||
|
||||
if (showPaging) {
|
||||
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true);
|
||||
}
|
||||
|
||||
html += LibraryBrowser.getPosterDetailViewHtml({
|
||||
items: result.Items,
|
||||
useAverageAspectRatio: true,
|
||||
countNameSingular: "Show",
|
||||
countNamePlural: "Shows"
|
||||
});
|
||||
|
||||
if (showPaging) {
|
||||
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
|
||||
}
|
||||
|
||||
var elem = $('#items', page).html(html).trigger('create');
|
||||
|
||||
$('select', elem).on('change', function () {
|
||||
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', "#tvGenresPage", function () {
|
||||
|
||||
reloadItems(this);
|
||||
|
||||
}).on('pageshow', "#tvGenresPage", function () {
|
||||
|
||||
|
||||
});
|
||||
|
||||
})(jQuery, document);
|
|
@ -9,7 +9,7 @@
|
|||
SortOrder: "Ascending",
|
||||
IncludeItemTypes: "Series",
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio,SeriesInfo,ItemCounts,DateCreated",
|
||||
Fields: "PrimaryImageAspectRatio,SeriesInfo,ItemCounts,DateCreated,UserData",
|
||||
Limit: LibraryBrowser.getDetaultPageSize(),
|
||||
StartIndex: 0
|
||||
};
|
||||
|
@ -46,12 +46,7 @@
|
|||
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
|
||||
}
|
||||
|
||||
var elem = $('#items', page);
|
||||
|
||||
// cleanup existing event handlers
|
||||
$('select', elem).off('change');
|
||||
|
||||
elem.html(html).trigger('create');
|
||||
var elem = $('#items', page).html(html).trigger('create');
|
||||
|
||||
$('select', elem).on('change', function () {
|
||||
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;
|
||||
|
|
23
dashboard-ui/tvgenres.html
Normal file
23
dashboard-ui/tvgenres.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Media Browser</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="tvGenresPage" data-role="page" class="page libraryPage noLogoPage listPage" 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">Suggested</a>
|
||||
<a href="tvshows.html" data-role="button">Shows</a>
|
||||
<a href="tvgenres.html" data-role="button" class="ui-btn-active">Genres</a>
|
||||
<a href="#" data-role="button">Actors</a>
|
||||
</div>
|
||||
<div class="viewSettings">
|
||||
</div>
|
||||
<div id="items"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -11,7 +11,7 @@
|
|||
<div data-role="controlgroup" data-type="horizontal" class="libraryViewNav" data-mini="true">
|
||||
<a href="tvrecommended.html" data-role="button" class="ui-btn-active">Suggested</a>
|
||||
<a href="tvshows.html" data-role="button">Shows</a>
|
||||
<a href="#" data-role="button">Genres</a>
|
||||
<a href="tvgenres.html" data-role="button">Genres</a>
|
||||
<a href="#" data-role="button">Actors</a>
|
||||
</div>
|
||||
<div class="ehsContent">
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div data-role="controlgroup" data-type="horizontal" class="libraryViewNav" data-mini="true">
|
||||
<a href="tvrecommended.html" data-role="button">Suggested</a>
|
||||
<a href="tvshows.html" data-role="button" class="ui-btn-active">Shows</a>
|
||||
<a href="#" data-role="button">Genres</a>
|
||||
<a href="tvgenres.html" data-role="button">Genres</a>
|
||||
<a href="#" data-role="button">Actors</a>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<div data-role="controlgroup" data-type="horizontal" class="libraryViewNav" data-mini="true">
|
||||
<a href="tvrecommended.html" data-role="button">Suggested</a>
|
||||
<a href="tvshows.html" data-role="button" class="ui-btn-active">Shows</a>
|
||||
<a href="#" data-role="button">Genres</a>
|
||||
<a href="tvgenres.html" data-role="button">Genres</a>
|
||||
<a href="#" data-role="button">Actors</a>
|
||||
</div>
|
||||
<div class="viewSettings">
|
||||
|
@ -29,7 +29,6 @@
|
|||
<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>
|
||||
<strong>Sort By:</strong>
|
||||
|
@ -62,7 +61,6 @@
|
|||
<input class="radioSortOrder" data-theme="c" type="radio" name="radioSortOrder" id="radioDescending" value="off" data-sortorder="Descending" data-mini="true">
|
||||
<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">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.71" targetFramework="net45" />
|
||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.72" targetFramework="net45" />
|
||||
<package id="ServiceStack.Common" version="3.9.43" targetFramework="net45" />
|
||||
<package id="ServiceStack.Text" version="3.9.43" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Add table
Add a link
Reference in a new issue