mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fixes #1958 - Title does not reset on home browse (Web Interface)
This commit is contained in:
parent
96a169fb05
commit
2737d1f9f9
39 changed files with 97 additions and 139 deletions
|
@ -203,7 +203,7 @@ define(['loading', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'b
|
|||
return;
|
||||
//}
|
||||
}
|
||||
viewManager.tryRestoreView(currentRequest).then(function () {
|
||||
viewManager.tryRestoreView(currentRequest, function () {
|
||||
|
||||
// done
|
||||
currentRouteInfo = {
|
||||
|
@ -211,7 +211,12 @@ define(['loading', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'b
|
|||
path: ctx.path
|
||||
};
|
||||
|
||||
}, onNewViewNeeded);
|
||||
}).catch(function (result) {
|
||||
|
||||
if (!result || !result.cancelled) {
|
||||
onNewViewNeeded();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var firstConnectionResult;
|
||||
|
|
|
@ -35,8 +35,6 @@ define(['viewcontainer', 'focusManager', 'queryString', 'layoutManager'], functi
|
|||
|
||||
function onViewChange(view, options, isRestore) {
|
||||
|
||||
var viewType = options.type;
|
||||
|
||||
var lastView = currentView;
|
||||
if (lastView) {
|
||||
dispatchViewEvent(lastView, 'viewhide');
|
||||
|
@ -123,67 +121,54 @@ define(['viewcontainer', 'focusManager', 'queryString', 'layoutManager'], functi
|
|||
//events.on(connectionManager, 'localusersignedin', resetCachedViews);
|
||||
//events.on(connectionManager, 'localusersignedout', resetCachedViews);
|
||||
|
||||
function tryRestoreInternal(viewcontainer, options, resolve, reject) {
|
||||
function ViewManager() {
|
||||
}
|
||||
|
||||
ViewManager.prototype.loadView = function (options) {
|
||||
|
||||
var lastView = currentView;
|
||||
|
||||
// Record the element that has focus
|
||||
if (lastView) {
|
||||
lastView.activeElement = document.activeElement;
|
||||
}
|
||||
|
||||
if (options.cancel) {
|
||||
return;
|
||||
}
|
||||
|
||||
viewcontainer.tryRestoreView(options).then(function (view) {
|
||||
viewcontainer.loadView(options).then(function (view) {
|
||||
|
||||
onViewChange(view, options);
|
||||
});
|
||||
};
|
||||
|
||||
ViewManager.prototype.tryRestoreView = function (options, onViewChanging) {
|
||||
|
||||
if (options.cancel) {
|
||||
return Promise.reject({ cancelled: true });
|
||||
}
|
||||
|
||||
// Record the element that has focus
|
||||
if (currentView) {
|
||||
currentView.activeElement = document.activeElement;
|
||||
}
|
||||
|
||||
return viewcontainer.tryRestoreView(options).then(function (view) {
|
||||
|
||||
onViewChanging();
|
||||
onViewChange(view, options, true);
|
||||
resolve();
|
||||
|
||||
}, reject);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function ViewManager() {
|
||||
ViewManager.prototype.currentView = function () {
|
||||
return currentView;
|
||||
};
|
||||
|
||||
var self = this;
|
||||
|
||||
self.loadView = function (options) {
|
||||
|
||||
var lastView = currentView;
|
||||
|
||||
// Record the element that has focus
|
||||
if (lastView) {
|
||||
lastView.activeElement = document.activeElement;
|
||||
}
|
||||
|
||||
if (options.cancel) {
|
||||
return;
|
||||
}
|
||||
|
||||
viewcontainer.loadView(options).then(function (view) {
|
||||
|
||||
onViewChange(view, options);
|
||||
});
|
||||
};
|
||||
|
||||
self.tryRestoreView = function (options) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
if (options.cancel) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Record the element that has focus
|
||||
if (currentView) {
|
||||
currentView.activeElement = document.activeElement;
|
||||
}
|
||||
|
||||
tryRestoreInternal(viewcontainer, options, resolve, reject);
|
||||
});
|
||||
};
|
||||
|
||||
self.currentView = function () {
|
||||
return currentView;
|
||||
};
|
||||
|
||||
self.dispatchPageEvents = function (value) {
|
||||
dispatchPageEvents = value;
|
||||
};
|
||||
}
|
||||
ViewManager.prototype.dispatchPageEvents = function (value) {
|
||||
dispatchPageEvents = value;
|
||||
};
|
||||
|
||||
return new ViewManager();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue