Replacing custom bundling with webpack2.
This commit is contained in:
		
							parent
							
								
									d7cb46dafc
								
							
						
					
					
						commit
						eb4c88cd44
					
				
							
								
								
									
										50
									
								
								external/webpack/block-require.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								external/webpack/block-require.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,50 @@ | |||||||
|  | /* Copyright 2017 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. | ||||||
|  |  */ | ||||||
|  | /* eslint-env node */ | ||||||
|  | 
 | ||||||
|  | 'use strict'; | ||||||
|  | 
 | ||||||
|  | function isPDFJSDevCheck(test) { | ||||||
|  |   // Is it something like `typeof __pdfjsdev_webpack__ === 'undefined'`?
 | ||||||
|  |   return test.type === 'BinaryExpression' && | ||||||
|  |          (test.operator === '===' || test.operator === '!==' || | ||||||
|  |           test.operator === '==' || test.operator === '!=') && | ||||||
|  |          test.left.type === 'UnaryExpression' && | ||||||
|  |          test.left.operator === 'typeof' && | ||||||
|  |          test.left.argument.type === 'Identifier' && | ||||||
|  |          test.left.argument.name === '__pdfjsdev_webpack__' && | ||||||
|  |          test.right.type === 'Literal' && test.right.value === 'undefined'; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function isPDFJSDevEnabled(test) { | ||||||
|  |   return test.operator[0] === '!'; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function BlockRequirePlugin() {} | ||||||
|  | 
 | ||||||
|  | BlockRequirePlugin.prototype.apply = function(compiler) { | ||||||
|  |   compiler.plugin('compilation', function(compilation, data) { | ||||||
|  |     data.normalModuleFactory.plugin('parser', function (parser, options) { | ||||||
|  |       parser.plugin('statement if', function (ifNode) { | ||||||
|  |         if (isPDFJSDevCheck(ifNode.test)) { | ||||||
|  |           return isPDFJSDevEnabled(ifNode.test); | ||||||
|  |         } | ||||||
|  |         return undefined; | ||||||
|  |       }); | ||||||
|  |     }); | ||||||
|  |   }); | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | module.exports = BlockRequirePlugin; | ||||||
							
								
								
									
										30
									
								
								external/webpack/pdfjsdev-loader.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								external/webpack/pdfjsdev-loader.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,30 @@ | |||||||
|  | /* Copyright 2017 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. | ||||||
|  |  */ | ||||||
|  | /* eslint-env node */ | ||||||
|  | 
 | ||||||
|  | 'use strict'; | ||||||
|  | 
 | ||||||
|  | var preprocessor2 = require('../builder/preprocessor2.js'); | ||||||
|  | 
 | ||||||
|  | module.exports = function (source) { | ||||||
|  |   // Options must be specified, ignoring request if not.
 | ||||||
|  |   if (!this.query || typeof this.query !== 'object') { | ||||||
|  |     return source; | ||||||
|  |   } | ||||||
|  |   this.cacheable(); | ||||||
|  |   var ctx = this.query; | ||||||
|  |   source = preprocessor2.preprocessPDFJSCode(ctx, source); | ||||||
|  |   return source; | ||||||
|  | }; | ||||||
							
								
								
									
										264
									
								
								gulpfile.js
									
									
									
									
									
								
							
							
						
						
									
										264
									
								
								gulpfile.js
									
									
									
									
									
								
							| @ -31,6 +31,8 @@ var spawn = require('child_process').spawn; | |||||||
| var streamqueue = require('streamqueue'); | var streamqueue = require('streamqueue'); | ||||||
| var merge = require('merge-stream'); | var merge = require('merge-stream'); | ||||||
| var zip = require('gulp-zip'); | var zip = require('gulp-zip'); | ||||||
|  | var webpack2 = require('webpack'); | ||||||
|  | var webpackStream = require('webpack-stream'); | ||||||
| 
 | 
 | ||||||
| var BUILD_DIR = 'build/'; | var BUILD_DIR = 'build/'; | ||||||
| var JSDOC_DIR = 'jsdoc/'; | var JSDOC_DIR = 'jsdoc/'; | ||||||
| @ -79,12 +81,45 @@ function createStringSource(filename, content) { | |||||||
|   return source; |   return source; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function stripUMDHeaders(content) { | function createWebpackConfig(defines, output) { | ||||||
|   var reg = new RegExp( |   var path = require('path'); | ||||||
|     'if \\(typeof define === \'function\' && define.amd\\) \\{[^}]*' + |   var BlockRequirePlugin = require('./external/webpack/block-require.js'); | ||||||
|     '\\} else if \\(typeof exports !== \'undefined\'\\) \\{[^}]*' + | 
 | ||||||
|     '\\} else ', 'g'); |   var versionInfo = getVersionJSON(); | ||||||
|   return content.replace(reg, ''); |   var bundleDefines = builder.merge(defines, { | ||||||
|  |     BUNDLE_VERSION: versionInfo.version, | ||||||
|  |     BUNDLE_BUILD: versionInfo.commit | ||||||
|  |   }); | ||||||
|  | 
 | ||||||
|  |   return { | ||||||
|  |     output: output, | ||||||
|  |     plugins: [ | ||||||
|  |       new BlockRequirePlugin() | ||||||
|  |     ], | ||||||
|  |     resolve: { | ||||||
|  |       alias: { | ||||||
|  |         'pdfjs': path.join(__dirname, 'src'), | ||||||
|  |         'pdfjs-web': path.join(__dirname, 'web'), | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     module: { | ||||||
|  |       loaders: [ | ||||||
|  |         { | ||||||
|  |           loader: path.join(__dirname, 'external/webpack/pdfjsdev-loader.js'), | ||||||
|  |           options: { | ||||||
|  |             rootPath: __dirname, | ||||||
|  |             saveComments: 'copyright', | ||||||
|  |             defines: bundleDefines | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       ] | ||||||
|  |     } | ||||||
|  |   }; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function webpack2Stream(config) { | ||||||
|  |   // Replacing webpack1 to webpack2 in the webpack-stream.
 | ||||||
|  |   return webpackStream(config, webpack2); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function stripCommentHeaders(content) { | function stripCommentHeaders(content) { | ||||||
| @ -124,185 +159,74 @@ function checkChromePreferencesFile(chromePrefsPath, webPrefsPath) { | |||||||
|   }); |   }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function bundle(filename, outfilename, pathPrefix, initFiles, amdName, defines, | function replaceWebpackRequire() { | ||||||
|                 isMainFile, versionInfo) { |   // Produced bundles can be rebundled again, avoid collisions (e.g. in api.js)
 | ||||||
|   // Reading UMD headers and building loading orders of modules. The
 |   // by renaming  __webpack_require__ to something else.
 | ||||||
|   // readDependencies returns AMD module names: removing 'pdfjs' prefix and
 |   return replace('__webpack_require__', '__w_pdfjs_require__'); | ||||||
|   // adding '.js' extensions to the name.
 |  | ||||||
|   var umd = require('./external/umdutils/verifier.js'); |  | ||||||
|   initFiles = initFiles.map(function (p) { |  | ||||||
|     return pathPrefix + p; |  | ||||||
|   }); |  | ||||||
|   var files = umd.readDependencies(initFiles).loadOrder.map(function (name) { |  | ||||||
|     return pathPrefix + name.replace(/^[\w\-]+\//, '') + '.js'; |  | ||||||
|   }); |  | ||||||
| 
 |  | ||||||
|   var crlfchecker = require('./external/crlfchecker/crlfchecker.js'); |  | ||||||
|   crlfchecker.checkIfCrlfIsPresent(files); |  | ||||||
| 
 |  | ||||||
|   var bundleContent = files.map(function (file) { |  | ||||||
|     var content = fs.readFileSync(file); |  | ||||||
| 
 |  | ||||||
|     // 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.
 |  | ||||||
|     content = stripCommentHeaders('\n' + content); |  | ||||||
| 
 |  | ||||||
|     // Removes AMD and CommonJS branches from UMD headers.
 |  | ||||||
|     content = stripUMDHeaders(content); |  | ||||||
| 
 |  | ||||||
|     return content; |  | ||||||
|   }).join(''); |  | ||||||
| 
 |  | ||||||
|   var jsName = amdName.replace(/[\-_\.\/]\w/g, function (all) { |  | ||||||
|     return all[1].toUpperCase(); |  | ||||||
|   }); |  | ||||||
| 
 |  | ||||||
|   var p2 = require('./external/builder/preprocessor2.js'); |  | ||||||
|   var ctx = { |  | ||||||
|     rootPath: __dirname, |  | ||||||
|     saveComments: 'copyright', |  | ||||||
|     defines: builder.merge(defines, { |  | ||||||
|       BUNDLE_VERSION: versionInfo.version, |  | ||||||
|       BUNDLE_BUILD: versionInfo.commit, |  | ||||||
|       BUNDLE_AMD_NAME: amdName, |  | ||||||
|       BUNDLE_JS_NAME: jsName, |  | ||||||
|       MAIN_FILE: isMainFile |  | ||||||
|     }) |  | ||||||
|   }; |  | ||||||
| 
 |  | ||||||
|   var templateContent = fs.readFileSync(filename).toString(); |  | ||||||
|   templateContent = templateContent.replace( |  | ||||||
|     /\/\/#expand\s+__BUNDLE__\s*\n/, function (all) { |  | ||||||
|       return bundleContent; |  | ||||||
|     }); |  | ||||||
|   bundleContent = null; |  | ||||||
| 
 |  | ||||||
|   templateContent = p2.preprocessPDFJSCode(ctx, templateContent); |  | ||||||
|   fs.writeFileSync(outfilename, templateContent); |  | ||||||
|   templateContent = null; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function createBundle(defines) { | function createBundle(defines) { | ||||||
|   var versionJSON = getVersionJSON(); |  | ||||||
| 
 |  | ||||||
|   console.log(); |   console.log(); | ||||||
|   console.log('### Bundling files into pdf.js'); |   console.log('### Bundling files into pdf.js'); | ||||||
| 
 | 
 | ||||||
|   var mainFiles = [ |  | ||||||
|     'display/global.js' |  | ||||||
|   ]; |  | ||||||
| 
 |  | ||||||
|   var workerFiles = [ |  | ||||||
|     'core/worker.js' |  | ||||||
|   ]; |  | ||||||
| 
 |  | ||||||
|   var mainAMDName = 'pdfjs-dist/build/pdf'; |   var mainAMDName = 'pdfjs-dist/build/pdf'; | ||||||
|   var workerAMDName = 'pdfjs-dist/build/pdf.worker'; |  | ||||||
|   var mainOutputName = 'pdf.js'; |   var mainOutputName = 'pdf.js'; | ||||||
|  |   if (defines.SINGLE_FILE) { | ||||||
|  |     mainAMDName = 'pdfjs-dist/build/pdf.combined'; | ||||||
|  |     mainOutputName = 'pdf.combined.js'; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   var mainFileConfig = createWebpackConfig(defines, { | ||||||
|  |     filename: mainOutputName, | ||||||
|  |     library: mainAMDName, | ||||||
|  |     libraryTarget: 'umd', | ||||||
|  |     umdNamedDefine: true | ||||||
|  |   }); | ||||||
|  |   var mainOutput = gulp.src('./src/pdf.js') | ||||||
|  |     .pipe(webpack2Stream(mainFileConfig)) | ||||||
|  |     .pipe(replaceWebpackRequire()); | ||||||
|  |   if (defines.SINGLE_FILE) { | ||||||
|  |     return mainOutput; // don't need a worker file.
 | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   var workerAMDName = 'pdfjs-dist/build/pdf.worker'; | ||||||
|   var workerOutputName = 'pdf.worker.js'; |   var workerOutputName = 'pdf.worker.js'; | ||||||
| 
 | 
 | ||||||
|   // Extension does not need network.js file.
 |   var workerFileConfig = createWebpackConfig(defines, { | ||||||
|   if (!defines.FIREFOX && !defines.MOZCENTRAL) { |     filename: workerOutputName, | ||||||
|     workerFiles.push('core/network.js'); |     library: workerAMDName, | ||||||
|   } |     libraryTarget: 'umd', | ||||||
| 
 |     umdNamedDefine: true | ||||||
|   if (defines.SINGLE_FILE) { |   }); | ||||||
|     // In singlefile mode, all of the src files will be bundled into
 |   var workerOutput = gulp.src('./src/pdf.worker.js') | ||||||
|     // the main pdf.js output.
 |     .pipe(webpack2Stream(workerFileConfig)) | ||||||
|     mainFiles = mainFiles.concat(workerFiles); |     .pipe(replaceWebpackRequire()); | ||||||
|     workerFiles = null; // no need for worker file
 |   return merge([mainOutput, workerOutput]); | ||||||
|     mainAMDName = 'pdfjs-dist/build/pdf.combined'; |  | ||||||
|     workerAMDName = null; |  | ||||||
|     mainOutputName = 'pdf.combined.js'; |  | ||||||
|     workerOutputName = null; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   var state = 'mainfile'; |  | ||||||
|   var source = stream.Readable({ objectMode: true }); |  | ||||||
|   source._read = function () { |  | ||||||
|     var tmpFile; |  | ||||||
|     switch (state) { |  | ||||||
|       case 'mainfile': |  | ||||||
|         // 'buildnumber' shall create BUILD_DIR for us
 |  | ||||||
|         tmpFile = BUILD_DIR + '~' + mainOutputName + '.tmp'; |  | ||||||
|         bundle('src/pdf.js', tmpFile, 'src/', mainFiles, mainAMDName, |  | ||||||
|           defines, true, versionJSON); |  | ||||||
|         this.push(new gutil.File({ |  | ||||||
|           cwd: '', |  | ||||||
|           base: '', |  | ||||||
|           path: mainOutputName, |  | ||||||
|           contents: fs.readFileSync(tmpFile) |  | ||||||
|         })); |  | ||||||
|         fs.unlinkSync(tmpFile); |  | ||||||
|         state = workerFiles ? 'workerfile' : 'stop'; |  | ||||||
|         break; |  | ||||||
|       case 'workerfile': |  | ||||||
|         // 'buildnumber' shall create BUILD_DIR for us
 |  | ||||||
|         tmpFile = BUILD_DIR + '~' + workerOutputName + '.tmp'; |  | ||||||
|         bundle('src/pdf.js', tmpFile, 'src/', workerFiles, workerAMDName, |  | ||||||
|           defines, false, versionJSON); |  | ||||||
|         this.push(new gutil.File({ |  | ||||||
|           cwd: '', |  | ||||||
|           base: '', |  | ||||||
|           path: workerOutputName, |  | ||||||
|           contents: fs.readFileSync(tmpFile) |  | ||||||
|         })); |  | ||||||
|         fs.unlinkSync(tmpFile); |  | ||||||
|         state = 'stop'; |  | ||||||
|         break; |  | ||||||
|       case 'stop': |  | ||||||
|         this.push(null); |  | ||||||
|         break; |  | ||||||
|     } |  | ||||||
|   }; |  | ||||||
|   return source; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function createWebBundle(defines) { | function createWebBundle(defines) { | ||||||
|   var versionJSON = getVersionJSON(); |   var viewerOutputName = 'viewer.js'; | ||||||
| 
 | 
 | ||||||
|   var template, files, outputName, amdName; |   var viewerFileConfig = createWebpackConfig(defines, { | ||||||
|   if (defines.COMPONENTS) { |     filename: viewerOutputName | ||||||
|     amdName = 'pdfjs-dist/web/pdf_viewer'; |   }); | ||||||
|     template = 'web/pdf_viewer.component.js'; |   return gulp.src('./web/viewer.js') | ||||||
|     files = [ |              .pipe(webpack2Stream(viewerFileConfig)); | ||||||
|       'pdf_viewer.js', |  | ||||||
|       'pdf_history.js', |  | ||||||
|       'pdf_find_controller.js', |  | ||||||
|       'download_manager.js' |  | ||||||
|     ]; |  | ||||||
|     outputName = 'pdf_viewer.js'; |  | ||||||
|   } else { |  | ||||||
|     amdName = 'pdfjs-dist/web/viewer'; |  | ||||||
|     outputName = 'viewer.js'; |  | ||||||
|     template = 'web/viewer.js'; |  | ||||||
|     files = ['app.js']; |  | ||||||
|     if (defines.FIREFOX || defines.MOZCENTRAL) { |  | ||||||
|       files.push('firefoxcom.js', 'firefox_print_service.js'); |  | ||||||
|     } else if (defines.CHROME) { |  | ||||||
|       files.push('chromecom.js', 'pdf_print_service.js'); |  | ||||||
|     } else if (defines.GENERIC) { |  | ||||||
|       files.push('pdf_print_service.js'); |  | ||||||
|     } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|   var source = stream.Readable({ objectMode: true }); | function createComponentsBundle(defines) { | ||||||
|   source._read = function () { |   var componentsAMDName = 'pdfjs-dist/web/pdf_viewer'; | ||||||
|     // 'buildnumber' shall create BUILD_DIR for us
 |   var componentsOutputName = 'pdf_viewer.js'; | ||||||
|     var tmpFile = BUILD_DIR + '~' + outputName + '.tmp'; | 
 | ||||||
|     bundle(template, tmpFile, 'web/', files, amdName, defines, false, |   var componentsFileConfig = createWebpackConfig(defines, { | ||||||
|       versionJSON); |     filename: componentsOutputName, | ||||||
|     this.push(new gutil.File({ |     library: componentsAMDName, | ||||||
|       cwd: '', |     libraryTarget: 'umd', | ||||||
|       base: '', |     umdNamedDefine: true | ||||||
|       path: outputName, |   }); | ||||||
|       contents: fs.readFileSync(tmpFile) |   return gulp.src('./web/pdf_viewer.component.js') | ||||||
|     })); |     .pipe(webpack2Stream(componentsFileConfig)) | ||||||
|     fs.unlinkSync(tmpFile); |     .pipe(replaceWebpackRequire()); | ||||||
|     this.push(null); |  | ||||||
|   }; |  | ||||||
|   return source; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function checkFile(path) { | function checkFile(path) { | ||||||
| @ -631,7 +555,7 @@ gulp.task('components', ['buildnumber'], function () { | |||||||
|   ]; |   ]; | ||||||
| 
 | 
 | ||||||
|   return merge([ |   return merge([ | ||||||
|     createWebBundle(defines).pipe(gulp.dest(COMPONENTS_DIR)), |     createComponentsBundle(defines).pipe(gulp.dest(COMPONENTS_DIR)), | ||||||
|     gulp.src(COMPONENTS_IMAGES).pipe(gulp.dest(COMPONENTS_DIR + 'images')), |     gulp.src(COMPONENTS_IMAGES).pipe(gulp.dest(COMPONENTS_DIR + 'images')), | ||||||
|     gulp.src('web/compatibility.js').pipe(gulp.dest(COMPONENTS_DIR)), |     gulp.src('web/compatibility.js').pipe(gulp.dest(COMPONENTS_DIR)), | ||||||
|     preprocessCSS('web/pdf_viewer.css', 'components', defines, true) |     preprocessCSS('web/pdf_viewer.css', 'components', defines, true) | ||||||
|  | |||||||
| @ -23,6 +23,8 @@ | |||||||
|     "streamqueue": "^1.1.1", |     "streamqueue": "^1.1.1", | ||||||
|     "typogr": "~0.6.5", |     "typogr": "~0.6.5", | ||||||
|     "uglify-js": "^2.6.1", |     "uglify-js": "^2.6.1", | ||||||
|  |     "webpack": "^2.2.1", | ||||||
|  |     "webpack-stream": "^3.2.0", | ||||||
|     "wintersmith": "^2.0.0", |     "wintersmith": "^2.0.0", | ||||||
|     "yargs": "^3.14.0" |     "yargs": "^3.14.0" | ||||||
|   }, |   }, | ||||||
|  | |||||||
| @ -12,8 +12,7 @@ | |||||||
|  * See the License for the specific language governing permissions and |  * See the License for the specific language governing permissions and | ||||||
|  * limitations under the License. |  * limitations under the License. | ||||||
|  */ |  */ | ||||||
| /* globals pdfjsFilePath, pdfjsVersion, pdfjsBuild, requirejs, pdfjsLibs, | /* globals requirejs, pdfjsLibs, __webpack_require__, __pdfjsdev_webpack__ */ | ||||||
|            __webpack_require__ */ |  | ||||||
| 
 | 
 | ||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
| @ -70,10 +69,18 @@ var isWorkerDisabled = false; | |||||||
| var workerSrc; | var workerSrc; | ||||||
| var isPostMessageTransfersDisabled = false; | var isPostMessageTransfersDisabled = false; | ||||||
| 
 | 
 | ||||||
|  | var pdfjsFilePath = | ||||||
|  |   typeof PDFJSDev !== 'undefined' && | ||||||
|  |   PDFJSDev.test('PRODUCTION && !(MOZCENTRAL || FIREFOX)') && | ||||||
|  |   typeof document !== 'undefined' && document.currentScript ? | ||||||
|  |     document.currentScript.src : null; | ||||||
|  | 
 | ||||||
| var fakeWorkerFilesLoader = null; | var fakeWorkerFilesLoader = null; | ||||||
| var useRequireEnsure = false; | var useRequireEnsure = false; | ||||||
|  | // The if below protected by __pdfjsdev_webpack__ check from webpack parsing.
 | ||||||
| if (typeof PDFJSDev !== 'undefined' && | if (typeof PDFJSDev !== 'undefined' && | ||||||
|     PDFJSDev.test('GENERIC && !SINGLE_FILE')) { |     PDFJSDev.test('GENERIC && !SINGLE_FILE') && | ||||||
|  |     typeof __pdfjsdev_webpack__ === 'undefined') { | ||||||
|   // For GENERIC build we need add support of different fake file loaders
 |   // For GENERIC build we need add support of different fake file loaders
 | ||||||
|   // for different  frameworks.
 |   // for different  frameworks.
 | ||||||
|   if (typeof window === 'undefined') { |   if (typeof window === 'undefined') { | ||||||
| @ -83,8 +90,8 @@ if (typeof PDFJSDev !== 'undefined' && | |||||||
|       require.ensure = require('node-ensure'); |       require.ensure = require('node-ensure'); | ||||||
|     } |     } | ||||||
|     useRequireEnsure = true; |     useRequireEnsure = true; | ||||||
|   } |   } else if (typeof require !== 'undefined' && | ||||||
|   if (typeof __webpack_require__ !== 'undefined') { |              typeof require.ensure === 'function') { | ||||||
|     useRequireEnsure = true; |     useRequireEnsure = true; | ||||||
|   } |   } | ||||||
|   if (typeof requirejs !== 'undefined' && requirejs.toUrl) { |   if (typeof requirejs !== 'undefined' && requirejs.toUrl) { | ||||||
| @ -2184,11 +2191,9 @@ var _UnsupportedManager = (function UnsupportedManagerClosure() { | |||||||
|   }; |   }; | ||||||
| })(); | })(); | ||||||
| 
 | 
 | ||||||
| if (typeof pdfjsVersion !== 'undefined') { | if (typeof PDFJSDev !== 'undefined') { | ||||||
|   exports.version = pdfjsVersion; |   exports.version = PDFJSDev.eval('BUNDLE_VERSION'); | ||||||
| } |   exports.build = PDFJSDev.eval('BUNDLE_BUILD'); | ||||||
| if (typeof pdfjsBuild !== 'undefined') { |  | ||||||
|   exports.build = pdfjsBuild; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| exports.getDocument = getDocument; | exports.getDocument = getDocument; | ||||||
|  | |||||||
| @ -12,7 +12,6 @@ | |||||||
|  * See the License for the specific language governing permissions and |  * See the License for the specific language governing permissions and | ||||||
|  * limitations under the License. |  * limitations under the License. | ||||||
|  */ |  */ | ||||||
| /* globals pdfjsVersion, pdfjsBuild */ |  | ||||||
| 
 | 
 | ||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
| @ -54,11 +53,9 @@ | |||||||
|   } |   } | ||||||
|   var PDFJS = globalScope.PDFJS; |   var PDFJS = globalScope.PDFJS; | ||||||
| 
 | 
 | ||||||
|   if (typeof pdfjsVersion !== 'undefined') { |   if (typeof PDFJSDev !== 'undefined') { | ||||||
|     PDFJS.version = pdfjsVersion; |     PDFJS.version = PDFJSDev.eval('BUNDLE_VERSION'); | ||||||
|   } |     PDFJS.build = PDFJSDev.eval('BUNDLE_BUILD'); | ||||||
|   if (typeof pdfjsBuild !== 'undefined') { |  | ||||||
|     PDFJS.build = pdfjsBuild; |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   PDFJS.pdfBug = false; |   PDFJS.pdfBug = false; | ||||||
|  | |||||||
							
								
								
									
										99
									
								
								src/pdf.js
									
									
									
									
									
								
							
							
						
						
									
										99
									
								
								src/pdf.js
									
									
									
									
									
								
							| @ -12,75 +12,50 @@ | |||||||
|  * See the License for the specific language governing permissions and |  * See the License for the specific language governing permissions and | ||||||
|  * limitations under the License. |  * limitations under the License. | ||||||
|  */ |  */ | ||||||
| /* eslint strict: ["error", "function"] */ |  | ||||||
| /* eslint-disable no-unused-vars */ | /* eslint-disable no-unused-vars */ | ||||||
| /* umdutils ignore */ | /* umdutils ignore */ | ||||||
| 
 | 
 | ||||||
| (function (root, factory) { |  | ||||||
|   'use strict'; |  | ||||||
|   if (typeof define === 'function' && define.amd) { |  | ||||||
|     define(PDFJSDev.eval('BUNDLE_AMD_NAME'), ['exports'], factory); |  | ||||||
|   } else if (typeof exports !== 'undefined') { |  | ||||||
|     factory(exports); |  | ||||||
|   } else { |  | ||||||
|     factory((root[PDFJSDev.eval('BUNDLE_JS_NAME')] = {})); |  | ||||||
|   } |  | ||||||
| }(this, function (exports) { |  | ||||||
|   // Use strict in our context only - users might not want it
 |  | ||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
| var pdfjsVersion = PDFJSDev.eval('BUNDLE_VERSION'); | var pdfjsVersion = PDFJSDev.eval('BUNDLE_VERSION'); | ||||||
| var pdfjsBuild = PDFJSDev.eval('BUNDLE_BUILD'); | var pdfjsBuild = PDFJSDev.eval('BUNDLE_BUILD'); | ||||||
| 
 | 
 | ||||||
|   var pdfjsFilePath = | var pdfjsSharedUtil = require('./shared/util.js'); | ||||||
|     typeof document !== 'undefined' && document.currentScript ? | var pdfjsDisplayGlobal = require('./display/global.js'); | ||||||
|       document.currentScript.src : null; | var pdfjsDisplayAPI = require('./display/api.js'); | ||||||
|  | var pdfjsDisplayTextLayer = require('./display/text_layer.js'); | ||||||
|  | var pdfjsDisplayAnnotationLayer = require('./display/annotation_layer.js'); | ||||||
|  | var pdfjsDisplayDOMUtils = require('./display/dom_utils.js'); | ||||||
|  | var pdfjsDisplaySVG = require('./display/svg.js'); | ||||||
| 
 | 
 | ||||||
|   var pdfjsLibs = {}; | if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('SINGLE_FILE')) { | ||||||
| 
 |   require('./core/worker.js'); | ||||||
|   (function pdfjsWrapper() { |   require('./core/network.js'); | ||||||
| 
 |  | ||||||
| //#expand __BUNDLE__
 |  | ||||||
| 
 |  | ||||||
|   }).call(pdfjsLibs); |  | ||||||
| 
 |  | ||||||
|   if (PDFJSDev.test('MAIN_FILE')) { |  | ||||||
|     exports.PDFJS = pdfjsLibs.pdfjsDisplayGlobal.PDFJS; |  | ||||||
|     exports.build = pdfjsLibs.pdfjsDisplayAPI.build; |  | ||||||
|     exports.version = pdfjsLibs.pdfjsDisplayAPI.version; |  | ||||||
|     exports.getDocument = pdfjsLibs.pdfjsDisplayAPI.getDocument; |  | ||||||
|     exports.PDFDataRangeTransport = |  | ||||||
|       pdfjsLibs.pdfjsDisplayAPI.PDFDataRangeTransport; |  | ||||||
|     exports.PDFWorker = pdfjsLibs.pdfjsDisplayAPI.PDFWorker; |  | ||||||
|     exports.renderTextLayer = pdfjsLibs.pdfjsDisplayTextLayer.renderTextLayer; |  | ||||||
|     exports.AnnotationLayer = |  | ||||||
|       pdfjsLibs.pdfjsDisplayAnnotationLayer.AnnotationLayer; |  | ||||||
|     exports.CustomStyle = pdfjsLibs.pdfjsDisplayDOMUtils.CustomStyle; |  | ||||||
|     exports.createPromiseCapability = |  | ||||||
|       pdfjsLibs.pdfjsSharedUtil.createPromiseCapability; |  | ||||||
|     exports.PasswordResponses = pdfjsLibs.pdfjsSharedUtil.PasswordResponses; |  | ||||||
|     exports.InvalidPDFException = pdfjsLibs.pdfjsSharedUtil.InvalidPDFException; |  | ||||||
|     exports.MissingPDFException = pdfjsLibs.pdfjsSharedUtil.MissingPDFException; |  | ||||||
|     exports.SVGGraphics = pdfjsLibs.pdfjsDisplaySVG.SVGGraphics; |  | ||||||
|     exports.UnexpectedResponseException = |  | ||||||
|       pdfjsLibs.pdfjsSharedUtil.UnexpectedResponseException; |  | ||||||
|     exports.OPS = pdfjsLibs.pdfjsSharedUtil.OPS; |  | ||||||
|     exports.UNSUPPORTED_FEATURES = |  | ||||||
|       pdfjsLibs.pdfjsSharedUtil.UNSUPPORTED_FEATURES; |  | ||||||
|     exports.isValidUrl = pdfjsLibs.pdfjsDisplayDOMUtils.isValidUrl; |  | ||||||
|     exports.createValidAbsoluteUrl = |  | ||||||
|       pdfjsLibs.pdfjsSharedUtil.createValidAbsoluteUrl; |  | ||||||
|     exports.createObjectURL = pdfjsLibs.pdfjsSharedUtil.createObjectURL; |  | ||||||
|     exports.removeNullCharacters = |  | ||||||
|       pdfjsLibs.pdfjsSharedUtil.removeNullCharacters; |  | ||||||
|     exports.shadow = pdfjsLibs.pdfjsSharedUtil.shadow; |  | ||||||
|     exports.createBlob = pdfjsLibs.pdfjsSharedUtil.createBlob; |  | ||||||
|     exports.getFilenameFromUrl = |  | ||||||
|       pdfjsLibs.pdfjsDisplayDOMUtils.getFilenameFromUrl; |  | ||||||
|     exports.addLinkAttributes = |  | ||||||
|       pdfjsLibs.pdfjsDisplayDOMUtils.addLinkAttributes; |  | ||||||
|   } else { |  | ||||||
|     exports.WorkerMessageHandler = |  | ||||||
|       pdfjsLibs.pdfjsCoreWorker.WorkerMessageHandler; |  | ||||||
| } | } | ||||||
| })); | 
 | ||||||
|  | exports.PDFJS = pdfjsDisplayGlobal.PDFJS; | ||||||
|  | exports.build = pdfjsDisplayAPI.build; | ||||||
|  | exports.version = pdfjsDisplayAPI.version; | ||||||
|  | exports.getDocument = pdfjsDisplayAPI.getDocument; | ||||||
|  | exports.PDFDataRangeTransport = pdfjsDisplayAPI.PDFDataRangeTransport; | ||||||
|  | exports.PDFWorker = pdfjsDisplayAPI.PDFWorker; | ||||||
|  | exports.renderTextLayer = pdfjsDisplayTextLayer.renderTextLayer; | ||||||
|  | exports.AnnotationLayer = pdfjsDisplayAnnotationLayer.AnnotationLayer; | ||||||
|  | exports.CustomStyle = pdfjsDisplayDOMUtils.CustomStyle; | ||||||
|  | exports.createPromiseCapability = pdfjsSharedUtil.createPromiseCapability; | ||||||
|  | exports.PasswordResponses = pdfjsSharedUtil.PasswordResponses; | ||||||
|  | exports.InvalidPDFException = pdfjsSharedUtil.InvalidPDFException; | ||||||
|  | exports.MissingPDFException = pdfjsSharedUtil.MissingPDFException; | ||||||
|  | exports.SVGGraphics = pdfjsDisplaySVG.SVGGraphics; | ||||||
|  | exports.UnexpectedResponseException = | ||||||
|  |   pdfjsSharedUtil.UnexpectedResponseException; | ||||||
|  | exports.OPS = pdfjsSharedUtil.OPS; | ||||||
|  | exports.UNSUPPORTED_FEATURES = pdfjsSharedUtil.UNSUPPORTED_FEATURES; | ||||||
|  | exports.isValidUrl = pdfjsDisplayDOMUtils.isValidUrl; | ||||||
|  | exports.createValidAbsoluteUrl = pdfjsSharedUtil.createValidAbsoluteUrl; | ||||||
|  | exports.createObjectURL = pdfjsSharedUtil.createObjectURL; | ||||||
|  | exports.removeNullCharacters = pdfjsSharedUtil.removeNullCharacters; | ||||||
|  | exports.shadow = pdfjsSharedUtil.shadow; | ||||||
|  | exports.createBlob = pdfjsSharedUtil.createBlob; | ||||||
|  | exports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl; | ||||||
|  | exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes; | ||||||
|  | |||||||
							
								
								
									
										30
									
								
								src/pdf.worker.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								src/pdf.worker.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,30 @@ | |||||||
|  | /* Copyright 2012 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. | ||||||
|  |  */ | ||||||
|  | /* eslint-disable no-unused-vars */ | ||||||
|  | /* umdutils ignore */ | ||||||
|  | 
 | ||||||
|  | 'use strict'; | ||||||
|  | 
 | ||||||
|  | var pdfjsVersion = PDFJSDev.eval('BUNDLE_VERSION'); | ||||||
|  | var pdfjsBuild = PDFJSDev.eval('BUNDLE_BUILD'); | ||||||
|  | 
 | ||||||
|  | var pdfjsCoreWorker = require('./core/worker.js'); | ||||||
|  | 
 | ||||||
|  | if (typeof PDFJSDev === 'undefined' || | ||||||
|  |     !PDFJSDev.test('FIREFOX || MOZCENTRAL')) { | ||||||
|  |   require('./core/network.js'); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler; | ||||||
| @ -12,7 +12,7 @@ | |||||||
|  * See the License for the specific language governing permissions and |  * See the License for the specific language governing permissions and | ||||||
|  * limitations under the License. |  * limitations under the License. | ||||||
|  */ |  */ | ||||||
| /* globals DEFAULT_URL, PDFBug, Stats */ | /* globals PDFBug, Stats */ | ||||||
| 
 | 
 | ||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
| @ -1391,20 +1391,20 @@ function loadAndEnablePDFBug(enabledTabs) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function webViewerInitialized() { | function webViewerInitialized() { | ||||||
|  |   var appConfig = PDFViewerApplication.appConfig; | ||||||
|   var file; |   var file; | ||||||
|   if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) { |   if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) { | ||||||
|     var queryString = document.location.search.substring(1); |     var queryString = document.location.search.substring(1); | ||||||
|     var params = parseQueryString(queryString); |     var params = parseQueryString(queryString); | ||||||
|     file = 'file' in params ? params.file : DEFAULT_URL; |     file = 'file' in params ? params.file : appConfig.defaultUrl; | ||||||
|     validateFileURL(file); |     validateFileURL(file); | ||||||
|   } else if (PDFJSDev.test('FIREFOX || MOZCENTRAL')) { |   } else if (PDFJSDev.test('FIREFOX || MOZCENTRAL')) { | ||||||
|     file = window.location.href.split('#')[0]; |     file = window.location.href.split('#')[0]; | ||||||
|   } else if (PDFJSDev.test('CHROME')) { |   } else if (PDFJSDev.test('CHROME')) { | ||||||
|     file = DEFAULT_URL; |     file = appConfig.defaultUrl; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   var waitForBeforeOpening = []; |   var waitForBeforeOpening = []; | ||||||
|   var appConfig = PDFViewerApplication.appConfig; |  | ||||||
|   if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) { |   if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) { | ||||||
|     var fileInput = document.createElement('input'); |     var fileInput = document.createElement('input'); | ||||||
|     fileInput.id = appConfig.openFileInputName; |     fileInput.id = appConfig.openFileInputName; | ||||||
|  | |||||||
| @ -12,50 +12,38 @@ | |||||||
|  * See the License for the specific language governing permissions and |  * See the License for the specific language governing permissions and | ||||||
|  * limitations under the License. |  * limitations under the License. | ||||||
|  */ |  */ | ||||||
| /* eslint strict: ["error", "function"] */ |  | ||||||
| /* umdutils ignore */ | /* umdutils ignore */ | ||||||
| 
 | 
 | ||||||
| (function (root, factory) { |  | ||||||
|   'use strict'; |  | ||||||
|   if (typeof define === 'function' && define.amd) { |  | ||||||
|     define('pdfjs-dist/web/pdf_viewer', ['exports', 'pdfjs-dist/build/pdf'], |  | ||||||
|       factory); |  | ||||||
|   } else if (typeof exports !== 'undefined') { |  | ||||||
|     factory(exports, require('../build/pdf.js')); |  | ||||||
|   } else { |  | ||||||
|     factory((root.pdfjsDistWebPDFViewer = {}), root.pdfjsDistBuildPdf); |  | ||||||
|   } |  | ||||||
| }(this, function (exports, pdfjsLib) { |  | ||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
|   var pdfViewerLibs = { | var pdfjsLib = require('./pdfjs.js'); | ||||||
|     pdfjsWebPDFJS: pdfjsLib | var pdfjsWebPDFViewer = require('./pdf_viewer.js'); | ||||||
|   }; | var pdfjsWebPDFPageView = require('./pdf_page_view.js'); | ||||||
| 
 | var pdfjsWebPDFLinkService = require('./pdf_link_service.js'); | ||||||
|   (function () { | var pdfjsWebTextLayerBuilder = require('./text_layer_builder.js'); | ||||||
| //#expand __BUNDLE__
 | var pdfjsWebAnnotationLayerBuilder = require('./annotation_layer_builder.js'); | ||||||
|   }).call(pdfViewerLibs); | var pdfjsWebPDFHistory = require('./pdf_history.js'); | ||||||
|  | var pdfjsWebPDFFindController = require('./pdf_find_controller.js'); | ||||||
|  | var pdfjsWebUIUtils = require('./ui_utils.js'); | ||||||
|  | var pdfjsWebDownloadManager = require('./download_manager.js'); | ||||||
| 
 | 
 | ||||||
| var PDFJS = pdfjsLib.PDFJS; | var PDFJS = pdfjsLib.PDFJS; | ||||||
| 
 | 
 | ||||||
|   PDFJS.PDFViewer = pdfViewerLibs.pdfjsWebPDFViewer.PDFViewer; | PDFJS.PDFViewer = pdfjsWebPDFViewer.PDFViewer; | ||||||
|   PDFJS.PDFPageView = pdfViewerLibs.pdfjsWebPDFPageView.PDFPageView; | PDFJS.PDFPageView = pdfjsWebPDFPageView.PDFPageView; | ||||||
|   PDFJS.PDFLinkService = pdfViewerLibs.pdfjsWebPDFLinkService.PDFLinkService; | PDFJS.PDFLinkService = pdfjsWebPDFLinkService.PDFLinkService; | ||||||
|   PDFJS.TextLayerBuilder = | PDFJS.TextLayerBuilder = pdfjsWebTextLayerBuilder.TextLayerBuilder; | ||||||
|     pdfViewerLibs.pdfjsWebTextLayerBuilder.TextLayerBuilder; |  | ||||||
| PDFJS.DefaultTextLayerFactory = | PDFJS.DefaultTextLayerFactory = | ||||||
|     pdfViewerLibs.pdfjsWebTextLayerBuilder.DefaultTextLayerFactory; |   pdfjsWebTextLayerBuilder.DefaultTextLayerFactory; | ||||||
| PDFJS.AnnotationLayerBuilder = | PDFJS.AnnotationLayerBuilder = | ||||||
|     pdfViewerLibs.pdfjsWebAnnotationLayerBuilder.AnnotationLayerBuilder; |   pdfjsWebAnnotationLayerBuilder.AnnotationLayerBuilder; | ||||||
| PDFJS.DefaultAnnotationLayerFactory = | PDFJS.DefaultAnnotationLayerFactory = | ||||||
|     pdfViewerLibs.pdfjsWebAnnotationLayerBuilder.DefaultAnnotationLayerFactory; |   pdfjsWebAnnotationLayerBuilder.DefaultAnnotationLayerFactory; | ||||||
|   PDFJS.PDFHistory = pdfViewerLibs.pdfjsWebPDFHistory.PDFHistory; | PDFJS.PDFHistory = pdfjsWebPDFHistory.PDFHistory; | ||||||
|   PDFJS.PDFFindController = | PDFJS.PDFFindController = pdfjsWebPDFFindController.PDFFindController; | ||||||
|     pdfViewerLibs.pdfjsWebPDFFindController.PDFFindController; | PDFJS.EventBus = pdfjsWebUIUtils.EventBus; | ||||||
|   PDFJS.EventBus = pdfViewerLibs.pdfjsWebUIUtils.EventBus; |  | ||||||
| 
 | 
 | ||||||
|   PDFJS.DownloadManager = pdfViewerLibs.pdfjsWebDownloadManager.DownloadManager; | PDFJS.DownloadManager = pdfjsWebDownloadManager.DownloadManager; | ||||||
|   PDFJS.ProgressBar = pdfViewerLibs.pdfjsWebUIUtils.ProgressBar; | PDFJS.ProgressBar = pdfjsWebUIUtils.ProgressBar; | ||||||
| 
 | 
 | ||||||
| exports.PDFJS = PDFJS; | exports.PDFJS = PDFJS; | ||||||
| })); |  | ||||||
|  | |||||||
| @ -12,10 +12,14 @@ | |||||||
|  * See the License for the specific language governing permissions and |  * See the License for the specific language governing permissions and | ||||||
|  * limitations under the License. |  * limitations under the License. | ||||||
|  */ |  */ | ||||||
|  | /* globals module */ | ||||||
| /* umdutils ignore */ | /* umdutils ignore */ | ||||||
| 
 | 
 | ||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
|  | if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PRODUCTION')) { | ||||||
|  |   module.exports = window['pdfjs-dist/build/pdf']; // loaded via html script tag
 | ||||||
|  | } else { | ||||||
|   (function (root, factory) { |   (function (root, factory) { | ||||||
|     if (typeof define === 'function' && define.amd) { |     if (typeof define === 'function' && define.amd) { | ||||||
|       define('pdfjs-web/pdfjs', ['exports', 'pdfjs/main_loader'], factory); |       define('pdfjs-web/pdfjs', ['exports', 'pdfjs/main_loader'], factory); | ||||||
| @ -32,3 +36,4 @@ | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   })); |   })); | ||||||
|  | } | ||||||
|  | |||||||
| @ -35,19 +35,21 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) { | |||||||
|   })(); |   })(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| var pdfjsWebLibs; | var pdfjsWebApp; | ||||||
| if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PRODUCTION')) { | if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PRODUCTION')) { | ||||||
|   pdfjsWebLibs = { |   pdfjsWebApp = require('./app.js'); | ||||||
|     pdfjsWebPDFJS: window.pdfjsDistBuildPdf |  | ||||||
|   }; |  | ||||||
|   (function () { |  | ||||||
| //#expand __BUNDLE__
 |  | ||||||
|   }).call(pdfjsWebLibs); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) { | if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) { | ||||||
|   // FIXME the l10n.js file in the Firefox extension needs global FirefoxCom.
 |   // FIXME the l10n.js file in the Firefox extension needs global FirefoxCom.
 | ||||||
|   window.FirefoxCom = pdfjsWebLibs.pdfjsWebFirefoxCom.FirefoxCom; |   window.FirefoxCom = require('./firefoxcom.js').FirefoxCom; | ||||||
|  |   require('./firefox_print_service.js'); | ||||||
|  | } | ||||||
|  | if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) { | ||||||
|  |   require('./chromecom.js'); | ||||||
|  | } | ||||||
|  | if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME || GENERIC')) { | ||||||
|  |   require('./pdf_print_service.js'); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function getViewerConfiguration() { | function getViewerConfiguration() { | ||||||
| @ -162,6 +164,7 @@ function getViewerConfiguration() { | |||||||
|     printContainer: document.getElementById('printContainer'), |     printContainer: document.getElementById('printContainer'), | ||||||
|     openFileInputName: 'fileInput', |     openFileInputName: 'fileInput', | ||||||
|     debuggerScriptPath: './debugger.js', |     debuggerScriptPath: './debugger.js', | ||||||
|  |     defaultUrl: DEFAULT_URL | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -174,8 +177,8 @@ function webViewerLoad() { | |||||||
|       web.PDFViewerApplication.run(config); |       web.PDFViewerApplication.run(config); | ||||||
|     }); |     }); | ||||||
|   } else { |   } else { | ||||||
|     window.PDFViewerApplication = pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication; |     window.PDFViewerApplication = pdfjsWebApp.PDFViewerApplication; | ||||||
|     pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication.run(config); |     pdfjsWebApp.PDFViewerApplication.run(config); | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user