mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #5666 from ConnorS1110/update-up-next-dialog-text
Update up-next text when auto play next episode is disabled
This commit is contained in:
commit
e92b9f0adc
2 changed files with 18 additions and 8 deletions
|
@ -6,6 +6,7 @@ import layoutManager from '../layoutManager';
|
||||||
import focusManager from '../focusManager';
|
import focusManager from '../focusManager';
|
||||||
import globalize from '../../scripts/globalize';
|
import globalize from '../../scripts/globalize';
|
||||||
import itemHelper from '../itemHelper';
|
import itemHelper from '../itemHelper';
|
||||||
|
import ServerConnections from '../ServerConnections';
|
||||||
import './upnextdialog.scss';
|
import './upnextdialog.scss';
|
||||||
import '../../elements/emby-button/emby-button';
|
import '../../elements/emby-button/emby-button';
|
||||||
import '../../styles/flexstyles.scss';
|
import '../../styles/flexstyles.scss';
|
||||||
|
@ -54,9 +55,9 @@ function setNextVideoText() {
|
||||||
|
|
||||||
const timeText = '<span class="upNextDialog-countdownText">' + globalize.translate('HeaderSecondsValue', secondsRemaining) + '</span>';
|
const timeText = '<span class="upNextDialog-countdownText">' + globalize.translate('HeaderSecondsValue', secondsRemaining) + '</span>';
|
||||||
|
|
||||||
const nextVideoText = instance.itemType === 'Episode' ?
|
const nextVideoText = instance.showStaticNextText ?
|
||||||
globalize.translate('HeaderNextEpisodePlayingInValue', timeText) :
|
globalize.translate('HeaderNextItem', globalize.translate(instance.itemType)) :
|
||||||
globalize.translate('HeaderNextVideoPlayingInValue', timeText);
|
globalize.translate('HeaderNextItemPlayingInValue', globalize.translate(instance.itemType), timeText);
|
||||||
|
|
||||||
elem.querySelector('.upNextDialog-nextVideoText').innerHTML = nextVideoText;
|
elem.querySelector('.upNextDialog-nextVideoText').innerHTML = nextVideoText;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +105,9 @@ async function onStartNowClick() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function init(instance, options) {
|
async function init(instance, options) {
|
||||||
|
instance.showStaticNextText = await showStaticNextText(options.nextItem);
|
||||||
|
|
||||||
options.parent.innerHTML = getHtml();
|
options.parent.innerHTML = getHtml();
|
||||||
|
|
||||||
options.parent.classList.add('hide');
|
options.parent.classList.add('hide');
|
||||||
|
@ -199,12 +202,19 @@ function startComingUpNextHideTimer(instance) {
|
||||||
setNextVideoText.call(instance);
|
setNextVideoText.call(instance);
|
||||||
clearCountdownTextTimeout(instance);
|
clearCountdownTextTimeout(instance);
|
||||||
|
|
||||||
instance._countdownTextTimeout = setInterval(setNextVideoText.bind(instance), 400);
|
if (!instance.showStaticNextText) instance._countdownTextTimeout = setInterval(setNextVideoText.bind(instance), 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function showStaticNextText(nextItem) {
|
||||||
|
const apiClient = ServerConnections.getApiClient(nextItem);
|
||||||
|
const currentUser = await apiClient.getCurrentUser();
|
||||||
|
return !currentUser.Configuration.EnableNextEpisodeAutoPlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
class UpNextDialog {
|
class UpNextDialog {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
this.showStaticNextText = false; // default to showing countdown text
|
||||||
|
|
||||||
init(this, options);
|
init(this, options);
|
||||||
}
|
}
|
||||||
|
@ -235,9 +245,9 @@ class UpNextDialog {
|
||||||
hideComingUpNext.call(this);
|
hideComingUpNext.call(this);
|
||||||
|
|
||||||
this.options = null;
|
this.options = null;
|
||||||
|
this.showStaticNextText = false;
|
||||||
this.itemType = null;
|
this.itemType = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default UpNextDialog;
|
export default UpNextDialog;
|
||||||
|
|
||||||
|
|
|
@ -441,8 +441,8 @@
|
||||||
"HeaderNewApiKey": "New API Key",
|
"HeaderNewApiKey": "New API Key",
|
||||||
"HeaderNewDevices": "New Devices",
|
"HeaderNewDevices": "New Devices",
|
||||||
"HeaderNewRepository": "New Repository",
|
"HeaderNewRepository": "New Repository",
|
||||||
"HeaderNextEpisodePlayingInValue": "Next Episode Playing in {0}",
|
"HeaderNextItem": "Next {0}",
|
||||||
"HeaderNextVideoPlayingInValue": "Next Video Playing in {0}",
|
"HeaderNextItemPlayingInValue": "Next {0} Playing in {1}",
|
||||||
"HeaderNoLyrics": "No lyrics found",
|
"HeaderNoLyrics": "No lyrics found",
|
||||||
"HeaderOnNow": "On Now",
|
"HeaderOnNow": "On Now",
|
||||||
"HeaderOtherItems": "Other Items",
|
"HeaderOtherItems": "Other Items",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue