Commit Graph

28 Commits

Author SHA1 Message Date
Jonas Jenwald
223c429357 Fix inconsistent spacing and trailing commas in objects in web/ files, so we can enable the comma-dangle and object-curly-spacing ESLint rules later on
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing

Given that we currently have quite inconsistent object formatting, fixing this in in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.

*Please note:* This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.

```diff
diff --git a/web/pdf_thumbnail_view.js b/web/pdf_thumbnail_view.js
index 002dbf29..1de4e530 100644
--- a/web/pdf_thumbnail_view.js
+++ b/web/pdf_thumbnail_view.js
@@ -420,8 +420,8 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
     setPageLabel: function PDFThumbnailView_setPageLabel(label) {
       this.pageLabel = (typeof label === 'string' ? label : null);

-      this.l10n.get('thumb_page_title', { page: this.pageId, }, 'Page {{page}}').
-          then((msg) => {
+      this.l10n.get('thumb_page_title', { page: this.pageId, },
+                    'Page {{page}}').then((msg) => {
         this.anchor.title = msg;
       });

diff --git a/web/secondary_toolbar.js b/web/secondary_toolbar.js
index 160e0410..6495fc5e 100644
--- a/web/secondary_toolbar.js
+++ b/web/secondary_toolbar.js
@@ -65,7 +65,8 @@ class SecondaryToolbar {
       { element: options.printButton, eventName: 'print', close: true, },
       { element: options.downloadButton, eventName: 'download', close: true, },
       { element: options.viewBookmarkButton, eventName: null, close: true, },
-      { element: options.firstPageButton, eventName: 'firstpage', close: true, },
+      { element: options.firstPageButton, eventName: 'firstpage',
+        close: true, },
       { element: options.lastPageButton, eventName: 'lastpage', close: true, },
       { element: options.pageRotateCwButton, eventName: 'rotatecw',
         close: false, },
@@ -76,7 +77,7 @@ class SecondaryToolbar {
       { element: options.cursorHandToolButton, eventName: 'switchcursortool',
         eventDetails: { tool: CursorTool.HAND, }, close: true, },
       { element: options.documentPropertiesButton,
-        eventName: 'documentproperties', close: true, }
+        eventName: 'documentproperties', close: true, },
     ];
     this.items = {
       firstPage: options.firstPageButton,
```
2017-06-01 12:47:47 +02:00
Jonas Jenwald
36c2791296 Unify handling of various cursor tools, e.g. the current Hand Tool and a possible future Zoom Tool, in a new PDFCursorTools module
With the current way that the `HandTool` is implemented, if someone would try to also add a Zoom tool (as issue 1260 asks for) that probably wouldn't work very well given that you'd then have two cursor tools which may not play nice together.
Hence this patch, which attempts to refactor things so that it should be simpler to add e.g. a Zoom tool as well (given that that issue is marked as "good-beginner-bug", and I'm not sure if that really applies considering the current state of the code).

Note that I personally have no interest in implementing a Zoom tool (similar to Adobe Reader) since I wouldn't use it, but I figured that it can't hurt to make this code a bit more future proof.
2017-05-22 00:51:01 +02:00
Tim van der Meij
67049602c5
Convert the secondary toolbar to ES6 syntax 2017-05-07 21:43:50 +02:00
Jonas Jenwald
f27b5013e2 Replace unnecessary bind(this) statements with arrow functions in web/ files
By using `let`, which is block-scoped, instead of `var` in a couple of places we're able to get rid of additional `bind` calls.
2017-05-04 17:13:09 +02:00
Yury Delendik
8e681ce3e2 Change amd to cjs path in ES6 modules 2017-04-14 10:32:36 -05:00
Jonas Jenwald
3b35c15d42 Convert the files in the /web folder to ES6 modules
Note that as discussed on IRC, this makes the viewer slightly slower to load *only* in `gulp server` mode, however the difference seem slight enough that I think it will be fine.
2017-04-09 11:55:48 +02:00
Jonas Jenwald
328e7397ea Fix errors reported by the no-extra-bind ESLint rule
http://eslint.org/docs/rules/no-extra-bind
2016-12-12 20:35:50 +01:00
Yury Delendik
a4402c84de Refactor toolbar (and secondary toolbar). 2016-11-18 12:51:15 -06:00
Jonas Jenwald
be8a69a52c Ensure that we provide the source parameter when dispatching the button click events in SecondaryToolbar (PR 7313 follow-up) 2016-09-09 08:16:10 +02:00
Jonas Jenwald
6e126b31dc Only update the max-height of the SecondaryToolbar when it's actually visible
There's really no good reason to attempt to adjust the `max-height` of the `SecondaryToolbar` when it's not visible, so let's not do that anymore.
Also, we can listen for the `resize` event in `SecondaryToolbar`, to avoid having to manually call the `max-height` adjust function from various event handlers in `app.js`. Please note that by always adjusting the `max-height` when the toolbar is opened we no longer need the `localized` event, since it was mainly used to set a correct inital `max-height` value.
2016-09-09 08:16:09 +02:00
Tim van der Meij
f4ae277355 Convert the secondary toolbar to a class 2016-05-11 20:53:39 +02:00
Yury Delendik
eb3d1ca003 Removes circular dependency of secondary toolbar on app.js. 2016-04-28 15:04:09 -05:00
Yury Delendik
b6c74f2056 Moves all document.getElementById lookups into viewer.js 2016-04-21 11:39:11 -05:00
Yury Delendik
006e8fb59d Introduces UMD headers to the web/ folder. 2016-04-13 10:09:48 -05:00
Manas
a2ba1b8189 Uses editorconfig to maintain consistent coding styles
Removes the following as they unnecessary
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
2015-11-14 07:32:18 +05:30
Tim van der Meij
6abf3d6ba3 Simplify document properties field logic
This patch:
- Simplifies the way fields are passed to the document properties overlay
- Simplifies the way fields are filled internally in the document properties overlay
- Avoids passing a document properties reference to the secondary toolbar
2015-04-27 15:25:40 +02:00
Jonas Jenwald
2dc1af8028 Break dependencies between PresentationMode and other code, and add PresentationMode related utility methods to PDFViewer
This patch:
 - Adds a couple of utility methods to `PDFViewer` to enable checking `presentationModeState` without cumbersome comparisons.

 - Disentangles `PresentationMode` from `PDFHistory` and `HandTool`, by adding event listeners for `presentationmodechanged` to both of them.

 - Adds a utility function to `PDFViewerApplication` for requesting PresentationMode.

 - Prevents initialization of `PresentationMode` if the browser does not support the fullscreen API.
2015-04-21 16:02:32 +02:00
Yury Delendik
44779f14b0 Renames and refactors PDFView to PDFViewerApplication. 2014-09-28 10:39:56 -05:00
Hengjie
eaa587753b Fix issue where pdfDocument is null
Happens when no file is loaded
2014-08-04 12:27:47 +12:00
Jonas Jenwald
5cd6dddeee Convert the existing overlays to use the OverlayManager 2014-05-25 21:33:15 +02:00
Tim van der Meij
5f7ded4ff6 Document properties 2014-01-22 00:07:07 +01:00
Tim van der Meij
e14d917161 Close the secondary toolbar when an action is only performed once 2014-01-17 12:16:43 +01:00
Rob Wu
838802c2d3 Explain meaning of elements in secondary_toolbar 2014-01-08 11:59:30 +01:00
Jonas Jenwald
bee1b734c2 A few small tweaks of the SecondaryToolbar code 2013-10-18 23:03:28 +02:00
Tim van der Meij
46d74bdc51 Decrease dependence of SecondaryToolbar on UI buttons 2013-10-17 23:49:30 +02:00
Jonas Jenwald
bfc66626a0 Move Presentation Mode related code from viewer.js to its own file 2013-10-01 23:11:46 +02:00
Jonas Jenwald
fabed80b5f Prevent trying to set the 'maxHeight' property of the secondaryToolbar before the viewer is completely loaded 2013-09-14 18:00:36 +02:00
Tim van der Meij
3c0ac37292 Secondary toolbar 2013-09-04 23:48:31 +02:00