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.
This commit is contained in:
parent
313060aff5
commit
3b35c15d42
@ -13,24 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(function (root, factory) {
|
||||
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;
|
||||
import * as pdfjsLib from 'pdfjs-web/pdfjs';
|
||||
import { mozL10n } from 'pdfjs-web/ui_utils';
|
||||
import { SimpleLinkService } from 'pdfjs-web/pdf_link_service';
|
||||
|
||||
/**
|
||||
* @typedef {Object} AnnotationLayerBuilderOptions
|
||||
@ -142,6 +127,7 @@ DefaultAnnotationLayerFactory.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
exports.AnnotationLayerBuilder = AnnotationLayerBuilder;
|
||||
exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory;
|
||||
}));
|
||||
export {
|
||||
AnnotationLayerBuilder,
|
||||
DefaultAnnotationLayerFactory,
|
||||
};
|
||||
|
126
web/app.js
126
web/app.js
@ -14,95 +14,34 @@
|
||||
*/
|
||||
/* globals PDFBug, Stats */
|
||||
|
||||
'use strict';
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define('pdfjs-web/app', ['exports', 'pdfjs-web/ui_utils',
|
||||
'pdfjs-web/pdf_history',
|
||||
'pdfjs-web/preferences', 'pdfjs-web/pdf_sidebar',
|
||||
'pdfjs-web/view_history', 'pdfjs-web/pdf_thumbnail_viewer',
|
||||
'pdfjs-web/toolbar', 'pdfjs-web/secondary_toolbar',
|
||||
'pdfjs-web/password_prompt', 'pdfjs-web/pdf_presentation_mode',
|
||||
'pdfjs-web/pdf_document_properties', 'pdfjs-web/hand_tool',
|
||||
'pdfjs-web/pdf_viewer', 'pdfjs-web/pdf_rendering_queue',
|
||||
'pdfjs-web/pdf_link_service', 'pdfjs-web/pdf_outline_viewer',
|
||||
'pdfjs-web/overlay_manager', 'pdfjs-web/pdf_attachment_viewer',
|
||||
'pdfjs-web/pdf_find_controller', 'pdfjs-web/pdf_find_bar',
|
||||
'pdfjs-web/dom_events', 'pdfjs-web/pdfjs'],
|
||||
factory);
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
factory(exports, require('./ui_utils.js'),
|
||||
require('./pdf_history.js'), require('./preferences.js'),
|
||||
require('./pdf_sidebar.js'), require('./view_history.js'),
|
||||
require('./pdf_thumbnail_viewer.js'), require('./toolbar.js'),
|
||||
require('./secondary_toolbar.js'), require('./password_prompt.js'),
|
||||
require('./pdf_presentation_mode.js'),
|
||||
require('./pdf_document_properties.js'), require('./hand_tool.js'),
|
||||
require('./pdf_viewer.js'), require('./pdf_rendering_queue.js'),
|
||||
require('./pdf_link_service.js'), require('./pdf_outline_viewer.js'),
|
||||
require('./overlay_manager.js'), require('./pdf_attachment_viewer.js'),
|
||||
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;
|
||||
import * as pdfjsLib from 'pdfjs-web/pdfjs';
|
||||
import {
|
||||
animationStarted, DEFAULT_SCALE_VALUE, getPDFFileNameFromURL, localized,
|
||||
MAX_SCALE, MIN_SCALE, mozL10n, noContextMenuHandler, normalizeWheelEventDelta,
|
||||
parseQueryString, ProgressBar, RendererType, UNKNOWN_SCALE
|
||||
} from 'pdfjs-web/ui_utils';
|
||||
import {
|
||||
PDFRenderingQueue, RenderingStates
|
||||
} from 'pdfjs-web/pdf_rendering_queue';
|
||||
import { PDFSidebar, SidebarView } from 'pdfjs-web/pdf_sidebar';
|
||||
import { PDFViewer, PresentationModeState } from 'pdfjs-web/pdf_viewer';
|
||||
import { getGlobalEventBus } from 'pdfjs-web/dom_events';
|
||||
import { HandTool } from 'pdfjs-web/hand_tool';
|
||||
import { OverlayManager } from 'pdfjs-web/overlay_manager';
|
||||
import { PasswordPrompt } from 'pdfjs-web/password_prompt';
|
||||
import { PDFAttachmentViewer } from 'pdfjs-web/pdf_attachment_viewer';
|
||||
import { PDFDocumentProperties } from 'pdfjs-web/pdf_document_properties';
|
||||
import { PDFFindBar } from 'pdfjs-web/pdf_find_bar';
|
||||
import { PDFFindController } from 'pdfjs-web/pdf_find_controller';
|
||||
import { PDFHistory } from 'pdfjs-web/pdf_history';
|
||||
import { PDFLinkService } from 'pdfjs-web/pdf_link_service';
|
||||
import { PDFOutlineViewer } from 'pdfjs-web/pdf_outline_viewer';
|
||||
import { PDFPresentationMode } from 'pdfjs-web/pdf_presentation_mode';
|
||||
import { PDFThumbnailViewer } from 'pdfjs-web/pdf_thumbnail_viewer';
|
||||
import { Preferences } from 'pdfjs-web/preferences';
|
||||
import { SecondaryToolbar } from 'pdfjs-web/secondary_toolbar';
|
||||
import { Toolbar } from 'pdfjs-web/toolbar';
|
||||
import { ViewHistory } from 'pdfjs-web/view_history';
|
||||
|
||||
var DEFAULT_SCALE_DELTA = 1.1;
|
||||
var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
|
||||
@ -2269,7 +2208,8 @@ var PDFPrintServiceFactory = {
|
||||
}
|
||||
};
|
||||
|
||||
exports.PDFViewerApplication = PDFViewerApplication;
|
||||
exports.DefaultExternalServices = DefaultExternalServices;
|
||||
exports.PDFPrintServiceFactory = PDFPrintServiceFactory;
|
||||
}));
|
||||
export {
|
||||
PDFViewerApplication,
|
||||
DefaultExternalServices,
|
||||
PDFPrintServiceFactory,
|
||||
};
|
||||
|
131
web/chromecom.js
131
web/chromecom.js
@ -14,34 +14,18 @@
|
||||
*/
|
||||
/* 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 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')) {
|
||||
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('CHROME')) {
|
||||
throw new Error('Module "pdfjs-web/chromecom" shall not be used outside ' +
|
||||
'CHROME build.');
|
||||
}
|
||||
}
|
||||
|
||||
var PDFViewerApplication = app.PDFViewerApplication;
|
||||
var DefaultExternalServices = app.DefaultExternalServices;
|
||||
var OverlayManager = overlayManager.OverlayManager;
|
||||
var Preferences = preferences.Preferences;
|
||||
|
||||
var ChromeCom = {};
|
||||
/**
|
||||
var ChromeCom = {};
|
||||
/**
|
||||
* Creates an event that the extension is listening for and will
|
||||
* asynchronously respond by calling the callback.
|
||||
*
|
||||
@ -51,7 +35,7 @@
|
||||
* with one data argument. When the request cannot be handled, the callback
|
||||
* is immediately invoked with no arguments.
|
||||
*/
|
||||
ChromeCom.request = function ChromeCom_request(action, data, callback) {
|
||||
ChromeCom.request = function ChromeCom_request(action, data, callback) {
|
||||
var message = {
|
||||
action: action,
|
||||
data: data
|
||||
@ -66,15 +50,15 @@
|
||||
} else {
|
||||
chrome.runtime.sendMessage(message);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Resolves a PDF file path and attempts to detects length.
|
||||
*
|
||||
* @param {String} file Absolute URL of PDF file.
|
||||
* @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)
|
||||
file = file.replace(/^drive:/i,
|
||||
'filesystem:' + location.origin + '/external/');
|
||||
@ -132,9 +116,9 @@
|
||||
return;
|
||||
}
|
||||
callback(file);
|
||||
};
|
||||
};
|
||||
|
||||
function getEmbedderOrigin(callback) {
|
||||
function getEmbedderOrigin(callback) {
|
||||
var origin = window === top ? location.origin : location.ancestorOrigins[0];
|
||||
if (origin === 'null') {
|
||||
// file:-URLs, data-URLs, sandboxed frames, etc.
|
||||
@ -142,17 +126,17 @@
|
||||
} else {
|
||||
callback(origin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getParentOrigin(callback) {
|
||||
function getParentOrigin(callback) {
|
||||
ChromeCom.request('getParentOrigin', null, callback);
|
||||
}
|
||||
}
|
||||
|
||||
function isAllowedFileSchemeAccess(callback) {
|
||||
function isAllowedFileSchemeAccess(callback) {
|
||||
ChromeCom.request('isAllowedFileSchemeAccess', null, callback);
|
||||
}
|
||||
}
|
||||
|
||||
function isRuntimeAvailable() {
|
||||
function isRuntimeAvailable() {
|
||||
try {
|
||||
// When the extension is reloaded, the extension runtime is destroyed and
|
||||
// the extension APIs become unavailable.
|
||||
@ -161,16 +145,16 @@
|
||||
}
|
||||
} catch (e) {}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function reloadIfRuntimeIsUnavailable() {
|
||||
function reloadIfRuntimeIsUnavailable() {
|
||||
if (!isRuntimeAvailable()) {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var chromeFileAccessOverlayPromise;
|
||||
function requestAccessToLocalFile(fileUrl) {
|
||||
var chromeFileAccessOverlayPromise;
|
||||
function requestAccessToLocalFile(fileUrl) {
|
||||
var onCloseOverlay = null;
|
||||
if (top !== window) {
|
||||
// When the extension reloads after receiving new permissions, the pages
|
||||
@ -232,9 +216,9 @@
|
||||
|
||||
OverlayManager.open('chromeFileAccessOverlay');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (window === top) {
|
||||
if (window === top) {
|
||||
// Chrome closes all extension tabs (crbug.com/511670) when the extension
|
||||
// reloads. To counter this, the tab URL and history state is saved to
|
||||
// localStorage and restored by extension-router.js.
|
||||
@ -249,22 +233,22 @@
|
||||
JSON.stringify(history.state));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// This port is used for several purposes:
|
||||
// 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
|
||||
// to the background page.
|
||||
// 3. When the background page knows the referrer of the page, the referrer is
|
||||
// saved in history.state.chromecomState.
|
||||
var port;
|
||||
// Set the referer for the given URL.
|
||||
// 0. Background: If loaded via a http(s) URL: Save referer.
|
||||
// 1. Page -> background: send URL and referer from history.state
|
||||
// 2. Background: Bind referer to URL (via webRequest).
|
||||
// 3. Background -> page: Send latest referer and save to history.
|
||||
// 4. Page: Invoke callback.
|
||||
function setReferer(url, callback) {
|
||||
// This port is used for several purposes:
|
||||
// 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
|
||||
// to the background page.
|
||||
// 3. When the background page knows the referrer of the page, the referrer is
|
||||
// saved in history.state.chromecomState.
|
||||
var port;
|
||||
// Set the referer for the given URL.
|
||||
// 0. Background: If loaded via a http(s) URL: Save referer.
|
||||
// 1. Page -> background: send URL and referer from history.state
|
||||
// 2. Background: Bind referer to URL (via webRequest).
|
||||
// 3. Background -> page: Send latest referer and save to history.
|
||||
// 4. Page: Invoke callback.
|
||||
function setReferer(url, callback) {
|
||||
if (!port) {
|
||||
// The background page will accept the port, and keep adding the Referer
|
||||
// request header to requests to |url| until the port is disconnected.
|
||||
@ -301,14 +285,14 @@
|
||||
port.onMessage.removeListener(onMessage);
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// chrome.storage.sync is not supported in every Chromium-derivate.
|
||||
// Note: The background page takes care of migrating values from
|
||||
// chrome.storage.local to chrome.storage.sync when needed.
|
||||
var storageArea = chrome.storage.sync || chrome.storage.local;
|
||||
// chrome.storage.sync is not supported in every Chromium-derivate.
|
||||
// Note: The background page takes care of migrating values from
|
||||
// chrome.storage.local to chrome.storage.sync when needed.
|
||||
var storageArea = chrome.storage.sync || chrome.storage.local;
|
||||
|
||||
Preferences._writeToStorage = function (prefObj) {
|
||||
Preferences._writeToStorage = function (prefObj) {
|
||||
return new Promise(function (resolve) {
|
||||
if (prefObj === 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) {
|
||||
if (chrome.storage.managed) {
|
||||
// Get preferences as set by the system administrator.
|
||||
@ -347,17 +331,18 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var ChromeExternalServices = Object.create(DefaultExternalServices);
|
||||
ChromeExternalServices.initPassiveLoading = function (callbacks) {
|
||||
var ChromeExternalServices = Object.create(DefaultExternalServices);
|
||||
ChromeExternalServices.initPassiveLoading = function (callbacks) {
|
||||
var appConfig = PDFViewerApplication.appConfig;
|
||||
ChromeCom.resolvePDFFile(appConfig.defaultUrl,
|
||||
function (url, length, originalURL) {
|
||||
callbacks.onOpenWithURL(url, length, originalURL);
|
||||
});
|
||||
};
|
||||
PDFViewerApplication.externalServices = ChromeExternalServices;
|
||||
};
|
||||
PDFViewerApplication.externalServices = ChromeExternalServices;
|
||||
|
||||
exports.ChromeCom = ChromeCom;
|
||||
}));
|
||||
export {
|
||||
ChromeCom,
|
||||
};
|
||||
|
@ -13,22 +13,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
import { EventBus } from 'pdfjs-web/ui_utils';
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define('pdfjs-web/dom_events', ['exports', 'pdfjs-web/ui_utils'], factory);
|
||||
} 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) {
|
||||
// Attaching to the application event bus to dispatch events to the DOM for
|
||||
// backwards viewer API compatibility.
|
||||
function attachDOMEventsToEventBus(eventBus) {
|
||||
eventBus.on('documentload', function () {
|
||||
var event = document.createEvent('CustomEvent');
|
||||
event.initCustomEvent('documentload', true, true, {});
|
||||
@ -137,18 +126,19 @@
|
||||
});
|
||||
e.source.container.dispatchEvent(event);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var globalEventBus = null;
|
||||
function getGlobalEventBus() {
|
||||
var globalEventBus = null;
|
||||
function getGlobalEventBus() {
|
||||
if (globalEventBus) {
|
||||
return globalEventBus;
|
||||
}
|
||||
globalEventBus = new EventBus();
|
||||
attachDOMEventsToEventBus(globalEventBus);
|
||||
return globalEventBus;
|
||||
}
|
||||
}
|
||||
|
||||
exports.attachDOMEventsToEventBus = attachDOMEventsToEventBus;
|
||||
exports.getGlobalEventBus = getGlobalEventBus;
|
||||
}));
|
||||
export {
|
||||
attachDOMEventsToEventBus,
|
||||
getGlobalEventBus,
|
||||
};
|
||||
|
@ -13,27 +13,14 @@
|
||||
* 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')) {
|
||||
throw new Error('Module "pdfjs-web/download_manager" shall not be used ' +
|
||||
'outside CHROME and GENERIC builds.');
|
||||
}
|
||||
|
||||
var PDFViewerApplication = app.PDFViewerApplication;
|
||||
var DefaultExternalServices = app.DefaultExternalServices;
|
||||
|
||||
function download(blobUrl, filename) {
|
||||
var a = document.createElement('a');
|
||||
if (a.click) {
|
||||
@ -118,5 +105,6 @@ GenericExternalServices.createDownloadManager = function () {
|
||||
};
|
||||
PDFViewerApplication.externalServices = GenericExternalServices;
|
||||
|
||||
exports.DownloadManager = DownloadManager;
|
||||
}));
|
||||
export {
|
||||
DownloadManager,
|
||||
};
|
||||
|
@ -13,25 +13,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
import * as pdfjsLib from 'pdfjs-web/pdfjs';
|
||||
import { CSS_UNITS } from 'pdfjs-web/ui_utils';
|
||||
import { PDFPrintServiceFactory } from 'pdfjs-web/app';
|
||||
|
||||
(function (root, factory) {
|
||||
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.
|
||||
function composePage(pdfDocument, pageNumber, size, printContainer) {
|
||||
// Creates a placeholder with div and canvas with right size for the page.
|
||||
function composePage(pdfDocument, pageNumber, size, printContainer) {
|
||||
var canvas = document.createElement('canvas');
|
||||
|
||||
// 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.pagesOverview = pagesOverview;
|
||||
this.printContainer = printContainer;
|
||||
}
|
||||
}
|
||||
|
||||
FirefoxPrintService.prototype = {
|
||||
FirefoxPrintService.prototype = {
|
||||
layout: function () {
|
||||
var pdfDocument = this.pdfDocument;
|
||||
var printContainer = this.printContainer;
|
||||
@ -102,9 +89,9 @@
|
||||
destroy: function () {
|
||||
this.printContainer.textContent = '';
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
PDFPrintServiceFactory.instance = {
|
||||
PDFPrintServiceFactory.instance = {
|
||||
get supportsPrinting() {
|
||||
var canvas = document.createElement('canvas');
|
||||
var value = 'mozPrintCallback' in canvas;
|
||||
@ -116,7 +103,8 @@
|
||||
return new FirefoxPrintService(pdfDocument, pagesOverview,
|
||||
printContainer);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
exports.FirefoxPrintService = FirefoxPrintService;
|
||||
}));
|
||||
export {
|
||||
FirefoxPrintService,
|
||||
};
|
||||
|
@ -13,29 +13,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
import * as pdfjsLib from 'pdfjs-web/pdfjs';
|
||||
import { PDFViewerApplication } from 'pdfjs-web/app';
|
||||
import { Preferences } from 'pdfjs-web/preferences';
|
||||
|
||||
(function (root, factory) {
|
||||
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' ||
|
||||
!PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
|
||||
throw new Error('Module "pdfjs-web/firefoxcom" shall not be used outside ' +
|
||||
'FIREFOX and MOZCENTRAL builds.');
|
||||
}
|
||||
|
||||
var Preferences = preferences.Preferences;
|
||||
var PDFViewerApplication = app.PDFViewerApplication;
|
||||
|
||||
var FirefoxCom = (function FirefoxComClosure() {
|
||||
return {
|
||||
/**
|
||||
@ -291,6 +278,7 @@ document.mozL10n.setExternalLocalizerServices({
|
||||
}
|
||||
});
|
||||
|
||||
exports.DownloadManager = DownloadManager;
|
||||
exports.FirefoxCom = FirefoxCom;
|
||||
}));
|
||||
export {
|
||||
DownloadManager,
|
||||
FirefoxCom,
|
||||
};
|
||||
|
@ -14,18 +14,7 @@
|
||||
* 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.
|
||||
* @param options.element {Element}
|
||||
* @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
|
||||
* shows whether grab-to-pan is activated.
|
||||
*/
|
||||
function GrabToPan(options) {
|
||||
function GrabToPan(options) {
|
||||
this.element = options.element;
|
||||
this.document = options.element.ownerDocument;
|
||||
if (typeof options.ignoreTarget === 'function') {
|
||||
@ -54,8 +43,8 @@
|
||||
// a grab operation, to ensure that the cursor has the desired appearance.
|
||||
var overlay = this.overlay = document.createElement('div');
|
||||
overlay.className = 'grab-to-pan-grabbing';
|
||||
}
|
||||
GrabToPan.prototype = {
|
||||
}
|
||||
GrabToPan.prototype = {
|
||||
/**
|
||||
* Class name of element which can be grabbed
|
||||
*/
|
||||
@ -187,11 +176,11 @@
|
||||
// Note: ChildNode.remove doesn't throw if the parentNode is undefined.
|
||||
this.overlay.remove();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// Get the correct (vendor-prefixed) name of the matches method.
|
||||
var matchesSelector;
|
||||
['webkitM', 'mozM', 'msM', 'oM', 'm'].some(function(prefix) {
|
||||
// Get the correct (vendor-prefixed) name of the matches method.
|
||||
var matchesSelector;
|
||||
['webkitM', 'mozM', 'msM', 'oM', 'm'].some(function(prefix) {
|
||||
var name = prefix + 'atches';
|
||||
if (name in document.documentElement) {
|
||||
matchesSelector = name;
|
||||
@ -201,24 +190,24 @@
|
||||
matchesSelector = name;
|
||||
}
|
||||
return matchesSelector; // If found, then truthy, and [].some() ends.
|
||||
});
|
||||
});
|
||||
|
||||
// Browser sniffing because it's impossible to feature-detect
|
||||
// whether event.which for onmousemove is reliable
|
||||
var isNotIEorIsIE10plus = !document.documentMode || document.documentMode > 9;
|
||||
var chrome = window.chrome;
|
||||
var isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app);
|
||||
// ^ Chrome 15+ ^ Opera 15+
|
||||
var isSafari6plus = /Apple/.test(navigator.vendor) &&
|
||||
// Browser sniffing because it's impossible to feature-detect
|
||||
// whether event.which for onmousemove is reliable
|
||||
var isNotIEorIsIE10plus = !document.documentMode || document.documentMode > 9;
|
||||
var chrome = window.chrome;
|
||||
var isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app);
|
||||
// ^ Chrome 15+ ^ Opera 15+
|
||||
var isSafari6plus = /Apple/.test(navigator.vendor) &&
|
||||
/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Whether the left mouse is not pressed.
|
||||
* @param event {MouseEvent}
|
||||
* @return {boolean} True if the left mouse button is not pressed.
|
||||
* False if unsure or if the left mouse button is pressed.
|
||||
*/
|
||||
function isLeftMouseReleased(event) {
|
||||
function isLeftMouseReleased(event) {
|
||||
if ('buttons' in event && isNotIEorIsIE10plus) {
|
||||
// http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-buttons
|
||||
// Firefox 15+
|
||||
@ -231,7 +220,8 @@
|
||||
// Safari 6.0+
|
||||
return event.which === 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.GrabToPan = GrabToPan;
|
||||
}));
|
||||
export {
|
||||
GrabToPan,
|
||||
};
|
||||
|
@ -13,24 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(function (root, factory) {
|
||||
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;
|
||||
import { GrabToPan } from 'pdfjs-web/grab_to_pan';
|
||||
import { localized } from 'pdfjs-web/ui_utils';
|
||||
import { Preferences } from 'pdfjs-web/preferences';
|
||||
|
||||
/**
|
||||
* @typedef {Object} HandToolOptions
|
||||
@ -110,5 +95,6 @@ var HandTool = (function HandToolClosure() {
|
||||
return HandTool;
|
||||
})();
|
||||
|
||||
exports.HandTool = HandTool;
|
||||
}));
|
||||
export {
|
||||
HandTool,
|
||||
};
|
||||
|
@ -13,18 +13,6 @@
|
||||
* 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 = {
|
||||
overlays: {},
|
||||
active: null,
|
||||
@ -151,5 +139,6 @@ var OverlayManager = {
|
||||
}
|
||||
};
|
||||
|
||||
exports.OverlayManager = OverlayManager;
|
||||
}));
|
||||
export {
|
||||
OverlayManager,
|
||||
};
|
||||
|
@ -13,24 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(function (root, factory) {
|
||||
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;
|
||||
import * as pdfjsLib from 'pdfjs-web/pdfjs';
|
||||
import { mozL10n } from 'pdfjs-web/ui_utils';
|
||||
import { OverlayManager } from 'pdfjs-web/overlay_manager';
|
||||
|
||||
/**
|
||||
* @typedef {Object} PasswordPromptOptions
|
||||
@ -120,5 +105,6 @@ var PasswordPrompt = (function PasswordPromptClosure() {
|
||||
return PasswordPrompt;
|
||||
})();
|
||||
|
||||
exports.PasswordPrompt = PasswordPrompt;
|
||||
}));
|
||||
export {
|
||||
PasswordPrompt,
|
||||
};
|
||||
|
@ -13,18 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(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) {
|
||||
import * as pdfjsLib from 'pdfjs-web/pdfjs';
|
||||
|
||||
/**
|
||||
* @typedef {Object} PDFAttachmentViewerOptions
|
||||
@ -205,5 +194,6 @@ var PDFAttachmentViewer = (function PDFAttachmentViewerClosure() {
|
||||
return PDFAttachmentViewer;
|
||||
})();
|
||||
|
||||
exports.PDFAttachmentViewer = PDFAttachmentViewer;
|
||||
}));
|
||||
export {
|
||||
PDFAttachmentViewer,
|
||||
};
|
||||
|
@ -13,23 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(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;
|
||||
import { getPDFFileNameFromURL, mozL10n } from 'pdfjs-web/ui_utils';
|
||||
import { OverlayManager } from 'pdfjs-web/overlay_manager';
|
||||
|
||||
/**
|
||||
* @typedef {Object} PDFDocumentPropertiesOptions
|
||||
@ -239,5 +224,6 @@ var PDFDocumentProperties = (function PDFDocumentPropertiesClosure() {
|
||||
return PDFDocumentProperties;
|
||||
})();
|
||||
|
||||
exports.PDFDocumentProperties = PDFDocumentProperties;
|
||||
}));
|
||||
export {
|
||||
PDFDocumentProperties,
|
||||
};
|
||||
|
@ -13,23 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(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;
|
||||
import { FindStates } from 'pdfjs-web/pdf_find_controller';
|
||||
import { mozL10n } from 'pdfjs-web/ui_utils';
|
||||
|
||||
/**
|
||||
* Creates a "search bar" given a set of DOM elements that act as controls
|
||||
@ -236,5 +221,6 @@ var PDFFindBar = (function PDFFindBarClosure() {
|
||||
return PDFFindBar;
|
||||
})();
|
||||
|
||||
exports.PDFFindBar = PDFFindBar;
|
||||
}));
|
||||
export {
|
||||
PDFFindBar,
|
||||
};
|
||||
|
@ -13,20 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(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;
|
||||
import { scrollIntoView } from 'pdfjs-web/ui_utils';
|
||||
|
||||
var FindStates = {
|
||||
FIND_FOUND: 0,
|
||||
@ -505,6 +492,7 @@ var PDFFindController = (function PDFFindControllerClosure() {
|
||||
return PDFFindController;
|
||||
})();
|
||||
|
||||
exports.FindStates = FindStates;
|
||||
exports.PDFFindController = PDFFindController;
|
||||
}));
|
||||
export {
|
||||
FindStates,
|
||||
PDFFindController,
|
||||
};
|
||||
|
@ -14,29 +14,18 @@
|
||||
*/
|
||||
/* 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.eventBus = options.eventBus || domEvents.getGlobalEventBus();
|
||||
|
||||
this.initialized = false;
|
||||
this.initialDestination = null;
|
||||
this.initialBookmark = null;
|
||||
}
|
||||
}
|
||||
|
||||
PDFHistory.prototype = {
|
||||
PDFHistory.prototype = {
|
||||
/**
|
||||
* @param {string} fingerprint
|
||||
*/
|
||||
@ -430,7 +419,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
exports.PDFHistory = PDFHistory;
|
||||
}));
|
||||
export {
|
||||
PDFHistory,
|
||||
};
|
||||
|
@ -13,21 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(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;
|
||||
import { domEvents } from 'pdfjs-web/dom_events';
|
||||
import { parseQueryString } from 'pdfjs-web/ui_utils';
|
||||
|
||||
var PageNumberRegExp = /^\d+$/;
|
||||
function isPageNumber(str) {
|
||||
@ -487,6 +474,7 @@ var SimpleLinkService = (function SimpleLinkServiceClosure() {
|
||||
return SimpleLinkService;
|
||||
})();
|
||||
|
||||
exports.PDFLinkService = PDFLinkService;
|
||||
exports.SimpleLinkService = SimpleLinkService;
|
||||
}));
|
||||
export {
|
||||
PDFLinkService,
|
||||
SimpleLinkService,
|
||||
};
|
||||
|
@ -13,18 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(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) {
|
||||
import * as pdfjsLib from 'pdfjs-web/pdfjs';
|
||||
|
||||
var PDFJS = pdfjsLib.PDFJS;
|
||||
|
||||
@ -231,5 +220,6 @@ var PDFOutlineViewer = (function PDFOutlineViewerClosure() {
|
||||
return PDFOutlineViewer;
|
||||
})();
|
||||
|
||||
exports.PDFOutlineViewer = PDFOutlineViewer;
|
||||
}));
|
||||
export {
|
||||
PDFOutlineViewer,
|
||||
};
|
||||
|
@ -13,31 +13,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define('pdfjs-web/pdf_page_view', ['exports',
|
||||
'pdfjs-web/ui_utils', 'pdfjs-web/pdf_rendering_queue',
|
||||
'pdfjs-web/dom_events', 'pdfjs-web/pdfjs'], factory);
|
||||
} 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;
|
||||
import * as pdfjsLib from 'pdfjs-web/pdfjs';
|
||||
import {
|
||||
approximateFraction, CSS_UNITS, DEFAULT_SCALE, getOutputScale, RendererType,
|
||||
roundToDivide
|
||||
} from 'pdfjs-web/ui_utils';
|
||||
import { domEvents } from 'pdfjs-web/dom_events';
|
||||
import { RenderingStates } from 'pdfjs-web/pdf_rendering_queue';
|
||||
|
||||
var TEXT_LAYER_RENDER_DELAY = 200; // ms
|
||||
|
||||
@ -691,5 +673,6 @@ var PDFPageView = (function PDFPageViewClosure() {
|
||||
return PDFPageView;
|
||||
})();
|
||||
|
||||
exports.PDFPageView = PDFPageView;
|
||||
}));
|
||||
export {
|
||||
PDFPageView,
|
||||
};
|
||||
|
@ -13,19 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(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;
|
||||
import { normalizeWheelEventDelta } from 'pdfjs-web/ui_utils';
|
||||
|
||||
var DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500; // in ms
|
||||
var DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms
|
||||
@ -517,5 +505,6 @@ var PDFPresentationMode = (function PDFPresentationModeClosure() {
|
||||
return PDFPresentationMode;
|
||||
})();
|
||||
|
||||
exports.PDFPresentationMode = PDFPresentationMode;
|
||||
}));
|
||||
export {
|
||||
PDFPresentationMode,
|
||||
};
|
||||
|
@ -13,31 +13,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
import * as pdfjsLib from 'pdfjs-web/pdfjs';
|
||||
import { CSS_UNITS, mozL10n } from 'pdfjs-web/ui_utils';
|
||||
import { OverlayManager } from 'pdfjs-web/overlay_manager';
|
||||
import { PDFPrintServiceFactory } from 'pdfjs-web/app';
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
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
|
||||
// the suggested dimensions of the output page.
|
||||
function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) {
|
||||
// Renders the page to the canvas of the given print service, and returns
|
||||
// the suggested dimensions of the output page.
|
||||
function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) {
|
||||
var scratchCanvas = activeService.scratchCanvas;
|
||||
|
||||
// The size of the canvas in pixels for printing.
|
||||
@ -70,18 +55,18 @@
|
||||
height: height,
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function PDFPrintService(pdfDocument, pagesOverview, printContainer) {
|
||||
function PDFPrintService(pdfDocument, pagesOverview, printContainer) {
|
||||
this.pdfDocument = pdfDocument;
|
||||
this.pagesOverview = pagesOverview;
|
||||
this.printContainer = printContainer;
|
||||
this.currentPage = -1;
|
||||
// The temporary canvas where renderPage paints one page at a time.
|
||||
this.scratchCanvas = document.createElement('canvas');
|
||||
}
|
||||
}
|
||||
|
||||
PDFPrintService.prototype = {
|
||||
PDFPrintService.prototype = {
|
||||
layout: function () {
|
||||
this.throwIfInactive();
|
||||
|
||||
@ -213,11 +198,11 @@
|
||||
throw new Error('This print request was cancelled or completed.');
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
var print = window.print;
|
||||
window.print = function print() {
|
||||
var print = window.print;
|
||||
window.print = function print() {
|
||||
if (activeService) {
|
||||
console.warn('Ignored window.print() because of a pending print job.');
|
||||
return;
|
||||
@ -254,22 +239,22 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
function dispatchEvent(eventType) {
|
||||
function dispatchEvent(eventType) {
|
||||
var event = document.createEvent('CustomEvent');
|
||||
event.initCustomEvent(eventType, false, false, 'custom');
|
||||
window.dispatchEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
function abort() {
|
||||
function abort() {
|
||||
if (activeService) {
|
||||
activeService.destroy();
|
||||
dispatchEvent('afterprint');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderProgress(index, total) {
|
||||
function renderProgress(index, total) {
|
||||
var progressContainer = document.getElementById('printServiceOverlay');
|
||||
var progress = Math.round(100 * index / total);
|
||||
var progressBar = progressContainer.querySelector('progress');
|
||||
@ -277,11 +262,11 @@
|
||||
progressBar.value = progress;
|
||||
progressPerc.textContent = mozL10n.get('print_progress_percent',
|
||||
{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.
|
||||
// Also intercept Cmd/Ctrl + Shift + P in Chrome and Opera
|
||||
if (event.keyCode === /* P= */ 80 && (event.ctrlKey || event.metaKey) &&
|
||||
@ -300,8 +285,8 @@
|
||||
}
|
||||
return;
|
||||
}
|
||||
}, true);
|
||||
if (hasAttachEvent) {
|
||||
}, true);
|
||||
if (hasAttachEvent) {
|
||||
document.attachEvent('onkeydown', function(event) {
|
||||
event = event || window.event;
|
||||
if (event.keyCode === /* P= */ 80 && event.ctrlKey) {
|
||||
@ -309,9 +294,9 @@
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if ('onbeforeprint' in window) {
|
||||
if ('onbeforeprint' in window) {
|
||||
// Do not propagate before/afterprint events when they are not triggered
|
||||
// from within this polyfill. (FF/IE).
|
||||
var stopPropagationIfNeeded = function(event) {
|
||||
@ -321,19 +306,19 @@
|
||||
};
|
||||
window.addEventListener('beforeprint', stopPropagationIfNeeded);
|
||||
window.addEventListener('afterprint', stopPropagationIfNeeded);
|
||||
}
|
||||
}
|
||||
|
||||
var overlayPromise;
|
||||
function ensureOverlay() {
|
||||
var overlayPromise;
|
||||
function ensureOverlay() {
|
||||
if (!overlayPromise) {
|
||||
overlayPromise = OverlayManager.register('printServiceOverlay',
|
||||
document.getElementById('printServiceOverlay'), abort, true);
|
||||
document.getElementById('printCancel').onclick = abort;
|
||||
}
|
||||
return overlayPromise;
|
||||
}
|
||||
}
|
||||
|
||||
PDFPrintServiceFactory.instance = {
|
||||
PDFPrintServiceFactory.instance = {
|
||||
supportsPrinting: true,
|
||||
|
||||
createPrintService: function (pdfDocument, pagesOverview, printContainer) {
|
||||
@ -344,7 +329,8 @@
|
||||
printContainer);
|
||||
return activeService;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
exports.PDFPrintService = PDFPrintService;
|
||||
}));
|
||||
export {
|
||||
PDFPrintService,
|
||||
};
|
||||
|
@ -13,18 +13,6 @@
|
||||
* 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 RenderingStates = {
|
||||
@ -186,6 +174,7 @@ var PDFRenderingQueue = (function PDFRenderingQueueClosure() {
|
||||
return PDFRenderingQueue;
|
||||
})();
|
||||
|
||||
exports.RenderingStates = RenderingStates;
|
||||
exports.PDFRenderingQueue = PDFRenderingQueue;
|
||||
}));
|
||||
export {
|
||||
RenderingStates,
|
||||
PDFRenderingQueue,
|
||||
};
|
||||
|
@ -13,23 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(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;
|
||||
import { mozL10n } from 'pdfjs-web/ui_utils';
|
||||
import { RenderingStates } from 'pdfjs-web/pdf_rendering_queue';
|
||||
|
||||
var UI_NOTIFICATION_CLASS = 'pdfSidebarNotification';
|
||||
|
||||
@ -460,6 +445,7 @@ var PDFSidebar = (function PDFSidebarClosure() {
|
||||
return PDFSidebar;
|
||||
})();
|
||||
|
||||
exports.SidebarView = SidebarView;
|
||||
exports.PDFSidebar = PDFSidebar;
|
||||
}));
|
||||
export {
|
||||
SidebarView,
|
||||
PDFSidebar,
|
||||
};
|
||||
|
@ -13,24 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(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;
|
||||
import { getOutputScale, mozL10n } from 'pdfjs-web/ui_utils';
|
||||
import { RenderingStates } from 'pdfjs-web/pdf_rendering_queue';
|
||||
|
||||
var THUMBNAIL_WIDTH = 98; // px
|
||||
var THUMBNAIL_CANVAS_BORDER_WIDTH = 1; // px
|
||||
@ -430,5 +414,6 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
|
||||
|
||||
PDFThumbnailView.tempImageCache = null;
|
||||
|
||||
exports.PDFThumbnailView = PDFThumbnailView;
|
||||
}));
|
||||
export {
|
||||
PDFThumbnailView,
|
||||
};
|
||||
|
@ -13,25 +13,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
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;
|
||||
import {
|
||||
getVisibleElements, scrollIntoView, watchScroll
|
||||
} from 'pdfjs-web/ui_utils';
|
||||
import { PDFThumbnailView } from 'pdfjs-web/pdf_thumbnail_view';
|
||||
|
||||
var THUMBNAIL_SCROLL_MARGIN = -19;
|
||||
|
||||
@ -247,5 +232,6 @@ var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() {
|
||||
return PDFThumbnailViewer;
|
||||
})();
|
||||
|
||||
exports.PDFThumbnailViewer = PDFThumbnailViewer;
|
||||
}));
|
||||
export {
|
||||
PDFThumbnailViewer,
|
||||
};
|
||||
|
@ -13,48 +13,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define('pdfjs-web/pdf_viewer', ['exports', 'pdfjs-web/ui_utils',
|
||||
'pdfjs-web/pdf_page_view', 'pdfjs-web/pdf_rendering_queue',
|
||||
'pdfjs-web/text_layer_builder', 'pdfjs-web/annotation_layer_builder',
|
||||
'pdfjs-web/pdf_link_service', 'pdfjs-web/dom_events', 'pdfjs-web/pdfjs'],
|
||||
factory);
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
factory(exports, require('./ui_utils.js'), require('./pdf_page_view.js'),
|
||||
require('./pdf_rendering_queue.js'), require('./text_layer_builder.js'),
|
||||
require('./annotation_layer_builder.js'),
|
||||
require('./pdf_link_service.js'), require('./dom_events.js'),
|
||||
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;
|
||||
import * as pdfjsLib from 'pdfjs-web/pdfjs';
|
||||
import {
|
||||
CSS_UNITS, DEFAULT_SCALE, DEFAULT_SCALE_VALUE, getVisibleElements,
|
||||
MAX_AUTO_SCALE, RendererType, SCROLLBAR_PADDING, scrollIntoView,
|
||||
UNKNOWN_SCALE, VERTICAL_PADDING, watchScroll
|
||||
} from 'pdfjs-web/ui_utils';
|
||||
import {
|
||||
PDFRenderingQueue, RenderingStates,
|
||||
} from 'pdfjs-web/pdf_rendering_queue';
|
||||
import { AnnotationLayerBuilder } from 'pdfjs-web/annotation_layer_builder';
|
||||
import { domEvents } from 'pdfjs-web/dom_events';
|
||||
import { PDFPageView } from 'pdfjs-web/pdf_page_view';
|
||||
import { SimpleLinkService } from 'pdfjs-web/pdf_link_service';
|
||||
import { TextLayerBuilder } from 'pdfjs-web/text_layer_builder';
|
||||
|
||||
var PresentationModeState = {
|
||||
UNKNOWN: 0,
|
||||
@ -988,6 +960,7 @@ var PDFViewer = (function pdfViewer() {
|
||||
return PDFViewer;
|
||||
})();
|
||||
|
||||
exports.PresentationModeState = PresentationModeState;
|
||||
exports.PDFViewer = PDFViewer;
|
||||
}));
|
||||
export {
|
||||
PresentationModeState,
|
||||
PDFViewer,
|
||||
};
|
||||
|
@ -13,18 +13,6 @@
|
||||
* 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;
|
||||
function getDefaultPreferences() {
|
||||
if (!defaultPreferences) {
|
||||
@ -221,5 +209,6 @@ if (typeof PDFJSDev === 'undefined' ||
|
||||
};
|
||||
}
|
||||
|
||||
exports.Preferences = Preferences;
|
||||
}));
|
||||
export {
|
||||
Preferences,
|
||||
};
|
||||
|
@ -13,21 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(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;
|
||||
import { mozL10n, SCROLLBAR_PADDING } from 'pdfjs-web/ui_utils';
|
||||
|
||||
/**
|
||||
* @typedef {Object} SecondaryToolbarOptions
|
||||
@ -241,5 +227,6 @@ var SecondaryToolbar = (function SecondaryToolbarClosure() {
|
||||
return SecondaryToolbar;
|
||||
})();
|
||||
|
||||
exports.SecondaryToolbar = SecondaryToolbar;
|
||||
}));
|
||||
export {
|
||||
SecondaryToolbar,
|
||||
};
|
||||
|
@ -13,19 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(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) {
|
||||
import * as pdfjsLib from 'pdfjs-web/pdfjs';
|
||||
import { domEvents } from 'pdfjs-web/dom_events';
|
||||
|
||||
var EXPAND_DIVS_TIMEOUT = 300; // ms
|
||||
|
||||
@ -419,6 +408,7 @@ DefaultTextLayerFactory.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
exports.TextLayerBuilder = TextLayerBuilder;
|
||||
exports.DefaultTextLayerFactory = DefaultTextLayerFactory;
|
||||
}));
|
||||
export {
|
||||
TextLayerBuilder,
|
||||
DefaultTextLayerFactory,
|
||||
};
|
||||
|
@ -13,28 +13,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
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;
|
||||
import {
|
||||
animationStarted, DEFAULT_SCALE, DEFAULT_SCALE_VALUE, localized, MAX_SCALE,
|
||||
MIN_SCALE, mozL10n, noContextMenuHandler
|
||||
} from 'pdfjs-web/ui_utils';
|
||||
|
||||
var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading';
|
||||
var SCALE_SELECT_CONTAINER_PADDING = 8;
|
||||
@ -286,5 +268,6 @@ var Toolbar = (function ToolbarClosure() {
|
||||
return Toolbar;
|
||||
})();
|
||||
|
||||
exports.Toolbar = Toolbar;
|
||||
}));
|
||||
export {
|
||||
Toolbar,
|
||||
};
|
||||
|
@ -13,17 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
(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) {
|
||||
import * as pdfjsLib from 'pdfjs-web/pdfjs';
|
||||
|
||||
var CSS_UNITS = 96.0 / 72.0;
|
||||
var DEFAULT_SCALE_VALUE = 'auto';
|
||||
@ -571,30 +561,31 @@ var ProgressBar = (function ProgressBarClosure() {
|
||||
return ProgressBar;
|
||||
})();
|
||||
|
||||
exports.CSS_UNITS = CSS_UNITS;
|
||||
exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE;
|
||||
exports.DEFAULT_SCALE = DEFAULT_SCALE;
|
||||
exports.MIN_SCALE = MIN_SCALE;
|
||||
exports.MAX_SCALE = MAX_SCALE;
|
||||
exports.UNKNOWN_SCALE = UNKNOWN_SCALE;
|
||||
exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE;
|
||||
exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING;
|
||||
exports.VERTICAL_PADDING = VERTICAL_PADDING;
|
||||
exports.RendererType = RendererType;
|
||||
exports.mozL10n = mozL10n;
|
||||
exports.EventBus = EventBus;
|
||||
exports.ProgressBar = ProgressBar;
|
||||
exports.getPDFFileNameFromURL = getPDFFileNameFromURL;
|
||||
exports.noContextMenuHandler = noContextMenuHandler;
|
||||
exports.parseQueryString = parseQueryString;
|
||||
exports.getVisibleElements = getVisibleElements;
|
||||
exports.roundToDivide = roundToDivide;
|
||||
exports.approximateFraction = approximateFraction;
|
||||
exports.getOutputScale = getOutputScale;
|
||||
exports.scrollIntoView = scrollIntoView;
|
||||
exports.watchScroll = watchScroll;
|
||||
exports.binarySearchFirstItem = binarySearchFirstItem;
|
||||
exports.normalizeWheelEventDelta = normalizeWheelEventDelta;
|
||||
exports.animationStarted = animationStarted;
|
||||
exports.localized = localized;
|
||||
}));
|
||||
export {
|
||||
CSS_UNITS,
|
||||
DEFAULT_SCALE_VALUE,
|
||||
DEFAULT_SCALE,
|
||||
MIN_SCALE,
|
||||
MAX_SCALE,
|
||||
UNKNOWN_SCALE,
|
||||
MAX_AUTO_SCALE,
|
||||
SCROLLBAR_PADDING,
|
||||
VERTICAL_PADDING,
|
||||
RendererType,
|
||||
mozL10n,
|
||||
EventBus,
|
||||
ProgressBar,
|
||||
getPDFFileNameFromURL,
|
||||
noContextMenuHandler,
|
||||
parseQueryString,
|
||||
getVisibleElements,
|
||||
roundToDivide,
|
||||
approximateFraction,
|
||||
getOutputScale,
|
||||
scrollIntoView,
|
||||
watchScroll,
|
||||
binarySearchFirstItem,
|
||||
normalizeWheelEventDelta,
|
||||
animationStarted,
|
||||
localized,
|
||||
};
|
||||
|
@ -13,18 +13,6 @@
|
||||
* 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;
|
||||
|
||||
/**
|
||||
@ -142,5 +130,6 @@ var ViewHistory = (function ViewHistoryClosure() {
|
||||
return ViewHistory;
|
||||
})();
|
||||
|
||||
exports.ViewHistory = ViewHistory;
|
||||
}));
|
||||
export {
|
||||
ViewHistory,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user