[Pkg-javascript-commits] [pdf.js] 29/72: Reset state upon load if showPreviousViewOnLoad
David Prévot
taffit at moszumanska.debian.org
Wed Mar 18 20:15:57 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 6a16d7dd44fb32dac6280a80554e2317e84b9cb9
Author: Rob Wu <rob at robwu.nl>
Date: Tue Jan 27 23:57:46 2015 +0100
Reset state upon load if showPreviousViewOnLoad
And moved showPreviousViewOnLoad up to PDFViewerApplication.initialize
---
web/viewer.js | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/web/viewer.js b/web/viewer.js
index d47962d..f2e5950 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -108,6 +108,7 @@ var PDFViewerApplication = {
mouseScrollDelta: 0,
preferenceSidebarViewOnLoad: SidebarView.NONE,
preferencePdfBugEnabled: false,
+ preferenceShowPreviousViewOnLoad: true,
isViewerEmbedded: (window.parent !== window),
url: '',
@@ -226,6 +227,12 @@ var PDFViewerApplication = {
Preferences.get('pdfBugEnabled').then(function resolved(value) {
self.preferencePdfBugEnabled = value;
}),
+ Preferences.get('showPreviousViewOnLoad').then(function resolved(value) {
+ self.preferenceShowPreviousViewOnLoad = value;
+ if (!value && window.history.state) {
+ window.history.replaceState(null, '');
+ }
+ }),
Preferences.get('disableTextLayer').then(function resolved(value) {
if (PDFJS.disableTextLayer === true) {
return;
@@ -250,6 +257,7 @@ var PDFViewerApplication = {
Preferences.get('useOnlyCssZoom').then(function resolved(value) {
PDFJS.useOnlyCssZoom = value;
})
+
// TODO move more preferences and other async stuff here
]).catch(function (reason) { });
@@ -894,11 +902,6 @@ var PDFViewerApplication = {
});
// Fetch the necessary preference values.
- var showPreviousViewOnLoad;
- var showPreviousViewOnLoadPromise =
- Preferences.get('showPreviousViewOnLoad').then(function (prefValue) {
- showPreviousViewOnLoad = prefValue;
- });
var defaultZoomValue;
var defaultZoomValuePromise =
Preferences.get('defaultZoomValue').then(function (prefValue) {
@@ -906,10 +909,11 @@ var PDFViewerApplication = {
});
var storePromise = store.initializedPromise;
- Promise.all([firstPagePromise, storePromise, showPreviousViewOnLoadPromise,
- defaultZoomValuePromise]).then(function resolved() {
+ Promise.all([firstPagePromise, storePromise, defaultZoomValuePromise]).then(
+ function resolved() {
var storedHash = null;
- if (showPreviousViewOnLoad && store.get('exists', false)) {
+ if (PDFViewerApplication.preferenceShowPreviousViewOnLoad &&
+ store.get('exists', false)) {
var pageNum = store.get('page', '1');
var zoom = defaultZoomValue ||
store.get('zoom', self.pdfViewer.currentScale);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list