1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-21 15:48:06 +02:00

Introduces UMD headers to the web/ folder.

This commit is contained in:
Yury Delendik 2016-04-08 12:34:27 -05:00
parent 1c253e6e1d
commit 006e8fb59d
39 changed files with 836 additions and 281 deletions

View file

@ -12,10 +12,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*globals pdfjsLib, mozL10n, SimpleLinkService */
/*globals pdfjsLib */
'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'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'),
require('./pdf_link_service.js'));
} else {
factory((root.pdfjsWebAnnotationLayerBuilder = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFLinkService);
}
}(this, function (exports, uiUtils, pdfLinkService) {
var mozL10n = uiUtils.mozL10n;
var SimpleLinkService = pdfLinkService.SimpleLinkService;
/**
* @typedef {Object} AnnotationLayerBuilderOptions
* @property {HTMLDivElement} pageDiv
@ -119,3 +135,6 @@ DefaultAnnotationLayerFactory.prototype = {
});
}
};
exports.AnnotationLayerBuilder = AnnotationLayerBuilder;
}));

View file

@ -12,18 +12,92 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals pdfjsLib, PDFBug, FirefoxCom, Stats, ProgressBar, DownloadManager,
getPDFFileNameFromURL, PDFHistory, Preferences, SidebarView,
ViewHistory, Stats, PDFThumbnailViewer, URL, noContextMenuHandler,
SecondaryToolbar, PasswordPrompt, PDFPresentationMode, PDFSidebar,
PDFDocumentProperties, HandTool, Promise, PDFLinkService,
PDFOutlineViewer, PDFAttachmentViewer, OverlayManager,
PDFFindController, PDFFindBar, PDFViewer, PDFRenderingQueue,
PresentationModeState, parseQueryString, RenderingStates,
UNKNOWN_SCALE, DEFAULT_SCALE_VALUE, DEFAULT_URL, mozL10n */
/* globals DEFAULT_URL, pdfjsLib, PDFBug, Stats */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/app', ['exports', 'pdfjs-web/ui_utils',
'pdfjs-web/firefoxcom', 'pdfjs-web/download_manager',
'pdfjs-web/pdf_history', 'pdfjs-web/preferences', 'pdfjs-web/pdf_sidebar',
'pdfjs-web/view_history', 'pdfjs-web/pdf_thumbnail_viewer',
'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/mozPrintCallback_polyfill'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'), require('./firefoxcom.js'),
require('./download_manager.js'), require('./pdf_history.js'),
require('./preferences.js'), require('./pdf_sidebar.js'),
require('./view_history.js'), require('./pdf_thumbnail_viewer.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('./mozPrintCallback_polyfill.js'));
} else {
factory((root.pdfjsWebApp = {}), root.pdfjsWebUIUtils,
root.pdfjsWebFirefoxCom, root.pdfjsWebDownloadManager,
root.pdfjsWebPDFHistory, root.pdfjsWebPreferences,
root.pdfjsWebPDFSidebar, root.pdfjsWebViewHistory,
root.pdfjsWebPDFThumbnailViewer, 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.pdfjsWebMozPrintCallbackPolyfill);
}
}(this, function (exports, uiUtilsLib, firefoxComLib, downloadManagerLib,
pdfHistoryLib, preferencesLib, pdfSidebarLib, viewHistoryLib,
pdfThumbnailViewerLib, secondaryToolbarLib, passwordPromptLib,
pdfPresentationModeLib, pdfDocumentPropertiesLib, handToolLib,
pdfViewerLib, pdfRenderingQueueLib, pdfLinkServiceLib,
pdfOutlineViewerLib, overlayManagerLib,
pdfAttachmentViewerLib, pdfFindControllerLib, pdfFindBarLib,
mozPrintCallbackPolyfillLib) {
var FirefoxCom = firefoxComLib.FirefoxCom;
var UNKNOWN_SCALE = uiUtilsLib.UNKNOWN_SCALE;
var DEFAULT_SCALE_VALUE = uiUtilsLib.DEFAULT_SCALE_VALUE;
var ProgressBar = uiUtilsLib.ProgressBar;
var getPDFFileNameFromURL = uiUtilsLib.getPDFFileNameFromURL;
var noContextMenuHandler = uiUtilsLib.noContextMenuHandler;
var mozL10n = uiUtilsLib.mozL10n;
var parseQueryString = uiUtilsLib.parseQueryString;
var DownloadManager = downloadManagerLib.DownloadManager ||
firefoxComLib.DownloadManager;
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 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 DEFAULT_SCALE_DELTA = 1.1;
var MIN_SCALE = 0.25;
var MAX_SCALE = 10.0;
@ -47,26 +121,6 @@ function configure(PDFJS) {
//#endif
}
//#include ui_utils.js
//#include preferences.js
//#include platform_integration.js
//#include view_history.js
//#include pdf_find_bar.js
//#include pdf_find_controller.js
//#include pdf_link_service.js
//#include pdf_history.js
//#include secondary_toolbar.js
//#include pdf_presentation_mode.js
//#include hand_tool.js
//#include overlay_manager.js
//#include password_prompt.js
//#include pdf_document_properties.js
//#include pdf_viewer.js
//#include pdf_thumbnail_viewer.js
//#include pdf_sidebar.js
//#include pdf_outline_viewer.js
//#include pdf_attachment_viewer.js
var PDFViewerApplication = {
initialBookmark: document.location.hash.substring(1),
initialDestination: null,
@ -2144,3 +2198,10 @@ window.addEventListener('afterprint', function afterPrint(evt) {
window.requestAnimationFrame(resolve);
});
})();
exports.PDFViewerApplication = PDFViewerApplication;
// TODO remove circular reference of pdfjs-web/secondary_toolbar on app.
secondaryToolbarLib._setApp(exports);
}));

View file

@ -13,10 +13,27 @@
* limitations under the License.
*/
/* globals chrome, pdfjsLib, PDFViewerApplication, OverlayManager */
/* globals chrome, pdfjsLib */
'use strict';
var ChromeCom = (function ChromeComClosure() {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/chromecom', ['exports', 'pdfjs-web/app',
'pdfjs-web/overlay_manager'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./app.js'), require('./overlay_manager.js'));
} else {
factory((root.pdfjsWebChromeCom = {}), root.pdfjsWebApp,
root.pdfjsWebOverlayManager);
}
}(this, function (exports, app, overlayManager) {
//#if CHROME
//#if !CHROME
if (true) { return; } // TODO ensure nothing depends on this module.
//#endif
var PDFViewerApplication = app.PDFViewerApplication;
var OverlayManager = overlayManager.OverlayManager;
var ChromeCom = {};
/**
* Creates an event that the extension is listening for and will
@ -205,7 +222,7 @@ var ChromeCom = (function ChromeComClosure() {
// because the shown string should match the UI at chrome://extensions.
// These strings are from chrome/app/resources/generated_resources_*.xtb.
var i18nFileAccessLabel =
//#include chrome-i18n-allow-access-to-file-urls.json
//#include $ROOT/web/chrome-i18n-allow-access-to-file-urls.json
[chrome.i18n.getUILanguage && chrome.i18n.getUILanguage()];
if (i18nFileAccessLabel) {
@ -304,5 +321,6 @@ var ChromeCom = (function ChromeComClosure() {
}
}
return ChromeCom;
})();
exports.ChromeCom = ChromeCom;
//#endif
}));

View file

@ -12,12 +12,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals URL, pdfjsLib */
/* globals pdfjsLib */
'use strict';
var DownloadManager = (function DownloadManagerClosure() {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/download_manager', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebDownloadManager = {}));
}
}(this, function (exports) {
//#if GENERIC || CHROME
function download(blobUrl, filename) {
var a = document.createElement('a');
if (a.click) {
@ -97,5 +105,6 @@ var DownloadManager = (function DownloadManagerClosure() {
}
};
return DownloadManager;
})();
exports.DownloadManager = DownloadManager;
//#endif
}));

View file

@ -12,10 +12,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals Preferences, pdfjsLib, Promise */
/* globals pdfjsLib */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/firefoxcom', ['exports', 'pdfjs-web/preferences'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./preferences.js'));
} else {
factory((root.pdfjsWebFirefoxCom = {}), root.pdfjsWebPreferences);
}
}(this, function (exports, preferences) {
//#if FIREFOX || MOZCENTRAL
//#if !(FIREFOX || MOZCENTRAL)
if (true) { return; } // TODO ensure nothing depends on this module.
//#endif
var Preferences = preferences.Preferences;
var FirefoxCom = (function FirefoxComClosure() {
return {
/**
@ -132,3 +148,8 @@ Preferences._readFromStorage = function (prefObj) {
});
});
};
exports.DownloadManager = DownloadManager;
exports.FirefoxCom = FirefoxCom;
//#endif
}));

View file

@ -16,7 +16,15 @@
'use strict';
var GrabToPan = (function GrabToPanClosure() {
(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}
@ -217,5 +225,5 @@ var GrabToPan = (function GrabToPanClosure() {
}
}
return GrabToPan;
})();
exports.GrabToPan = GrabToPan;
}));

View file

@ -12,11 +12,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals mozL10n, GrabToPan, Preferences, SecondaryToolbar */
'use strict';
//#include grab_to_pan.js
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/hand_tool', ['exports', 'pdfjs-web/ui_utils',
'pdfjs-web/grab_to_pan', 'pdfjs-web/preferences',
'pdfjs-web/secondary_toolbar'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'), require('./grab_to_pan.js'),
require('./preferences.js'), require('./secondary_toolbar.js'));
} else {
factory((root.pdfjsWebHandTool = {}), root.pdfjsWebUIUtils,
root.pdfjsWebGrabToPan, root.pdfjsWebPreferences,
root.pdfjsWebSecondaryToolbar);
}
}(this, function (exports, uiUtils, grabToPan, preferences, secondaryToolbar) {
var mozL10n = uiUtils.mozL10n;
var GrabToPan = grabToPan.GrabToPan;
var Preferences = preferences.Preferences;
var SecondaryToolbar = secondaryToolbar.SecondaryToolbar;
var HandTool = {
initialize: function handToolInitialize(options) {
var toggleHandTool = options.toggleHandTool;
@ -82,3 +100,6 @@ var HandTool = {
}
}
};
exports.HandTool = HandTool;
}));

View file

@ -15,10 +15,21 @@
/* globals HTMLCanvasElement */
'use strict';
(function mozPrintCallbackPolyfillClosure() {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/mozPrintCallback_polyfill', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebMozPrintCallbackPolyfill = {}));
}
}(this, function (exports) {
//#if !(FIREFOX || MOZCENTRAL)
if ('mozPrintCallback' in document.createElement('canvas')) {
return;
}
// Cause positive result on feature-detection:
HTMLCanvasElement.prototype.mozPrintCallback = undefined;
@ -139,4 +150,5 @@
window.addEventListener('beforeprint', stopPropagationIfNeeded, false);
window.addEventListener('afterprint', stopPropagationIfNeeded, false);
}
})();
//#endif
}));

