Browse Source

PDF.js version 1.8.505 - See mozilla/pdf.js@82bd62ecc6cb86a10e1eec9eea782207938fd6a2

master v1.8.505
pdfjsbot 8 years ago
parent
commit
6ed3411d40
  1. 2
      bower.json
  2. 12
      build/pdf.combined.js
  3. 2
      build/pdf.combined.js.map
  4. 12
      build/pdf.js
  5. 2
      build/pdf.js.map
  6. 4
      build/pdf.min.js
  7. 4
      build/pdf.worker.js
  8. 2
      build/pdf.worker.js.map
  9. 4
      lib/display/api.js
  10. 4
      lib/display/global.js
  11. 4
      lib/pdf.js
  12. 4
      lib/pdf.worker.js
  13. 318
      lib/web/app.js
  14. 2
      package.json

2
bower.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "1.8.503",
"version": "1.8.505",
"main": [
"build/pdf.js",
"build/pdf.worker.js"

12
build/pdf.combined.js

@ -13125,8 +13125,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -13125,8 +13125,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.503';
exports.build = build = '80c33253';
exports.version = version = '1.8.505';
exports.build = build = '82bd62ec';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -28630,8 +28630,8 @@ if (!_util.globalScope.PDFJS) { @@ -28630,8 +28630,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.503';
PDFJS.build = '80c33253';
PDFJS.version = '1.8.505';
PDFJS.build = '82bd62ec';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -47250,8 +47250,8 @@ exports.TilingPattern = TilingPattern; @@ -47250,8 +47250,8 @@ exports.TilingPattern = TilingPattern;
"use strict";
var pdfjsVersion = '1.8.503';
var pdfjsBuild = '80c33253';
var pdfjsVersion = '1.8.505';
var pdfjsBuild = '82bd62ec';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(26);
var pdfjsDisplayAPI = __w_pdfjs_require__(10);

2
build/pdf.combined.js.map

File diff suppressed because one or more lines are too long

12
build/pdf.js

@ -3854,8 +3854,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -3854,8 +3854,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.503';
exports.build = build = '80c33253';
exports.version = version = '1.8.505';
exports.build = build = '82bd62ec';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -5912,8 +5912,8 @@ if (!_util.globalScope.PDFJS) { @@ -5912,8 +5912,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.503';
PDFJS.build = '80c33253';
PDFJS.version = '1.8.505';
PDFJS.build = '82bd62ec';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -11452,8 +11452,8 @@ exports.TilingPattern = TilingPattern; @@ -11452,8 +11452,8 @@ exports.TilingPattern = TilingPattern;
"use strict";
var pdfjsVersion = '1.8.503';
var pdfjsBuild = '80c33253';
var pdfjsVersion = '1.8.505';
var pdfjsBuild = '82bd62ec';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(9);
var pdfjsDisplayAPI = __w_pdfjs_require__(3);

2
build/pdf.js.map

File diff suppressed because one or more lines are too long

4
build/pdf.min.js vendored

File diff suppressed because one or more lines are too long

4
build/pdf.worker.js vendored

@ -40403,8 +40403,8 @@ exports.Type1Parser = Type1Parser; @@ -40403,8 +40403,8 @@ exports.Type1Parser = Type1Parser;
"use strict";
var pdfjsVersion = '1.8.503';
var pdfjsBuild = '80c33253';
var pdfjsVersion = '1.8.505';
var pdfjsBuild = '82bd62ec';
var pdfjsCoreWorker = __w_pdfjs_require__(8);
{
__w_pdfjs_require__(19);

2
build/pdf.worker.js.map vendored

File diff suppressed because one or more lines are too long

4
lib/display/api.js

@ -1480,8 +1480,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -1480,8 +1480,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.503';
exports.build = build = '80c33253';
exports.version = version = '1.8.505';
exports.build = build = '82bd62ec';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;

4
lib/display/global.js

@ -39,8 +39,8 @@ if (!_util.globalScope.PDFJS) { @@ -39,8 +39,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.503';
PDFJS.build = '80c33253';
PDFJS.version = '1.8.505';
PDFJS.build = '82bd62ec';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

4
lib/pdf.js

@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
*/
'use strict';
var pdfjsVersion = '1.8.503';
var pdfjsBuild = '80c33253';
var pdfjsVersion = '1.8.505';
var pdfjsBuild = '82bd62ec';
var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayGlobal = require('./display/global.js');
var pdfjsDisplayAPI = require('./display/api.js');

4
lib/pdf.worker.js vendored

@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
*/
'use strict';
var pdfjsVersion = '1.8.503';
var pdfjsBuild = '80c33253';
var pdfjsVersion = '1.8.505';
var pdfjsBuild = '82bd62ec';
var pdfjsCoreWorker = require('./core/worker.js');
{
require('./core/network.js');

318
lib/web/app.js

@ -138,7 +138,7 @@ var PDFViewerApplication = { @@ -138,7 +138,7 @@ var PDFViewerApplication = {
baseUrl: '',
externalServices: DefaultExternalServices,
_boundEvents: {},
initialize: function pdfViewInitialize(appConfig) {
initialize: function initialize(appConfig) {
var _this = this;
this.preferences = this.externalServices.createPreferences();
@ -334,11 +334,10 @@ var PDFViewerApplication = { @@ -334,11 +334,10 @@ var PDFViewerApplication = {
resolve(undefined);
});
},
run: function pdfViewRun(config) {
run: function run(config) {
this.initialize(config).then(webViewerInitialized);
},
zoomIn: function pdfViewZoomIn(ticks) {
zoomIn: function zoomIn(ticks) {
var newScale = this.pdfViewer.currentScale;
do {
newScale = (newScale * DEFAULT_SCALE_DELTA).toFixed(2);
@ -347,7 +346,7 @@ var PDFViewerApplication = { @@ -347,7 +346,7 @@ var PDFViewerApplication = {
} while (--ticks > 0 && newScale < _ui_utils.MAX_SCALE);
this.pdfViewer.currentScaleValue = newScale;
},
zoomOut: function pdfViewZoomOut(ticks) {
zoomOut: function zoomOut(ticks) {
var newScale = this.pdfViewer.currentScale;
do {
newScale = (newScale / DEFAULT_SCALE_DELTA).toFixed(2);
@ -356,6 +355,7 @@ var PDFViewerApplication = { @@ -356,6 +355,7 @@ var PDFViewerApplication = {
} while (--ticks > 0 && newScale > _ui_utils.MIN_SCALE);
this.pdfViewer.currentScaleValue = newScale;
},
get pagesCount() {
return this.pdfDocument ? this.pdfDocument.numPages : 0;
},
@ -375,7 +375,7 @@ var PDFViewerApplication = { @@ -375,7 +375,7 @@ var PDFViewerApplication = {
return PDFPrintServiceFactory.instance.supportsPrinting;
},
get supportsFullscreen() {
var support;
var support = void 0;
var doc = document.documentElement;
support = !!(doc.requestFullscreen || doc.mozRequestFullScreen || doc.webkitRequestFullScreen || doc.msRequestFullscreen);
if (document.fullscreenEnabled === false || document.mozFullScreenEnabled === false || document.webkitFullscreenEnabled === false || document.msFullscreenEnabled === false) {
@ -402,29 +402,29 @@ var PDFViewerApplication = { @@ -402,29 +402,29 @@ var PDFViewerApplication = {
get supportedMouseWheelZoomModifierKeys() {
return this.externalServices.supportedMouseWheelZoomModifierKeys;
},
initPassiveLoading: function pdfViewInitPassiveLoading() {
initPassiveLoading: function initPassiveLoading() {
throw new Error('Not implemented: initPassiveLoading');
},
setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) {
setTitleUsingUrl: function setTitleUsingUrl(url) {
this.url = url;
this.baseUrl = url.split('#')[0];
var title = (0, _ui_utils.getPDFFileNameFromURL)(url, '');
if (!title) {
try {
title = decodeURIComponent((0, _pdf.getFilenameFromUrl)(url)) || url;
} catch (e) {
} catch (ex) {
title = url;
}
}
this.setTitle(title);
},
setTitle: function pdfViewSetTitle(title) {
setTitle: function setTitle(title) {
if (this.isViewerEmbedded) {
return;
}
document.title = title;
},
close: function pdfViewClose() {
close: function close() {
var errorWrapper = this.appConfig.errorWrapper.container;
errorWrapper.setAttribute('hidden', 'true');
if (!this.pdfLoadingTask) {
@ -521,8 +521,9 @@ var PDFViewerApplication = { @@ -521,8 +521,9 @@ var PDFViewerApplication = {
});
});
},
download: function download() {
var _this4 = this;
download: function pdfViewDownload() {
function downloadByUrl() {
downloadManager.downloadUrl(url, filename);
}
@ -530,23 +531,19 @@ var PDFViewerApplication = { @@ -530,23 +531,19 @@ var PDFViewerApplication = {
var filename = (0, _ui_utils.getPDFFileNameFromURL)(this.url);
var downloadManager = this.downloadManager;
downloadManager.onerror = function (err) {
PDFViewerApplication.error('PDF failed to download.');
_this4.error('PDF failed to download: ' + err);
};
if (!this.pdfDocument) {
downloadByUrl();
return;
}
if (!this.downloadComplete) {
if (!this.pdfDocument || !this.downloadComplete) {
downloadByUrl();
return;
}
this.pdfDocument.getData().then(function getDataSuccess(data) {
this.pdfDocument.getData().then(function (data) {
var blob = (0, _pdf.createBlob)(data, 'application/pdf');
downloadManager.download(blob, url, filename);
}, downloadByUrl).then(null, downloadByUrl);
}).catch(downloadByUrl);
},
fallback: function pdfViewFallback(featureId) {},
error: function pdfViewError(message, moreInfo) {
fallback: function fallback(featureId) {},
error: function error(message, moreInfo) {
var moreInfoText = [this.l10n.get('error_version_info', {
version: _pdf.version || '?',
build: _pdf.build || '?'
@ -596,8 +593,8 @@ var PDFViewerApplication = { @@ -596,8 +593,8 @@ var PDFViewerApplication = {
errorMoreInfo.value = parts.join('\n');
});
},
progress: function pdfViewProgress(level) {
var _this4 = this;
progress: function progress(level) {
var _this5 = this;
var percent = Math.round(level * 100);
if (percent > this.loadingBar.percent || isNaN(percent)) {
@ -609,22 +606,22 @@ var PDFViewerApplication = { @@ -609,22 +606,22 @@ var PDFViewerApplication = {
}
this.loadingBar.show();
this.disableAutoFetchLoadingBarTimeout = setTimeout(function () {
_this4.loadingBar.hide();
_this4.disableAutoFetchLoadingBarTimeout = null;
_this5.loadingBar.hide();
_this5.disableAutoFetchLoadingBarTimeout = null;
}, DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT);
}
}
},
load: function load(pdfDocument, scale) {
var _this5 = this;
var _this6 = this;
scale = scale || _ui_utils.UNKNOWN_SCALE;
this.pdfDocument = pdfDocument;
pdfDocument.getDownloadInfo().then(function () {
_this5.downloadComplete = true;
_this5.loadingBar.hide();
_this6.downloadComplete = true;
_this6.loadingBar.hide();
firstPagePromise.then(function () {
_this5.eventBus.dispatch('documentload', { source: _this5 });
_this6.eventBus.dispatch('documentload', { source: _this6 });
});
});
this.toolbar.setPagesCount(pdfDocument.numPages, false);
@ -643,27 +640,27 @@ var PDFViewerApplication = { @@ -643,27 +640,27 @@ var PDFViewerApplication = {
var pdfThumbnailViewer = this.pdfThumbnailViewer;
pdfThumbnailViewer.setDocument(pdfDocument);
firstPagePromise.then(function (pdfPage) {
_this5.loadingBar.setWidth(_this5.appConfig.viewerContainer);
if (!_pdf.PDFJS.disableHistory && !_this5.isViewerEmbedded) {
if (!_this5.viewerPrefs['showPreviousViewOnLoad']) {
_this5.pdfHistory.clearHistoryState();
_this6.loadingBar.setWidth(_this6.appConfig.viewerContainer);
if (!_pdf.PDFJS.disableHistory && !_this6.isViewerEmbedded) {
if (!_this6.viewerPrefs['showPreviousViewOnLoad']) {
_this6.pdfHistory.clearHistoryState();
}
_this5.pdfHistory.initialize(_this5.documentFingerprint);
if (_this5.pdfHistory.initialDestination) {
_this5.initialDestination = _this5.pdfHistory.initialDestination;
} else if (_this5.pdfHistory.initialBookmark) {
_this5.initialBookmark = _this5.pdfHistory.initialBookmark;
_this6.pdfHistory.initialize(_this6.documentFingerprint);
if (_this6.pdfHistory.initialDestination) {
_this6.initialDestination = _this6.pdfHistory.initialDestination;
} else if (_this6.pdfHistory.initialBookmark) {
_this6.initialBookmark = _this6.pdfHistory.initialBookmark;
}
}
var initialParams = {
destination: _this5.initialDestination,
bookmark: _this5.initialBookmark,
destination: _this6.initialDestination,
bookmark: _this6.initialBookmark,
hash: null
};
var storedHash = _this5.viewerPrefs['defaultZoomValue'] ? 'zoom=' + _this5.viewerPrefs['defaultZoomValue'] : null;
var sidebarView = _this5.viewerPrefs['sidebarViewOnLoad'];
var storedHash = _this6.viewerPrefs['defaultZoomValue'] ? 'zoom=' + _this6.viewerPrefs['defaultZoomValue'] : null;
var sidebarView = _this6.viewerPrefs['sidebarViewOnLoad'];
new Promise(function (resolve, reject) {
if (!_this5.viewerPrefs['showPreviousViewOnLoad']) {
if (!_this6.viewerPrefs['showPreviousViewOnLoad']) {
resolve();
return;
}
@ -679,42 +676,40 @@ var PDFViewerApplication = { @@ -679,42 +676,40 @@ var PDFViewerApplication = {
resolve();
return;
}
storedHash = 'page=' + values.page + '&zoom=' + (_this5.viewerPrefs['defaultZoomValue'] || values.zoom) + ',' + values.scrollLeft + ',' + values.scrollTop;
sidebarView = _this5.viewerPrefs['sidebarViewOnLoad'] || values.sidebarView | 0;
storedHash = 'page=' + values.page + '&zoom=' + (_this6.viewerPrefs['defaultZoomValue'] || values.zoom) + ',' + values.scrollLeft + ',' + values.scrollTop;
sidebarView = _this6.viewerPrefs['sidebarViewOnLoad'] || values.sidebarView | 0;
resolve();
}).catch(function () {
resolve();
});
}).catch(resolve);
}).then(function () {
_this5.setInitialView(storedHash, {
_this6.setInitialView(storedHash, {
sidebarView: sidebarView,
scale: scale
});
initialParams.hash = storedHash;
if (!_this5.isViewerEmbedded) {
_this5.pdfViewer.focus();
if (!_this6.isViewerEmbedded) {
pdfViewer.focus();
}
return pagesPromise;
}).then(function () {
if (!initialParams.destination && !initialParams.bookmark && !initialParams.hash) {
return;
}
if (_this5.hasEqualPageSizes) {
if (_this6.hasEqualPageSizes) {
return;
}
_this5.initialDestination = initialParams.destination;
_this5.initialBookmark = initialParams.bookmark;
_this5.pdfViewer.currentScaleValue = _this5.pdfViewer.currentScaleValue;
_this5.setInitialView(initialParams.hash);
_this6.initialDestination = initialParams.destination;
_this6.initialBookmark = initialParams.bookmark;
pdfViewer.currentScaleValue = pdfViewer.currentScaleValue;
_this6.setInitialView(initialParams.hash);
});
});
pdfDocument.getPageLabels().then(function (labels) {
if (!labels || _this5.viewerPrefs['disablePageLabels']) {
if (!labels || _this6.viewerPrefs['disablePageLabels']) {
return;
}
var i = 0,
numLabels = labels.length;
if (numLabels !== _this5.pagesCount) {
if (numLabels !== _this6.pagesCount) {
console.error('The number of Page Labels does not match ' + 'the number of pages in the document.');
return;
}
@ -726,17 +721,17 @@ var PDFViewerApplication = { @@ -726,17 +721,17 @@ var PDFViewerApplication = {
}
pdfViewer.setPageLabels(labels);
pdfThumbnailViewer.setPageLabels(labels);
_this5.toolbar.setPagesCount(pdfDocument.numPages, true);
_this5.toolbar.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel);
_this6.toolbar.setPagesCount(pdfDocument.numPages, true);
_this6.toolbar.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel);
});
pagesPromise.then(function () {
if (!_this5.supportsPrinting) {
if (!_this6.supportsPrinting) {
return;
}
pdfDocument.getJavaScript().then(function (javaScript) {
if (javaScript.length) {
console.warn('Warning: JavaScript is not supported');
_this5.fallback(_pdf.UNSUPPORTED_FEATURES.javaScript);
_this6.fallback(_pdf.UNSUPPORTED_FEATURES.javaScript);
}
var regex = /\bprint\s*\(/;
for (var i = 0, ii = javaScript.length; i < ii; i++) {
@ -752,18 +747,18 @@ var PDFViewerApplication = { @@ -752,18 +747,18 @@ var PDFViewerApplication = {
});
Promise.all([onePageRendered, _ui_utils.animationStarted]).then(function () {
pdfDocument.getOutline().then(function (outline) {
_this5.pdfOutlineViewer.render({ outline: outline });
_this6.pdfOutlineViewer.render({ outline: outline });
});
pdfDocument.getAttachments().then(function (attachments) {
_this5.pdfAttachmentViewer.render({ attachments: attachments });
_this6.pdfAttachmentViewer.render({ attachments: attachments });
});
});
pdfDocument.getMetadata().then(function (_ref2) {
var info = _ref2.info,
metadata = _ref2.metadata;
_this5.documentInfo = info;
_this5.metadata = metadata;
_this6.documentInfo = info;
_this6.metadata = metadata;
console.log('PDF ' + pdfDocument.fingerprint + ' [' + info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() + ' / ' + (info.Creator || '-').trim() + ']' + ' (PDF.js: ' + (_pdf.version || '-') + (!_pdf.PDFJS.disableWebGL ? ' [WebGL]' : '') + ')');
var pdfTitle = void 0;
if (metadata && metadata.has('dc:title')) {
@ -776,11 +771,11 @@ var PDFViewerApplication = { @@ -776,11 +771,11 @@ var PDFViewerApplication = {
pdfTitle = info['Title'];
}
if (pdfTitle) {
_this5.setTitle(pdfTitle + ' - ' + document.title);
_this6.setTitle(pdfTitle + ' - ' + document.title);
}
if (info.IsAcroFormPresent) {
console.warn('Warning: AcroForm/XFA is not supported');
_this5.fallback(_pdf.UNSUPPORTED_FEATURES.forms);
_this6.fallback(_pdf.UNSUPPORTED_FEATURES.forms);
}
});
},
@ -812,8 +807,7 @@ var PDFViewerApplication = { @@ -812,8 +807,7 @@ var PDFViewerApplication = {
this.pdfViewer.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE;
}
},
cleanup: function pdfViewCleanup() {
cleanup: function cleanup() {
if (!this.pdfDocument) {
return;
}
@ -823,20 +817,20 @@ var PDFViewerApplication = { @@ -823,20 +817,20 @@ var PDFViewerApplication = {
this.pdfDocument.cleanup();
}
},
forceRendering: function pdfViewForceRendering() {
forceRendering: function forceRendering() {
this.pdfRenderingQueue.printing = this.printing;
this.pdfRenderingQueue.isThumbnailViewEnabled = this.pdfSidebar.isThumbnailViewVisible;
this.pdfRenderingQueue.renderHighestPriority();
},
beforePrint: function pdfViewSetupBeforePrint() {
var _this6 = this;
beforePrint: function beforePrint() {
var _this7 = this;
if (this.printService) {
return;
}
if (!this.supportsPrinting) {
this.l10n.get('printing_not_supported', null, 'Warning: Printing is not fully supported by ' + 'this browser.').then(function (printMessage) {
_this6.error(printMessage);
_this7.error(printMessage);
});
return;
}
@ -853,6 +847,7 @@ var PDFViewerApplication = { @@ -853,6 +847,7 @@ var PDFViewerApplication = {
this.forceRendering();
printService.layout();
},
get hasEqualPageSizes() {
var firstPage = this.pdfViewer.getPageView(0);
for (var i = 1, ii = this.pagesCount; i < ii; ++i) {
@ -884,21 +879,22 @@ var PDFViewerApplication = { @@ -884,21 +879,22 @@ var PDFViewerApplication = {
this.forceRendering();
pdfViewer.currentPageNumber = pageNumber;
},
requestPresentationMode: function pdfViewRequestPresentationMode() {
requestPresentationMode: function requestPresentationMode() {
if (!this.pdfPresentationMode) {
return;
}
this.pdfPresentationMode.request();
},
bindEvents: function bindEvents() {
var eventBus = this.eventBus;
this._boundEvents.beforePrint = this.beforePrint.bind(this);
this._boundEvents.afterPrint = this.afterPrint.bind(this);
var eventBus = this.eventBus,
_boundEvents = this._boundEvents;
_boundEvents.beforePrint = this.beforePrint.bind(this);
_boundEvents.afterPrint = this.afterPrint.bind(this);
eventBus.on('resize', webViewerResize);
eventBus.on('hashchange', webViewerHashchange);
eventBus.on('beforeprint', this._boundEvents.beforePrint);
eventBus.on('afterprint', this._boundEvents.afterPrint);
eventBus.on('beforeprint', _boundEvents.beforePrint);
eventBus.on('afterprint', _boundEvents.afterPrint);
eventBus.on('pagerendered', webViewerPageRendered);
eventBus.on('textlayerrendered', webViewerTextLayerRendered);
eventBus.on('updateviewarea', webViewerUpdateViewarea);
@ -928,41 +924,45 @@ var PDFViewerApplication = { @@ -928,41 +924,45 @@ var PDFViewerApplication = {
eventBus.on('fileinputchange', webViewerFileInputChange);
},
bindWindowEvents: function bindWindowEvents() {
var eventBus = this.eventBus;
this._boundEvents.windowResize = function () {
var eventBus = this.eventBus,
_boundEvents = this._boundEvents;
_boundEvents.windowResize = function () {
eventBus.dispatch('resize');
};
this._boundEvents.windowHashChange = function () {
_boundEvents.windowHashChange = function () {
eventBus.dispatch('hashchange', { hash: document.location.hash.substring(1) });
};
this._boundEvents.windowBeforePrint = function () {
_boundEvents.windowBeforePrint = function () {
eventBus.dispatch('beforeprint');
};
this._boundEvents.windowAfterPrint = function () {
_boundEvents.windowAfterPrint = function () {
eventBus.dispatch('afterprint');
};
window.addEventListener('wheel', webViewerWheel);
window.addEventListener('click', webViewerClick);
window.addEventListener('keydown', webViewerKeyDown);
window.addEventListener('resize', this._boundEvents.windowResize);
window.addEventListener('hashchange', this._boundEvents.windowHashChange);
window.addEventListener('beforeprint', this._boundEvents.windowBeforePrint);
window.addEventListener('afterprint', this._boundEvents.windowAfterPrint);
this._boundEvents.windowChange = function (evt) {
window.addEventListener('resize', _boundEvents.windowResize);
window.addEventListener('hashchange', _boundEvents.windowHashChange);
window.addEventListener('beforeprint', _boundEvents.windowBeforePrint);
window.addEventListener('afterprint', _boundEvents.windowAfterPrint);
_boundEvents.windowChange = function (evt) {
var files = evt.target.files;
if (!files || files.length === 0) {
return;
}
eventBus.dispatch('fileinputchange', { fileInput: evt.target });
};
window.addEventListener('change', this._boundEvents.windowChange);
window.addEventListener('change', _boundEvents.windowChange);
},
unbindEvents: function unbindEvents() {
var eventBus = this.eventBus;
var eventBus = this.eventBus,
_boundEvents = this._boundEvents;
eventBus.off('resize', webViewerResize);
eventBus.off('hashchange', webViewerHashchange);
eventBus.off('beforeprint', this._boundEvents.beforePrint);
eventBus.off('afterprint', this._boundEvents.afterPrint);
eventBus.off('beforeprint', _boundEvents.beforePrint);
eventBus.off('afterprint', _boundEvents.afterPrint);
eventBus.off('pagerendered', webViewerPageRendered);
eventBus.off('textlayerrendered', webViewerTextLayerRendered);
eventBus.off('updateviewarea', webViewerUpdateViewarea);
@ -990,26 +990,28 @@ var PDFViewerApplication = { @@ -990,26 +990,28 @@ var PDFViewerApplication = {
eventBus.off('find', webViewerFind);
eventBus.off('findfromurlhash', webViewerFindFromUrlHash);
eventBus.off('fileinputchange', webViewerFileInputChange);
this._boundEvents.beforePrint = null;
this._boundEvents.afterPrint = null;
_boundEvents.beforePrint = null;
_boundEvents.afterPrint = null;
},
unbindWindowEvents: function unbindWindowEvents() {
var _boundEvents = this._boundEvents;
window.removeEventListener('wheel', webViewerWheel);
window.removeEventListener('click', webViewerClick);
window.removeEventListener('keydown', webViewerKeyDown);
window.removeEventListener('resize', this._boundEvents.windowResize);
window.removeEventListener('hashchange', this._boundEvents.windowHashChange);
window.removeEventListener('beforeprint', this._boundEvents.windowBeforePrint);
window.removeEventListener('afterprint', this._boundEvents.windowAfterPrint);
window.removeEventListener('change', this._boundEvents.windowChange);
this._boundEvents.windowChange = null;
this._boundEvents.windowResize = null;
this._boundEvents.windowHashChange = null;
this._boundEvents.windowBeforePrint = null;
this._boundEvents.windowAfterPrint = null;
window.removeEventListener('resize', _boundEvents.windowResize);
window.removeEventListener('hashchange', _boundEvents.windowHashChange);
window.removeEventListener('beforeprint', _boundEvents.windowBeforePrint);
window.removeEventListener('afterprint', _boundEvents.windowAfterPrint);
window.removeEventListener('change', _boundEvents.windowChange);
_boundEvents.windowChange = null;
_boundEvents.windowResize = null;
_boundEvents.windowHashChange = null;
_boundEvents.windowBeforePrint = null;
_boundEvents.windowAfterPrint = null;
}
};
var validateFileURL;
var validateFileURL = void 0;
{
var HOSTED_VIEWER_ORIGINS = ['null', 'http://mozilla.github.io', 'https://mozilla.github.io'];
validateFileURL = function validateFileURL(file) {
@ -1022,12 +1024,12 @@ var validateFileURL; @@ -1022,12 +1024,12 @@ var validateFileURL;
if (fileOrigin !== viewerOrigin) {
throw new Error('file origin does not match viewer\'s');
}
} catch (e) {
var message = e && e.message;
} catch (ex) {
var message = ex && ex.message;
PDFViewerApplication.l10n.get('loading_error', null, 'An error occurred while loading the PDF.').then(function (loadingErrorMessage) {
PDFViewerApplication.error(loadingErrorMessage, { message: message });
});
throw e;
throw ex;
}
};
}
@ -1052,7 +1054,7 @@ function loadAndEnablePDFBug(enabledTabs) { @@ -1052,7 +1054,7 @@ function loadAndEnablePDFBug(enabledTabs) {
}
function webViewerInitialized() {
var appConfig = PDFViewerApplication.appConfig;
var file;
var file = void 0;
var queryString = document.location.search.substring(1);
var params = (0, _ui_utils.parseQueryString)(queryString);
file = 'file' in params ? params.file : appConfig.defaultUrl;
@ -1134,8 +1136,8 @@ function webViewerInitialized() { @@ -1134,8 +1136,8 @@ function webViewerInitialized() {
if (PDFViewerApplication.supportsIntegratedFind) {
appConfig.toolbar.viewFind.classList.add('hidden');
}
appConfig.sidebar.mainContainer.addEventListener('transitionend', function (e) {
if (e.target === this) {
appConfig.sidebar.mainContainer.addEventListener('transitionend', function (evt) {
if (evt.target === this) {
PDFViewerApplication.eventBus.dispatch('resize');
}
}, true);
@ -1150,7 +1152,7 @@ function webViewerInitialized() { @@ -1150,7 +1152,7 @@ function webViewerInitialized() {
});
});
}
var webViewerOpenFileViaURL;
var webViewerOpenFileViaURL = void 0;
{
webViewerOpenFileViaURL = function webViewerOpenFileViaURL(file) {
if (file && file.lastIndexOf('file:', 0) === 0) {
@ -1163,9 +1165,9 @@ var webViewerOpenFileViaURL; @@ -1163,9 +1165,9 @@ var webViewerOpenFileViaURL;
xhr.open('GET', file);
xhr.responseType = 'arraybuffer';
xhr.send();
} catch (e) {
} catch (ex) {
PDFViewerApplication.l10n.get('loading_error', null, 'An error occurred while loading the PDF.').then(function (msg) {
PDFViewerApplication.error(msg, e);
PDFViewerApplication.error(msg, ex);
});
}
return;
@ -1175,8 +1177,8 @@ var webViewerOpenFileViaURL; @@ -1175,8 +1177,8 @@ var webViewerOpenFileViaURL;
}
};
}
function webViewerPageRendered(e) {
var pageNumber = e.pageNumber;
function webViewerPageRendered(evt) {
var pageNumber = evt.pageNumber;
var pageIndex = pageNumber - 1;
var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex);
if (pageNumber === PDFViewerApplication.page) {
@ -1198,10 +1200,10 @@ function webViewerPageRendered(e) { @@ -1198,10 +1200,10 @@ function webViewerPageRendered(e) {
});
}
}
function webViewerTextLayerRendered(e) {}
function webViewerPageMode(e) {
var mode = e.mode,
view;
function webViewerTextLayerRendered(evt) {}
function webViewerPageMode(evt) {
var mode = evt.mode,
view = void 0;
switch (mode) {
case 'thumbs':
view = _pdf_sidebar.SidebarView.THUMBS;
@ -1222,8 +1224,8 @@ function webViewerPageMode(e) { @@ -1222,8 +1224,8 @@ function webViewerPageMode(e) {
}
PDFViewerApplication.pdfSidebar.switchView(view, true);
}
function webViewerNamedAction(e) {
var action = e.action;
function webViewerNamedAction(evt) {
var action = evt.action;
switch (action) {
case 'GoToPage':
PDFViewerApplication.appConfig.toolbar.pageNumber.select();
@ -1235,9 +1237,10 @@ function webViewerNamedAction(e) { @@ -1235,9 +1237,10 @@ function webViewerNamedAction(e) {
break;
}
}
function webViewerPresentationModeChanged(e) {
var active = e.active;
var switchInProgress = e.switchInProgress;
function webViewerPresentationModeChanged(evt) {
var active = evt.active,
switchInProgress = evt.switchInProgress;
PDFViewerApplication.pdfViewer.presentationModeState = switchInProgress ? _pdf_viewer.PresentationModeState.CHANGING : active ? _pdf_viewer.PresentationModeState.FULLSCREEN : _pdf_viewer.PresentationModeState.NORMAL;
}
function webViewerSidebarViewChanged(evt) {
@ -1276,9 +1279,9 @@ function webViewerResize() { @@ -1276,9 +1279,9 @@ function webViewerResize() {
}
PDFViewerApplication.pdfViewer.update();
}
function webViewerHashchange(e) {
function webViewerHashchange(evt) {
if (PDFViewerApplication.pdfHistory.isHashChangeUnlocked) {
var hash = e.hash;
var hash = evt.hash;
if (!hash) {
return;
}
@ -1289,18 +1292,17 @@ function webViewerHashchange(e) { @@ -1289,18 +1292,17 @@ function webViewerHashchange(e) {
}
}
}
var webViewerFileInputChange;
var webViewerFileInputChange = void 0;
{
webViewerFileInputChange = function webViewerFileInputChange(e) {
var file = e.fileInput.files[0];
if (!_pdf.PDFJS.disableCreateObjectURL && typeof URL !== 'undefined' && URL.createObjectURL) {
webViewerFileInputChange = function webViewerFileInputChange(evt) {
var file = evt.fileInput.files[0];
if (!_pdf.PDFJS.disableCreateObjectURL && URL.createObjectURL) {
PDFViewerApplication.open(URL.createObjectURL(file));
} else {
var fileReader = new FileReader();
fileReader.onload = function webViewerChangeFileReaderOnload(evt) {
var buffer = evt.target.result;
var uint8Array = new Uint8Array(buffer);
PDFViewerApplication.open(uint8Array);
PDFViewerApplication.open(new Uint8Array(buffer));
};
fileReader.readAsArrayBuffer(file);
}
@ -1347,15 +1349,15 @@ function webViewerZoomIn() { @@ -1347,15 +1349,15 @@ function webViewerZoomIn() {
function webViewerZoomOut() {
PDFViewerApplication.zoomOut();
}
function webViewerPageNumberChanged(e) {
function webViewerPageNumberChanged(evt) {
var pdfViewer = PDFViewerApplication.pdfViewer;
pdfViewer.currentPageLabel = e.value;
if (e.value !== pdfViewer.currentPageNumber.toString() && e.value !== pdfViewer.currentPageLabel) {
pdfViewer.currentPageLabel = evt.value;
if (evt.value !== pdfViewer.currentPageNumber.toString() && evt.value !== pdfViewer.currentPageLabel) {
PDFViewerApplication.toolbar.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel);
}
}
function webViewerScaleChanged(e) {
PDFViewerApplication.pdfViewer.currentScaleValue = e.value;
function webViewerScaleChanged(evt) {
PDFViewerApplication.pdfViewer.currentScaleValue = evt.value;
}
function webViewerRotateCw() {
PDFViewerApplication.rotatePages(90);
@ -1366,31 +1368,31 @@ function webViewerRotateCcw() { @@ -1366,31 +1368,31 @@ function webViewerRotateCcw() {
function webViewerDocumentProperties() {
PDFViewerApplication.pdfDocumentProperties.open();
}
function webViewerFind(e) {
PDFViewerApplication.findController.executeCommand('find' + e.type, {
query: e.query,
phraseSearch: e.phraseSearch,
caseSensitive: e.caseSensitive,
highlightAll: e.highlightAll,
findPrevious: e.findPrevious
function webViewerFind(evt) {
PDFViewerApplication.findController.executeCommand('find' + evt.type, {
query: evt.query,
phraseSearch: evt.phraseSearch,
caseSensitive: evt.caseSensitive,
highlightAll: evt.highlightAll,
findPrevious: evt.findPrevious
});
}
function webViewerFindFromUrlHash(e) {
function webViewerFindFromUrlHash(evt) {
PDFViewerApplication.findController.executeCommand('find', {
query: e.query,
phraseSearch: e.phraseSearch,
query: evt.query,
phraseSearch: evt.phraseSearch,
caseSensitive: false,
highlightAll: true,
findPrevious: false
});
}
function webViewerScaleChanging(e) {
PDFViewerApplication.toolbar.setPageScale(e.presetValue, e.scale);
function webViewerScaleChanging(evt) {
PDFViewerApplication.toolbar.setPageScale(evt.presetValue, evt.scale);
PDFViewerApplication.pdfViewer.update();
}
function webViewerPageChanging(e) {
var page = e.pageNumber;
PDFViewerApplication.toolbar.setPageNumber(page, e.pageLabel || null);
function webViewerPageChanging(evt) {
var page = evt.pageNumber;
PDFViewerApplication.toolbar.setPageNumber(page, evt.pageLabel || null);
PDFViewerApplication.secondaryToolbar.setPageNumber(page);
if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) {
PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(page);
@ -1403,7 +1405,7 @@ function webViewerPageChanging(e) { @@ -1403,7 +1405,7 @@ function webViewerPageChanging(e) {
}
}
var zoomDisabled = false,
zoomDisabledTimeout;
zoomDisabledTimeout = void 0;
function webViewerWheel(evt) {
var pdfViewer = PDFViewerApplication.pdfViewer;
if (pdfViewer.isInPresentationMode) {

2
package.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "1.8.503",
"version": "1.8.505",
"main": "build/pdf.js",
"description": "Generic build of Mozilla's PDF.js library.",
"keywords": [

Loading…
Cancel
Save