Browse Source

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.
Jonas Jenwald 8 years ago
parent
commit
3b35c15d42
  1. 28
      web/annotation_layer_builder.js
  2. 126
      web/app.js
  3. 131
      web/chromecom.js
  4. 34
      web/dom_events.js
  5. 22
      web/download_manager.js
  6. 42
      web/firefox_print_service.js
  7. 28
      web/firefoxcom.js
  8. 56
      web/grab_to_pan.js
  9. 26
      web/hand_tool.js
  10. 17
      web/overlay_manager.js
  11. 26
      web/password_prompt.js
  12. 18
      web/pdf_attachment_viewer.js
  13. 24
      web/pdf_document_properties.js
  14. 24
      web/pdf_find_bar.js
  15. 22
      web/pdf_find_controller.js
  16. 26
      web/pdf_history.js
  17. 24
      web/pdf_link_service.js
  18. 18
      web/pdf_outline_viewer.js
  19. 37
      web/pdf_page_view.js
  20. 19
      web/pdf_presentation_mode.js
  21. 88
      web/pdf_print_service.js
  22. 19
      web/pdf_rendering_queue.js
  23. 26
      web/pdf_sidebar.js
  24. 25
      web/pdf_thumbnail_view.js
  25. 28
      web/pdf_thumbnail_viewer.js
  26. 63
      web/pdf_viewer.js
  27. 17
      web/preferences.js
  28. 21
      web/secondary_toolbar.js
  29. 22
      web/text_layer_builder.js
  30. 31
      web/toolbar.js
  31. 67
      web/ui_utils.js
  32. 17
      web/view_history.js

28
web/annotation_layer_builder.js

