mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 03:18:19 -07:00
126 lines
3.2 KiB
JavaScript
126 lines
3.2 KiB
JavaScript
(function ($, document) {
|
|
|
|
function loadRecommendedPrograms(page) {
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
ApiClient.getLiveTvRecommendedPrograms({
|
|
|
|
userId: Dashboard.getCurrentUserId(),
|
|
IsAiring: true,
|
|
limit: 18
|
|
|
|
}).done(function (result) {
|
|
|
|
var html = LibraryBrowser.getPosterViewHtml({
|
|
|
|
items: result.Items,
|
|
shape: "auto",
|
|
showTitle: true,
|
|
showParentTitle: true,
|
|
overlayText: true,
|
|
coverImage: true,
|
|
lazy: true
|
|
|
|
});
|
|
|
|
var elem = page.querySelector('.activeProgramItems');
|
|
elem.innerHTML = html;
|
|
ImageLoader.lazyChildren(elem);
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
LibraryBrowser.setLastRefreshed(page);
|
|
});
|
|
}
|
|
|
|
function reload(page) {
|
|
|
|
loadRecommendedPrograms(page);
|
|
|
|
ApiClient.getLiveTvRecommendedPrograms({
|
|
|
|
userId: Dashboard.getCurrentUserId(),
|
|
IsAiring: false,
|
|
HasAired: false,
|
|
limit: 9,
|
|
IsMovie: false,
|
|
IsSports: false
|
|
|
|
}).done(function (result) {
|
|
|
|
var html = LibraryBrowser.getPosterViewHtml({
|
|
|
|
items: result.Items,
|
|
shape: "auto",
|
|
showTitle: true,
|
|
showParentTitle: true,
|
|
overlayText: true,
|
|
coverImage: true,
|
|
lazy: true
|
|
|
|
});
|
|
|
|
var elem = page.querySelector('.upcomingProgramItems');
|
|
elem.innerHTML = html;
|
|
ImageLoader.lazyChildren(elem);
|
|
});
|
|
|
|
ApiClient.getLiveTvRecommendedPrograms({
|
|
|
|
userId: Dashboard.getCurrentUserId(),
|
|
IsAiring: false,
|
|
HasAired: false,
|
|
limit: 9,
|
|
IsMovie: true
|
|
|
|
}).done(function (result) {
|
|
|
|
var html = LibraryBrowser.getPosterViewHtml({
|
|
items: result.Items,
|
|
shape: "auto",
|
|
showTitle: false,
|
|
coverImage: true,
|
|
overlayText: false,
|
|
lazy: true
|
|
});
|
|
|
|
var elem = page.querySelector('.upcomingTvMovieItems');
|
|
elem.innerHTML = html;
|
|
ImageLoader.lazyChildren(elem);
|
|
});
|
|
|
|
ApiClient.getLiveTvRecommendedPrograms({
|
|
|
|
userId: Dashboard.getCurrentUserId(),
|
|
IsAiring: false,
|
|
HasAired: false,
|
|
limit: 9,
|
|
IsSports: true
|
|
|
|
}).done(function (result) {
|
|
|
|
var html = LibraryBrowser.getPosterViewHtml({
|
|
items: result.Items,
|
|
shape: "auto",
|
|
showTitle: false,
|
|
coverImage: true,
|
|
overlayText: false,
|
|
lazy: true
|
|
});
|
|
|
|
var elem = page.querySelector('.upcomingSportsItems');
|
|
elem.innerHTML = html;
|
|
ImageLoader.lazyChildren(elem);
|
|
});
|
|
}
|
|
|
|
$(document).on('pagebeforeshowready', "#liveTvSuggestedPage", function () {
|
|
|
|
var page = this;
|
|
|
|
if (LibraryBrowser.needsRefresh(page)) {
|
|
reload(page);
|
|
}
|
|
});
|
|
|
|
})(jQuery, document); |