View file

@ -15,6 +15,16 @@
'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,
@ -141,3 +151,6 @@ var OverlayManager = {
}
}
};
exports.OverlayManager = OverlayManager;
}));

View file

@ -12,10 +12,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals pdfjsLib, mozL10n, OverlayManager */
/* globals pdfjsLib */
'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'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'), require('./overlay_manager.js'));
} else {
factory((root.pdfjsWebPasswordPrompt = {}), root.pdfjsWebUIUtils,
root.pdfjsWebOverlayManager);
}
}(this, function (exports, uiUtils, overlayManager) {
var mozL10n = uiUtils.mozL10n;
var OverlayManager = overlayManager.OverlayManager;
var PasswordPrompt = {
overlayName: null,
updatePassword: null,
@ -79,3 +94,6 @@ var PasswordPrompt = {
}
}
};
exports.PasswordPrompt = PasswordPrompt;
}));

View file

@ -16,6 +16,16 @@
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_attachment_viewer', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebPDFAttachmentViewer = {}));
}
}(this, function (exports) {
/**
* @typedef {Object} PDFAttachmentViewerOptions
* @property {HTMLDivElement} container - The viewer element.
@ -114,3 +124,6 @@ var PDFAttachmentViewer = (function PDFAttachmentViewerClosure() {
return PDFAttachmentViewer;
})();
exports.PDFAttachmentViewer = PDFAttachmentViewer;
}));

View file

@ -12,10 +12,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals mozL10n, getPDFFileNameFromURL, OverlayManager */
'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;
/**
* @typedef {Object} PDFDocumentPropertiesOptions
* @property {string} overlayName - Name/identifier for the overlay.
@ -222,3 +237,6 @@ var PDFDocumentProperties = (function PDFDocumentPropertiesClosure() {
return PDFDocumentProperties;
})();
exports.PDFDocumentProperties = PDFDocumentProperties;
}));

View file

@ -12,10 +12,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals FindStates, mozL10n */
'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;
/**
* Creates a "search bar" given a set of DOM elements that act as controls
* for searching or for setting search preferences in the UI. This object
@ -188,3 +203,6 @@ var PDFFindBar = (function PDFFindBarClosure() {
};
return PDFFindBar;
})();
exports.PDFFindBar = PDFFindBar;
}));

View file

@ -12,10 +12,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals FirefoxCom, Promise, scrollIntoView */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_find_controller', ['exports',
'pdfjs-web/ui_utils', 'pdfjs-web/firefoxcom'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'), require('./firefoxcom.js'));
} else {
factory((root.pdfjsWebPDFFindController = {}), root.pdfjsWebUIUtils,
root.pdfjsWebFirefoxCom);
}
}(this, function (exports, uiUtils, firefoxCom) {
var scrollIntoView = uiUtils.scrollIntoView;
var FirefoxCom = firefoxCom.FirefoxCom;
var FindStates = {
FIND_FOUND: 0,
FIND_NOTFOUND: 1,
@ -416,3 +430,7 @@ var PDFFindController = (function PDFFindControllerClosure() {
};
return PDFFindController;
})();
exports.FindStates = FindStates;
exports.PDFFindController = PDFFindController;
}));

