1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update live tv pages

This commit is contained in:
Luke Pulverenti 2015-09-08 00:22:38 -04:00
parent ec67431a0e
commit a61e96accb
19 changed files with 172 additions and 216 deletions

View file

@ -59,7 +59,7 @@
});
}
$(document).on('pageinit', ".libraryPage", function () {
pageClassOn('pageinit', "libraryPage", function () {
var page = this;
@ -78,7 +78,6 @@
} else {
init(page, pickers[0]);
}
});
$.fn.alphaValue = function (val) {

View file

@ -204,7 +204,7 @@
}
}
Events.on(document, 'pagebeforeshow', ".page", function () {
pageClassOn('pagebeforeshow', "page", function () {
var page = this;

View file

@ -130,7 +130,7 @@
return false;
}
$(document).on('pageinit', ".collectionEditorPage", function () {
pageClassOn('pageinit', "collectionEditorPage", function () {
var page = this;

View file

@ -111,16 +111,16 @@
var i, length;
var elem = $('.sections', page);
var elem = page.querySelector('.sections');
if (!elem.html().length) {
if (!elem.innerHTML) {
var html = '';
for (i = 0, length = sections.length; i < length; i++) {
html += '<div class="homePageSection section' + sections[i].id + '"></div>';
}
elem.html(html);
elem.innerHTML = html;
}
var promises = [];

View file

@ -1157,7 +1157,7 @@
smallIcon: true
});
$('#themeSongsContent', page).html(html);
page.querySelector('#themeSongsContent').innerHTML = html;
} else {
$('#themeSongsCollapsible', page).hide();
}

View file

@ -315,7 +315,12 @@
if (LibraryBrowser.enableFullPaperTabs()) {
page.querySelector('paper-tabs').selected = selected;
var tabs = page.querySelector('paper-tabs');
if (tabs.selected) {
// showTab was called
return;
}
tabs.selected = selected;
} else {
page.querySelector('neon-animated-pages').selected = selected;

View file

@ -1211,7 +1211,7 @@
});
}
$(document).on('pageinit', ".libraryPage", function () {
pageClassOn('pageinit', "libraryPage", function () {
var page = this;
@ -1270,7 +1270,9 @@
$(itemsContainers[i]).createCardMenus();
}
}).on('pagebeforeshow', ".libraryPage", function () {
});
pageClassOn('pagebeforeshow', "libraryPage", function () {
var page = this;

View file

@ -1,5 +1,98 @@
(function () {
function getTimersHtml(timers) {
var html = '';
var index = '';
for (var i = 0, length = timers.length; i < length; i++) {
var timer = timers[i];
var startDateText = LibraryBrowser.getFutureDateText(parseISO8601Date(timer.StartDate, { toLocal: true }));
if (startDateText != index) {
if (index) {
html += '</div>';
html += '</div>';
}
html += '<div class="homePageSection">';
html += '<h1>' + startDateText + '</h1>';
html += '<div class="paperList">';
index = startDateText;
}
html += '<paper-icon-item>';
var program = timer.ProgramInfo || {};
var imgUrl;
if (program.ImageTags && program.ImageTags.Primary) {
imgUrl = ApiClient.getScaledImageUrl(program.Id, {
height: 80,
tag: program.ImageTags.Primary,
type: "Primary"
});
}
if (imgUrl) {
html += '<paper-fab class="listAvatar blue" style="background-image:url(\'' + imgUrl + '\');background-repeat:no-repeat;background-position:center center;background-size: cover;" item-icon></paper-fab>';
}
else if (program.IsKids) {
html += '<paper-fab class="listAvatar" style="background:#2196F3;" icon="person" item-icon></paper-fab>';
}
else if (program.IsSports) {
html += '<paper-fab class="listAvatar" style="background:#8BC34A;" icon="person" item-icon></paper-fab>';
}
else if (program.IsMovie) {
html += '<paper-fab class="listAvatar" icon="movie" item-icon></paper-fab>';
}
else if (program.IsNews) {
html += '<paper-fab class="listAvatar" style="background:#673AB7;" icon="new-releases" item-icon></paper-fab>';
}
else {
html += '<paper-fab class="listAvatar blue" icon="live-tv" item-icon></paper-fab>';
}
html += '<paper-item-body two-line>';
html += '<a class="clearLink" href="livetvtimer.html?id=' + timer.Id + '">';
html += '<div>';
html += timer.Name;
html += '</div>';
html += '<div secondary>';
html += LibraryBrowser.getDisplayTime(timer.StartDate);
html += ' - ' + LibraryBrowser.getDisplayTime(timer.EndDate);
html += '</div>';
html += '</a>';
html += '</paper-item-body>';
if (timer.SeriesTimerId) {
html += '<div class="ui-li-aside" style="right:0;">';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '</div>';
}
html += '<paper-icon-button icon="cancel" data-timerid="' + timer.Id + '" title="' + Globalize.translate('ButonCancelRecording') + '" class="btnDeleteTimer"></paper-icon-button>';
html += '</paper-icon-item>';
}
if (timers.length) {
html += '</div>';
html += '</div>';
}
return html;
}
window.LiveTvHelpers = {
getDaysOfWeek: function () {
@ -42,7 +135,8 @@
} else {
elem.hide();
}
}
},
getTimersHtml: getTimersHtml
};
})();
@ -135,7 +229,7 @@
function onPlayClick() {
$('.itemFlyout').popup('close');
hideOverlay();
MediaController.play({
ids: [this.getAttribute('data-id')]
@ -143,7 +237,7 @@
}
function onRecordClick() {
$('.itemFlyout').popup('close');
hideOverlay();
Dashboard.navigate('livetvnewrecording.html?programid=' + this.getAttribute('data-id'));
}
@ -151,7 +245,7 @@
function showOverlay(elem, item) {
require(['jqmpopup'], function () {
$('.itemFlyout').popup('close').remove();
hideOverlay();
var html = '<div data-role="popup" class="itemFlyout" data-theme="b" data-arrow="true" data-history="false">';
@ -165,8 +259,6 @@
html += '</div>';
$('.itemFlyout').popup('close').popup('destroy').remove();
$(document.body).append(html);
var popup = $('.itemFlyout').on('mouseenter', onOverlayMouseOver).on('mouseleave', onOverlayMouseOut).popup({
@ -206,7 +298,11 @@
function hideOverlay() {
$('.itemFlyout').popup('close').remove();
var flyout = document.querySelectorAll('.itemFlyout');
if (flyout.length) {
$(flyout).popup('close').popup('destroy').remove();
}
if (currentPosterItem) {

View file

@ -4,15 +4,28 @@
var html = '';
html += '<li><a href="livetvrecordinglist.html?groupid=' + group.Id + '">';
html += '<paper-icon-item>';
html += '<h3>';
html += '<paper-fab class="listAvatar blue" icon="live-tv" item-icon></paper-fab>';
html += '<paper-item-body two-line>';
html += '<a href="livetvrecordinglist.html?groupid=' + group.Id + '" class="clearLink">';
html += '<div>';
html += group.Name;
html += '</h3>';
html += '</div>';
html += '<span class="ui-li-count">' + group.RecordingCount + '</span>';
html += '<div secondary>';
if (group.RecordingCount == 1) {
html += Globalize.translate('ValueItemCount', group.RecordingCount);
} else {
html += Globalize.translate('ValueItemCountPlural', group.RecordingCount);
}
html += '</div>';
html += '</li>';
html += '</a>';
html += '</paper-item-body>';
html += '</paper-icon-item>';
return html;
}
@ -27,32 +40,30 @@
var html = '';
html += '<ul data-role="listview" data-inset="true">';
html += '<div class="paperList">';
for (var i = 0, length = groups.length; i < length; i++) {
html += getRecordingGroupHtml(groups[i]);
}
html += '</ul>';
html += '</div>';
$('#recordingGroupItems', page).html(html).trigger('create');
page.querySelector('#recordingGroupItems').innerHTML = html;
Dashboard.hideLoadingMsg();
}
function renderRecordings(elem, recordings) {
var screenWidth = $(window).width();
if (recordings.length) {
elem.show();
elem.classList.remove('hide');
} else {
elem.hide();
elem.classList.add('hide');
}
$('.recordingItems', elem).html(LibraryBrowser.getPosterViewHtml({
var recordingItems = elem.querySelector('.recordingItems');
recordingItems.innerHTML = LibraryBrowser.getPosterViewHtml({
items: recordings,
shape: "auto",
showTitle: true,
@ -61,7 +72,9 @@
coverImage: true,
lazy: true
})).lazyChildren();
});
ImageLoader.lazyChildren(recordingItems);
}
function reload(page) {
@ -75,7 +88,7 @@
}).done(function (result) {
renderRecordings($('#activeRecordings', page), result.Items);
renderRecordings(page.querySelector('#activeRecordings'), result.Items);
});
@ -87,7 +100,7 @@
}).done(function (result) {
renderRecordings($('#latestRecordings', page), result.Items);
renderRecordings(page.querySelector('#latestRecordings'), result.Items);
});
ApiClient.getLiveTvRecordingGroups({

View file

@ -141,87 +141,15 @@
var timers = result.Items;
var html = '';
var html = LiveTvHelpers.getTimersHtml(timers);
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
var elem = $('.scheduleTab', page).html(html);
var index = '';
$('.btnDeleteTimer', elem).on('click', function () {
for (var i = 0, length = timers.length; i < length; i++) {
var timer = timers[i];
var startDateText = LibraryBrowser.getFutureDateText(parseISO8601Date(timer.StartDate, { toLocal: true }));
if (startDateText != index) {
html += '<li data-role="list-divider">' + startDateText + '</li>';
index = startDateText;
}
html += '<li><a href="livetvtimer.html?id=' + timer.Id + '">';
var program = timer.ProgramInfo || {};
var imgUrl;
var programImages = program.ImageTags || {};
if (programImages.Primary) {
imgUrl = ApiClient.getScaledImageUrl(program.Id, {
height: 80,
tag: programImages.Primary,
type: "Primary"
});
} else {
imgUrl = "css/images/items/searchhintsv2/tv.png";
}
html += '<img src="css/images/items/searchhintsv2/tv.png" style="display:none;">';
html += '<div class="ui-li-thumb" style="background-image:url(\'' + imgUrl + '\');width:5em;height:5em;background-repeat:no-repeat;background-position:center center;background-size: cover;"></div>';
html += '<h3>';
html += program.EpisodeTitle || timer.Name;
html += '</h3>';
html += '<p>';
if (program.IsLive) {
html += '<span class="liveTvProgram">' + Globalize.translate('LabelLiveProgram') + '&nbsp;&nbsp;</span>';
}
else if (program.IsPremiere) {
html += '<span class="premiereTvProgram">' + Globalize.translate('LabelPremiereProgram') + '&nbsp;&nbsp;</span>';
}
else if (program.IsSeries && !program.IsRepeat) {
html += '<span class="newTvProgram">' + Globalize.translate('LabelNewProgram') + '&nbsp;&nbsp;</span>';
}
html += LibraryBrowser.getDisplayTime(timer.StartDate);
html += ' - ' + LibraryBrowser.getDisplayTime(timer.EndDate);
html += '</p>';
if (timer.SeriesTimerId) {
html += '<div class="ui-li-aside" style="right:0;">';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '</div>';
}
html += '</a>';
html += '<a data-timerid="' + timer.Id + '" href="#" title="' + Globalize.translate('ButonCancelRecording') + '" class="btnCancelTimer">' + Globalize.translate('ButonCancelRecording') + '</a>';
html += '</li>';
}
html += '</ul>';
var elem = $('.scheduleTab', page).html(html).trigger('create');
$('.btnCancelTimer', elem).on('click', function () {
deleteTimer(page, this.getAttribute('data-timerid'));
var id = this.getAttribute('data-timerid');
deleteTimer(page, id);
});
}

View file

@ -21,94 +21,7 @@
function renderTimers(page, timers) {
var html = '';
var index = '';
for (var i = 0, length = timers.length; i < length; i++) {
var timer = timers[i];
var startDateText = LibraryBrowser.getFutureDateText(parseISO8601Date(timer.StartDate, { toLocal: true }));
if (startDateText != index) {
if (index) {
html += '</div>';
html += '</div>';
}
html += '<div class="homePageSection">';
html += '<h1>' + startDateText + '</h1>';
html += '<div class="paperList">';
index = startDateText;
}
html += '<paper-icon-item>';
var program = timer.ProgramInfo || {};
var imgUrl;
if (program.ImageTags && program.ImageTags.Primary) {
imgUrl = ApiClient.getScaledImageUrl(program.Id, {
height: 80,
tag: program.ImageTags.Primary,
type: "Primary"
});
}
if (imgUrl) {
html += '<paper-fab class="listAvatar blue" style="background-image:url(\'' + imgUrl + '\');background-repeat:no-repeat;background-position:center center;background-size: cover;" item-icon></paper-fab>';
}
else if (program.IsKids) {
html += '<paper-fab class="listAvatar" style="background:#2196F3;" icon="person" item-icon></paper-fab>';
}
else if (program.IsSports) {
html += '<paper-fab class="listAvatar" style="background:#8BC34A;" icon="person" item-icon></paper-fab>';
}
else if (program.IsMovie) {
html += '<paper-fab class="listAvatar" icon="movie" item-icon></paper-fab>';
}
else if (program.IsNews) {
html += '<paper-fab class="listAvatar" style="background:#673AB7;" icon="new-releases" item-icon></paper-fab>';
}
else {
html += '<paper-fab class="listAvatar blue" icon="live-tv" item-icon></paper-fab>';
}
html += '<paper-item-body two-line>';
html += '<a class="clearLink" href="livetvtimer.html?id=' + timer.Id + '">';
html += '<div>';
html += timer.Name;
html += '</div>';
html += '<div secondary>';
html += LibraryBrowser.getDisplayTime(timer.StartDate);
html += ' - ' + LibraryBrowser.getDisplayTime(timer.EndDate);
html += '</div>';
html += '</a>';
html += '</paper-item-body>';
if (timer.SeriesTimerId) {
html += '<div class="ui-li-aside" style="right:0;">';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '<div class="timerCircle seriesTimerCircle"></div>';
html += '</div>';
}
html += '<paper-icon-button icon="cancel" data-timerid="' + timer.Id + '" title="' + Globalize.translate('ButonCancelRecording') + '" class="btnDeleteTimer"></paper-icon-button>';
html += '</paper-icon-item>';
}
if (timers.length) {
html += '</div>';
html += '</div>';
}
var html = LiveTvHelpers.getTimersHtml(timers);
var elem = $('#items', page).html(html);

View file

@ -18,7 +18,7 @@
appStorage.setItem(supporterPlaybackKey, new Date().getTime());
deferred.resolve();
}
else if ((new Date().getTime() - lastMessage) > 432000000) {
else if ((new Date().getTime() - lastMessage) > 345600000) {
showPlaybackOverlay(deferred);
} else {

View file

@ -59,7 +59,7 @@
return MediaController.getCurrentPlayer();
}
Events.on(document, 'thememediadownload', ".libraryPage", function (e, themeMediaResult) {
Events.on(document, 'thememediadownload', function (e, themeMediaResult) {
if (!enabled()) {
return;