mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 11:28:23 -07:00
102 lines
2.9 KiB
JavaScript
102 lines
2.9 KiB
JavaScript
(function ($, document, apiClient) {
|
|
|
|
var currentItem;
|
|
|
|
function reload(page) {
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
ApiClient.getLiveTvProgram(getParameterByName('id'), Dashboard.getCurrentUserId()).done(function (item) {
|
|
|
|
var context = 'livetv';
|
|
currentItem = item;
|
|
|
|
var name = item.Name;
|
|
|
|
if (item.IsRepeat) {
|
|
name += ' (R)';
|
|
}
|
|
|
|
$('#itemImage', page).html(LibraryBrowser.getDetailImageHtml(item));
|
|
|
|
Dashboard.setPageTitle(name);
|
|
|
|
$('.itemName', page).html(name);
|
|
|
|
$('.itemEpisodeName', page).html(item.EpisodeTitle || '');
|
|
|
|
if (item.CommunityRating) {
|
|
$('.itemCommunityRating', page).html(LibraryBrowser.getRatingHtml(item)).show();
|
|
} else {
|
|
$('.itemCommunityRating', page).hide();
|
|
}
|
|
|
|
$('.userDataIcons', page).html(LibraryBrowser.getUserDataIconsHtml(item));
|
|
|
|
LibraryBrowser.renderGenres($('.itemGenres', page), item, context);
|
|
LibraryBrowser.renderOverview($('.itemOverview', page), item);
|
|
$('.itemMiscInfo', page).html(LibraryBrowser.getMiscInfoHtml(item));
|
|
|
|
LiveTvHelpers.renderMiscProgramInfo($('.miscTvProgramInfo', page), item);
|
|
|
|
if (ApiClient.isWebSocketOpen()) {
|
|
|
|
var vals = [item.Type, item.Id, item.Name];
|
|
|
|
vals.push('livetv');
|
|
|
|
ApiClient.sendWebSocketMessage("Context", vals.join('|'));
|
|
}
|
|
|
|
if (!item.TimerId && !item.SeriesTimerId) {
|
|
$('#recordButtonContainer', page).show();
|
|
} else {
|
|
$('#recordButtonContainer', page).hide();
|
|
}
|
|
|
|
if (MediaPlayer.canPlay(item)) {
|
|
$('#playButtonContainer', page).show();
|
|
} else {
|
|
$('#playButtonContainer', page).hide();
|
|
}
|
|
|
|
Dashboard.getCurrentUser().done(function (user) {
|
|
|
|
if (user.Configuration.IsAdministrator && item.LocationType !== "Offline") {
|
|
$('#editButtonContainer', page).show();
|
|
} else {
|
|
$('#editButtonContainer', page).hide();
|
|
}
|
|
|
|
});
|
|
|
|
LiveTvHelpers.renderOriginalAirDate($('.airDate', page), item);
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
});
|
|
}
|
|
|
|
$(document).on('pageinit', "#liveTvProgramPage", function () {
|
|
|
|
var page = this;
|
|
|
|
$('#btnRecord', page).on('click', function() {
|
|
|
|
var id = getParameterByName('id');
|
|
|
|
Dashboard.navigate('livetvnewrecording.html?programid=' + id);
|
|
|
|
});
|
|
|
|
}).on('pageshow', "#liveTvProgramPage", function () {
|
|
|
|
var page = this;
|
|
|
|
reload(page);
|
|
|
|
}).on('pagehide', "#liveTvProgramPage", function () {
|
|
|
|
currentItem = null;
|
|
});
|
|
|
|
})(jQuery, document, ApiClient); |