View file

@ -15,7 +15,16 @@
'use strict';
var PDFHistory = (function () {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_history', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebPDFHistory = {}));
}
}(this, function (exports) {
function PDFHistory(options) {
this.linkService = options.linkService;
@ -423,5 +432,5 @@ var PDFHistory = (function () {
}
};
return PDFHistory;
})();
exports.PDFHistory = PDFHistory;
}));

View file

@ -12,10 +12,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFViewer, PDFHistory, Promise, parseQueryString */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_link_service', ['exports', 'pdfjs-web/ui_utils'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'));
} else {
factory((root.pdfjsWebPDFLinkService = {}), root.pdfjsWebUIUtils);
}
}(this, function (exports, uiUtils) {
var parseQueryString = uiUtils.parseQueryString;
/**
* Performs navigation functions inside PDF, such as opening specified page,
* or destination.
@ -299,3 +311,56 @@ var PDFLinkService = (function () {
return PDFLinkService;
})();
var SimpleLinkService = (function SimpleLinkServiceClosure() {
function SimpleLinkService() {}
SimpleLinkService.prototype = {
/**
* @returns {number}
*/
get page() {
return 0;
},
/**
* @param {number} value
*/
set page(value) {},
/**
* @param dest - The PDF destination object.
*/
navigateTo: function (dest) {},
/**
* @param dest - The PDF destination object.
* @returns {string} The hyperlink to the PDF object.
*/
getDestinationHash: function (dest) {
return '#';
},
/**
* @param hash - The PDF parameters/hash.
* @returns {string} The hyperlink to the PDF object.
*/
getAnchorUrl: function (hash) {
return '#';
},
/**
* @param {string} hash
*/
setHash: function (hash) {},
/**
* @param {string} action
*/
executeNamedAction: function (action) {},
/**
* @param {number} pageNum - page number.
* @param {Object} pageRef - reference to the page.
*/
cachePageRef: function (pageNum, pageRef) {}
};
return SimpleLinkService;
})();
exports.PDFLinkService = PDFLinkService;
exports.SimpleLinkService = SimpleLinkService;
}));