@ -13,24 +13,9 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import * as pdfjsLib from 'pdfjs-web/pdfjs';
import { mozL10n } from 'pdfjs-web/ui_utils';
(function (root, factory) { import { SimpleLinkService } from 'pdfjs-web/pdf_link_service';
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/annotation_layer_builder', ['exports',
'pdfjs-web/ui_utils', 'pdfjs-web/pdf_link_service',
'pdfjs-web/pdfjs'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'),
require('./pdf_link_service.js'), require('./pdfjs.js'));
} else {
factory((root.pdfjsWebAnnotationLayerBuilder = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFLinkService, root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtils, pdfLinkService, pdfjsLib) {
var mozL10n = uiUtils.mozL10n;
var SimpleLinkService = pdfLinkService.SimpleLinkService;
/** /**
* @typedef {Object} AnnotationLayerBuilderOptions * @typedef {Object} AnnotationLayerBuilderOptions
@ -142,6 +127,7 @@ DefaultAnnotationLayerFactory.prototype = {
} }
}; };
exports.AnnotationLayerBuilder = AnnotationLayerBuilder; export {
exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory; AnnotationLayerBuilder,
})); DefaultAnnotationLayerFactory,
};

126
web/app.js

@ -14,95 +14,34 @@
*/ */
/* globals PDFBug, Stats */ /* globals PDFBug, Stats */
'use strict'; import * as pdfjsLib from 'pdfjs-web/pdfjs';
import {
(function (root, factory) { animationStarted, DEFAULT_SCALE_VALUE, getPDFFileNameFromURL, localized,
if (typeof define === 'function' && define.amd) { MAX_SCALE, MIN_SCALE, mozL10n, noContextMenuHandler, normalizeWheelEventDelta,
define('pdfjs-web/app', ['exports', 'pdfjs-web/ui_utils', parseQueryString, ProgressBar, RendererType, UNKNOWN_SCALE
'pdfjs-web/pdf_history', } from 'pdfjs-web/ui_utils';
'pdfjs-web/preferences', 'pdfjs-web/pdf_sidebar', import {
'pdfjs-web/view_history', 'pdfjs-web/pdf_thumbnail_viewer', PDFRenderingQueue, RenderingStates
'pdfjs-web/toolbar', 'pdfjs-web/secondary_toolbar', } from 'pdfjs-web/pdf_rendering_queue';
'pdfjs-web/password_prompt', 'pdfjs-web/pdf_presentation_mode', import { PDFSidebar, SidebarView } from 'pdfjs-web/pdf_sidebar';
'pdfjs-web/pdf_document_properties', 'pdfjs-web/hand_tool', import { PDFViewer, PresentationModeState } from 'pdfjs-web/pdf_viewer';
'pdfjs-web/pdf_viewer', 'pdfjs-web/pdf_rendering_queue', import { getGlobalEventBus } from 'pdfjs-web/dom_events';
'pdfjs-web/pdf_link_service', 'pdfjs-web/pdf_outline_viewer', import { HandTool } from 'pdfjs-web/hand_tool';
'pdfjs-web/overlay_manager', 'pdfjs-web/pdf_attachment_viewer', import { OverlayManager } from 'pdfjs-web/overlay_manager';
'pdfjs-web/pdf_find_controller', 'pdfjs-web/pdf_find_bar', import { PasswordPrompt } from 'pdfjs-web/password_prompt';
'pdfjs-web/dom_events', 'pdfjs-web/pdfjs'], import { PDFAttachmentViewer } from 'pdfjs-web/pdf_attachment_viewer';
factory); import { PDFDocumentProperties } from 'pdfjs-web/pdf_document_properties';
} else if (typeof exports !== 'undefined') { import { PDFFindBar } from 'pdfjs-web/pdf_find_bar';
factory(exports, require('./ui_utils.js'), import { PDFFindController } from 'pdfjs-web/pdf_find_controller';
require('./pdf_history.js'), require('./preferences.js'), import { PDFHistory } from 'pdfjs-web/pdf_history';
require('./pdf_sidebar.js'), require('./view_history.js'), import { PDFLinkService } from 'pdfjs-web/pdf_link_service';
require('./pdf_thumbnail_viewer.js'), require('./toolbar.js'), import { PDFOutlineViewer } from 'pdfjs-web/pdf_outline_viewer';
require('./secondary_toolbar.js'), require('./password_prompt.js'), import { PDFPresentationMode } from 'pdfjs-web/pdf_presentation_mode';
require('./pdf_presentation_mode.js'), import { PDFThumbnailViewer } from 'pdfjs-web/pdf_thumbnail_viewer';
require('./pdf_document_properties.js'), require('./hand_tool.js'), import { Preferences } from 'pdfjs-web/preferences';
require('./pdf_viewer.js'), require('./pdf_rendering_queue.js'), import { SecondaryToolbar } from 'pdfjs-web/secondary_toolbar';
require('./pdf_link_service.js'), require('./pdf_outline_viewer.js'), import { Toolbar } from 'pdfjs-web/toolbar';
require('./overlay_manager.js'), require('./pdf_attachment_viewer.js'), import { ViewHistory } from 'pdfjs-web/view_history';
require('./pdf_find_controller.js'), require('./pdf_find_bar.js'),
require('./dom_events.js'), require('./pdfjs.js'));
} else {
factory((root.pdfjsWebApp = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFHistory,
root.pdfjsWebPreferences, root.pdfjsWebPDFSidebar,
root.pdfjsWebViewHistory, root.pdfjsWebPDFThumbnailViewer,
root.pdfjsWebToolbar, root.pdfjsWebSecondaryToolbar,
root.pdfjsWebPasswordPrompt, root.pdfjsWebPDFPresentationMode,
root.pdfjsWebPDFDocumentProperties, root.pdfjsWebHandTool,
root.pdfjsWebPDFViewer, root.pdfjsWebPDFRenderingQueue,
root.pdfjsWebPDFLinkService, root.pdfjsWebPDFOutlineViewer,
root.pdfjsWebOverlayManager, root.pdfjsWebPDFAttachmentViewer,
root.pdfjsWebPDFFindController, root.pdfjsWebPDFFindBar,
root.pdfjsWebDOMEvents, root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtilsLib, pdfHistoryLib,
preferencesLib, pdfSidebarLib, viewHistoryLib,
pdfThumbnailViewerLib, toolbarLib, secondaryToolbarLib,
passwordPromptLib, pdfPresentationModeLib,
pdfDocumentPropertiesLib, handToolLib, pdfViewerLib,
pdfRenderingQueueLib, pdfLinkServiceLib, pdfOutlineViewerLib,
overlayManagerLib, pdfAttachmentViewerLib,
pdfFindControllerLib, pdfFindBarLib, domEventsLib, pdfjsLib) {
var UNKNOWN_SCALE = uiUtilsLib.UNKNOWN_SCALE;
var DEFAULT_SCALE_VALUE = uiUtilsLib.DEFAULT_SCALE_VALUE;
var MIN_SCALE = uiUtilsLib.MIN_SCALE;
var MAX_SCALE = uiUtilsLib.MAX_SCALE;
var ProgressBar = uiUtilsLib.ProgressBar;
var getPDFFileNameFromURL = uiUtilsLib.getPDFFileNameFromURL;
var noContextMenuHandler = uiUtilsLib.noContextMenuHandler;
var mozL10n = uiUtilsLib.mozL10n;
var parseQueryString = uiUtilsLib.parseQueryString;
var PDFHistory = pdfHistoryLib.PDFHistory;
var Preferences = preferencesLib.Preferences;
var SidebarView = pdfSidebarLib.SidebarView;
var PDFSidebar = pdfSidebarLib.PDFSidebar;
var ViewHistory = viewHistoryLib.ViewHistory;
var PDFThumbnailViewer = pdfThumbnailViewerLib.PDFThumbnailViewer;
var Toolbar = toolbarLib.Toolbar;
var SecondaryToolbar = secondaryToolbarLib.SecondaryToolbar;
var PasswordPrompt = passwordPromptLib.PasswordPrompt;
var PDFPresentationMode = pdfPresentationModeLib.PDFPresentationMode;
var PDFDocumentProperties = pdfDocumentPropertiesLib.PDFDocumentProperties;
var HandTool = handToolLib.HandTool;
var PresentationModeState = pdfViewerLib.PresentationModeState;
var PDFViewer = pdfViewerLib.PDFViewer;
var RenderingStates = pdfRenderingQueueLib.RenderingStates;
var PDFRenderingQueue = pdfRenderingQueueLib.PDFRenderingQueue;
var PDFLinkService = pdfLinkServiceLib.PDFLinkService;
var PDFOutlineViewer = pdfOutlineViewerLib.PDFOutlineViewer;
var OverlayManager = overlayManagerLib.OverlayManager;
var PDFAttachmentViewer = pdfAttachmentViewerLib.PDFAttachmentViewer;
var PDFFindController = pdfFindControllerLib.PDFFindController;
var PDFFindBar = pdfFindBarLib.PDFFindBar;
var getGlobalEventBus = domEventsLib.getGlobalEventBus;
var normalizeWheelEventDelta = uiUtilsLib.normalizeWheelEventDelta;
var animationStarted = uiUtilsLib.animationStarted;
var localized = uiUtilsLib.localized;
var RendererType = uiUtilsLib.RendererType;
var DEFAULT_SCALE_DELTA = 1.1; var DEFAULT_SCALE_DELTA = 1.1;
var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
@ -2269,7 +2208,8 @@ var PDFPrintServiceFactory = {
} }
}; };
exports.PDFViewerApplication = PDFViewerApplication; export {
exports.DefaultExternalServices = DefaultExternalServices; PDFViewerApplication,
exports.PDFPrintServiceFactory = PDFPrintServiceFactory; DefaultExternalServices,
})); PDFPrintServiceFactory,
};

131
web/chromecom.js

@ -14,34 +14,18 @@
*/ */
/* globals chrome */ /* globals chrome */
'use strict'; import * as pdfjsLib from 'pdfjs-web/pdfjs';
import { DefaultExternalServices, PDFViewerApplication } from 'pdfjs-web/app';
import { OverlayManager } from 'pdfjs-web/overlay_manager';
import { Preferences } from 'pdfjs-web/preferences';
(function (root, factory) { if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('CHROME')) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/chromecom', ['exports', 'pdfjs-web/app',
'pdfjs-web/overlay_manager', 'pdfjs-web/preferences', 'pdfjs-web/pdfjs'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./app.js'), require('./overlay_manager.js'),
require('./preferences.js'), require('./pdfjs.js'));
} else {
factory((root.pdfjsWebChromeCom = {}), root.pdfjsWebApp,
root.pdfjsWebOverlayManager, root.pdfjsWebPreferences,
root.pdfjsWebPDFJS);
}
}(this, function (exports, app, overlayManager, preferences, pdfjsLib) {
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('CHROME')) {
throw new Error('Module "pdfjs-web/chromecom" shall not be used outside ' + throw new Error('Module "pdfjs-web/chromecom" shall not be used outside ' +
'CHROME build.'); 'CHROME build.');
} }
var PDFViewerApplication = app.PDFViewerApplication; var ChromeCom = {};
var DefaultExternalServices = app.DefaultExternalServices; /**
var OverlayManager = overlayManager.OverlayManager;
var Preferences = preferences.Preferences;
var ChromeCom = {};
/**
* Creates an event that the extension is listening for and will * Creates an event that the extension is listening for and will
* asynchronously respond by calling the callback. * asynchronously respond by calling the callback.
* *
@ -51,7 +35,7 @@
* with one data argument. When the request cannot be handled, the callback * with one data argument. When the request cannot be handled, the callback
* is immediately invoked with no arguments. * is immediately invoked with no arguments.
*/ */
ChromeCom.request = function ChromeCom_request(action, data, callback) { ChromeCom.request = function ChromeCom_request(action, data, callback) {
var message = { var message = {
action: action, action: action,
data: data data: data
@ -66,15 +50,15 @@
} else { } else {
chrome.runtime.sendMessage(message); chrome.runtime.sendMessage(message);
} }
}; };
/** /**
* Resolves a PDF file path and attempts to detects length. * Resolves a PDF file path and attempts to detects length.
* *
* @param {String} file Absolute URL of PDF file. * @param {String} file Absolute URL of PDF file.
* @param {Function} callback A callback with resolved URL and file length. * @param {Function} callback A callback with resolved URL and file length.
*/ */
ChromeCom.resolvePDFFile = function ChromeCom_resolvePDFFile(file, callback) { ChromeCom.resolvePDFFile = function ChromeCom_resolvePDFFile(file, callback) {
// Expand drive:-URLs to filesystem URLs (Chrome OS) // Expand drive:-URLs to filesystem URLs (Chrome OS)
file = file.replace(/^drive:/i, file = file.replace(/^drive:/i,
'filesystem:' + location.origin + '/external/'); 'filesystem:' + location.origin + '/external/');
@ -132,9 +116,9 @@
return; return;
} }
callback(file); callback(file);
}; };
function getEmbedderOrigin(callback) { function getEmbedderOrigin(callback) {
var origin = window === top ? location.origin : location.ancestorOrigins[0]; var origin = window === top ? location.origin : location.ancestorOrigins[0];
if (origin === 'null') { if (origin === 'null') {
// file:-URLs, data-URLs, sandboxed frames, etc. // file:-URLs, data-URLs, sandboxed frames, etc.
@ -142,17 +126,17 @@
} else { } else {
callback(origin); callback(origin);
} }
} }
function getParentOrigin(callback) { function getParentOrigin(callback) {
ChromeCom.request('getParentOrigin', null, callback); ChromeCom.request('getParentOrigin', null, callback);
} }
function isAllowedFileSchemeAccess(callback) { function isAllowedFileSchemeAccess(callback) {
ChromeCom.request('isAllowedFileSchemeAccess', null, callback); ChromeCom.request('isAllowedFileSchemeAccess', null, callback);
} }
function isRuntimeAvailable() { function isRuntimeAvailable() {
try { try {
// When the extension is reloaded, the extension runtime is destroyed and // When the extension is reloaded, the extension runtime is destroyed and
// the extension APIs become unavailable. // the extension APIs become unavailable.
@ -161,16 +145,16 @@
} }
} catch (e) {} } catch (e) {}
return false; return false;
} }
function reloadIfRuntimeIsUnavailable() { function reloadIfRuntimeIsUnavailable() {
if (!isRuntimeAvailable()) { if (!isRuntimeAvailable()) {
location.reload(); location.reload();
} }
} }
var chromeFileAccessOverlayPromise; var chromeFileAccessOverlayPromise;
function requestAccessToLocalFile(fileUrl) { function requestAccessToLocalFile(fileUrl) {
var onCloseOverlay = null; var onCloseOverlay = null;
if (top !== window) { if (top !== window) {
// When the extension reloads after receiving new permissions, the pages // When the extension reloads after receiving new permissions, the pages
@ -232,9 +216,9 @@
OverlayManager.open('chromeFileAccessOverlay'); OverlayManager.open('chromeFileAccessOverlay');
}); });
} }
if (window === top) { if (window === top) {
// Chrome closes all extension tabs (crbug.com/511670) when the extension // Chrome closes all extension tabs (crbug.com/511670) when the extension
// reloads. To counter this, the tab URL and history state is saved to // reloads. To counter this, the tab URL and history state is saved to
// localStorage and restored by extension-router.js. // localStorage and restored by extension-router.js.
@ -249,22 +233,22 @@
JSON.stringify(history.state)); JSON.stringify(history.state));
} }
}); });
} }
// This port is used for several purposes: // This port is used for several purposes:
// 1. When disconnected, the background page knows that the frame has unload. // 1. When disconnected, the background page knows that the frame has unload.
// 2. When the referrer was saved in history.state.chromecomState, it is sent // 2. When the referrer was saved in history.state.chromecomState, it is sent
// to the background page. // to the background page.
// 3. When the background page knows the referrer of the page, the referrer is // 3. When the background page knows the referrer of the page, the referrer is
// saved in history.state.chromecomState. // saved in history.state.chromecomState.
var port; var port;
// Set the referer for the given URL. // Set the referer for the given URL.
// 0. Background: If loaded via a http(s) URL: Save referer. // 0. Background: If loaded via a http(s) URL: Save referer.
// 1. Page -> background: send URL and referer from history.state // 1. Page -> background: send URL and referer from history.state
// 2. Background: Bind referer to URL (via webRequest). // 2. Background: Bind referer to URL (via webRequest).
// 3. Background -> page: Send latest referer and save to history. // 3. Background -> page: Send latest referer and save to history.
// 4. Page: Invoke callback. // 4. Page: Invoke callback.
function setReferer(url, callback) { function setReferer(url, callback) {
if (!port) { if (!port) {
// The background page will accept the port, and keep adding the Referer // The background page will accept the port, and keep adding the Referer
// request header to requests to |url| until the port is disconnected. // request header to requests to |url| until the port is disconnected.
@ -301,14 +285,14 @@
port.onMessage.removeListener(onMessage); port.onMessage.removeListener(onMessage);
callback(); callback();
} }
} }
// chrome.storage.sync is not supported in every Chromium-derivate. // chrome.storage.sync is not supported in every Chromium-derivate.
// Note: The background page takes care of migrating values from // Note: The background page takes care of migrating values from
// chrome.storage.local to chrome.storage.sync when needed. // chrome.storage.local to chrome.storage.sync when needed.
var storageArea = chrome.storage.sync || chrome.storage.local; var storageArea = chrome.storage.sync || chrome.storage.local;
Preferences._writeToStorage = function (prefObj) { Preferences._writeToStorage = function (prefObj) {
return new Promise(function (resolve) { return new Promise(function (resolve) {
if (prefObj === Preferences.defaults) { if (prefObj === Preferences.defaults) {
var keysToRemove = Object.keys(Preferences.defaults); var keysToRemove = Object.keys(Preferences.defaults);
@ -323,9 +307,9 @@
}); });
} }
}); });
}; };
Preferences._readFromStorage = function (prefObj) { Preferences._readFromStorage = function (prefObj) {
return new Promise(function (resolve) { return new Promise(function (resolve) {
if (chrome.storage.managed) { if (chrome.storage.managed) {
// Get preferences as set by the system administrator. // Get preferences as set by the system administrator.
@ -347,17 +331,18 @@
}); });
} }
}); });
}; };
var ChromeExternalServices = Object.create(DefaultExternalServices); var ChromeExternalServices = Object.create(DefaultExternalServices);
ChromeExternalServices.initPassiveLoading = function (callbacks) { ChromeExternalServices.initPassiveLoading = function (callbacks) {
var appConfig = PDFViewerApplication.appConfig; var appConfig = PDFViewerApplication.appConfig;
ChromeCom.resolvePDFFile(appConfig.defaultUrl, ChromeCom.resolvePDFFile(appConfig.defaultUrl,
function (url, length, originalURL) { function (url, length, originalURL) {
callbacks.onOpenWithURL(url, length, originalURL); callbacks.onOpenWithURL(url, length, originalURL);
}); });
}; };
PDFViewerApplication.externalServices = ChromeExternalServices; PDFViewerApplication.externalServices = ChromeExternalServices;
exports.ChromeCom = ChromeCom; export {
})); ChromeCom,
};

