mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
new mobile web client menu
This commit is contained in:
parent
946f2ff98e
commit
79a51f6b3a
16 changed files with 357 additions and 146 deletions
|
@ -2370,118 +2370,4 @@
|
|||
|
||||
};
|
||||
|
||||
})(window, document, jQuery, screen, localStorage);
|
||||
|
||||
|
||||
(function (window, document, $) {
|
||||
|
||||
var itemCountsPromise;
|
||||
var liveTvServicesPromise;
|
||||
|
||||
function renderHeader(page, user) {
|
||||
|
||||
var html = '<div class="viewMenuBar">';
|
||||
|
||||
html += '<a data-role="button" href="index.html" data-icon="bars" data-iconpos="notext" data-inline="true" title="Menu">Menu</a>';
|
||||
|
||||
html += '<button class="viewMenuRemoteControlButton" onclick="RemoteControl.showMenu();" type="button" data-icon="remote" data-inline="true" data-iconpos="notext" title="Remote Control">Remote Control</button>';
|
||||
|
||||
if (user.Configuration.IsAdministrator) {
|
||||
html += '<a class="editorMenuLink" href="edititemmetadata.html" data-role="button" data-icon="edit" data-inline="true" data-iconpos="notext" title="Metadata Manager">Metadata Manager</a>';
|
||||
}
|
||||
|
||||
html += '<div class="viewMenuSecondary">';
|
||||
|
||||
html += '<a class="viewMenuLink btnCurrentUser" href="#" onclick="Dashboard.showUserFlyout(this);">';
|
||||
|
||||
if (user.PrimaryImageTag) {
|
||||
|
||||
var url = ApiClient.getUserImageUrl(user.Id, {
|
||||
height: 40,
|
||||
tag: user.PrimaryImageTag,
|
||||
type: "Primary"
|
||||
});
|
||||
|
||||
html += '<img src="' + url + '" />';
|
||||
} else {
|
||||
html += '<img src="css/images/currentuserdefaultwhite.png" />';
|
||||
}
|
||||
|
||||
html += '</a>';
|
||||
|
||||
html += '<button onclick="Search.showSearchPanel($.mobile.activePage);" type="button" data-icon="search" data-inline="true" data-iconpos="notext">Search</button>';
|
||||
|
||||
if (user.Configuration.IsAdministrator) {
|
||||
html += '<a href="dashboard.html" data-role="button" data-icon="gear" data-inline="true" data-iconpos="notext">Dashboard</a>';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
|
||||
html += '</div>';
|
||||
|
||||
$(page).prepend(html);
|
||||
|
||||
$('.viewMenuBar', page).trigger('create');
|
||||
}
|
||||
|
||||
function insertViews(page, user, counts, liveTvServices) {
|
||||
|
||||
var html = '';
|
||||
|
||||
var selectedCssClass = ' selectedViewLink';
|
||||
var selectedHtml = "<span class='selectedViewIndicator'>▶</span>";
|
||||
|
||||
var view = page.getAttribute('data-view') || getParameterByName('context');
|
||||
|
||||
if (counts.MovieCount || counts.TrailerCount) {
|
||||
|
||||
html += '<a class="viewMenuLink viewMenuTextLink desktopViewMenuLink' + (view == 'movies' ? selectedCssClass : '') + '" href="moviesrecommended.html">' + (view == 'movies' ? selectedHtml : '') + '<span class="viewName">Movies</span></a>';
|
||||
}
|
||||
|
||||
if (counts.EpisodeCount || counts.SeriesCount) {
|
||||
html += '<a class="viewMenuLink viewMenuTextLink desktopViewMenuLink' + (view == 'tv' ? selectedCssClass : '') + '" href="tvrecommended.html">' + (view == 'tv' ? selectedHtml : '') + '<span class="viewName">TV</span></a>';
|
||||
}
|
||||
|
||||
if (liveTvServices.length) {
|
||||
html += '<a class="viewMenuLink viewMenuTextLink desktopViewMenuLink' + (view == 'livetv' ? selectedCssClass : '') + '" href="livetvchannels.html">' + (view == 'livetv' ? selectedHtml : '') + '<span class="viewName">Live TV</span></a>';
|
||||
}
|
||||
|
||||
if (counts.SongCount || counts.MusicVideoCount) {
|
||||
html += '<a class="viewMenuLink viewMenuTextLink desktopViewMenuLink' + (view == 'music' ? selectedCssClass : '') + '" href="musicrecommended.html">' + (view == 'music' ? selectedHtml : '') + '<span class="viewName">Music</span></a>';
|
||||
}
|
||||
|
||||
if (counts.GameCount) {
|
||||
html += '<a class="viewMenuLink viewMenuTextLink desktopViewMenuLink' + (view == 'games' ? selectedCssClass : '') + '" href="gamesrecommended.html">' + (view == 'games' ? selectedHtml : '') + '<span class="viewName">Games</span></a>';
|
||||
}
|
||||
|
||||
$('.viewMenuRemoteControlButton', page).before(html);
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', ".libraryPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
if (!$('.viewMenuBar', page).length) {
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
|
||||
renderHeader(page, user);
|
||||
|
||||
itemCountsPromise = itemCountsPromise || ApiClient.getItemCounts(Dashboard.getCurrentUserId());
|
||||
liveTvServicesPromise = liveTvServicesPromise || ApiClient.getLiveTvServices();
|
||||
|
||||
$.when(itemCountsPromise, liveTvServicesPromise).done(function (response1, response2) {
|
||||
|
||||
var counts = response1[0];
|
||||
var liveTvServices = response2[0];
|
||||
|
||||
insertViews(page, user, counts, liveTvServices);
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
})(window, document, jQuery);
|
||||
|
||||
})(window, document, jQuery, screen, localStorage);
|
Loading…
Add table
Add a link
Reference in a new issue