View file

@ -16,6 +16,16 @@
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_outline_viewer', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebPDFOutlineViewer = {}));
}
}(this, function (exports) {
var DEFAULT_TITLE = '\u2013';
/**
@ -210,3 +220,6 @@ var PDFOutlineViewer = (function PDFOutlineViewerClosure() {
return PDFOutlineViewer;
})();
exports.PDFOutlineViewer = PDFOutlineViewer;
}));

View file

@ -12,11 +12,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals RenderingStates, pdfjsLib, DEFAULT_SCALE, CSS_UNITS, getOutputScale,
TextLayerBuilder, Promise, approximateFraction, roundToDivide */
/* globals pdfjsLib */
'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'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'),
require('./pdf_rendering_queue.js'));
} else {
factory((root.pdfjsWebPDFPageView = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFRenderingQueue);
}
}(this, function (exports, uiUtils, pdfRenderingQueue) {
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 RenderingStates = pdfRenderingQueue.RenderingStates;
var TEXT_LAYER_RENDER_DELAY = 200; // ms
/**
@ -582,3 +601,6 @@ var PDFPageView = (function PDFPageViewClosure() {
return PDFPageView;
})();
exports.PDFPageView = PDFPageView;
}));

View file

@ -15,6 +15,16 @@
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_presentation_mode', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebPDFPresentationMode = {}));
}
}(this, function (exports) {
var DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500; // in ms
var DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms
var ACTIVE_SELECTOR = 'pdfPresentationMode';
@ -389,3 +399,6 @@ var PDFPresentationMode = (function PDFPresentationModeClosure() {
return PDFPresentationMode;
})();
exports.PDFPresentationMode = PDFPresentationMode;
}));

View file

@ -15,6 +15,16 @@
'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 = {
@ -175,3 +185,7 @@ var PDFRenderingQueue = (function PDFRenderingQueueClosure() {
return PDFRenderingQueue;
})();
exports.RenderingStates = RenderingStates;
exports.PDFRenderingQueue = PDFRenderingQueue;
}));

View file

@ -12,10 +12,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals RenderingStates */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdf_sidebar', ['exports',
'pdfjs-web/pdf_rendering_queue'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./pdf_rendering_queue.js'));
} else {
factory((root.pdfjsWebPDFSidebar = {}), root.pdfjsWebPDFRenderingQueue);
}
}(this, function (exports, pdfRenderingQueue) {
var RenderingStates = pdfRenderingQueue.RenderingStates;
var SidebarView = {
NONE: 0,
THUMBS: 1,
@ -330,3 +342,7 @@ var PDFSidebar = (function PDFSidebarClosure() {
return PDFSidebar;
})();
exports.SidebarView = SidebarView;
exports.PDFSidebar = PDFSidebar;
}));

View file

@ -12,10 +12,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals mozL10n, RenderingStates, Promise, getOutputScale */
'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;
var THUMBNAIL_WIDTH = 98; // px
var THUMBNAIL_CANVAS_BORDER_WIDTH = 1; // px
@ -377,3 +393,6 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
})();
PDFThumbnailView.tempImageCache = null;
exports.PDFThumbnailView = PDFThumbnailView;
}));

View file