34
web/dom_events.js

@ -13,22 +13,11 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { EventBus } from 'pdfjs-web/ui_utils';
(function (root, factory) { // Attaching to the application event bus to dispatch events to the DOM for
if (typeof define === 'function' && define.amd) { // backwards viewer API compatibility.
define('pdfjs-web/dom_events', ['exports', 'pdfjs-web/ui_utils'], factory); function attachDOMEventsToEventBus(eventBus) {
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'));
} else {
factory((root.pdfjsWebDOMEvents = {}), root.pdfjsWebUIUtils);
}
}(this, function (exports, uiUtils) {
var EventBus = uiUtils.EventBus;
// Attaching to the application event bus to dispatch events to the DOM for
// backwards viewer API compatibility.
function attachDOMEventsToEventBus(eventBus) {
eventBus.on('documentload', function () { eventBus.on('documentload', function () {
var event = document.createEvent('CustomEvent'); var event = document.createEvent('CustomEvent');
event.initCustomEvent('documentload', true, true, {}); event.initCustomEvent('documentload', true, true, {});
@ -137,18 +126,19 @@
}); });
e.source.container.dispatchEvent(event); e.source.container.dispatchEvent(event);
}); });
} }
var globalEventBus = null; var globalEventBus = null;
function getGlobalEventBus() { function getGlobalEventBus() {
if (globalEventBus) { if (globalEventBus) {
return globalEventBus; return globalEventBus;
} }
globalEventBus = new EventBus(); globalEventBus = new EventBus();
attachDOMEventsToEventBus(globalEventBus); attachDOMEventsToEventBus(globalEventBus);
return globalEventBus; return globalEventBus;
} }
exports.attachDOMEventsToEventBus = attachDOMEventsToEventBus; export {
exports.getGlobalEventBus = getGlobalEventBus; attachDOMEventsToEventBus,
})); getGlobalEventBus,
};

22
web/download_manager.js

@ -13,27 +13,14 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import * as pdfjsLib from 'pdfjs-web/pdfjs';
import { DefaultExternalServices, PDFViewerApplication } from 'pdfjs-web/app';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/download_manager', ['exports', 'pdfjs-web/app',
'pdfjs-web/pdfjs'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./app.js'), require('./pdfjs.js'));
} else {
factory((root.pdfjsWebDownloadManager = {}), root.pdfjsWebApp,
root.pdfjsWebPDFJS);
}
}(this, function (exports, app, pdfjsLib) {
if (typeof PDFJSDev !== 'undefined' && !PDFJSDev.test('CHROME || GENERIC')) { if (typeof PDFJSDev !== 'undefined' && !PDFJSDev.test('CHROME || GENERIC')) {
throw new Error('Module "pdfjs-web/download_manager" shall not be used ' + throw new Error('Module "pdfjs-web/download_manager" shall not be used ' +
'outside CHROME and GENERIC builds.'); 'outside CHROME and GENERIC builds.');
} }
var PDFViewerApplication = app.PDFViewerApplication;
var DefaultExternalServices = app.DefaultExternalServices;
function download(blobUrl, filename) { function download(blobUrl, filename) {
var a = document.createElement('a'); var a = document.createElement('a');
if (a.click) { if (a.click) {
@ -118,5 +105,6 @@ GenericExternalServices.createDownloadManager = function () {
}; };
PDFViewerApplication.externalServices = GenericExternalServices; PDFViewerApplication.externalServices = GenericExternalServices;
exports.DownloadManager = DownloadManager; export {
})); DownloadManager,
};

42
web/firefox_print_service.js

@ -13,25 +13,12 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import * as pdfjsLib from 'pdfjs-web/pdfjs';
import { CSS_UNITS } from 'pdfjs-web/ui_utils';
(function (root, factory) { import { PDFPrintServiceFactory } from 'pdfjs-web/app';
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/firefox_print_service', ['exports', 'pdfjs-web/ui_utils',
'pdfjs-web/app', 'pdfjs-web/pdfjs'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'), require('./app.js'),
require('./pdfjs.js'));
} else {
factory((root.pdfjsWebFirefoxPrintService = {}), root.pdfjsWebUIUtils,
root.pdfjsWebApp, root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtils, app, pdfjsLib) {
var CSS_UNITS = uiUtils.CSS_UNITS;
var PDFPrintServiceFactory = app.PDFPrintServiceFactory;
// Creates a placeholder with div and canvas with right size for the page. // Creates a placeholder with div and canvas with right size for the page.
function composePage(pdfDocument, pageNumber, size, printContainer) { function composePage(pdfDocument, pageNumber, size, printContainer) {
var canvas = document.createElement('canvas'); var canvas = document.createElement('canvas');
// The size of the canvas in pixels for printing. // The size of the canvas in pixels for printing.
@ -79,15 +66,15 @@
} }
}); });
}; };
} }
function FirefoxPrintService(pdfDocument, pagesOverview, printContainer) { function FirefoxPrintService(pdfDocument, pagesOverview, printContainer) {
this.pdfDocument = pdfDocument; this.pdfDocument = pdfDocument;
this.pagesOverview = pagesOverview; this.pagesOverview = pagesOverview;
this.printContainer = printContainer; this.printContainer = printContainer;
} }
FirefoxPrintService.prototype = { FirefoxPrintService.prototype = {
layout: function () { layout: function () {
var pdfDocument = this.pdfDocument; var pdfDocument = this.pdfDocument;
var printContainer = this.printContainer; var printContainer = this.printContainer;
@ -102,9 +89,9 @@
destroy: function () { destroy: function () {
this.printContainer.textContent = ''; this.printContainer.textContent = '';
} }
}; };
PDFPrintServiceFactory.instance = { PDFPrintServiceFactory.instance = {
get supportsPrinting() { get supportsPrinting() {
var canvas = document.createElement('canvas'); var canvas = document.createElement('canvas');
var value = 'mozPrintCallback' in canvas; var value = 'mozPrintCallback' in canvas;
@ -116,7 +103,8 @@
return new FirefoxPrintService(pdfDocument, pagesOverview, return new FirefoxPrintService(pdfDocument, pagesOverview,
printContainer); printContainer);
} }
}; };
exports.FirefoxPrintService = FirefoxPrintService; export {
})); FirefoxPrintService,
};

