pdf.js/web
Jonas Jenwald 4773bf6fcb Add support for updating the document hash, off by default, when the browser history is updated (issue 5753)
This is *really* the best that we can do here, since other proposed solutions would interfere with (and break) the painstakingly implemented browsing history that's present in the default viewer.

I'm still not convinced that this is a good idea in general, but this patch implements it in a way where it is possible to toggle[1] for users that wish to have this feature. In particular, there's a couple of reasons why I'm not finding this feature necessary/great:
 - It's already possible to easily obtain the current hash, by simply clicking on the `viewBookmark` button at any time.
 - Hash changes requires a bit of special handling[2], i.e. extra code, to prevent issues when the browser history is traversed (see `PDFHistory._popState`). Currently this is only necessary when the user has manually changed the hash, with this patch it will always be the case (assuming the feature is active).
 - It's not always possible to change the URL when updating the browser history. For example: In the Firefox built-in viewer, the URL cannot be modified for local files (i.e. those using the `file://` protocol).
This leads to inconsistent behaviour, and may in some cases even result in errors being thrown and the history thus not updating, if the browser prevents changes to the URL during `pushState`/`replaceState` calls.

---
[1] Using the `historyUpdateUrl` viewer preference.

[2] This depends, to a great extent, on browsers always firing `popstate` events *before* `hashchange` events, which may or may not actually be guaranteed.
2019-01-06 20:09:02 +01:00
..
images Add spread modes to web viewer 2018-05-14 23:10:32 -04:00
.eslintrc Enable eslint-plugin-import to prevent unresolved paths 2018-11-23 13:50:28 +01:00
.gitignore Remove obselete file from .gitignore 2015-01-26 16:44:45 +01:00
annotation_layer_builder.css Add support of Ink annotation 2018-10-03 00:28:49 +02:00
annotation_layer_builder.js Move the imageResourcesPath option to a BaseViewer/PDFPageView/AnnotationLayerBuilder option 2018-02-13 14:28:38 +01:00
app_options.js Add support for updating the document hash, off by default, when the browser history is updated (issue 5753) 2019-01-06 20:09:02 +01:00
app.js Add support for updating the document hash, off by default, when the browser history is updated (issue 5753) 2019-01-06 20:09:02 +01:00
base_viewer.js [api-minor] Change the getViewport method, on PDFPageProxy, to take a parameter object rather than a bunch of (randomly) ordered parameters 2018-12-21 11:55:20 +01:00
chrome-i18n-allow-access-to-file-urls.json Add translations of "Allow access to file URLs" 2015-08-14 18:59:55 +02:00
chromecom.js Refactor the Preferences classes to utilize async methods rather than manually returning Promises 2018-09-03 09:52:36 +02:00
compressed.tracemonkey-pldi-09.pdf Add Makefile. Move some files around to make building the website easier. 2011-07-05 10:53:57 -07:00
debugger.js Replace String.prototype.substr() occurrences with String.prototype.substring() 2018-09-28 11:41:07 +02:00
default_preferences.json Add support for updating the document hash, off by default, when the browser history is updated (issue 5753) 2019-01-06 20:09:02 +01:00
download_manager.js Stop exposing the URL polyfill in the global scope 2018-07-04 09:16:28 +02:00
firefox_print_service.js [api-minor] Change the getViewport method, on PDFPageProxy, to take a parameter object rather than a bunch of (randomly) ordered parameters 2018-12-21 11:55:20 +01:00
firefoxcom.js Convert PDFDataRangeTransport to an ES6 class 2018-10-20 17:15:27 +02:00
genericcom.js Refactor the Preferences classes to utilize async methods rather than manually returning Promises 2018-09-03 09:52:36 +02:00
genericl10n.js Refactor the IL10n implementations to utilize async methods rather than manually returning Promises 2018-09-03 09:52:36 +02:00
grab_to_pan.js Enable the no-var ESLint rule in the /web folder 2017-11-05 16:53:47 +01:00
interfaces.js Add support for updating the document hash, off by default, when the browser history is updated (issue 5753) 2019-01-06 20:09:02 +01:00
overlay_manager.js Refactor the OverlayManager to utilize async methods rather than manually returning Promises 2018-09-03 09:52:36 +02:00
password_prompt.js Change var to let, and use object destructuring, in a couple of previously class converted web/*.js files 2017-07-03 11:22:49 +02:00
pdf_attachment_viewer.js Move the disableCreateObjectURL option from the global PDFJS object and into getDocument instead 2018-03-01 18:11:17 +01:00
pdf_cursor_tools.js Simplify resetting of the SecondaryToolbar Scroll/Spread mode buttons, and add a missing comment in PDFCursorTools 2018-07-08 10:55:56 +02:00
pdf_document_properties.js Implement the setDocument method for the find controller 2018-09-30 16:57:40 +02:00
pdf_find_bar.js Convert some occurrences, in the /web folder, of classList.{add, remove} to classList.toggle with the "force" parameter 2018-10-12 15:41:11 +02:00
pdf_find_controller.js Merge pull request #10231 from Snuffleupagus/find-no-scroll-highlightAll 2018-11-10 20:37:47 +01:00
pdf_find_utils.js Add initial support for "Whole words" searching in the viewer 2018-09-10 11:59:29 +02:00
pdf_history.js Add support for updating the document hash, off by default, when the browser history is updated (issue 5753) 2019-01-06 20:09:02 +01:00
pdf_link_service.js For repeated 'findagain' operations, attempt to reset the search position if the user has e.g. scrolled in the document (issue 4141) 2018-11-03 12:03:11 +01:00
pdf_outline_viewer.js Attempt to simplify the signature of the PDFSidebar constructor, by moving the eventBus parameter from the options object and removing the PDFOutlineViewer dependency 2018-10-02 13:14:11 +02:00
pdf_page_view.js [api-minor] Change the getViewport method, on PDFPageProxy, to take a parameter object rather than a bunch of (randomly) ordered parameters 2018-12-21 11:55:20 +01:00
pdf_presentation_mode.js Add source parameters to all remaining EventBus.dispatch calls that are currently missing those 2018-08-30 10:39:32 +02:00
pdf_print_service.js [api-minor] Change the getViewport method, on PDFPageProxy, to take a parameter object rather than a bunch of (randomly) ordered parameters 2018-12-21 11:55:20 +01:00
pdf_rendering_queue.js Replace a few occurences of var with let in already ES6 converted web/ files 2017-10-22 16:23:38 +02:00
pdf_sidebar_resizer.js Only resize the sidebar with the left mouse button 2017-12-02 19:05:17 +01:00
pdf_sidebar.js Attempt to simplify the signature of the PDFSidebar constructor, by moving the eventBus parameter from the options object and removing the PDFOutlineViewer dependency 2018-10-02 13:14:11 +02:00
pdf_single_page_viewer.js Add a helper method for _getVisiblePages, in BaseViewer, for the case where only a single page is displayed in the viewer 2018-10-28 14:59:31 +01:00
pdf_thumbnail_view.js [api-minor] Change the getViewport method, on PDFPageProxy, to take a parameter object rather than a bunch of (randomly) ordered parameters 2018-12-21 11:55:20 +01:00
pdf_thumbnail_viewer.js [api-minor] Change the getViewport method, on PDFPageProxy, to take a parameter object rather than a bunch of (randomly) ordered parameters 2018-12-21 11:55:20 +01:00
pdf_viewer.component.js Remove the attachDOMEventsToEventBus functionality, since EventBus instances are able to re-dispatch events to the DOM (PR 10019, bug 1492849 follow-up) 2018-10-31 23:32:39 +01:00
pdf_viewer.css Add spread modes to web viewer 2018-05-14 23:10:32 -04:00
pdf_viewer.js Add a helper method for _getVisiblePages, in BaseViewer, for the case where only a single page is displayed in the viewer 2018-10-28 14:59:31 +01:00
pdfjs.js Use ES6 notation, and replace var with let, in web/pdf_viewer.component.js and web/pdfjs.js 2017-11-05 16:53:47 +01:00
preferences.js Refactor the Preferences classes to utilize async methods rather than manually returning Promises 2018-09-03 09:52:36 +02:00
secondary_toolbar.js Convert some occurrences, in the /web folder, of classList.{add, remove} to classList.toggle with the "force" parameter 2018-10-12 15:41:11 +02:00
text_layer_builder.css Use span instead of div in the text layer 2018-11-18 15:54:08 +01:00
text_layer_builder.js Avoid unnecessary PDFFindController.scrollMatchIntoView calls in TextLayerBuilder._renderMatches when highlightAll is set (PR 10201 follow-up) 2018-11-14 15:42:15 +01:00
toolbar.js Convert some occurrences, in the /web folder, of classList.{add, remove} to classList.toggle with the "force" parameter 2018-10-12 15:41:11 +02:00
ui_utils.js Remove the attachDOMEventsToEventBus functionality, since EventBus instances are able to re-dispatch events to the DOM (PR 10019, bug 1492849 follow-up) 2018-10-31 23:32:39 +01:00
view_history.js Refactor the ViewHistory to utilize async methods rather than manually returning Promises 2018-09-03 09:52:36 +02:00
viewer_compatibility.js Remove the disableFullscreen hack for embedded IE 11 (issue 9585) 2018-06-14 12:25:28 +02:00
viewer-snippet-chrome-extension.html Wraps mozL10n to async calls; splits firefox and generic l10n libs. 2017-05-31 09:22:25 -05:00
viewer-snippet-chrome-overlays.html [CRX] Add file chooser as fallback (fixes #9411) 2018-03-21 18:21:46 +01:00
viewer-snippet-firefox-extension.html Wraps mozL10n to async calls; splits firefox and generic l10n libs. 2017-05-31 09:22:25 -05:00
viewer-snippet-minified.html Remove XHTML leftovers from the viewer HTML files 2016-02-14 13:23:34 +01:00
viewer-snippet.html Wraps mozL10n to async calls; splits firefox and generic l10n libs. 2017-05-31 09:22:25 -05:00
viewer.css Fix small visual quirk in thumbnail viewer 2018-12-18 22:48:26 +01:00
viewer.html Add initial support for "Whole words" searching in the viewer 2018-09-10 11:59:29 +02:00
viewer.js In GENERIC builds, dispatch a "webviewerloaded" event (from the webViewerLoad function) before initializing the viewer 2018-11-30 10:04:30 +01:00