Move the code that resets the history state when the |showPreviousViewOnLoad| preference is set to |false|
Since this code is *only* necessary if/when the history is actually enabled, this patch refactors it to actually reflect that.
This commit is contained in:
parent
03497eabd5
commit
6091e7bd6b
@ -232,9 +232,6 @@ var PDFViewerApplication = {
|
|||||||
}),
|
}),
|
||||||
Preferences.get('showPreviousViewOnLoad').then(function resolved(value) {
|
Preferences.get('showPreviousViewOnLoad').then(function resolved(value) {
|
||||||
self.preferenceShowPreviousViewOnLoad = value;
|
self.preferenceShowPreviousViewOnLoad = value;
|
||||||
if (!value && window.history.state) {
|
|
||||||
window.history.replaceState(null, '');
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
Preferences.get('defaultZoomValue').then(function resolved(value) {
|
Preferences.get('defaultZoomValue').then(function resolved(value) {
|
||||||
self.preferenceDefaultZoomValue = value;
|
self.preferenceDefaultZoomValue = value;
|
||||||
@ -884,6 +881,9 @@ var PDFViewerApplication = {
|
|||||||
if (!PDFJS.disableHistory && !self.isViewerEmbedded) {
|
if (!PDFJS.disableHistory && !self.isViewerEmbedded) {
|
||||||
// The browsing history is only enabled when the viewer is standalone,
|
// The browsing history is only enabled when the viewer is standalone,
|
||||||
// i.e. not when it is embedded in a web page.
|
// i.e. not when it is embedded in a web page.
|
||||||
|
if (!self.preferenceShowPreviousViewOnLoad && window.history.state) {
|
||||||
|
window.history.replaceState(null, '');
|
||||||
|
}
|
||||||
PDFHistory.initialize(self.documentFingerprint, self);
|
PDFHistory.initialize(self.documentFingerprint, self);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -891,7 +891,7 @@ var PDFViewerApplication = {
|
|||||||
var storePromise = store.initializedPromise;
|
var storePromise = store.initializedPromise;
|
||||||
Promise.all([firstPagePromise, storePromise]).then(function resolved() {
|
Promise.all([firstPagePromise, storePromise]).then(function resolved() {
|
||||||
var storedHash = null;
|
var storedHash = null;
|
||||||
if (PDFViewerApplication.preferenceShowPreviousViewOnLoad &&
|
if (self.preferenceShowPreviousViewOnLoad &&
|
||||||
store.get('exists', false)) {
|
store.get('exists', false)) {
|
||||||
var pageNum = store.get('page', '1');
|
var pageNum = store.get('page', '1');
|
||||||
var zoom = self.preferenceDefaultZoomValue ||
|
var zoom = self.preferenceDefaultZoomValue ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user