28
web/firefoxcom.js

@ -13,29 +13,16 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import * as pdfjsLib from 'pdfjs-web/pdfjs';
import { PDFViewerApplication } from 'pdfjs-web/app';
(function (root, factory) { import { Preferences } from 'pdfjs-web/preferences';
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/firefoxcom', ['exports', 'pdfjs-web/preferences',
'pdfjs-web/app', 'pdfjs-web/pdfjs'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./preferences.js'), require('./app.js'),
require('./pdfjs.js'));
} else {
factory((root.pdfjsWebFirefoxCom = {}), root.pdfjsWebPreferences,
root.pdfjsWebApp, root.pdfjsWebPDFJS);
}
}(this, function (exports, preferences, app, pdfjsLib) {
if (typeof PDFJSDev === 'undefined' || if (typeof PDFJSDev === 'undefined' ||
!PDFJSDev.test('FIREFOX || MOZCENTRAL')) { !PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
throw new Error('Module "pdfjs-web/firefoxcom" shall not be used outside ' + throw new Error('Module "pdfjs-web/firefoxcom" shall not be used outside ' +
'FIREFOX and MOZCENTRAL builds.'); 'FIREFOX and MOZCENTRAL builds.');
} }
var Preferences = preferences.Preferences;
var PDFViewerApplication = app.PDFViewerApplication;
var FirefoxCom = (function FirefoxComClosure() { var FirefoxCom = (function FirefoxComClosure() {
return { return {
/** /**
@ -291,6 +278,7 @@ document.mozL10n.setExternalLocalizerServices({
} }
}); });
exports.DownloadManager = DownloadManager; export {
exports.FirefoxCom = FirefoxCom; DownloadManager,
})); FirefoxCom,
};

56
web/grab_to_pan.js

@ -14,18 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; /**
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/grab_to_pan', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebGrabToPan = {}));
}
}(this, function (exports) {
/**
* Construct a GrabToPan instance for a given HTML element. * Construct a GrabToPan instance for a given HTML element.
* @param options.element {Element} * @param options.element {Element}
* @param options.ignoreTarget {function} optional. See `ignoreTarget(node)` * @param options.ignoreTarget {function} optional. See `ignoreTarget(node)`
@ -33,7 +22,7 @@
* when grab-to-pan is (de)activated. The first argument is a boolean that * when grab-to-pan is (de)activated. The first argument is a boolean that
* shows whether grab-to-pan is activated. * shows whether grab-to-pan is activated.
*/ */
function GrabToPan(options) { function GrabToPan(options) {
this.element = options.element; this.element = options.element;
this.document = options.element.ownerDocument; this.document = options.element.ownerDocument;
if (typeof options.ignoreTarget === 'function') { if (typeof options.ignoreTarget === 'function') {
@ -54,8 +43,8 @@
// a grab operation, to ensure that the cursor has the desired appearance. // a grab operation, to ensure that the cursor has the desired appearance.
var overlay = this.overlay = document.createElement('div'); var overlay = this.overlay = document.createElement('div');
overlay.className = 'grab-to-pan-grabbing'; overlay.className = 'grab-to-pan-grabbing';
} }
GrabToPan.prototype = { GrabToPan.prototype = {
/** /**
* Class name of element which can be grabbed * Class name of element which can be grabbed
*/ */
@ -187,11 +176,11 @@
// Note: ChildNode.remove doesn't throw if the parentNode is undefined. // Note: ChildNode.remove doesn't throw if the parentNode is undefined.
this.overlay.remove(); this.overlay.remove();
} }
}; };
// Get the correct (vendor-prefixed) name of the matches method. // Get the correct (vendor-prefixed) name of the matches method.
var matchesSelector; var matchesSelector;
['webkitM', 'mozM', 'msM', 'oM', 'm'].some(function(prefix) { ['webkitM', 'mozM', 'msM', 'oM', 'm'].some(function(prefix) {
var name = prefix + 'atches'; var name = prefix + 'atches';
if (name in document.documentElement) { if (name in document.documentElement) {
matchesSelector = name; matchesSelector = name;
@ -201,24 +190,24 @@
matchesSelector = name; matchesSelector = name;
} }
return matchesSelector; // If found, then truthy, and [].some() ends. return matchesSelector; // If found, then truthy, and [].some() ends.
}); });
// Browser sniffing because it's impossible to feature-detect // Browser sniffing because it's impossible to feature-detect
// whether event.which for onmousemove is reliable // whether event.which for onmousemove is reliable
var isNotIEorIsIE10plus = !document.documentMode || document.documentMode > 9; var isNotIEorIsIE10plus = !document.documentMode || document.documentMode > 9;
var chrome = window.chrome; var chrome = window.chrome;
var isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app); var isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app);
// ^ Chrome 15+ ^ Opera 15+ // ^ Chrome 15+ ^ Opera 15+
var isSafari6plus = /Apple/.test(navigator.vendor) && var isSafari6plus = /Apple/.test(navigator.vendor) &&
/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent); /Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);
/** /**
* Whether the left mouse is not pressed. * Whether the left mouse is not pressed.
* @param event {MouseEvent} * @param event {MouseEvent}
* @return {boolean} True if the left mouse button is not pressed. * @return {boolean} True if the left mouse button is not pressed.
* False if unsure or if the left mouse button is pressed. * False if unsure or if the left mouse button is pressed.
*/ */
function isLeftMouseReleased(event) { function isLeftMouseReleased(event) {
if ('buttons' in event && isNotIEorIsIE10plus) { if ('buttons' in event && isNotIEorIsIE10plus) {
// http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-buttons // http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-buttons
// Firefox 15+ // Firefox 15+
@ -231,7 +220,8 @@
// Safari 6.0+ // Safari 6.0+
return event.which === 0; return event.which === 0;
} }
} }
exports.GrabToPan = GrabToPan; export {
})); GrabToPan,
};

26
web/hand_tool.js

@ -13,24 +13,9 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { GrabToPan } from 'pdfjs-web/grab_to_pan';
import { localized } from 'pdfjs-web/ui_utils';
(function (root, factory) { import { Preferences } from 'pdfjs-web/preferences';
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/hand_tool', ['exports', 'pdfjs-web/grab_to_pan',
'pdfjs-web/preferences', 'pdfjs-web/ui_utils'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./grab_to_pan.js'), require('./preferences.js'),
require('./ui_utils.js'));
} else {
factory((root.pdfjsWebHandTool = {}), root.pdfjsWebGrabToPan,
root.pdfjsWebPreferences, root.pdfjsWebUIUtils);
}
}(this, function (exports, grabToPan, preferences, uiUtils) {
var GrabToPan = grabToPan.GrabToPan;
var Preferences = preferences.Preferences;
var localized = uiUtils.localized;
/** /**
* @typedef {Object} HandToolOptions * @typedef {Object} HandToolOptions
@ -110,5 +95,6 @@ var HandTool = (function HandToolClosure() {
return HandTool; return HandTool;
})(); })();
exports.HandTool = HandTool; export {
})); HandTool,
};

17
web/overlay_manager.js

@ -13,18 +13,6 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/overlay_manager', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebOverlayManager = {}));
}
}(this, function (exports) {
var OverlayManager = { var OverlayManager = {
overlays: {}, overlays: {},
active: null, active: null,
@ -151,5 +139,6 @@ var OverlayManager = {
} }
}; };
exports.OverlayManager = OverlayManager; export {
})); OverlayManager,
};

26
web/password_prompt.js

@ -13,24 +13,9 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import * as pdfjsLib from 'pdfjs-web/pdfjs';
import { mozL10n } from 'pdfjs-web/ui_utils';
(function (root, factory) { import { OverlayManager } from 'pdfjs-web/overlay_manager';
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/password_prompt', ['exports',
'pdfjs-web/ui_utils', 'pdfjs-web/overlay_manager', 'pdfjs-web/pdfjs'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'), require('./overlay_manager.js'),
require('./pdfjs.js'));
} else {
factory((root.pdfjsWebPasswordPrompt = {}), root.pdfjsWebUIUtils,
root.pdfjsWebOverlayManager, root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtils, overlayManager, pdfjsLib) {
var mozL10n = uiUtils.mozL10n;
var OverlayManager = overlayManager.OverlayManager;
/** /**
* @typedef {Object} PasswordPromptOptions * @typedef {Object} PasswordPromptOptions
@ -120,5 +105,6 @@ var PasswordPrompt = (function PasswordPromptClosure() {
return PasswordPrompt; return PasswordPrompt;
})(); })();
exports.PasswordPrompt = PasswordPrompt; export {
})); PasswordPrompt,
};

18
web/pdf_attachment_viewer.js

@ -13,18 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import * as pdfjsLib from 'pdfjs-web/pdfjs';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_attachment_viewer', ['exports', 'pdfjs-web/pdfjs'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./pdfjs.js'));
} else {
factory((root.pdfjsWebPDFAttachmentViewer = {}), root.pdfjsWebPDFJS);
}
}(this, function (exports, pdfjsLib) {
/** /**
* @typedef {Object} PDFAttachmentViewerOptions * @typedef {Object} PDFAttachmentViewerOptions
@ -205,5 +194,6 @@ var PDFAttachmentViewer = (function PDFAttachmentViewerClosure() {
return PDFAttachmentViewer; return PDFAttachmentViewer;
})(); })();
exports.PDFAttachmentViewer = PDFAttachmentViewer; export {
})); PDFAttachmentViewer,
};

24
web/pdf_document_properties.js

@ -13,23 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { getPDFFileNameFromURL, mozL10n } from 'pdfjs-web/ui_utils';
import { OverlayManager } from 'pdfjs-web/overlay_manager';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_document_properties', ['exports',
'pdfjs-web/ui_utils', 'pdfjs-web/overlay_manager'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'), require('./overlay_manager.js'));
} else {
factory((root.pdfjsWebPDFDocumentProperties = {}), root.pdfjsWebUIUtils,
root.pdfjsWebOverlayManager);
}
}(this, function (exports, uiUtils, overlayManager) {
var getPDFFileNameFromURL = uiUtils.getPDFFileNameFromURL;
var mozL10n = uiUtils.mozL10n;
var OverlayManager = overlayManager.OverlayManager;
/** /**
* @typedef {Object} PDFDocumentPropertiesOptions * @typedef {Object} PDFDocumentPropertiesOptions
@ -239,5 +224,6 @@ var PDFDocumentProperties = (function PDFDocumentPropertiesClosure() {
return PDFDocumentProperties; return PDFDocumentProperties;
})(); })();
exports.PDFDocumentProperties = PDFDocumentProperties; export {
})); PDFDocumentProperties,
};

24
web/pdf_find_bar.js

@ -13,23 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { FindStates } from 'pdfjs-web/pdf_find_controller';
import { mozL10n } from 'pdfjs-web/ui_utils';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_find_bar', ['exports',
'pdfjs-web/ui_utils', 'pdfjs-web/pdf_find_controller'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'),
require('./pdf_find_controller.js'));
} else {
factory((root.pdfjsWebPDFFindBar = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFFindController);
}
}(this, function (exports, uiUtils, pdfFindController) {
var mozL10n = uiUtils.mozL10n;
var FindStates = pdfFindController.FindStates;
/** /**
* Creates a "search bar" given a set of DOM elements that act as controls * Creates a "search bar" given a set of DOM elements that act as controls
@ -236,5 +221,6 @@ var PDFFindBar = (function PDFFindBarClosure() {
return PDFFindBar; return PDFFindBar;
})(); })();
exports.PDFFindBar = PDFFindBar; export {
})); PDFFindBar,
};

22
web/pdf_find_controller.js

@ -13,20 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { scrollIntoView } from 'pdfjs-web/ui_utils';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_find_controller', ['exports', 'pdfjs-web/ui_utils'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'));
} else {
factory((root.pdfjsWebPDFFindController = {}), root.pdfjsWebUIUtils);
}
}(this, function (exports, uiUtils) {
var scrollIntoView = uiUtils.scrollIntoView;
var FindStates = { var FindStates = {
FIND_FOUND: 0, FIND_FOUND: 0,
@ -505,6 +492,7 @@ var PDFFindController = (function PDFFindControllerClosure() {
return PDFFindController; return PDFFindController;
})(); })();
exports.FindStates = FindStates; export {
exports.PDFFindController = PDFFindController; FindStates,
})); PDFFindController,
};

26
web/pdf_history.js

@ -14,29 +14,18 @@
*/ */
/* globals chrome */ /* globals chrome */
'use strict'; import { domEvents } from 'pdfjs-web/dom_events';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_history', ['exports', 'pdfjs-web/dom_events'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./dom_events.js'));
} else {
factory((root.pdfjsWebPDFHistory = {}), root.pdfjsWebDOMEvents);
}
}(this, function (exports, domEvents) {
function PDFHistory(options) { function PDFHistory(options) {
this.linkService = options.linkService; this.linkService = options.linkService;
this.eventBus = options.eventBus || domEvents.getGlobalEventBus(); this.eventBus = options.eventBus || domEvents.getGlobalEventBus();
this.initialized = false; this.initialized = false;
this.initialDestination = null; this.initialDestination = null;
this.initialBookmark = null; this.initialBookmark = null;
} }
PDFHistory.prototype = { PDFHistory.prototype = {
/** /**
* @param {string} fingerprint * @param {string} fingerprint
*/ */
@ -430,7 +419,8 @@
} }
} }
} }
}; };
exports.PDFHistory = PDFHistory; export {
})); PDFHistory,
};

