mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update live tv menu
This commit is contained in:
parent
06b74be1fd
commit
3bae11071d
57 changed files with 368 additions and 115 deletions
|
@ -92,7 +92,8 @@
|
|||
}
|
||||
else if (view == "Poster") {
|
||||
|
||||
posterOptions.showTitle = context != 'photos';
|
||||
posterOptions.showTitle = context == 'photos' ? 'auto' : true;
|
||||
posterOptions.overlayText = context == 'photos';
|
||||
|
||||
html = LibraryBrowser.getPosterViewHtml(posterOptions);
|
||||
}
|
||||
|
@ -180,7 +181,9 @@
|
|||
var info = LibraryBrowser.getListItemInfo(this);
|
||||
|
||||
if (info.mediaType == 'Photo') {
|
||||
Photos.startSlideshow(page, query, info.id);
|
||||
require(['scripts/photos'], function () {
|
||||
Photos.startSlideshow(page, query, info.id);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -186,6 +186,7 @@
|
|||
},
|
||||
|
||||
enableFullPaperTabs: function () {
|
||||
|
||||
return AppInfo.isNativeApp;
|
||||
},
|
||||
|
||||
|
@ -294,6 +295,45 @@
|
|||
}
|
||||
},
|
||||
|
||||
showTab: function (url, index) {
|
||||
|
||||
if (!LibraryBrowser.enableFullPaperTabs()) {
|
||||
|
||||
if (index) {
|
||||
url = replaceQueryString(url, 'tab', index);
|
||||
}
|
||||
Dashboard.navigate(url);
|
||||
return;
|
||||
}
|
||||
|
||||
$(document).one('pageshowready', '.page', function () {
|
||||
|
||||
if (getWindowUrl().toLowerCase().indexOf(url.toLowerCase()) != -1) {
|
||||
|
||||
var pages = this.querySelector('neon-animated-pages');
|
||||
|
||||
if (pages) {
|
||||
|
||||
var entryAnimation = pages.entryAnimation;
|
||||
var exitAnimation = pages.exitAnimation;
|
||||
pages.entryAnimation = null;
|
||||
pages.exitAnimation = null;
|
||||
|
||||
var tabs = this.querySelector('paper-tabs');
|
||||
var noSlide = tabs.noSlide;
|
||||
tabs.noSlide = true;
|
||||
tabs.selected = index;
|
||||
|
||||
pages.entryAnimation = entryAnimation;
|
||||
pages.exitAnimation = exitAnimation;
|
||||
tabs.noSlide = noSlide;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Dashboard.navigate(url);
|
||||
},
|
||||
|
||||
canShare: function (item, user) {
|
||||
|
||||
return user.Policy.EnablePublicSharing;
|
||||
|
@ -1503,6 +1543,8 @@
|
|||
cssClass += " fullWidthCardOnMobile";
|
||||
}
|
||||
|
||||
var showTitle = options.showTitle == 'auto' ? true : options.showTitle;
|
||||
|
||||
if (options.autoThumb && item.ImageTags && item.ImageTags.Primary && item.PrimaryImageAspectRatio && item.PrimaryImageAspectRatio >= 1.5) {
|
||||
|
||||
width = posterWidth;
|
||||
|
@ -1664,37 +1706,38 @@
|
|||
|
||||
} else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") {
|
||||
|
||||
if (item.Name && options.showTitle) {
|
||||
if (item.Name && showTitle) {
|
||||
icon = 'library-music';
|
||||
}
|
||||
cssClass += " defaultBackground";
|
||||
|
||||
} else if (item.Type == "Recording" || item.Type == "Program" || item.Type == "TvChannel") {
|
||||
|
||||
if (item.Name && options.showTitle) {
|
||||
if (item.Name && showTitle) {
|
||||
icon = 'folder-open';
|
||||
}
|
||||
|
||||
cssClass += " defaultBackground";
|
||||
} else if (item.MediaType == "Video" || item.Type == "Season" || item.Type == "Series") {
|
||||
|
||||
if (item.Name && options.showTitle) {
|
||||
if (item.Name && showTitle) {
|
||||
icon = 'videocam';
|
||||
}
|
||||
cssClass += " defaultBackground";
|
||||
} else if (item.Type == "Person") {
|
||||
|
||||
if (item.Name && options.showTitle) {
|
||||
if (item.Name && showTitle) {
|
||||
icon = 'person';
|
||||
}
|
||||
cssClass += " defaultBackground";
|
||||
} else {
|
||||
if (item.Name && options.showTitle) {
|
||||
if (item.Name && showTitle) {
|
||||
icon = 'folder-open';
|
||||
}
|
||||
cssClass += " defaultBackground";
|
||||
}
|
||||
|
||||
icon = item.icon || icon;
|
||||
cssClass += ' ' + options.shape + 'Card';
|
||||
|
||||
var mediaSourceCount = item.MediaSourceCount || 1;
|
||||
|
@ -1705,7 +1748,7 @@
|
|||
cssClass += ' groupedCard';
|
||||
}
|
||||
|
||||
if (options.showTitle && !options.overlayText) {
|
||||
if (showTitle && !options.overlayText) {
|
||||
cssClass += ' bottomPaddedCard';
|
||||
}
|
||||
|
||||
|
@ -1766,7 +1809,8 @@
|
|||
}
|
||||
|
||||
var transition = options.transition === false || !AppInfo.enableSectionTransitions ? '' : ' data-transition="slide"';
|
||||
html += '<a' + transition + ' class="' + anchorCssClass + '" href="' + href + '"' + defaultActionAttribute + '>';
|
||||
var onclick = item.onclick ? ' onclick="' + item.onclick + '"' : '';
|
||||
html += '<a' + onclick + transition + ' class="' + anchorCssClass + '" href="' + href + '"' + defaultActionAttribute + '>';
|
||||
html += '<div class="' + imageCssClass + '" style="' + style + '"' + dataSrc + '>';
|
||||
if (icon) {
|
||||
html += '<iron-icon icon="' + icon + '"></iron-icon>';
|
||||
|
@ -1791,18 +1835,18 @@
|
|||
html += '<div class="mediaSourceIndicator">' + mediaSourceCount + '</div>';
|
||||
}
|
||||
if (item.IsUnidentified) {
|
||||
html += '<div class="unidentifiedIndicator"><i class="fa fa-exclamation"></i></div>';
|
||||
html += '<div class="unidentifiedIndicator"><iron-icon icon="error"></iron-icon></div>';
|
||||
}
|
||||
|
||||
var progressHtml = options.showProgress === false || item.IsFolder ? '' : LibraryBrowser.getItemProgressBarHtml((item.Type == 'Recording' ? item : item.UserData));
|
||||
|
||||
var footerOverlayed = false;
|
||||
|
||||
if (options.overlayText || (forceName && !options.showTitle)) {
|
||||
if (options.overlayText || (forceName && !showTitle)) {
|
||||
|
||||
var footerCssClass = progressHtml ? 'cardFooter fullCardFooter' : 'cardFooter';
|
||||
|
||||
html += LibraryBrowser.getCardFooterText(item, options, imgUrl, forceName, footerCssClass, progressHtml);
|
||||
html += LibraryBrowser.getCardFooterText(item, options, showTitle, imgUrl, forceName, footerCssClass, progressHtml);
|
||||
footerOverlayed = true;
|
||||
}
|
||||
else if (progressHtml) {
|
||||
|
@ -1830,7 +1874,7 @@
|
|||
html += '</div>';
|
||||
|
||||
if (!options.overlayText && !footerOverlayed) {
|
||||
html += LibraryBrowser.getCardFooterText(item, options, imgUrl, forceName, 'cardFooter outerCardFooter', progressHtml);
|
||||
html += LibraryBrowser.getCardFooterText(item, options, showTitle, imgUrl, forceName, 'cardFooter outerCardFooter', progressHtml);
|
||||
}
|
||||
|
||||
// cardBox
|
||||
|
@ -1842,7 +1886,7 @@
|
|||
return html;
|
||||
},
|
||||
|
||||
getCardFooterText: function (item, options, imgUrl, forceName, footerClass, progressHtml) {
|
||||
getCardFooterText: function (item, options, showTitle, imgUrl, forceName, footerClass, progressHtml) {
|
||||
|
||||
var html = '';
|
||||
|
||||
|
@ -1854,9 +1898,9 @@
|
|||
html += "</div>";
|
||||
}
|
||||
|
||||
var name = LibraryBrowser.getPosterViewDisplayName(item, options.displayAsSpecial);
|
||||
var name = options.showTitle == 'auto' && !item.IsFolder && item.MediaType == 'Photo' ? '' : LibraryBrowser.getPosterViewDisplayName(item, options.displayAsSpecial);
|
||||
|
||||
if (!imgUrl && !options.showTitle) {
|
||||
if (!imgUrl && !showTitle) {
|
||||
html += "<div class='cardDefaultText'>";
|
||||
html += htmlEncode(name);
|
||||
html += "</div>";
|
||||
|
@ -1871,7 +1915,7 @@
|
|||
lines.push(item.EpisodeTitle ? item.Name : (item.SeriesName || item.Album || item.AlbumArtist || item.GameSystem || ""));
|
||||
}
|
||||
|
||||
if (options.showTitle || forceName) {
|
||||
if (showTitle || forceName) {
|
||||
|
||||
lines.push(htmlEncode(name));
|
||||
}
|
||||
|
|
|
@ -588,9 +588,9 @@
|
|||
var html = '<div data-role="popup" class="detailsMenu" style="border:0;padding:0;" data-ids="' + ids.join(',') + '" data-context="' + (context || '') + '">';
|
||||
|
||||
html += '<div style="padding:1em 1em;background:rgba(20,20,20,1);margin:0;text-align:center;" class="detailsMenuHeader">';
|
||||
html += '<button type="button" class="imageButton detailsMenuLeftButton" data-role="none"><i class="fa fa-arrow-left"></i></button>';
|
||||
html += '<paper-icon-button icon="keyboard-arrow-left" class="detailsMenuLeftButton"></paper-icon-button>';
|
||||
html += '<h3 style="font-weight:400;margin:.5em 0;"></h3>';
|
||||
html += '<button type="button" class="imageButton detailsMenuRightButton" data-role="none"><i class="fa fa-arrow-right"></i></button>';
|
||||
html += '<paper-icon-button icon="keyboard-arrow-right" class="detailsMenuRightButton"></paper-icon-button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="detailsMenuContent" style="background-position:center center;background-repeat:no-repeat;background-size:cover;">';
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
html += '<div class="viewMenuSearch hide">';
|
||||
html += '<form class="viewMenuSearchForm">';
|
||||
html += '<input type="text" data-role="none" data-type="search" class="headerSearchInput" autocomplete="off" spellcheck="off" />';
|
||||
html += '<div class="searchInputIcon fa fa-search"></div>';
|
||||
html += '<iron-icon class="searchInputIcon" icon="search"></iron-icon>';
|
||||
html += '<paper-icon-button icon="close" class="btnCloseSearch"></paper-icon-button>';
|
||||
html += '</form>';
|
||||
html += '</div>';
|
||||
|
@ -348,7 +348,7 @@
|
|||
html += '<a class="sidebarLink lnkMediaFolder lnkMySync" data-itemid="mysync" onclick="return LibraryMenu.onLinkClicked(event, this);" href="mysync.html"><iron-icon icon="refresh" class="sidebarLinkIcon"></iron-icon><span class="sidebarLinkText">' + Globalize.translate('ButtonSync') + '</span></a>';
|
||||
|
||||
if (Dashboard.isConnectMode()) {
|
||||
html += '<a class="sidebarLink lnkMediaFolder" data-itemid="selectserver" onclick="return LibraryMenu.onLinkClicked(event, this);" href="selectserver.html"><span class="fa fa-globe sidebarLinkIcon"></span><span class="sidebarLinkText">' + Globalize.translate('ButtonSelectServer') + '</span></a>';
|
||||
html += '<a class="sidebarLink lnkMediaFolder" data-itemid="selectserver" onclick="return LibraryMenu.onLinkClicked(event, this);" href="selectserver.html"><iron-icon icon="wifi" class="sidebarLinkIcon"></iron-icon><span class="sidebarLinkText">' + Globalize.translate('ButtonSelectServer') + '</span></a>';
|
||||
}
|
||||
|
||||
if (showUserAtTop()) {
|
||||
|
@ -369,6 +369,51 @@
|
|||
LibraryMenu.setTitle(text);
|
||||
}
|
||||
|
||||
function getUserViews(apiClient, userId) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
apiClient.getUserViews({}, userId).done(function (result) {
|
||||
|
||||
var items = result.Items;
|
||||
|
||||
var list = [];
|
||||
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
|
||||
var view = items[i];
|
||||
|
||||
list.push(view);
|
||||
|
||||
if (view.CollectionType == 'livetv') {
|
||||
|
||||
view.ImageTags = {};
|
||||
view.icon = 'live-tv';
|
||||
|
||||
var guideView = $.extend({}, view);
|
||||
guideView.Name = Globalize.translate('ButtonGuide');
|
||||
guideView.ImageTags = {};
|
||||
guideView.icon = 'dvr';
|
||||
guideView.url = 'livetv.html?tab=1';
|
||||
guideView.onclick = "LibraryBrowser.showTab('livetv.html', 1);";
|
||||
list.push(guideView);
|
||||
|
||||
var recordedTvView = $.extend({}, view);
|
||||
recordedTvView.Name = Globalize.translate('ButtonRecordedTv');
|
||||
recordedTvView.ImageTags = {};
|
||||
recordedTvView.icon = 'video-library';
|
||||
recordedTvView.url = 'livetv.html?tab=3';
|
||||
recordedTvView.onclick = "LibraryBrowser.showTab('livetv.html', 3);";
|
||||
list.push(recordedTvView);
|
||||
}
|
||||
}
|
||||
|
||||
deferred.resolveWith(null, [list]);
|
||||
});
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
function updateLibraryMenu(user) {
|
||||
|
||||
if (!user) {
|
||||
|
@ -383,9 +428,9 @@
|
|||
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
apiClient.getUserViews({}, userId).done(function (result) {
|
||||
getUserViews(apiClient, userId).done(function (result) {
|
||||
|
||||
var items = result.Items;
|
||||
var items = result;
|
||||
|
||||
var html = '';
|
||||
html += '<div class="sidebarHeader">';
|
||||
|
@ -445,7 +490,10 @@
|
|||
color = "#293AAE";
|
||||
}
|
||||
|
||||
return '<a data-itemid="' + itemId + '" class="lnkMediaFolder sidebarLink" onclick="return LibraryMenu.onLinkClicked(event, this);" href="' + getItemHref(i, i.CollectionType) + '"><iron-icon icon="' + icon + '" class="sidebarLinkIcon" style="color:' + color + '"></iron-icon><span class="sectionName">' + i.Name + '</span></a>';
|
||||
icon = i.icon || icon;
|
||||
|
||||
var onclick = i.onclick ? ' function(){' + i.onclick + '}' : 'null';
|
||||
return '<a data-itemid="' + itemId + '" class="lnkMediaFolder sidebarLink" onclick="return LibraryMenu.onLinkClicked(event, this, ' + onclick + ');" href="' + getItemHref(i, i.CollectionType) + '"><iron-icon icon="' + icon + '" class="sidebarLinkIcon" style="color:' + color + '"></iron-icon><span class="sectionName">' + i.Name + '</span></a>';
|
||||
|
||||
}).join('');
|
||||
|
||||
|
@ -497,7 +545,7 @@
|
|||
window.LibraryMenu = {
|
||||
getTopParentId: getTopParentId,
|
||||
|
||||
onLinkClicked: function (event, link) {
|
||||
onLinkClicked: function (event, link, action) {
|
||||
|
||||
if (event.which != 1) {
|
||||
return true;
|
||||
|
@ -510,7 +558,11 @@
|
|||
closeMainDrawer();
|
||||
|
||||
setTimeout(function () {
|
||||
Dashboard.navigate(link.href);
|
||||
if (action) {
|
||||
action();
|
||||
} else {
|
||||
Dashboard.navigate(link.href);
|
||||
}
|
||||
}, 400);
|
||||
}, 50);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,38 @@
|
|||
|
||||
var items = result.Items;
|
||||
|
||||
deferred.resolveWith(null, [items]);
|
||||
var list = [];
|
||||
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
|
||||
var view = items[i];
|
||||
|
||||
list.push(view);
|
||||
|
||||
if (view.CollectionType == 'livetv') {
|
||||
|
||||
view.ImageTags = {};
|
||||
view.icon = 'live-tv';
|
||||
|
||||
var guideView = $.extend({}, view);
|
||||
guideView.Name = Globalize.translate('ButtonGuide');
|
||||
guideView.ImageTags = {};
|
||||
guideView.icon = 'dvr';
|
||||
guideView.url = 'livetv.html?tab=1';
|
||||
guideView.onclick = "LibraryBrowser.showTab('livetv.html', 1);return false;";
|
||||
list.push(guideView);
|
||||
|
||||
var recordedTvView = $.extend({}, view);
|
||||
recordedTvView.Name = Globalize.translate('ButtonRecordedTv');
|
||||
recordedTvView.ImageTags = {};
|
||||
recordedTvView.icon = 'video-library';
|
||||
recordedTvView.url = 'livetv.html?tab=3';
|
||||
recordedTvView.onclick = "LibraryBrowser.showTab('livetv.html', 3);return false;";
|
||||
list.push(recordedTvView);
|
||||
}
|
||||
}
|
||||
|
||||
deferred.resolveWith(null, [list]);
|
||||
});
|
||||
|
||||
return deferred.promise();
|
||||
|
@ -36,53 +67,53 @@
|
|||
|
||||
switch (item.CollectionType) {
|
||||
case "movies":
|
||||
icon = "fa-film";
|
||||
icon = "local-movies";
|
||||
backgroundColor = 'rgba(176, 94, 81, 0.9)';
|
||||
break;
|
||||
case "music":
|
||||
icon = "fa-music";
|
||||
icon = "library-music";
|
||||
backgroundColor = 'rgba(217, 145, 67, 0.9)';
|
||||
break;
|
||||
case "photos":
|
||||
icon = "fa-photo";
|
||||
icon = "photo";
|
||||
backgroundColor = 'rgba(127, 0, 0, 0.9)';
|
||||
break;
|
||||
case "livetv":
|
||||
icon = "fa-video-camera";
|
||||
icon = "live-tv";
|
||||
backgroundColor = 'rgba(217, 145, 67, 0.9)';
|
||||
break;
|
||||
case "tvshows":
|
||||
icon = "fa-video-camera";
|
||||
icon = "live-tv";
|
||||
backgroundColor = 'rgba(77, 88, 164, 0.9)';
|
||||
break;
|
||||
case "games":
|
||||
icon = "fa-gamepad";
|
||||
icon = "folder";
|
||||
backgroundColor = 'rgba(183, 202, 72, 0.9)';
|
||||
break;
|
||||
case "trailers":
|
||||
icon = "fa-film";
|
||||
icon = "local-movies";
|
||||
backgroundColor = 'rgba(176, 94, 81, 0.9)';
|
||||
break;
|
||||
case "homevideos":
|
||||
icon = "fa-video-camera";
|
||||
icon = "video-library";
|
||||
backgroundColor = 'rgba(110, 52, 32, 0.9)';
|
||||
break;
|
||||
case "musicvideos":
|
||||
icon = "fa-video-camera";
|
||||
icon = "video-library";
|
||||
backgroundColor = 'rgba(143, 54, 168, 0.9)';
|
||||
break;
|
||||
case "books":
|
||||
icon = "fa-book";
|
||||
icon = "folder";
|
||||
break;
|
||||
case "channels":
|
||||
icon = "fa-globe";
|
||||
icon = "folder";
|
||||
backgroundColor = 'rgba(51, 136, 204, 0.9)';
|
||||
break;
|
||||
case "playlists":
|
||||
icon = "fa-list";
|
||||
icon = "folder";
|
||||
break;
|
||||
default:
|
||||
icon = "fa-folder-o";
|
||||
icon = "folder";
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -93,12 +124,15 @@
|
|||
}
|
||||
|
||||
var href = item.url || LibraryBrowser.getHref(item);
|
||||
var onclick = item.onclick ? ' onclick="' + item.onclick + '"' : '';
|
||||
|
||||
html += '<a data-itemid="' + item.Id + '" class="' + cssClass + '" href="' + href + '">';
|
||||
icon = item.icon || icon;
|
||||
|
||||
html += '<a' + onclick + ' data-itemid="' + item.Id + '" class="' + cssClass + '" href="' + href + '">';
|
||||
html += '<div class="cardBox" style="background-color:' + backgroundColor + ';margin:4px;border-radius:4px;">';
|
||||
|
||||
html += "<div class='cardText' style='padding:8px 10px;color:#fff;font-size:14px;'>";
|
||||
html += '<i class="fa ' + icon + '"></i>';
|
||||
html += '<iron-icon icon="' + icon + '"></iron-icon>';
|
||||
html += '<span style="margin-left:.7em;">' + item.Name + '</span>';
|
||||
html += "</div>";
|
||||
|
||||
|
|
|
@ -2013,6 +2013,10 @@ var AppInfo = {};
|
|||
Dashboard.importCss('css/livetv.css');
|
||||
return {};
|
||||
});
|
||||
define("fontawesome", [], function () {
|
||||
Dashboard.importCss('thirdparty/fontawesome/css/font-awesome.min.css');
|
||||
return {};
|
||||
});
|
||||
define("detailtablecss", [], function () {
|
||||
Dashboard.importCss('css/detailtable.css');
|
||||
return {};
|
||||
|
@ -2083,7 +2087,7 @@ var AppInfo = {};
|
|||
capabilities.DeviceProfile = MediaPlayer.getDeviceProfile(Math.max(screen.height, screen.width));
|
||||
createConnectionManager(capabilities).done(function () { onConnectionManagerCreated(deferred); });
|
||||
|
||||
//$(document.body).append('<div style="background:#3F51B5;position:fixed;z-index:999999;top:0;right:0;left:0;bottom:0;padding:50px;"><iron-icon icon="live-tv" style="width:640px;height:640px;color:#fff;"></iron-icon></div>');
|
||||
//$(document.body).append('<div style="background:#009688;position:fixed;z-index:999999;top:0;right:0;left:0;bottom:0;padding:50px;"><iron-icon icon="queue-music" style="width:640px;height:640px;color:#fff;"></iron-icon></div>');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue