|
|
|
@ -16,18 +16,18 @@
@@ -16,18 +16,18 @@
|
|
|
|
|
|
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
var DEFAULT_URL = 'compressed.tracemonkey-pldi-09.pdf'; |
|
|
|
|
let DEFAULT_URL = 'compressed.tracemonkey-pldi-09.pdf'; |
|
|
|
|
|
|
|
|
|
if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('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 m = /(^|&)file=([^&]*)/.exec(queryString); |
|
|
|
|
let queryString = document.location.search.slice(1); |
|
|
|
|
let m = /(^|&)file=([^&]*)/.exec(queryString); |
|
|
|
|
DEFAULT_URL = m ? decodeURIComponent(m[2]) : ''; |
|
|
|
|
|
|
|
|
|
// Example: chrome-extension://.../http://example.com/file.pdf
|
|
|
|
|
var humanReadableUrl = '/' + DEFAULT_URL + location.hash; |
|
|
|
|
let humanReadableUrl = '/' + DEFAULT_URL + location.hash; |
|
|
|
|
history.replaceState(history.state, '', humanReadableUrl); |
|
|
|
|
if (top === window) { |
|
|
|
|
chrome.runtime.sendMessage('showPageAction'); |
|
|
|
@ -35,7 +35,7 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) {
@@ -35,7 +35,7 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) {
|
|
|
|
|
})(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var pdfjsWebApp; |
|
|
|
|
let pdfjsWebApp; |
|
|
|
|
if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PRODUCTION')) { |
|
|
|
|
pdfjsWebApp = require('./app.js'); |
|
|
|
|
} |
|
|
|
@ -172,14 +172,13 @@ function getViewerConfiguration() {
@@ -172,14 +172,13 @@ function getViewerConfiguration() {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function webViewerLoad() { |
|
|
|
|
var config = getViewerConfiguration(); |
|
|
|
|
let config = getViewerConfiguration(); |
|
|
|
|
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) { |
|
|
|
|
Promise.all([ |
|
|
|
|
SystemJS.import('pdfjs-web/app'), |
|
|
|
|
SystemJS.import('pdfjs-web/genericcom'), |
|
|
|
|
SystemJS.import('pdfjs-web/pdf_print_service'), |
|
|
|
|
]).then(function (modules) { |
|
|
|
|
var app = modules[0]; |
|
|
|
|
]).then(function([app, ...otherModules]) { |
|
|
|
|
window.PDFViewerApplication = app.PDFViewerApplication; |
|
|
|
|
app.PDFViewerApplication.run(config); |
|
|
|
|
}); |
|
|
|
|