24
web/pdf_link_service.js

@ -13,21 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { domEvents } from 'pdfjs-web/dom_events';
import { parseQueryString } from 'pdfjs-web/ui_utils';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_link_service', ['exports', 'pdfjs-web/ui_utils',
'pdfjs-web/dom_events'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'), require('./dom_events.js'));
} else {
factory((root.pdfjsWebPDFLinkService = {}), root.pdfjsWebUIUtils,
root.pdfjsWebDOMEvents);
}
}(this, function (exports, uiUtils, domEvents) {
var parseQueryString = uiUtils.parseQueryString;
var PageNumberRegExp = /^\d+$/; var PageNumberRegExp = /^\d+$/;
function isPageNumber(str) { function isPageNumber(str) {
@ -487,6 +474,7 @@ var SimpleLinkService = (function SimpleLinkServiceClosure() {
return SimpleLinkService; return SimpleLinkService;
})(); })();
exports.PDFLinkService = PDFLinkService; export {
exports.SimpleLinkService = SimpleLinkService; PDFLinkService,
})); SimpleLinkService,
};

18
web/pdf_outline_viewer.js

@ -13,18 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import * as pdfjsLib from 'pdfjs-web/pdfjs';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_outline_viewer', ['exports', 'pdfjs-web/pdfjs'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./pdfjs.js'));
} else {
factory((root.pdfjsWebPDFOutlineViewer = {}), root.pdfjsWebPDFJS);
}
}(this, function (exports, pdfjsLib) {
var PDFJS = pdfjsLib.PDFJS; var PDFJS = pdfjsLib.PDFJS;
@ -231,5 +220,6 @@ var PDFOutlineViewer = (function PDFOutlineViewerClosure() {
return PDFOutlineViewer; return PDFOutlineViewer;
})(); })();
exports.PDFOutlineViewer = PDFOutlineViewer; export {
})); PDFOutlineViewer,
};

37
web/pdf_page_view.js

@ -13,31 +13,13 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import * as pdfjsLib from 'pdfjs-web/pdfjs';
import {
(function (root, factory) { approximateFraction, CSS_UNITS, DEFAULT_SCALE, getOutputScale, RendererType,
if (typeof define === 'function' && define.amd) { roundToDivide
define('pdfjs-web/pdf_page_view', ['exports', } from 'pdfjs-web/ui_utils';
'pdfjs-web/ui_utils', 'pdfjs-web/pdf_rendering_queue', import { domEvents } from 'pdfjs-web/dom_events';
'pdfjs-web/dom_events', 'pdfjs-web/pdfjs'], factory); import { RenderingStates } from 'pdfjs-web/pdf_rendering_queue';
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'),
require('./pdf_rendering_queue.js'), require('./dom_events.js'),
require('./pdfjs.js'));
} else {
factory((root.pdfjsWebPDFPageView = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFRenderingQueue, root.pdfjsWebDOMEvents,
root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtils, pdfRenderingQueue, domEvents, pdfjsLib) {
var CSS_UNITS = uiUtils.CSS_UNITS;
var DEFAULT_SCALE = uiUtils.DEFAULT_SCALE;
var getOutputScale = uiUtils.getOutputScale;
var approximateFraction = uiUtils.approximateFraction;
var roundToDivide = uiUtils.roundToDivide;
var RendererType = uiUtils.RendererType;
var RenderingStates = pdfRenderingQueue.RenderingStates;
var TEXT_LAYER_RENDER_DELAY = 200; // ms var TEXT_LAYER_RENDER_DELAY = 200; // ms
@ -691,5 +673,6 @@ var PDFPageView = (function PDFPageViewClosure() {
return PDFPageView; return PDFPageView;
})(); })();
exports.PDFPageView = PDFPageView; export {
})); PDFPageView,
};

19
web/pdf_presentation_mode.js

@ -13,19 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { normalizeWheelEventDelta } from 'pdfjs-web/ui_utils';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_presentation_mode', ['exports', 'pdfjs-web/ui_utils'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'));
} else {
factory((root.pdfjsWebPDFPresentationMode = {}), root.pdfjsWebUIUtils);
}
}(this, function (exports, uiUtils) {
var normalizeWheelEventDelta = uiUtils.normalizeWheelEventDelta;
var DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500; // in ms var DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500; // in ms
var DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms var DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms
@ -517,5 +505,6 @@ var PDFPresentationMode = (function PDFPresentationModeClosure() {
return PDFPresentationMode; return PDFPresentationMode;
})(); })();
exports.PDFPresentationMode = PDFPresentationMode; export {
})); PDFPresentationMode,
};

88
web/pdf_print_service.js

@ -13,31 +13,16 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import * as pdfjsLib from 'pdfjs-web/pdfjs';
import { CSS_UNITS, mozL10n } from 'pdfjs-web/ui_utils';
(function (root, factory) { import { OverlayManager } from 'pdfjs-web/overlay_manager';
if (typeof define === 'function' && define.amd) { import { PDFPrintServiceFactory } from 'pdfjs-web/app';
define('pdfjs-web/pdf_print_service', ['exports', 'pdfjs-web/ui_utils',
'pdfjs-web/overlay_manager', 'pdfjs-web/app', 'pdfjs-web/pdfjs'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'), require('./overlay_manager.js'),
require('./app.js'), require('./pdfjs.js'));
} else {
factory((root.pdfjsWebPDFPrintService = {}), root.pdfjsWebUIUtils,
root.pdfjsWebOverlayManager, root.pdfjsWebApp, root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtils, overlayManager, app, pdfjsLib) {
var mozL10n = uiUtils.mozL10n;
var CSS_UNITS = uiUtils.CSS_UNITS;
var PDFPrintServiceFactory = app.PDFPrintServiceFactory;
var OverlayManager = overlayManager.OverlayManager;
var activeService = null; var activeService = null;
// Renders the page to the canvas of the given print service, and returns // Renders the page to the canvas of the given print service, and returns
// the suggested dimensions of the output page. // the suggested dimensions of the output page.
function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) { function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) {
var scratchCanvas = activeService.scratchCanvas; var scratchCanvas = activeService.scratchCanvas;
// The size of the canvas in pixels for printing. // The size of the canvas in pixels for printing.
@ -70,18 +55,18 @@
height: height, height: height,
}; };
}); });
} }
function PDFPrintService(pdfDocument, pagesOverview, printContainer) { function PDFPrintService(pdfDocument, pagesOverview, printContainer) {
this.pdfDocument = pdfDocument; this.pdfDocument = pdfDocument;
this.pagesOverview = pagesOverview; this.pagesOverview = pagesOverview;
this.printContainer = printContainer; this.printContainer = printContainer;
this.currentPage = -1; this.currentPage = -1;
// The temporary canvas where renderPage paints one page at a time. // The temporary canvas where renderPage paints one page at a time.
this.scratchCanvas = document.createElement('canvas'); this.scratchCanvas = document.createElement('canvas');
} }
PDFPrintService.prototype = { PDFPrintService.prototype = {
layout: function () { layout: function () {
this.throwIfInactive(); this.throwIfInactive();
@ -213,11 +198,11 @@
throw new Error('This print request was cancelled or completed.'); throw new Error('This print request was cancelled or completed.');
} }
}, },
}; };
var print = window.print; var print = window.print;
window.print = function print() { window.print = function print() {
if (activeService) { if (activeService) {
console.warn('Ignored window.print() because of a pending print job.'); console.warn('Ignored window.print() because of a pending print job.');
return; return;
@ -254,22 +239,22 @@
} }
}); });
} }
}; };
function dispatchEvent(eventType) { function dispatchEvent(eventType) {
var event = document.createEvent('CustomEvent'); var event = document.createEvent('CustomEvent');
event.initCustomEvent(eventType, false, false, 'custom'); event.initCustomEvent(eventType, false, false, 'custom');
window.dispatchEvent(event); window.dispatchEvent(event);
} }
function abort() { function abort() {
if (activeService) { if (activeService) {
activeService.destroy(); activeService.destroy();
dispatchEvent('afterprint'); dispatchEvent('afterprint');
} }
} }
function renderProgress(index, total) { function renderProgress(index, total) {
var progressContainer = document.getElementById('printServiceOverlay'); var progressContainer = document.getElementById('printServiceOverlay');
var progress = Math.round(100 * index / total); var progress = Math.round(100 * index / total);
var progressBar = progressContainer.querySelector('progress'); var progressBar = progressContainer.querySelector('progress');
@ -277,11 +262,11 @@
progressBar.value = progress; progressBar.value = progress;
progressPerc.textContent = mozL10n.get('print_progress_percent', progressPerc.textContent = mozL10n.get('print_progress_percent',
{progress: progress}, progress + '%'); {progress: progress}, progress + '%');
} }
var hasAttachEvent = !!document.attachEvent; var hasAttachEvent = !!document.attachEvent;
window.addEventListener('keydown', function(event) { window.addEventListener('keydown', function(event) {
// Intercept Cmd/Ctrl + P in all browsers. // Intercept Cmd/Ctrl + P in all browsers.
// Also intercept Cmd/Ctrl + Shift + P in Chrome and Opera // Also intercept Cmd/Ctrl + Shift + P in Chrome and Opera
if (event.keyCode === /* P= */ 80 && (event.ctrlKey || event.metaKey) && if (event.keyCode === /* P= */ 80 && (event.ctrlKey || event.metaKey) &&
@ -300,8 +285,8 @@
} }
return; return;
} }
}, true); }, true);
if (hasAttachEvent) { if (hasAttachEvent) {
document.attachEvent('onkeydown', function(event) { document.attachEvent('onkeydown', function(event) {
event = event || window.event; event = event || window.event;
if (event.keyCode === /* P= */ 80 && event.ctrlKey) { if (event.keyCode === /* P= */ 80 && event.ctrlKey) {
@ -309,9 +294,9 @@
return false; return false;
} }
}); });
} }
if ('onbeforeprint' in window) { if ('onbeforeprint' in window) {
// Do not propagate before/afterprint events when they are not triggered // Do not propagate before/afterprint events when they are not triggered
// from within this polyfill. (FF/IE). // from within this polyfill. (FF/IE).
var stopPropagationIfNeeded = function(event) { var stopPropagationIfNeeded = function(event) {
@ -321,19 +306,19 @@
}; };
window.addEventListener('beforeprint', stopPropagationIfNeeded); window.addEventListener('beforeprint', stopPropagationIfNeeded);
window.addEventListener('afterprint', stopPropagationIfNeeded); window.addEventListener('afterprint', stopPropagationIfNeeded);
} }
var overlayPromise; var overlayPromise;
function ensureOverlay() { function ensureOverlay() {
if (!overlayPromise) { if (!overlayPromise) {
overlayPromise = OverlayManager.register('printServiceOverlay', overlayPromise = OverlayManager.register('printServiceOverlay',
document.getElementById('printServiceOverlay'), abort, true); document.getElementById('printServiceOverlay'), abort, true);
document.getElementById('printCancel').onclick = abort; document.getElementById('printCancel').onclick = abort;
} }
return overlayPromise; return overlayPromise;
} }
PDFPrintServiceFactory.instance = { PDFPrintServiceFactory.instance = {
supportsPrinting: true, supportsPrinting: true,
createPrintService: function (pdfDocument, pagesOverview, printContainer) { createPrintService: function (pdfDocument, pagesOverview, printContainer) {
@ -344,7 +329,8 @@
printContainer); printContainer);
return activeService; return activeService;
} }
}; };
exports.PDFPrintService = PDFPrintService; export {
})); PDFPrintService,
};

