mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
split up home page scripts
This commit is contained in:
parent
42ff117d72
commit
ceeb569571
5 changed files with 50 additions and 54 deletions
|
@ -5,7 +5,7 @@
|
|||
</head>
|
||||
<body>
|
||||
|
||||
<div id="indexPage" data-role="page" class="page homePage libraryPage allLibraryPage backdropPage pageWithAbsoluteTabs" data-title="${ButtonHome}" data-backdroptype="movie,series,game,book" data-require="scripts/sections,scripts/indexpage,scripts/homenextup,scripts/favorites,scripts/homeupcoming,paperbuttonstyle">
|
||||
<div id="indexPage" data-role="page" class="page homePage libraryPage allLibraryPage backdropPage pageWithAbsoluteTabs" data-title="${ButtonHome}" data-backdroptype="movie,series,game,book" data-require="scripts/indexpage">
|
||||
|
||||
<div class="libraryViewNav libraryViewNavWithMinHeight">
|
||||
<paper-tabs style="display:none;">
|
||||
|
@ -26,7 +26,7 @@
|
|||
<div class="ehsContent fullWidth">
|
||||
<neon-animated-pages>
|
||||
<neon-animatable>
|
||||
<div class="pageTabContent homeTabContent">
|
||||
<div class="pageTabContent homeTabContent" data-index="0">
|
||||
<div class="ui-bar-b readOnlyContent welcomeMessage" style="display: none; padding: 2em; border-radius: 10px; margin: 2em auto; font-weight: normal;">
|
||||
<h1 style="margin-top: 0;" class="tourHeader"></h1>
|
||||
<p>
|
||||
|
@ -38,7 +38,7 @@
|
|||
</div>
|
||||
</neon-animatable>
|
||||
<neon-animatable>
|
||||
<div class="pageTabContent homeNextUpTabContent">
|
||||
<div class="pageTabContent homeNextUpTabContent" data-index="1">
|
||||
<div class="homePageSection">
|
||||
<div>
|
||||
<h1 class="listHeader nextUpHeader" style="display:inline-block;vertical-align:middle;">${HeaderNextUp}</h1>
|
||||
|
@ -51,12 +51,12 @@
|
|||
</div>
|
||||
</neon-animatable>
|
||||
<neon-animatable>
|
||||
<div class="pageTabContent homeFavoritesTabContent">
|
||||
<div class="pageTabContent homeFavoritesTabContent" data-index="2">
|
||||
<div class="sections"></div>
|
||||
</div>
|
||||
</neon-animatable>
|
||||
<neon-animatable>
|
||||
<div class="pageTabContent homeUpcomingTabContent">
|
||||
<div class="pageTabContent homeUpcomingTabContent" data-index="3">
|
||||
<div id="upcomingItems">
|
||||
</div>
|
||||
<div class="noItemsMessage" style="display: none;">
|
||||
|
|
|
@ -141,20 +141,10 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinitdepends', "#indexPage", function () {
|
||||
|
||||
var page = this;
|
||||
var tabContent = page.querySelector('.homeFavoritesTabContent');
|
||||
|
||||
$(page.querySelector('neon-animated-pages')).on('tabchange', function () {
|
||||
|
||||
if (parseInt(this.selected) == 2) {
|
||||
window.HomePage.renderFavorites = function (page, tabContent) {
|
||||
if (LibraryBrowser.needsRefresh(tabContent)) {
|
||||
loadSections(tabContent, Dashboard.getCurrentUserId());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery, document);
|
|
@ -78,20 +78,10 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinitdepends', "#indexPage", function () {
|
||||
|
||||
var page = this;
|
||||
var tabContent = page.querySelector('.homeNextUpTabContent');
|
||||
|
||||
$(page.querySelector('neon-animated-pages')).on('tabchange', function () {
|
||||
|
||||
if (parseInt(this.selected) == 1) {
|
||||
window.HomePage.renderNextUp = function (page, tabContent) {
|
||||
if (LibraryBrowser.needsRefresh(tabContent)) {
|
||||
|
||||
reload(tabContent);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery, document);
|
|
@ -120,20 +120,10 @@
|
|||
ImageLoader.lazyChildren(elem);
|
||||
}
|
||||
|
||||
$(document).on('pageinitdepends', "#indexPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$(page.querySelector('neon-animated-pages')).on('tabchange', function () {
|
||||
|
||||
if (parseInt(this.selected) == 3) {
|
||||
var tabContent = page.querySelector('.homeUpcomingTabContent');
|
||||
|
||||
window.HomePage.renderUpcoming = function (page, tabContent) {
|
||||
if (LibraryBrowser.needsRefresh(tabContent)) {
|
||||
loadUpcoming(tabContent);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery, document);
|
|
@ -164,9 +164,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
function loadHomeTab(page) {
|
||||
|
||||
var tabContent = page.querySelector('.homeTabContent');
|
||||
function loadHomeTab(page, tabContent) {
|
||||
|
||||
if (LibraryBrowser.needsRefresh(tabContent)) {
|
||||
if (window.ApiClient) {
|
||||
|
@ -196,14 +194,38 @@
|
|||
|
||||
function loadTab(page, index) {
|
||||
|
||||
var tabContent = page.querySelector('.pageTabContent[data-index=\'' + index + '\']');
|
||||
var depends = [];
|
||||
var scope = 'HomePage';
|
||||
var method = '';
|
||||
|
||||
switch (index) {
|
||||
|
||||
case 0:
|
||||
loadHomeTab(page);
|
||||
depends.push('scripts/sections');
|
||||
method = 'renderHomeTab';
|
||||
break;
|
||||
case 1:
|
||||
depends.push('scripts/homenextup');
|
||||
method = 'renderNextUp';
|
||||
break;
|
||||
case 2:
|
||||
depends.push('scripts/favorites');
|
||||
method = 'renderFavorites';
|
||||
break;
|
||||
case 3:
|
||||
depends.push('scripts/homeupcoming');
|
||||
method = 'renderUpcoming';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
require(depends, function () {
|
||||
|
||||
window[scope][method](page, tabContent);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinitdepends', "#indexPage", function () {
|
||||
|
@ -248,4 +270,8 @@
|
|||
});
|
||||
}
|
||||
|
||||
window.HomePage = {
|
||||
renderHomeTab: loadHomeTab
|
||||
};
|
||||
|
||||
})(jQuery, document);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue