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

fix next up order

This commit is contained in:
Luke Pulverenti 2016-06-29 12:31:01 -04:00
parent b1a7dbd507
commit dc90abdf0f
7 changed files with 117 additions and 21 deletions

View file

@ -1,13 +1,6 @@
define([], function () {
function reload(page) {
Dashboard.showLoadingMsg();
loadNextUp(page, 'home-nextup');
}
function loadNextUp(page) {
function getNextUpPromise() {
var query = {
@ -18,7 +11,11 @@
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
};
ApiClient.getNextUpEpisodes(query).then(function (result) {
return ApiClient.getNextUpEpisodes(query);
}
function loadNextUp(page, promise) {
promise.then(function (result) {
if (result.Items.length) {
page.querySelector('.noNextUpItems').classList.add('hide');
@ -50,11 +47,17 @@
}
return function (view, params, tabContent) {
var self = this;
var self = this;
var nextUpPromise;
self.preRender = function () {
nextUpPromise = getNextUpPromise();
};
self.renderTab = function () {
reload(tabContent);
Dashboard.showLoadingMsg();
loadNextUp(view, nextUpPromise);
};
};

View file

@ -1,6 +1,7 @@
define(['datetime', 'scrollStyles'], function (datetime) {
function loadUpcoming(page) {
function getUpcomingPromise() {
Dashboard.showLoadingMsg();
var query = {
@ -13,7 +14,12 @@
EnableTotalRecordCount: false
};
ApiClient.getJSON(ApiClient.getUrl("Shows/Upcoming", query)).then(function (result) {
return ApiClient.getJSON(ApiClient.getUrl("Shows/Upcoming", query));
}
function loadUpcoming(page, promise) {
promise.then(function (result) {
var items = result.Items;
@ -124,11 +130,17 @@
}
return function (view, params, tabContent) {
var self = this;
var self = this;
var upcomingPromise;
self.preRender = function () {
upcomingPromise = getUpcomingPromise();
};
self.renderTab = function () {
loadUpcoming(tabContent);
Dashboard.showLoadingMsg();
loadUpcoming(view, upcomingPromise);
};
};

View file

@ -250,14 +250,13 @@
var mdlTabs = view.querySelector('.libraryViewNav');
libraryBrowser.configurePaperLibraryTabs(view, mdlTabs, view.querySelectorAll('.pageTabContent'), [0,1,2,3]);
libraryBrowser.configurePaperLibraryTabs(view, mdlTabs, view.querySelectorAll('.pageTabContent'), [0, 1, 2, 3]);
var tabControllers = [];
var renderedTabs = [];
function loadTab(page, index) {
function getTabController(page, index, callback) {
var tabContent = view.querySelector('.pageTabContent[data-index=\'' + index + '\']');
var depends = [];
switch (index) {
@ -279,12 +278,14 @@
}
require(depends, function (controllerFactory) {
var tabContent;
if (index == 0) {
tabContent = view.querySelector('.pageTabContent[data-index=\'' + index + '\']');
self.tabContent = tabContent;
}
var controller = tabControllers[index];
if (!controller) {
tabContent = view.querySelector('.pageTabContent[data-index=\'' + index + '\']');
controller = index ? new controllerFactory(view, params, tabContent) : self;
tabControllers[index] = controller;
@ -293,6 +294,24 @@
}
}
callback(controller);
});
}
function preLoadTab(page, index) {
getTabController(page, index, function (controller) {
if (renderedTabs.indexOf(index) == -1) {
if (controller.preRender) {
controller.preRender();
}
}
});
}
function loadTab(page, index) {
getTabController(page, index, function (controller) {
if (renderedTabs.indexOf(index) == -1) {
renderedTabs.push(index);
controller.renderTab();
@ -300,6 +319,10 @@
});
}
mdlTabs.addEventListener('beforetabchange', function (e) {
preLoadTab(view, parseInt(e.detail.selectedTabIndex));
});
mdlTabs.addEventListener('tabchange', function (e) {
loadTab(view, parseInt(e.detail.selectedTabIndex));
});

View file

@ -215,6 +215,11 @@
var current = LibraryBrowser.selectedTab(tabs);
tabs.selectedTabIndex = selected;
if (current == selected) {
tabs.dispatchEvent(new CustomEvent("beforetabchange", {
detail: {
selectedTabIndex: selected
}
}));
tabs.dispatchEvent(new CustomEvent("tabchange", {
detail: {
selectedTabIndex: selected
@ -289,6 +294,12 @@
var index = parseInt(link.getAttribute('data-index'));
var newPanel = panels[index];
tabs.dispatchEvent(new CustomEvent("beforetabchange", {
detail: {
selectedTabIndex: index
}
}));
// If toCenter is called syncronously within the click event, it sometimes ends up canceling it
setTimeout(function () {
@ -355,6 +366,11 @@
LibraryBrowser.selectedTab(pageTabsContainer, 0);
return;
}
pageTabsContainer.dispatchEvent(new CustomEvent("beforetabchange", {
detail: {
selectedTabIndex: LibraryBrowser.selectedTab(pageTabsContainer)
}
}));
pageTabsContainer.dispatchEvent(new CustomEvent("tabchange", {
detail: {
selectedTabIndex: LibraryBrowser.selectedTab(pageTabsContainer)

View file

@ -3028,7 +3028,7 @@ var AppInfo = {};
defineRoute({
path: '/wizardcomponents.html',
dependencies: ['dashboardcss', 'emby-button', 'emby-input'],
dependencies: ['dashboardcss', 'emby-button', 'emby-input', 'emby-select'],
autoFocus: false,
anonymous: true,
controller: 'scripts/wizardcomponents'

View file

@ -12,6 +12,12 @@
ApiClient.getSystemInfo().then(function (systemInfo) {
if (systemInfo.OperatingSystem == 'Windows') {
view.querySelector('.fldSelectEncoderPathType').classList.add('hide');
} else {
view.querySelector('.fldSelectEncoderPathType').classList.remove('hide');
}
if (systemInfo.OperatingSystem == 'Windows' && systemInfo.SystemArchitecture != 'Arm') {
view.querySelector('.suggestedLocation').innerHTML = Globalize.translate('FFmpegSuggestedDownload', '<a target="_blank" href="https://ffmpeg.zeranoe.com/builds">https://ffmpeg.zeranoe.com</a>');
@ -45,6 +51,10 @@
view.querySelector('.suggestedLocation').innerHTML = Globalize.translate('FFmpegSuggestedDownload', '<a target="_blank" href="http://ffmpeg.org">https://ffmpeg.org/download.html</a>');
view.querySelector('.downloadInstructions').innerHTML = '';
}
var selectEncoderPath = view.querySelector('#selectEncoderPath');
selectEncoderPath.value = 'Custom';
onSelectEncoderPathChange.call(selectEncoderPath);
});
}
@ -60,6 +70,30 @@
});
}
function parentWithClass(elem, className) {
while (!elem.classList || !elem.classList.contains(className)) {
elem = elem.parentNode;
if (!elem) {
return null;
}
}
return elem;
}
function onSelectEncoderPathChange(e) {
var page = parentWithClass(this, 'page');
if (this.value == 'Custom') {
page.querySelector('.fldEncoderPath').classList.remove('hide');
} else {
page.querySelector('.fldEncoderPath').classList.add('hide');
}
}
return function (view, params) {
view.querySelector('#btnSelectEncoderPath').addEventListener("click", function () {
@ -99,6 +133,7 @@
return false;
});
view.querySelector('#selectEncoderPath').addEventListener('change', onSelectEncoderPathChange);
view.addEventListener('viewbeforeshow', function (e) {

View file

@ -31,7 +31,14 @@
<div style="margin-left:.5em;">${EnterFFmpegLocation}</div>
</div>
<div class="inputContainer fldEncoderPath" style="margin-top:1em;">
<br /><br />
<div class="selectContainer fldSelectEncoderPathType hide">
<select is="emby-select" id="selectEncoderPath" label="${LabelffmpegVersion}">
<option value="System">${OptionUseSystemInstalledVersion}</option>
<option value="Custom">${OptionUseMyCustomVersion}</option>
</select>
</div>
<div class="inputContainer fldEncoderPath hide">
<div style="display: flex; align-items: center;">
<div style="flex-grow:1;">
<input is="emby-input" class="txtEncoderPath" label="${LabelffmpegPath}" autocomplete="off" required />