19
web/pdf_rendering_queue.js

@ -13,18 +13,6 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_rendering_queue', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebPDFRenderingQueue = {}));
}
}(this, function (exports) {
var CLEANUP_TIMEOUT = 30000; var CLEANUP_TIMEOUT = 30000;
var RenderingStates = { var RenderingStates = {
@ -186,6 +174,7 @@ var PDFRenderingQueue = (function PDFRenderingQueueClosure() {
return PDFRenderingQueue; return PDFRenderingQueue;
})(); })();
exports.RenderingStates = RenderingStates; export {
exports.PDFRenderingQueue = PDFRenderingQueue; RenderingStates,
})); PDFRenderingQueue,
};

26
web/pdf_sidebar.js

@ -13,23 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { mozL10n } from 'pdfjs-web/ui_utils';
import { RenderingStates } from 'pdfjs-web/pdf_rendering_queue';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_sidebar', ['exports',
'pdfjs-web/pdf_rendering_queue', 'pdfjs-web/ui_utils'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./pdf_rendering_queue.js'),
require('./ui_utils.js'));
} else {
factory((root.pdfjsWebPDFSidebar = {}), root.pdfjsWebPDFRenderingQueue,
root.pdfjsWebUIUtils);
}
}(this, function (exports, pdfRenderingQueue, uiUtils) {
var RenderingStates = pdfRenderingQueue.RenderingStates;
var mozL10n = uiUtils.mozL10n;
var UI_NOTIFICATION_CLASS = 'pdfSidebarNotification'; var UI_NOTIFICATION_CLASS = 'pdfSidebarNotification';
@ -460,6 +445,7 @@ var PDFSidebar = (function PDFSidebarClosure() {
return PDFSidebar; return PDFSidebar;
})(); })();
exports.SidebarView = SidebarView; export {
exports.PDFSidebar = PDFSidebar; SidebarView,
})); PDFSidebar,
};

25
web/pdf_thumbnail_view.js

@ -13,24 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { getOutputScale, mozL10n } from 'pdfjs-web/ui_utils';
import { RenderingStates } from 'pdfjs-web/pdf_rendering_queue';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_thumbnail_view', ['exports',
'pdfjs-web/ui_utils', 'pdfjs-web/pdf_rendering_queue'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'),
require('./pdf_rendering_queue.js'));
} else {
factory((root.pdfjsWebPDFThumbnailView = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFRenderingQueue);
}
}(this, function (exports, uiUtils, pdfRenderingQueue) {
var mozL10n = uiUtils.mozL10n;
var getOutputScale = uiUtils.getOutputScale;
var RenderingStates = pdfRenderingQueue.RenderingStates;
var THUMBNAIL_WIDTH = 98; // px var THUMBNAIL_WIDTH = 98; // px
var THUMBNAIL_CANVAS_BORDER_WIDTH = 1; // px var THUMBNAIL_CANVAS_BORDER_WIDTH = 1; // px
@ -430,5 +414,6 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
PDFThumbnailView.tempImageCache = null; PDFThumbnailView.tempImageCache = null;
exports.PDFThumbnailView = PDFThumbnailView; export {
})); PDFThumbnailView,
};

28
web/pdf_thumbnail_viewer.js

@ -13,25 +13,10 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import {
getVisibleElements, scrollIntoView, watchScroll
(function (root, factory) { } from 'pdfjs-web/ui_utils';
if (typeof define === 'function' && define.amd) { import { PDFThumbnailView } from 'pdfjs-web/pdf_thumbnail_view';
define('pdfjs-web/pdf_thumbnail_viewer', ['exports',
'pdfjs-web/ui_utils', 'pdfjs-web/pdf_thumbnail_view'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'),
require('./pdf_thumbnail_view.js'));
} else {
factory((root.pdfjsWebPDFThumbnailViewer = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFThumbnailView);
}
}(this, function (exports, uiUtils, pdfThumbnailView) {
var watchScroll = uiUtils.watchScroll;
var getVisibleElements = uiUtils.getVisibleElements;
var scrollIntoView = uiUtils.scrollIntoView;
var PDFThumbnailView = pdfThumbnailView.PDFThumbnailView;
var THUMBNAIL_SCROLL_MARGIN = -19; var THUMBNAIL_SCROLL_MARGIN = -19;
@ -247,5 +232,6 @@ var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() {
return PDFThumbnailViewer; return PDFThumbnailViewer;
})(); })();
exports.PDFThumbnailViewer = PDFThumbnailViewer; export {
})); PDFThumbnailViewer,
};

63
web/pdf_viewer.js

@ -13,48 +13,20 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import * as pdfjsLib from 'pdfjs-web/pdfjs';
import {
(function (root, factory) { CSS_UNITS, DEFAULT_SCALE, DEFAULT_SCALE_VALUE, getVisibleElements,
if (typeof define === 'function' && define.amd) { MAX_AUTO_SCALE, RendererType, SCROLLBAR_PADDING, scrollIntoView,
define('pdfjs-web/pdf_viewer', ['exports', 'pdfjs-web/ui_utils', UNKNOWN_SCALE, VERTICAL_PADDING, watchScroll
'pdfjs-web/pdf_page_view', 'pdfjs-web/pdf_rendering_queue', } from 'pdfjs-web/ui_utils';
'pdfjs-web/text_layer_builder', 'pdfjs-web/annotation_layer_builder', import {
'pdfjs-web/pdf_link_service', 'pdfjs-web/dom_events', 'pdfjs-web/pdfjs'], PDFRenderingQueue, RenderingStates,
factory); } from 'pdfjs-web/pdf_rendering_queue';
} else if (typeof exports !== 'undefined') { import { AnnotationLayerBuilder } from 'pdfjs-web/annotation_layer_builder';
factory(exports, require('./ui_utils.js'), require('./pdf_page_view.js'), import { domEvents } from 'pdfjs-web/dom_events';
require('./pdf_rendering_queue.js'), require('./text_layer_builder.js'), import { PDFPageView } from 'pdfjs-web/pdf_page_view';
require('./annotation_layer_builder.js'), import { SimpleLinkService } from 'pdfjs-web/pdf_link_service';
require('./pdf_link_service.js'), require('./dom_events.js'), import { TextLayerBuilder } from 'pdfjs-web/text_layer_builder';
require('./pdfjs.js'));
} else {
factory((root.pdfjsWebPDFViewer = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFPageView, root.pdfjsWebPDFRenderingQueue,
root.pdfjsWebTextLayerBuilder, root.pdfjsWebAnnotationLayerBuilder,
root.pdfjsWebPDFLinkService, root.pdfjsWebDOMEvents, root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtils, pdfPageView, pdfRenderingQueue,
textLayerBuilder, annotationLayerBuilder, pdfLinkService,
domEvents, pdfjsLib) {
var UNKNOWN_SCALE = uiUtils.UNKNOWN_SCALE;
var SCROLLBAR_PADDING = uiUtils.SCROLLBAR_PADDING;
var VERTICAL_PADDING = uiUtils.VERTICAL_PADDING;
var MAX_AUTO_SCALE = uiUtils.MAX_AUTO_SCALE;
var CSS_UNITS = uiUtils.CSS_UNITS;
var DEFAULT_SCALE = uiUtils.DEFAULT_SCALE;
var DEFAULT_SCALE_VALUE = uiUtils.DEFAULT_SCALE_VALUE;
var RendererType = uiUtils.RendererType;
var scrollIntoView = uiUtils.scrollIntoView;
var watchScroll = uiUtils.watchScroll;
var getVisibleElements = uiUtils.getVisibleElements;
var PDFPageView = pdfPageView.PDFPageView;
var RenderingStates = pdfRenderingQueue.RenderingStates;
var PDFRenderingQueue = pdfRenderingQueue.PDFRenderingQueue;
var TextLayerBuilder = textLayerBuilder.TextLayerBuilder;
var AnnotationLayerBuilder = annotationLayerBuilder.AnnotationLayerBuilder;
var SimpleLinkService = pdfLinkService.SimpleLinkService;
var PresentationModeState = { var PresentationModeState = {
UNKNOWN: 0, UNKNOWN: 0,
@ -988,6 +960,7 @@ var PDFViewer = (function pdfViewer() {
return PDFViewer; return PDFViewer;
})(); })();
exports.PresentationModeState = PresentationModeState; export {
exports.PDFViewer = PDFViewer; PresentationModeState,
})); PDFViewer,
};

17
web/preferences.js

@ -13,18 +13,6 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/preferences', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebPreferences = {}));
}
}(this, function (exports) {
var defaultPreferences = null; var defaultPreferences = null;
function getDefaultPreferences() { function getDefaultPreferences() {
if (!defaultPreferences) { if (!defaultPreferences) {
@ -221,5 +209,6 @@ if (typeof PDFJSDev === 'undefined' ||
}; };
} }
exports.Preferences = Preferences; export {
})); Preferences,
};

