[Pkg-javascript-commits] [pdf.js] 08/109: Prevent switching to disabled views (i.e. outline or attachments) in the sidebar
David Prévot
taffit at moszumanska.debian.org
Fri Sep 25 03:04:11 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 f063c78cbf8e93608457b7c1d357ead003a030b2
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Fri Aug 7 13:20:14 2015 +0200
Prevent switching to disabled views (i.e. outline or attachments) in the sidebar
Currently in `switchSidebarView` there is code that attempts to handle the `outline` or `attachments` being disabled. However, given the placement of it, that code does not actually accomplish anything. Even more strange is the fact that the way that the buttons are disabled, that code won't ever be hit.
(Looking back with `git blame`, it seems that it has never worked as you'd expect.)
Hence this patch, which correctly disables switching to the `outline` or `attachments` views when they are disabled.
Once PR 6314 restores the 'pagemode' hash parameter, this patch thus makes it impossible to switch to a disabled sidebar view by modifying the 'pagemode' hash of an already loaded document.
---
web/viewer.js | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/web/viewer.js b/web/viewer.js
index cbeda49..d0a2e16 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -1040,29 +1040,27 @@ var PDFViewerApplication = {
break;
case 'outline':
+ if (outlineButton.disabled) {
+ return;
+ }
thumbsButton.classList.remove('toggled');
outlineButton.classList.add('toggled');
attachmentsButton.classList.remove('toggled');
thumbsView.classList.add('hidden');
outlineView.classList.remove('hidden');
attachmentsView.classList.add('hidden');
-
- if (outlineButton.getAttribute('disabled')) {
- return;
- }
break;
case 'attachments':
+ if (attachmentsButton.disabled) {
+ return;
+ }
thumbsButton.classList.remove('toggled');
outlineButton.classList.remove('toggled');
attachmentsButton.classList.add('toggled');
thumbsView.classList.add('hidden');
outlineView.classList.add('hidden');
attachmentsView.classList.remove('hidden');
-
- if (attachmentsButton.getAttribute('disabled')) {
- return;
- }
break;
}
},
--
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