Merge pull request #7172 from yurydelendik/umd-web

Introduces UMD headers to the web/ folder.
This commit is contained in:
Yury Delendik 2016-04-13 10:23:23 -05:00
commit 6282ec24d1
40 changed files with 889 additions and 306 deletions

View File

@ -66,7 +66,14 @@ function preprocess(inFilename, outFilename, defines) {
var realPath = fs.realpathSync(inFilename);
var dir = path.dirname(realPath);
try {
preprocess(path.join(dir, file), writeLine, defines);
var fullpath;
if (file.indexOf('$ROOT/') === 0) {
fullpath = path.join(__dirname, '../..',
file.substring('$ROOT/'.length));
} else {
fullpath = path.join(dir, file);
}
preprocess(fullpath, writeLine, defines);
} catch (e) {
if (e.code === 'ENOENT') {
throw new Error('Failed to include "' + file + '" at ' + loc());

View File

@ -245,7 +245,8 @@ function validateFile(path, name, context) {
if (name !== umd.amdId) {
error('AMD name does not match module name');
}
if (name.replace(/[_\/]/g, '') !== umd.jsRootName.toLowerCase()) {
if (name.replace(/[_\-\/]/g, '').toLowerCase() !==
umd.jsRootName.toLowerCase()) {
error('root name does not look like module name');
}
@ -272,7 +273,7 @@ function validateFile(path, name, context) {
return;
}
i = i.substring('root.'.length);
var j = umd.imports[index];
var j = umd.imports[index].replace(/(_|Lib)$/, '');
var offset = i.toLowerCase().lastIndexOf(j.toLowerCase());
if (offset + j.length !== i.length) {
error('JS import name does not look like corresponding body import ' +
@ -281,7 +282,7 @@ function validateFile(path, name, context) {
j = umd.amdImports[index];
if (j) {
if (j.replace(/[_\/]/g, '') !== i.toLowerCase()) {
if (j.replace(/[_\-\/]/g, '').toLowerCase() !== i.toLowerCase()) {
error('JS import name does not look like corresponding AMD import ' +
'name: ' + i + ' vs ' + j);
}

182
make.js
View File

@ -36,6 +36,7 @@ var config = JSON.parse(fs.readFileSync(CONFIG_FILE));
// Defined by buildnumber target.
var BUILD_NUMBER,
BUILD_COMMIT,
VERSION;
var ROOT_DIR = __dirname + '/', // absolute path to project's root
@ -100,8 +101,7 @@ var COMMON_WEB_FILES =
['web/images',
'web/debugger.js'],
COMMON_WEB_FILES_PREPROCESS =
['web/viewer.js',
'web/viewer.html'],
['web/viewer.html'],
COMMON_FIREFOX_FILES_PREPROCESS =
[FIREFOX_CONTENT_DIR + 'PdfStreamConverter.jsm',
FIREFOX_CONTENT_DIR + 'PdfjsContentUtils.jsm',
@ -127,6 +127,13 @@ target.generic = function() {
var defines = builder.merge(DEFINES, {GENERIC: true});
var TMP_VIEWER = GENERIC_DIR + '/web/viewer.js.tmp';
cd('web/');
var viewerBundleFiles = ['app.js'];
bundle('viewer.js', ROOT_DIR + TMP_VIEWER, viewerBundleFiles,
'pdfjs-dist/web/viewer', defines, true);
cd(ROOT_DIR);
var setup = {
defines: defines,
copy: [
@ -140,6 +147,7 @@ target.generic = function() {
],
preprocess: [
[BUILD_TARGETS, GENERIC_DIR + BUILD_DIR],
[TMP_VIEWER, GENERIC_DIR + '/web/viewer.js'],
[COMMON_WEB_FILES_PREPROCESS, GENERIC_DIR + '/web']
],
preprocessCSS: [
@ -152,6 +160,7 @@ target.generic = function() {
cleanupJSSource(GENERIC_DIR + '/build/pdf.js');
cleanupJSSource(GENERIC_DIR + '/web/viewer.js');
cleanupCSSSource(GENERIC_DIR + '/web/viewer.css');
rm(TMP_VIEWER);
};
target.components = function() {
@ -163,7 +172,18 @@ target.components = function() {
mkdir('-p', COMPONENTS_DIR);
mkdir('-p', COMPONENTS_DIR + 'images');
var defines = builder.merge(DEFINES, {COMPONENTS: true});
var defines = builder.merge(DEFINES, {COMPONENTS: true, GENERIC: true});
var TMP_PDF_VIEWER = COMPONENTS_DIR + 'pdf_viewer.js.tmp';
cd('web/');
var bundleFiles = [
'pdf_viewer.js',
'pdf_history.js',
'download_manager.js'
];
bundle('pdf_viewer.component.js', ROOT_DIR + TMP_PDF_VIEWER, bundleFiles,
'pdfjs-dist/web/pdf_viewer', defines, true);
cd(ROOT_DIR);
var COMPONENTS_IMAGES = [
'web/images/annotation-*.svg',
@ -179,7 +199,7 @@ target.components = function() {
['web/compatibility.js', COMPONENTS_DIR],
],
preprocess: [
['web/pdf_viewer.component.js', COMPONENTS_DIR + 'pdf_viewer.js'],
[TMP_PDF_VIEWER, COMPONENTS_DIR + 'pdf_viewer.js'],
],
preprocessCSS: [
['components', 'web/pdf_viewer.css', COMPONENTS_DIR + 'pdf_viewer.css'],
@ -189,6 +209,7 @@ target.components = function() {
cleanupJSSource(COMPONENTS_DIR + 'pdf_viewer.js');
cleanupCSSSource(COMPONENTS_DIR + 'pdf_viewer.css');
rm(TMP_PDF_VIEWER);
};
target.jsdoc = function() {
@ -479,6 +500,46 @@ target.cmaps = function () {
compressCmaps(CMAP_INPUT, VIEWER_CMAP_OUTPUT, true);
};
function bundle(filename, outfilename, initFiles, amdName, defines,
isMainFile) {
// Reading UMD headers and building loading orders of modules. The
// readDependencies returns AMD module names: removing 'pdfjs' prefix and
// adding '.js' extensions to the name.
var umd = require('./external/umdutils/verifier.js');
var files = umd.readDependencies(initFiles).loadOrder.map(
function (name) { return name.replace(/^[\w\-]+\//, '') + '.js'; });
crlfchecker.checkIfCrlfIsPresent(files);
var bundleContent = cat(files),
bundleVersion = VERSION,
bundleBuild = BUILD_COMMIT;
// Prepend a newline because stripCommentHeaders only strips comments that
// follow a line feed. The file where bundleContent is inserted already
// contains a license header, so the header of bundleContent can be removed.
bundleContent = stripCommentHeaders('\n' + bundleContent);
// Removes AMD and CommonJS branches from UMD headers.
bundleContent = stripUMDHeaders(bundleContent);
var jsName = amdName.replace(/[\-_\.\/]\w/g, function (all) {
return all[1].toUpperCase();
});
// This just preprocesses the empty pdf.js file, we don't actually want to
// preprocess everything yet since other build targets use this file.
builder.preprocess(filename, outfilename,
builder.merge(defines, {
BUNDLE: bundleContent,
BUNDLE_VERSION: bundleVersion,
BUNDLE_BUILD: bundleBuild,
BUNDLE_AMD_NAME: amdName,
BUNDLE_JS_NAME: jsName,
MAIN_FILE: isMainFile
}));
}
//
// make bundle
// Bundles all source files into one wrapper 'pdf.js' file, in the given order.
@ -493,86 +554,45 @@ target.bundle = function(args) {
echo();
echo('### Bundling files into ' + BUILD_TARGET);
function bundle(filename, outfilename, files, distname, isMainFile) {
var bundleContent = cat(files),
bundleVersion = VERSION,
bundleBuild = exec('git log --format="%h" -n 1',
{silent: true}).output.replace('\n', '');
crlfchecker.checkIfCrlfIsPresent(files);
// Prepend a newline because stripCommentHeaders only strips comments that
// follow a line feed. The file where bundleContent is inserted already
// contains a license header, so the header of bundleContent can be removed.
bundleContent = stripCommentHeaders('\n' + bundleContent);
// Removes AMD and CommonJS branches from UMD headers.
bundleContent = stripUMDHeaders(bundleContent);
var amdName = 'pdfjs-dist/build/' + distname.replace(/\.js$/, '');
var jsName = amdName.replace(/[\-_\.\/]\w/g, function (all) {
return all[1].toUpperCase();
});
// This just preprocesses the empty pdf.js file, we don't actually want to
// preprocess everything yet since other build targets use this file.
builder.preprocess(filename, outfilename, builder.merge(defines,
{BUNDLE: bundleContent,
BUNDLE_VERSION: bundleVersion,
BUNDLE_BUILD: bundleBuild,
BUNDLE_AMD_NAME: amdName,
BUNDLE_JS_NAME: jsName,
MAIN_FILE: isMainFile}));
}
if (!test('-d', BUILD_DIR)) {
mkdir(BUILD_DIR);
}
var umd = require('./external/umdutils/verifier.js');
var MAIN_SRC_FILES = [
SRC_DIR + 'display/global.js'
var mainFiles = [
'display/global.js'
];
var WORKER_SRC_FILES = [
SRC_DIR + 'core/worker.js'
var workerFiles = [
'core/worker.js'
];
var mainFileName = 'pdf.js';
var workerFileName = 'pdf.worker.js';
var mainAMDName = 'pdfjs-dist/build/pdf';
var workerAMDName = 'pdfjs-dist/build/pdf.worker';
// Extension does not need network.js file.
if (!defines.FIREFOX && !defines.MOZCENTRAL) {
WORKER_SRC_FILES.push(SRC_DIR + 'core/network.js');
workerFiles.push('core/network.js');
}
if (defines.SINGLE_FILE) {
// In singlefile mode, all of the src files will be bundled into
// the main pdf.js output.
MAIN_SRC_FILES = MAIN_SRC_FILES.concat(WORKER_SRC_FILES);
WORKER_SRC_FILES = null; // no need for worker file
mainFileName = 'pdf.combined.js';
workerFileName = null;
mainFiles = mainFiles.concat(workerFiles);
workerFiles = null; // no need for worker file
mainAMDName = 'pdfjs-dist/build/pdf.combined';
workerAMDName = null;
}
// Reading UMD headers and building loading orders of modules. The
// readDependencies returns AMD module names: removing 'pdfjs' prefix and
// adding '.js' extensions to the name.
var mainFiles = umd.readDependencies(MAIN_SRC_FILES).loadOrder.map(
function (name) { return name.replace('pdfjs/', '') + '.js'; });
var workerFiles = WORKER_SRC_FILES &&
umd.readDependencies(WORKER_SRC_FILES).loadOrder.map(
function (name) { return name.replace('pdfjs/', '') + '.js'; });
cd(SRC_DIR);
bundle('pdf.js', ROOT_DIR + BUILD_TARGET, mainFiles, mainFileName, true);
bundle('pdf.js', ROOT_DIR + BUILD_TARGET, mainFiles, mainAMDName, defines,
true);
if (workerFiles) {
var srcCopy = ROOT_DIR + BUILD_DIR + 'pdf.worker.js.temp';
cp('pdf.js', srcCopy);
bundle(srcCopy, ROOT_DIR + BUILD_WORKER_TARGET, workerFiles,
workerFileName, false);
bundle(srcCopy, ROOT_DIR + BUILD_WORKER_TARGET, workerFiles, workerAMDName,
defines, false);
rm(srcCopy);
}
};
@ -676,6 +696,13 @@ target.minified = function() {
var defines = builder.merge(DEFINES, {GENERIC: true, MINIFIED: true});
var TMP_VIEWER = MINIFIED_DIR + '/web/viewer.js.tmp';
cd('web/');
var viewerBundleFiles = ['app.js'];
bundle('viewer.js', ROOT_DIR + TMP_VIEWER, viewerBundleFiles,
'pdfjs-dist/web/viewer', defines, true);
cd(ROOT_DIR);
var setup = {
defines: defines,
copy: [
@ -686,6 +713,7 @@ target.minified = function() {
],
preprocess: [
[BUILD_TARGETS, MINIFIED_DIR + BUILD_DIR],
[TMP_VIEWER, MINIFIED_DIR + '/web/viewer.js'],
[COMMON_WEB_FILES_PREPROCESS, MINIFIED_DIR + '/web']
],
preprocessCSS: [
@ -696,6 +724,7 @@ target.minified = function() {
builder.build(setup);
cleanupCSSSource(MINIFIED_DIR + '/web/viewer.css');
rm(TMP_VIEWER);
var viewerFiles = [
'web/compatibility.js',
@ -762,6 +791,9 @@ target.buildnumber = function() {
echo('Extension build number: ' + BUILD_NUMBER);
VERSION = config.versionPrefix + BUILD_NUMBER;
BUILD_COMMIT = exec('git log --format="%h" -n 1', {silent: true}).
output.replace('\n', '');
};
//
@ -819,6 +851,14 @@ target.firefox = function() {
cp('-R', FIREFOX_EXTENSION_FILES_TO_COPY, ROOT_DIR + FIREFOX_BUILD_DIR);
cd(ROOT_DIR);
var TMP_VIEWER = FIREFOX_BUILD_CONTENT_DIR + '/web/viewer.js.tmp';
cd('web/');
var viewerBundleFiles = ['app.js', 'firefoxcom.js'];
bundle('viewer.js', ROOT_DIR + TMP_VIEWER, viewerBundleFiles,
'pdfjs-dist/web/viewer', defines, true);
cd(ROOT_DIR);
var setup = {
defines: defines,
copy: [
@ -829,6 +869,7 @@ target.firefox = function() {
FIREFOX_BUILD_CONTENT_DIR + '/web']
],
preprocess: [
[TMP_VIEWER, FIREFOX_BUILD_CONTENT_DIR + '/web/viewer.js'],
[COMMON_WEB_FILES_PREPROCESS, FIREFOX_BUILD_CONTENT_DIR + '/web'],
[BUILD_TARGETS, FIREFOX_BUILD_CONTENT_DIR + BUILD_DIR],
[COMMON_FIREFOX_FILES_PREPROCESS, FIREFOX_BUILD_CONTENT_DIR],
@ -846,6 +887,7 @@ target.firefox = function() {
cleanupJSSource(FIREFOX_BUILD_DIR + 'bootstrap.js');
cleanupJSSource(FIREFOX_BUILD_CONTENT_DIR + 'PdfjsChromeUtils.jsm');
cleanupCSSSource(FIREFOX_BUILD_CONTENT_DIR + '/web/viewer.css');
rm(TMP_VIEWER);
// Remove '.DS_Store' and other hidden files
find(FIREFOX_BUILD_DIR).forEach(function(file) {
@ -946,6 +988,13 @@ target.mozcentral = function() {
ROOT_DIR + MOZCENTRAL_EXTENSION_DIR + '/chrome.manifest');
cd(ROOT_DIR);
var TMP_VIEWER = MOZCENTRAL_CONTENT_DIR + '/web/viewer.js.tmp';
cd('web/');
var viewerBundleFiles = ['app.js', 'firefoxcom.js'];
bundle('viewer.js', ROOT_DIR + TMP_VIEWER, viewerBundleFiles,
'pdfjs-dist/web/viewer', defines, true);
cd(ROOT_DIR);
var setup = {
defines: defines,
copy: [
@ -954,6 +1003,7 @@ target.mozcentral = function() {
['extensions/firefox/tools/l10n.js', MOZCENTRAL_CONTENT_DIR + '/web']
],
preprocess: [
[TMP_VIEWER, MOZCENTRAL_CONTENT_DIR + '/web/viewer.js'],
[COMMON_WEB_FILES_PREPROCESS, MOZCENTRAL_CONTENT_DIR + '/web'],
[FIREFOX_CONTENT_DIR + 'pdfjschildbootstrap.js', MOZCENTRAL_CONTENT_DIR],
[BUILD_TARGETS, MOZCENTRAL_CONTENT_DIR + BUILD_DIR],
@ -973,6 +1023,7 @@ target.mozcentral = function() {
cleanupJSSource(MOZCENTRAL_CONTENT_DIR + '/PdfJs.jsm');
cleanupJSSource(MOZCENTRAL_CONTENT_DIR + '/PdfjsChromeUtils.jsm');
cleanupCSSSource(MOZCENTRAL_CONTENT_DIR + '/web/viewer.css');
rm(TMP_VIEWER);
// Remove '.DS_Store' and other hidden files
find(MOZCENTRAL_DIR).forEach(function(file) {
@ -1078,6 +1129,13 @@ target.chromium = function() {
mkdir('-p', CHROME_BUILD_CONTENT_DIR + BUILD_DIR);
mkdir('-p', CHROME_BUILD_CONTENT_DIR + '/web');
var TMP_VIEWER = CHROME_BUILD_CONTENT_DIR + '/web/viewer.js.tmp';
cd('web/');
var viewerBundleFiles = ['app.js', 'chromecom.js'];
bundle('viewer.js', ROOT_DIR + TMP_VIEWER, viewerBundleFiles,
'pdfjs-dist/web/viewer', defines, true);
cd(ROOT_DIR);
var setup = {
defines: defines,
copy: [
@ -1096,6 +1154,7 @@ target.chromium = function() {
],
preprocess: [
[BUILD_TARGETS, CHROME_BUILD_CONTENT_DIR + BUILD_DIR],
[TMP_VIEWER, CHROME_BUILD_CONTENT_DIR + '/web/viewer.js'],
[COMMON_WEB_FILES_PREPROCESS, CHROME_BUILD_CONTENT_DIR + '/web']
],
preprocessCSS: [
@ -1107,6 +1166,7 @@ target.chromium = function() {
cleanupJSSource(CHROME_BUILD_CONTENT_DIR + '/web/viewer.js');
cleanupCSSSource(CHROME_BUILD_CONTENT_DIR + '/web/viewer.css');
rm(TMP_VIEWER);
// Update the build version number
sed('-i', /PDFJSSCRIPT_VERSION/, VERSION,
@ -1508,7 +1568,7 @@ target.lint = function() {
echo();
echo('### Checking UMD dependencies');
var umd = require('./external/umdutils/verifier.js');
if (!umd.validateFiles({'pdfjs': './src'})) {
if (!umd.validateFiles({'pdfjs': './src', 'pdfjs-web': './web'})) {
exit(1);
}

View File

@ -71,7 +71,7 @@ var isPostMessageTransfersDisabled = false;
//#if PRODUCTION && !SINGLE_FILE
//#if GENERIC
//#include ../src/frameworks.js
//#include $ROOT/src/frameworks.js
//#else
//var fakeWorkerFilesLoader = null;
//#endif

View File

@ -43,19 +43,19 @@
var pdfjsLibs;
function initializePDFJS(callback) {
require.config({paths: {'pdfjs': '../../src'}});
require.config({paths: {'pdfjs': '../../src', 'pdfjs-web': '../../web'}});
require(['pdfjs/shared/util', 'pdfjs/display/global', 'pdfjs/core/primitives',
'pdfjs/core/annotation', 'pdfjs/core/crypto', 'pdfjs/core/stream',
'pdfjs/core/fonts', 'pdfjs/core/ps_parser', 'pdfjs/core/function',
'pdfjs/core/parser', 'pdfjs/core/evaluator', 'pdfjs/core/cmap',
'pdfjs/core/worker', 'pdfjs/core/network', 'pdfjs/core/type1_parser',
'pdfjs/core/cff_parser', 'pdfjs/display/api', 'pdfjs/display/metadata',
'pdfjs/display/dom_utils'],
'pdfjs/display/dom_utils', 'pdfjs-web/ui_utils'],
function (sharedUtil, displayGlobal, corePrimitives, coreAnnotation,
coreCrypto, coreStream, coreFonts, corePsParser, coreFunction,
coreParser, coreEvaluator, coreCMap, coreWorker, coreNetwork,
coreType1Parser, coreCFFParser, displayAPI, displayMetadata,
displayDOMUtils) {
displayDOMUtils, webUIUtils) {
pdfjsLibs = {
sharedUtil: sharedUtil,
@ -76,7 +76,8 @@ function initializePDFJS(callback) {
coreCFFParser: coreCFFParser,
displayAPI: displayAPI,
displayMetadata: displayMetadata,
displayDOMUtils: displayDOMUtils
displayDOMUtils: displayDOMUtils,
webUIUtils: webUIUtils
};
// Expose all loaded internal exported members to global scope.

View File

@ -11,8 +11,6 @@
<script src="testreporter.js"></script>
<script src="jasmine-boot.js"></script>
<script src="../../web/ui_utils.js"></script>
<!-- include spec files here... -->
<script src="primitives_spec.js"></script>
<script src="font_spec.js"></script>

View File

@ -12,10 +12,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*globals pdfjsLib, mozL10n, SimpleLinkService */
'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;
/**
* @typedef {Object} AnnotationLayerBuilderOptions
* @property {HTMLDivElement} pageDiv
@ -119,3 +135,6 @@ DefaultAnnotationLayerFactory.prototype = {
});
}
};
exports.AnnotationLayerBuilder = AnnotationLayerBuilder;
}));

View File

@ -12,18 +12,93 @@
* 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, 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',
'pdfjs-web/pdfjs'],
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'), require('./pdfjs.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, root.pdfjsWebPDFJS);
}
}(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, pdfjsLib) {
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 +122,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,
@ -1230,9 +1285,6 @@ var PDFViewerApplication = {
this.pdfPresentationMode.mouseScroll(delta);
}
};
//#if GENERIC
window.PDFView = PDFViewerApplication; // obsolete name, using it as an alias
//#endif
//#if GENERIC
var HOSTED_VIEWER_ORIGINS = ['null',
@ -1369,7 +1421,7 @@ function webViewerInitialized() {
var pdfBug = hashParams['pdfbug'];
var enabled = pdfBug.split(',');
PDFBug.enable(enabled);
PDFBug.init();
PDFBug.init(pdfjsLib);
}
}
@ -2144,3 +2196,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,28 @@
* limitations under the License.
*/
/* globals chrome, pdfjsLib, PDFViewerApplication, OverlayManager */
/* globals chrome */
'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', 'pdfjs-web/pdfjs'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./app.js'), require('./overlay_manager.js'),
require('./pdfjs.js'));
} else {
factory((root.pdfjsWebChromeCom = {}), root.pdfjsWebApp,
root.pdfjsWebOverlayManager, root.pdfjsWebPDFJS);
}
}(this, function (exports, app, overlayManager, pdfjsLib) {
//#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 +223,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 +322,6 @@ var ChromeCom = (function ChromeComClosure() {
}
}
return ChromeCom;
})();
exports.ChromeCom = ChromeCom;
//#endif
}));

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals pdfjsLib */
'use strict';
@ -65,7 +64,7 @@ var FontInspector = (function FontInspectorClosure() {
name: 'Font Inspector',
panel: null,
manager: null,
init: function init() {
init: function init(pdfjsLib) {
var panel = this.panel;
panel.setAttribute('style', 'padding: 5px;');
var tmp = document.createElement('button');
@ -291,7 +290,7 @@ var Stepper = (function StepperClosure() {
this.operatorListIdx = 0;
}
Stepper.prototype = {
init: function init() {
init: function init(pdfjsLib) {
var panel = this.panel;
var content = c('div', 'c=continue, s=step');
var table = c('table');
@ -458,7 +457,7 @@ var Stats = (function Stats() {
name: 'Stats',
panel: null,
manager: null,
init: function init() {
init: function init(pdfjsLib) {
this.panel.setAttribute('style', 'padding: 5px;');
pdfjsLib.PDFJS.enableStats = true;
},
@ -532,7 +531,7 @@ var PDFBug = (function PDFBugClosure() {
});
}
},
init: function init() {
init: function init(pdfjsLib) {
/*
* Basic Layout:
* PDFBug
@ -576,7 +575,7 @@ var PDFBug = (function PDFBugClosure() {
tool.panel = panel;
tool.manager = this;
if (tool.enabled) {
tool.init();
tool.init(pdfjsLib);
} else {
panel.textContent = tool.name + ' is disabled. To enable add ' +
' "' + tool.id + '" to the pdfBug parameter ' +

View File

@ -12,12 +12,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals URL, pdfjsLib */
'use strict';
var DownloadManager = (function DownloadManagerClosure() {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/download_manager', ['exports', 'pdfjs-web/pdfjs'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./pdfjs.js'));
} else {
factory((root.pdfjsWebDownloadManager = {}), root.pdfjsWebPDFJS);
}
}(this, function (exports, pdfjsLib) {
//#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 */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/firefoxcom', ['exports', 'pdfjs-web/preferences',
'pdfjs-web/pdfjs'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./preferences.js'), require('./pdfjs.js'));
} else {
factory((root.pdfjsWebFirefoxCom = {}), root.pdfjsWebPreferences,
root.pdfjsWebPDFJS);
}
}(this, function (exports, preferences, pdfjsLib) {
//#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,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals pdfjsLib, mozL10n, OverlayManager */
'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;
var PasswordPrompt = {
overlayName: null,
updatePassword: null,
@ -79,3 +95,6 @@ var PasswordPrompt = {
}
}
};
exports.PasswordPrompt = PasswordPrompt;
}));

View File

@ -12,10 +12,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals pdfjsLib */
'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) {
/**
* @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

@ -12,10 +12,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals pdfjsLib */
'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) {
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 */
'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/pdfjs'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./ui_utils.js'),
require('./pdf_rendering_queue.js'), require('./pdfjs.js'));
} else {
factory((root.pdfjsWebPDFPageView = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFRenderingQueue, root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtils, pdfRenderingQueue, 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 RenderingStates = pdfRenderingQueue.RenderingStates;
var TEXT_LAYER_RENDER_DELAY = 200; // ms
/**
@ -437,15 +456,6 @@ var PDFPageView = (function PDFPageViewClosure() {
cssTransform: false,
});
div.dispatchEvent(event);
//#if GENERIC
// This custom event is deprecated, and will be removed in the future,
// please use the |pagerendered| event instead.
var deprecatedEvent = document.createEvent('CustomEvent');
deprecatedEvent.initCustomEvent('pagerender', true, true, {
pageNumber: pdfPage.pageNumber
});
div.dispatchEvent(deprecatedEvent);
//#endif
if (!error) {
resolveRenderPromise(undefined);
@ -582,3 +592,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

@ -12,41 +12,47 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jshint globalstrict: false */
/* globals PDFJS, PDFViewer, PDFPageView, TextLayerBuilder, PDFLinkService,
DefaultTextLayerFactory, AnnotationLayerBuilder, PDFHistory,
DefaultAnnotationLayerFactory, DownloadManager, ProgressBar */
/* jshint globalstrict: false */
/* umdutils ignore */
(function pdfViewerWrapper() {
(function (root, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define('pdfjs-dist/web/pdf.components', ['exports', 'pdfjs-dist/build/pdf'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../build/pdf.js'));
} else {
factory((root.pdfjsDistWebPDFComponents = {}), root.pdfjsDistBuildPdf);
}
}(this, function (exports, pdfjsLib) {
'use strict';
var root = this;
if (!root.pdfjsLib) {
Object.defineProperty(root, 'pdfjsLib', {
get: function () {
return root.pdfjsDistBuildPdf || root.pdfjsDistBuildPdfCombined ||
root.pdfjsMainLoader;
},
enumerable: true,
configurable: true
});
}
var pdfViewerLibs = {
pdfjsWebPDFJS: pdfjsLib
};
//#include ui_utils.js
//#include pdf_link_service.js
//#include pdf_viewer.js
//#include pdf_history.js
//#include download_manager.js
(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 = pdfjsLib.PDFJS;
PDFJS.DownloadManager = DownloadManager;
PDFJS.ProgressBar = ProgressBar;
}).call((typeof window === 'undefined') ? this : window);
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;
exports.PDFJS = PDFJS;
}));

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 */
'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/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('./pdfjs.js'));
} else {
factory((root.pdfjsWebPDFViewer = {}), root.pdfjsWebUIUtils,
root.pdfjsWebPDFPageView, root.pdfjsWebPDFRenderingQueue,
root.pdfjsWebTextLayerBuilder, root.pdfjsWebAnnotationLayerBuilder,
root.pdfjsWebPDFLinkService, root.pdfjsWebPDFJS);
}
}(this, function (exports, uiUtils, pdfPageView, pdfRenderingQueue,
textLayerBuilder, annotationLayerBuilder, pdfLinkService,
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 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

@ -12,19 +12,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* umdutils ignore */
//#if !(FIREFOX || MOZCENTRAL)
//#include mozPrintCallback_polyfill.js
//#endif
'use strict';
//#if GENERIC || CHROME
//#include download_manager.js
//#endif
//#if FIREFOX || MOZCENTRAL
//#include firefoxcom.js
//#endif
//#if CHROME
//#include chromecom.js
//#endif
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/pdfjs', ['exports', 'pdfjs/main_loader'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../src/main_loader.js'));
} else {
factory((root.pdfjsWebPDFJS = {}), root.pdfjsMainLoader);
}
}(this, function (exports, mainLoader) {
// Re-export all mainLoader members.
for (var i in mainLoader) {
if (Object.prototype.hasOwnProperty.call(mainLoader, i)) {
exports[i] = mainLoader[i];
}
}
}));

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

@ -12,10 +12,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals pdfjsLib */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs-web/text_layer_builder', ['exports', 'pdfjs-web/pdfjs'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./pdfjs.js'));
} else {
factory((root.pdfjsWebTextLayerBuilder = {}), root.pdfjsWebPDFJS);
}
}(this, function (exports, pdfjsLib) {
/**
* @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,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* global PDFJS */
'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) {
var CSS_UNITS = 96.0 / 72.0;
var DEFAULT_SCALE_VALUE = 'auto';
var DEFAULT_SCALE = 1.0;
@ -26,9 +35,7 @@ var VERTICAL_PADDING = 5;
var mozL10n = document.mozL10n || document.webL10n;
if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {};
}
var PDFJS = pdfjsLib.PDFJS;
/**
* Disables fullscreen support, and by extension Presentation Mode,
@ -458,3 +465,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,34 @@
* 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
//#if PRODUCTION
//var pdfjsWebLibs = {
// pdfjsWebPDFJS: window.pdfjsDistBuildPdf
//};
//
//(function () {
//#expand __BUNDLE__
//}).call(pdfjsWebLibs);
//#endif
//#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 +52,14 @@ var DEFAULT_URL = 'compressed.tracemonkey-pldi-09.pdf';
function webViewerLoad() {
//#if !PRODUCTION
require.config({paths: {'pdfjs': '../src'}});
require(['pdfjs/main_loader'], function (loader) {
window.pdfjsLib = loader;
PDFViewerApplication.run();
require.config({paths: {'pdfjs': '../src', 'pdfjs-web': '.'}});
require(['pdfjs-web/app'], function (web) {
window.PDFViewerApplication = web.PDFViewerApplication;
web.PDFViewerApplication.run();
});
//#else
//window.pdfjsLib = window.pdfjsDistBuildPdf;
//PDFViewerApplication.run();
//window.PDFViewerApplication = pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication;
//pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication.run();
//#endif
}