@ -12,14 +12,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals watchScroll, getVisibleElements, scrollIntoView, PDFThumbnailView,
Promise */
'use strict';
var THUMBNAIL_SCROLL_MARGIN = -19;
(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) {
//#include pdf_thumbnail_view.js
var watchScroll = uiUtils.watchScroll;
var getVisibleElements = uiUtils.getVisibleElements;
var scrollIntoView = uiUtils.scrollIntoView;
var PDFThumbnailView = pdfThumbnailView.PDFThumbnailView;
var THUMBNAIL_SCROLL_MARGIN = -19;
/**
* @typedef {Object} PDFThumbnailViewerOptions
@ -196,3 +210,6 @@ var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() {
return PDFThumbnailViewer;
})();
exports.PDFThumbnailViewer = PDFThumbnailViewer;
}));

View file

@ -13,9 +13,6 @@
* limitations under the License.
*/
/*jshint globalstrict: false */
/* globals PDFJS, PDFViewer, PDFPageView, TextLayerBuilder, PDFLinkService,
DefaultTextLayerFactory, AnnotationLayerBuilder, PDFHistory,
DefaultAnnotationLayerFactory, DownloadManager, ProgressBar */
(function pdfViewerWrapper() {
'use strict';
@ -32,21 +29,26 @@
});
}
//#include ui_utils.js
//#include pdf_link_service.js
//#include pdf_viewer.js
//#include pdf_history.js
//#include download_manager.js
var pdfViewerLibs = {};
(function () {
//#expand __BUNDLE__
}).call(pdfViewerLibs);
PDFJS.PDFViewer = PDFViewer;
PDFJS.PDFPageView = PDFPageView;
PDFJS.PDFLinkService = PDFLinkService;
PDFJS.TextLayerBuilder = TextLayerBuilder;
PDFJS.DefaultTextLayerFactory = DefaultTextLayerFactory;
PDFJS.AnnotationLayerBuilder = AnnotationLayerBuilder;
PDFJS.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory;
PDFJS.PDFHistory = PDFHistory;
var PDFJS = window.PDFJS || (window.PDFJS = {});
PDFJS.DownloadManager = DownloadManager;
PDFJS.ProgressBar = ProgressBar;
PDFJS.PDFViewer = pdfViewerLibs.pdfjsWebPDFViewer.PDFViewer;
PDFJS.PDFPageView = pdfViewerLibs.pdfjsWebPDFPageView.PDFPageView;
PDFJS.PDFLinkService = pdfViewerLibs.pdfjsWebPDFLinkService.PDFLinkService;
PDFJS.TextLayerBuilder =
pdfViewerLibs.pdfjsWebTextLayerBuilder.TextLayerBuilder;
PDFJS.DefaultTextLayerFactory =
pdfViewerLibs.pdfjsWebTextLayerBuilder.DefaultTextLayerFactory;
PDFJS.AnnotationLayerBuilder =
pdfViewerLibs.pdfjsWebAnnotationLayerBuilder.AnnotationLayerBuilder;
PDFJS.DefaultAnnotationLayerFactory =
pdfViewerLibs.pdfjsWebAnnotationLayerBuilder.DefaultAnnotationLayerFactory;
PDFJS.PDFHistory = pdfViewerLibs.pdfjsWebPDFHistory.PDFHistory;
PDFJS.DownloadManager = pdfViewerLibs.pdfjsWebDownloadManager.DownloadManager;
PDFJS.ProgressBar = pdfViewerLibs.pdfjsWebUIUtils.ProgressBar;
}).call((typeof window === 'undefined') ? this : window);

View file

@ -12,14 +12,47 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*globals watchScroll, PDFPageView, UNKNOWN_SCALE,
SCROLLBAR_PADDING, VERTICAL_PADDING, MAX_AUTO_SCALE, CSS_UNITS,
DEFAULT_SCALE, scrollIntoView, getVisibleElements, RenderingStates,
pdfjsLib, Promise, TextLayerBuilder, PDFRenderingQueue,
AnnotationLayerBuilder, DEFAULT_SCALE_VALUE */
/* globals pdfjsLib */
'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'], 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'));
} else {
factory((root.pdfjsWebPDFViewer = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFPageView, root.pdfjsWebPDFRenderingQueue,
root.pdfjsWebTextLayerBuilder, root.pdfjsWebAnnotationLayerBuilder,
root.pdfjsWebPDFLinkService);
}
}(this, function (exports, uiUtils, pdfPageView, pdfRenderingQueue,
textLayerBuilder, annotationLayerBuilder, pdfLinkService) {
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 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 = {
UNKNOWN: 0,
NORMAL: 1,
@ -29,11 +62,6 @@ var PresentationModeState = {
var DEFAULT_CACHE_SIZE = 10;
//#include pdf_rendering_queue.js
//#include pdf_page_view.js
//#include text_layer_builder.js
//#include annotation_layer_builder.js
/**
* @typedef {Object} PDFViewerOptions
* @property {HTMLDivElement} container - The container for the viewer element.
@ -772,51 +800,6 @@ var PDFViewer = (function pdfViewer() {
return PDFViewer;
})();
var SimpleLinkService = (function SimpleLinkServiceClosure() {
function SimpleLinkService() {}
SimpleLinkService.prototype = {
/**
* @returns {number}
*/
get page() {
return 0;
},
/**
* @param {number} value
*/
set page(value) {},
/**
* @param dest - The PDF destination object.
*/
navigateTo: function (dest) {},
/**
* @param dest - The PDF destination object.
* @returns {string} The hyperlink to the PDF object.
*/
getDestinationHash: function (dest) {
return '#';
},
/**
* @param hash - The PDF parameters/hash.
* @returns {string} The hyperlink to the PDF object.
*/
getAnchorUrl: function (hash) {
return '#';
},
/**
* @param {string} hash
*/
setHash: function (hash) {},
/**
* @param {string} action
*/
executeNamedAction: function (action) {},
/**
* @param {number} pageNum - page number.
* @param {Object} pageRef - reference to the page.
*/
cachePageRef: function (pageNum, pageRef) {}
};
return SimpleLinkService;
})();
exports.PresentationModeState = PresentationModeState;
exports.PDFViewer = PDFViewer;
}));

View file

@ -1,30 +0,0 @@
/* Copyright 2016 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//#if !(FIREFOX || MOZCENTRAL)
//#include mozPrintCallback_polyfill.js
//#endif
//#if GENERIC || CHROME
//#include download_manager.js
//#endif
//#if FIREFOX || MOZCENTRAL
//#include firefoxcom.js
//#endif
//#if CHROME
//#include chromecom.js
//#endif

View file

@ -12,11 +12,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals DEFAULT_PREFERENCES, Promise */
/* globals DEFAULT_PREFERENCES, chrome */
'use strict';
//#include default_preferences.js
(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) {
//#include $ROOT/web/default_preferences.js
/**
* Preferences - Utility for storing persistent settings.
@ -209,3 +219,6 @@ Preferences._readFromStorage = function (prefObj) {
});
};
//#endif
exports.Preferences = Preferences;
}));

View file

@ -12,10 +12,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFViewerApplication, SCROLLBAR_PADDING */
'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 app; // Avoiding circular reference, see _setApp function below.
var PDFViewerApplication = null; // = app.PDFViewerApplication;
var SecondaryToolbar = {
opened: false,
previousContainerHeight: null,
@ -158,3 +173,12 @@ var SecondaryToolbar = {
}
}
};
function _setApp(app_) {
app = app_;
PDFViewerApplication = app.PDFViewerApplication;
}
exports.SecondaryToolbar = SecondaryToolbar;
exports._setApp = _setApp;
}));

View file

@ -16,6 +16,16 @@
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/text_layer_builder', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebTextLayerBuilder = {}));
}
}(this, function (exports) {
/**
* @typedef {Object} TextLayerBuilderOptions
* @property {HTMLDivElement} textLayerDiv - The text layer container.
@ -346,3 +356,7 @@ DefaultTextLayerFactory.prototype = {
});
}
};
exports.TextLayerBuilder = TextLayerBuilder;
exports.DefaultTextLayerFactory = DefaultTextLayerFactory;
}));

View file

@ -12,10 +12,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* global PDFJS */
/* globals PDFJS */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/ui_utils', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsWebUIUtils = {}));
}
}(this, function (exports) {
var CSS_UNITS = 96.0 / 72.0;
var DEFAULT_SCALE_VALUE = 'auto';
var DEFAULT_SCALE = 1.0;
@ -458,3 +468,24 @@ var ProgressBar = (function ProgressBarClosure() {
return ProgressBar;
})();
exports.CSS_UNITS = CSS_UNITS;
exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE;
exports.DEFAULT_SCALE = DEFAULT_SCALE;
exports.UNKNOWN_SCALE = UNKNOWN_SCALE;
exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE;
exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING;
exports.VERTICAL_PADDING = VERTICAL_PADDING;
exports.mozL10n = mozL10n;
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;
}));

