Commit Graph

22 Commits

Author SHA1 Message Date
Jonas Jenwald
614e8cf295 Change var to let, and use object destructuring, in a couple of previously class converted web/*.js files
Note that these files were among the first to be converted to ES6 classes, so it probably makes sense to do another pass to bring them inline with the most recent ES6 conversions.
2017-07-03 11:22:49 +02:00
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
09edfb3dc0 Re-factor ViewHistory to make it properly asynchronous
Rather than having to manually use `initializedPromise`, which really ought to be a private property, to ensure that setting/getting values in the `ViewHistory` works as intended, this re-factoring simply changes all of its methods to be asynchronous.

Furthermore, a `getMultiple` method (mirroring the existing `setMultiple` one) is also added to `ViewHistory`.

Finally, this patch also addresses an existing issue, where certain preferences (e.g. the default zoom level) would be ignored when calling `setInitialView` if reading from the `ViewHistory` fails for some reason.
2017-04-27 11:49:35 +02:00
Jonas Jenwald
16b4132ebf Convert the ViewHistory to an ES6 class 2017-04-26 11:49:06 +02: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
0af42f1ca7 Rename the ViewHistory localStorage (and sessionStorage) key from database to pdfjs.history, and migrate existing data on read (issue 7760)
For consistency, I also renamed the `FIREFOX/MOZCENTRAL` sessionStorage key, but given that sessionStorage is a lot less permanent than localStorage it didn't seem necessary to migrate any existing values.

Fixes 7760.
2016-11-21 21:03:37 +01:00
Yury Delendik
0576c9c6c6 Replaces all preprocessor directives with PDFJSDev calls. 2016-10-14 10:57:53 -05:00
Yury Delendik
006e8fb59d Introduces UMD headers to the web/ folder. 2016-04-13 10:09:48 -05:00
Tim van der Meij
b8aaa24257 Convert all node make instances to gulp 2016-03-04 20:30:36 +01:00
Tim van der Meij
df81b832bb Remove unused variables 2015-12-16 23:52:16 +01: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
55870788e5 Make the view history cache size configurable during initialization 2015-11-02 14:56:50 +01:00
Tim van der Meij
7681def0de Move VIEW_HISTORY_MEMORY constant to view_history.js
Currently this constant is present in `viewer.js`, but it is not used there at all. Instead, it is used in `view_history.js` where we have a global for it. We might as well move the constant to `view_history.js` as that is the only place where it is used, thereby removing a global and an unused constant from `viewer.js`.
2015-11-01 15:45:12 +01:00
Yury Delendik
f3c3b1fc2d Removes B2G preprocessing directives. 2015-06-30 16:53:32 -05:00
Samuel Chantaraud
37c3641fad Added Promise.catch
Fixed Promise so it rejects on uncaught exception
Catch possible rejection on ViewHistory.setMultiple
2014-05-22 13:53:19 -04:00
Jonas Jenwald
ec50aa4e8c Refactor how the database is read in ViewHistory 2014-04-29 15:59:51 +02:00
Jonas Jenwald
69eafaa58f Add support for setting multiple values at once in ViewHistory 2014-04-25 22:57:01 +02:00
Jonas Jenwald
48399a3ec7 Add writeToStorage method to ViewHistory 2014-04-25 20:13:17 +02:00
Jonas Jenwald
447d115ec1 [Firefox] Workaround for sessionStorage error when the preference network.cookie.lifetimePolicy is set to 1 (bug 1000777) 2014-04-25 18:12:25 +02:00
Yury Delendik
b39f0c311c Refactors history and how the database is stored 2014-04-03 13:23:18 -05:00
Yury Delendik
5bf3e44e30 Introduces LegacyPromise; polyfills DOM Promise 2014-01-03 18:17:05 -06:00
Jonas Jenwald
4bd9767112 Rename 'Settings' to 'ViewHistory' 2013-12-22 00:07:42 +01:00