21
web/secondary_toolbar.js

@ -13,21 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import { mozL10n, SCROLLBAR_PADDING } from 'pdfjs-web/ui_utils';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/secondary_toolbar', ['exports', 'pdfjs-web/ui_utils'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'));
} else {
factory((root.pdfjsWebSecondaryToolbar = {}), root.pdfjsWebUIUtils);
}
}(this, function (exports, uiUtils) {
var SCROLLBAR_PADDING = uiUtils.SCROLLBAR_PADDING;
var mozL10n = uiUtils.mozL10n;
/** /**
* @typedef {Object} SecondaryToolbarOptions * @typedef {Object} SecondaryToolbarOptions
@ -241,5 +227,6 @@ var SecondaryToolbar = (function SecondaryToolbarClosure() {
return SecondaryToolbar; return SecondaryToolbar;
})(); })();
exports.SecondaryToolbar = SecondaryToolbar; export {
})); SecondaryToolbar,
};

22
web/text_layer_builder.js

@ -13,19 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import * as pdfjsLib from 'pdfjs-web/pdfjs';
import { domEvents } from 'pdfjs-web/dom_events';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/text_layer_builder', ['exports', 'pdfjs-web/dom_events',
'pdfjs-web/pdfjs'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./dom_events.js'), require('./pdfjs.js'));
} else {
factory((root.pdfjsWebTextLayerBuilder = {}), root.pdfjsWebDOMEvents,
root.pdfjsWebPDFJS);
}
}(this, function (exports, domEvents, pdfjsLib) {
var EXPAND_DIVS_TIMEOUT = 300; // ms var EXPAND_DIVS_TIMEOUT = 300; // ms
@ -419,6 +408,7 @@ DefaultTextLayerFactory.prototype = {
} }
}; };
exports.TextLayerBuilder = TextLayerBuilder; export {
exports.DefaultTextLayerFactory = DefaultTextLayerFactory; TextLayerBuilder,
})); DefaultTextLayerFactory,
};

31
web/toolbar.js

@ -13,28 +13,10 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import {
animationStarted, DEFAULT_SCALE, DEFAULT_SCALE_VALUE, localized, MAX_SCALE,
(function (root, factory) { MIN_SCALE, mozL10n, noContextMenuHandler
if (typeof define === 'function' && define.amd) { } from 'pdfjs-web/ui_utils';
define('pdfjs-web/toolbar', ['exports', 'pdfjs-web/ui_utils'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'));
} else {
factory((root.pdfjsWebToolbar = {}), root.pdfjsWebUIUtils);
}
}(this, function (exports, uiUtils) {
var mozL10n = uiUtils.mozL10n;
var noContextMenuHandler = uiUtils.noContextMenuHandler;
var animationStarted = uiUtils.animationStarted;
var localized = uiUtils.localized;
var DEFAULT_SCALE_VALUE = uiUtils.DEFAULT_SCALE_VALUE;
var DEFAULT_SCALE = uiUtils.DEFAULT_SCALE;
var MIN_SCALE = uiUtils.MIN_SCALE;
var MAX_SCALE = uiUtils.MAX_SCALE;
var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading'; var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading';
var SCALE_SELECT_CONTAINER_PADDING = 8; var SCALE_SELECT_CONTAINER_PADDING = 8;
@ -286,5 +268,6 @@ var Toolbar = (function ToolbarClosure() {
return Toolbar; return Toolbar;
})(); })();
exports.Toolbar = Toolbar; export {
})); Toolbar,
};

67
web/ui_utils.js

@ -13,17 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict'; import * as pdfjsLib from 'pdfjs-web/pdfjs';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/ui_utils', ['exports', 'pdfjs-web/pdfjs'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./pdfjs.js'));
} else {
factory((root.pdfjsWebUIUtils = {}), root.pdfjsWebPDFJS);
}
}(this, function (exports, pdfjsLib) {
var CSS_UNITS = 96.0 / 72.0; var CSS_UNITS = 96.0 / 72.0;
var DEFAULT_SCALE_VALUE = 'auto'; var DEFAULT_SCALE_VALUE = 'auto';
@ -571,30 +561,31 @@ var ProgressBar = (function ProgressBarClosure() {
return ProgressBar; return ProgressBar;
})(); })();
exports.CSS_UNITS = CSS_UNITS; export {
exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE; CSS_UNITS,
exports.DEFAULT_SCALE = DEFAULT_SCALE; DEFAULT_SCALE_VALUE,
exports.MIN_SCALE = MIN_SCALE; DEFAULT_SCALE,
exports.MAX_SCALE = MAX_SCALE; MIN_SCALE,
exports.UNKNOWN_SCALE = UNKNOWN_SCALE; MAX_SCALE,
exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE; UNKNOWN_SCALE,
exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING; MAX_AUTO_SCALE,
exports.VERTICAL_PADDING = VERTICAL_PADDING; SCROLLBAR_PADDING,
exports.RendererType = RendererType; VERTICAL_PADDING,
exports.mozL10n = mozL10n; RendererType,
exports.EventBus = EventBus; mozL10n,
exports.ProgressBar = ProgressBar; EventBus,
exports.getPDFFileNameFromURL = getPDFFileNameFromURL; ProgressBar,
exports.noContextMenuHandler = noContextMenuHandler; getPDFFileNameFromURL,
exports.parseQueryString = parseQueryString; noContextMenuHandler,
exports.getVisibleElements = getVisibleElements; parseQueryString,
exports.roundToDivide = roundToDivide; getVisibleElements,
exports.approximateFraction = approximateFraction; roundToDivide,
exports.getOutputScale = getOutputScale; approximateFraction,
exports.scrollIntoView = scrollIntoView; getOutputScale,
exports.watchScroll = watchScroll; scrollIntoView,
exports.binarySearchFirstItem = binarySearchFirstItem; watchScroll,
exports.normalizeWheelEventDelta = normalizeWheelEventDelta; binarySearchFirstItem,
exports.animationStarted = animationStarted; normalizeWheelEventDelta,
exports.localized = localized; animationStarted,
})); localized,
};

17
web/view_history.js

@ -13,18 +13,6 @@
* limitations under the License. * limitations under the License.
*/ */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/view_history', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebViewHistory = {}));
}
}(this, function (exports) {
var DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20; var DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20;
/** /**
@ -142,5 +130,6 @@ var ViewHistory = (function ViewHistoryClosure() {
return ViewHistory; return ViewHistory;
})(); })();
exports.ViewHistory = ViewHistory; export {
})); ViewHistory,
};

Loading…
Cancel
Save