View file

@ -15,6 +15,16 @@
'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;
/**
@ -115,3 +125,6 @@ var ViewHistory = (function ViewHistoryClosure() {
return ViewHistory;
})();
exports.ViewHistory = ViewHistory;
}));

View file

@ -61,34 +61,7 @@ See https://github.com/adobe-type-tools/cmap-resources
<!--#endif-->
<!--#if !PRODUCTION-->
<script src="ui_utils.js"></script>
<script src="default_preferences.js"></script>
<script src="preferences.js"></script>
<script src="download_manager.js"></script>
<script src="platform_integration.js"></script>
<script src="view_history.js"></script>
<script src="pdf_link_service.js"></script>
<script src="pdf_rendering_queue.js"></script>
<script src="pdf_page_view.js"></script>
<script src="text_layer_builder.js"></script>
<script src="annotation_layer_builder.js"></script>
<script src="pdf_viewer.js"></script>
<script src="pdf_thumbnail_view.js"></script>
<script src="pdf_thumbnail_viewer.js"></script>
<script src="pdf_sidebar.js"></script>
<script src="pdf_outline_viewer.js"></script>
<script src="pdf_attachment_viewer.js"></script>
<script src="pdf_find_bar.js"></script>
<script src="pdf_find_controller.js"></script>
<script src="pdf_history.js"></script>
<script src="secondary_toolbar.js"></script>
<script src="pdf_presentation_mode.js"></script>
<script src="grab_to_pan.js"></script>
<script src="hand_tool.js"></script>
<script src="overlay_manager.js"></script>
<script src="password_prompt.js"></script>
<script src="pdf_document_properties.js"></script>
<script src="app.js"></script>
<!--#endif-->
<!--#if !MINIFIED -->

View file

@ -12,21 +12,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*globals require, parseQueryString, chrome, PDFViewerApplication */
/*globals require, chrome */
'use strict';
var DEFAULT_URL = 'compressed.tracemonkey-pldi-09.pdf';
//#include app.js
var pdfjsWebLibs = {};
(function () {
//#expand __BUNDLE__
}).call(pdfjsWebLibs);
//#if FIREFOX || MOZCENTRAL
//// FIXME the l10n.js file in the Firefox extension needs global FirefoxCom.
//window.FirefoxCom = pdfjsWebLibs.pdfjsWebFirefoxCom.FirefoxCom;
//#endif
//#if CHROME
//(function rewriteUrlClosure() {
// // Run this code outside DOMContentLoaded to make sure that the URL
// // is rewritten as soon as possible.
// var queryString = document.location.search.slice(1);
// var params = parseQueryString(queryString);
// DEFAULT_URL = params.file || '';
// var m = /(^|&)file=([^&]*)/.exec(queryString);
// DEFAULT_URL = m ? decodeURIComponent(m[2]) : '';
//
// // Example: chrome-extension://.../http://example.com/file.pdf
// var humanReadableUrl = '/' + DEFAULT_URL + location.hash;
@ -39,14 +47,16 @@ var DEFAULT_URL = 'compressed.tracemonkey-pldi-09.pdf';
function webViewerLoad() {
//#if !PRODUCTION
require.config({paths: {'pdfjs': '../src'}});
require(['pdfjs/main_loader'], function (loader) {
require.config({paths: {'pdfjs': '../src', 'pdfjs-web': '.'}});
require(['pdfjs/main_loader', 'pdfjs-web/app'], function (loader, web) {
window.pdfjsLib = loader;
PDFViewerApplication.run();
window.PDFViewerApplication = web.PDFViewerApplication;
web.PDFViewerApplication.run();
});
//#else
//window.pdfjsLib = window.pdfjsDistBuildPdf;
//PDFViewerApplication.run();
//window.PDFViewerApplication = pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication;
//pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication.run();
//#endif
}