mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
80 lines
2.1 KiB
JavaScript
80 lines
2.1 KiB
JavaScript
![]() |
(function ($, document, apiClient) {
|
|||
|
|
|||
|
var currentItem
|
|||
|
|
|||
|
function reload(page) {
|
|||
|
|
|||
|
Dashboard.showLoadingMsg();
|
|||
|
|
|||
|
ApiClient.getLiveTvChannel(getParameterByName('id')).done(function (item) {
|
|||
|
|
|||
|
currentItem = item;
|
|||
|
|
|||
|
var name = item.Name;
|
|||
|
|
|||
|
$('#itemImage', page).html(LibraryBrowser.getDetailImageHtml(item));
|
|||
|
|
|||
|
Dashboard.setPageTitle(name);
|
|||
|
|
|||
|
$('.itemName', page).html(name);
|
|||
|
|
|||
|
if (ApiClient.isWebSocketOpen()) {
|
|||
|
|
|||
|
var vals = [item.Type, item.Id, item.Name];
|
|||
|
|
|||
|
vals.push('livetv');
|
|||
|
|
|||
|
ApiClient.sendWebSocketMessage("Context", vals.join('|'));
|
|||
|
}
|
|||
|
|
|||
|
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();
|
|||
|
}
|
|||
|
|
|||
|
});
|
|||
|
|
|||
|
Dashboard.hideLoadingMsg();
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
$(document).on('pageinit', "#liveTvChannelPage", function () {
|
|||
|
|
|||
|
var page = this;
|
|||
|
|
|||
|
$('#btnPlay', page).on('click', function () {
|
|||
|
var userdata = currentItem.UserData || {};
|
|||
|
LibraryBrowser.showPlayMenu(this, currentItem.Name, currentItem.Type, currentItem.MediaType, userdata.PlaybackPositionTicks);
|
|||
|
});
|
|||
|
|
|||
|
$('#btnRemote', page).on('click', function () {
|
|||
|
|
|||
|
RemoteControl.showMenuForItem({ item: currentItem, context: 'livetv' });
|
|||
|
});
|
|||
|
|
|||
|
$('#btnEdit', page).on('click', function () {
|
|||
|
|
|||
|
Dashboard.navigate("edititemmetadata.html?channelid=" + currentItem.Id);
|
|||
|
});
|
|||
|
|
|||
|
}).on('pageshow', "#liveTvChannelPage", function () {
|
|||
|
|
|||
|
var page = this;
|
|||
|
|
|||
|
reload(page);
|
|||
|
|
|||
|
}).on('pagehide', "#liveTvChannelPage", function () {
|
|||
|
|
|||
|
currentItem = null;
|
|||
|
});
|
|||
|
|
|||
|
})(jQuery, document, ApiClient);
|