1
0
Fork 0
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:
Luke Pulverenti 2016-09-02 00:11:10 -04:00
parent 96a169fb05
commit 2737d1f9f9
39 changed files with 97 additions and 139 deletions

View file

@ -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();
});