[Pkg-javascript-commits] [pdf.js] 31/119: Move the code that resets the history state when the |showPreviousViewOnLoad| preference is set to |false|

David Prévot taffit at moszumanska.debian.org
Wed May 13 21:27:38 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 6091e7bd6bdd41e80a4d49abf2054d4e9e56eb45
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Tue Mar 31 17:14:08 2015 +0200

    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.
---
 web/viewer.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/web/viewer.js b/web/viewer.js
index fe3b226..5b11a14 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -232,9 +232,6 @@ var PDFViewerApplication = {
       }),
       Preferences.get('showPreviousViewOnLoad').then(function resolved(value) {
         self.preferenceShowPreviousViewOnLoad = value;
-        if (!value && window.history.state) {
-          window.history.replaceState(null, '');
-        }
       }),
       Preferences.get('defaultZoomValue').then(function resolved(value) {
         self.preferenceDefaultZoomValue = value;
@@ -884,6 +881,9 @@ var PDFViewerApplication = {
       if (!PDFJS.disableHistory && !self.isViewerEmbedded) {
         // The browsing history is only enabled when the viewer is standalone,
         // 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);
       }
     });
@@ -891,7 +891,7 @@ var PDFViewerApplication = {
     var storePromise = store.initializedPromise;
     Promise.all([firstPagePromise, storePromise]).then(function resolved() {
       var storedHash = null;
-      if (PDFViewerApplication.preferenceShowPreviousViewOnLoad &&
+      if (self.preferenceShowPreviousViewOnLoad &&
           store.get('exists', false)) {
         var pageNum = store.get('page', '1');
         var zoom = self.preferenceDefaultZoomValue ||

-- 
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