mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #2889 from dmitrylyzo/fix-dialog-history
Fix dialog history
This commit is contained in:
commit
5b05db5403
6 changed files with 22 additions and 20 deletions
|
@ -25,6 +25,7 @@ class AppRouter {
|
||||||
msgTimeout;
|
msgTimeout;
|
||||||
popstateOccurred = false;
|
popstateOccurred = false;
|
||||||
resolveOnNextShow;
|
resolveOnNextShow;
|
||||||
|
previousRoute = {};
|
||||||
/**
|
/**
|
||||||
* Pages of "no return" (when "Go back" should behave differently, probably quitting the application).
|
* Pages of "no return" (when "Go back" should behave differently, probably quitting the application).
|
||||||
*/
|
*/
|
||||||
|
@ -633,8 +634,13 @@ class AppRouter {
|
||||||
getHandler(route) {
|
getHandler(route) {
|
||||||
return (ctx, next) => {
|
return (ctx, next) => {
|
||||||
ctx.isBack = this.popstateOccurred;
|
ctx.isBack = this.popstateOccurred;
|
||||||
this.handleRoute(ctx, next, route);
|
|
||||||
this.popstateOccurred = false;
|
this.popstateOccurred = false;
|
||||||
|
|
||||||
|
const ignore = route.dummyRoute === true || this.previousRoute.dummyRoute === true;
|
||||||
|
this.previousRoute = route;
|
||||||
|
if (ignore) return;
|
||||||
|
|
||||||
|
this.handleRoute(ctx, next, route);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ import '../../assets/css/scrollstyles.scss';
|
||||||
animateDialogOpen(dlg);
|
animateDialogOpen(dlg);
|
||||||
|
|
||||||
if (isHistoryEnabled(dlg)) {
|
if (isHistoryEnabled(dlg)) {
|
||||||
appRouter.pushState({ dialogId: hash }, 'Dialog', `#${hash}`);
|
appRouter.show('/dialog', { dialogId: hash });
|
||||||
|
|
||||||
window.addEventListener('popstate', onHashChange);
|
window.addEventListener('popstate', onHashChange);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -41,8 +41,7 @@ function showQualityMenu(player, btn) {
|
||||||
|
|
||||||
return actionsheet.show({
|
return actionsheet.show({
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: btn,
|
positionTo: btn
|
||||||
enableHistory: false
|
|
||||||
}).then(function (id) {
|
}).then(function (id) {
|
||||||
const bitrate = parseInt(id);
|
const bitrate = parseInt(id);
|
||||||
if (bitrate !== selectedBitrate) {
|
if (bitrate !== selectedBitrate) {
|
||||||
|
@ -78,8 +77,7 @@ function showRepeatModeMenu(player, btn) {
|
||||||
|
|
||||||
return actionsheet.show({
|
return actionsheet.show({
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: btn,
|
positionTo: btn
|
||||||
enableHistory: false
|
|
||||||
}).then(function (mode) {
|
}).then(function (mode) {
|
||||||
if (mode) {
|
if (mode) {
|
||||||
playbackManager.setRepeatMode(mode, player);
|
playbackManager.setRepeatMode(mode, player);
|
||||||
|
@ -140,8 +138,7 @@ function showAspectRatioMenu(player, btn) {
|
||||||
|
|
||||||
return actionsheet.show({
|
return actionsheet.show({
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: btn,
|
positionTo: btn
|
||||||
enableHistory: false
|
|
||||||
}).then(function (id) {
|
}).then(function (id) {
|
||||||
if (id) {
|
if (id) {
|
||||||
playbackManager.setAspectRatio(id, player);
|
playbackManager.setAspectRatio(id, player);
|
||||||
|
@ -163,8 +160,7 @@ function showPlaybackRateMenu(player, btn) {
|
||||||
|
|
||||||
return actionsheet.show({
|
return actionsheet.show({
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: btn,
|
positionTo: btn
|
||||||
enableHistory: false
|
|
||||||
}).then(function (id) {
|
}).then(function (id) {
|
||||||
if (id) {
|
if (id) {
|
||||||
playbackManager.setPlaybackRate(id, player);
|
playbackManager.setPlaybackRate(id, player);
|
||||||
|
@ -241,8 +237,7 @@ function showWithUser(options, player, user) {
|
||||||
|
|
||||||
return actionsheet.show({
|
return actionsheet.show({
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: options.positionTo,
|
positionTo: options.positionTo
|
||||||
enableHistory: false
|
|
||||||
}).then(function (id) {
|
}).then(function (id) {
|
||||||
return handleSelectedOption(id, options, player);
|
return handleSelectedOption(id, options, player);
|
||||||
});
|
});
|
||||||
|
|
|
@ -63,8 +63,7 @@ class GroupSelectionMenu {
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: button,
|
positionTo: button,
|
||||||
resolveOnClick: true,
|
resolveOnClick: true,
|
||||||
border: true,
|
border: true
|
||||||
enableHistory: false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
actionsheet.show(menuOptions).then(function (id) {
|
actionsheet.show(menuOptions).then(function (id) {
|
||||||
|
@ -133,8 +132,7 @@ class GroupSelectionMenu {
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: button,
|
positionTo: button,
|
||||||
resolveOnClick: true,
|
resolveOnClick: true,
|
||||||
border: true,
|
border: true
|
||||||
enableHistory: false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
actionsheet.show(menuOptions).then(function (id) {
|
actionsheet.show(menuOptions).then(function (id) {
|
||||||
|
|
|
@ -903,8 +903,7 @@ import { appRouter } from '../../../components/appRouter';
|
||||||
actionsheet.show({
|
actionsheet.show({
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
title: globalize.translate('Audio'),
|
title: globalize.translate('Audio'),
|
||||||
positionTo: positionTo,
|
positionTo: positionTo
|
||||||
enableHistory: false
|
|
||||||
}).then(function (id) {
|
}).then(function (id) {
|
||||||
const index = parseInt(id);
|
const index = parseInt(id);
|
||||||
|
|
||||||
|
@ -950,8 +949,7 @@ import { appRouter } from '../../../components/appRouter';
|
||||||
actionsheet.show({
|
actionsheet.show({
|
||||||
title: globalize.translate('Subtitles'),
|
title: globalize.translate('Subtitles'),
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: positionTo,
|
positionTo: positionTo
|
||||||
enableHistory: false
|
|
||||||
}).then(function (id) {
|
}).then(function (id) {
|
||||||
const index = parseInt(id);
|
const index = parseInt(id);
|
||||||
|
|
||||||
|
|
|
@ -560,6 +560,11 @@ import { appRouter } from '../components/appRouter';
|
||||||
serverRequest: true
|
serverRequest: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
defineRoute({
|
||||||
|
path: '/dialog',
|
||||||
|
dummyRoute: true
|
||||||
|
});
|
||||||
|
|
||||||
defineRoute({
|
defineRoute({
|
||||||
path: '',
|
path: '',
|
||||||
isDefaultRoute: true,
|
isDefaultRoute: true,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue