|
|
|
|
@ -62,7 +62,8 @@ var CustomStyle = (function CustomStyleClosure() {
|
|
|
|
|
var prefixes = ['ms', 'Moz', 'Webkit', 'O'];
|
|
|
|
|
var _cache = {};
|
|
|
|
|
|
|
|
|
|
function CustomStyle() {}
|
|
|
|
|
function CustomStyle() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CustomStyle.getProp = function get(propName, element) {
|
|
|
|
|
// check cache only when no element is given
|
|
|
|
|
@ -423,7 +424,6 @@ var ProgressBar = (function ProgressBarClosure() {
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var DEFAULT_PREFERENCES = {
|
|
|
|
|
showPreviousViewOnLoad: true,
|
|
|
|
|
defaultZoomValue: '',
|
|
|
|
|
@ -581,7 +581,6 @@ var Preferences = {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Preferences._writeToStorage = function (prefObj) {
|
|
|
|
|
return new Promise(function (resolve) {
|
|
|
|
|
localStorage.setItem('pdfjs.preferences', JSON.stringify(prefObj));
|
|
|
|
|
@ -724,7 +723,6 @@ Preferences._readFromStorage = function (prefObj) {
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var DownloadManager = (function DownloadManagerClosure() {
|
|
|
|
|
|
|
|
|
|
function download(blobUrl, filename) {
|
|
|
|
|
@ -763,7 +761,8 @@ var DownloadManager = (function DownloadManagerClosure() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function DownloadManager() {}
|
|
|
|
|
function DownloadManager() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DownloadManager.prototype = {
|
|
|
|
|
downloadUrl: function DownloadManager_downloadUrl(url, filename) {
|
|
|
|
|
@ -809,9 +808,6 @@ var DownloadManager = (function DownloadManagerClosure() {
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* View History - This is a utility for saving various view parameters for
|
|
|
|
|
* recently opened files.
|
|
|
|
|
@ -859,7 +855,6 @@ var ViewHistory = (function ViewHistoryClosure() {
|
|
|
|
|
var databaseStr = JSON.stringify(this.database);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
localStorage.setItem('database', databaseStr);
|
|
|
|
|
resolve();
|
|
|
|
|
}.bind(this));
|
|
|
|
|
@ -1191,6 +1186,7 @@ var PDFFindController = (function PDFFindControllerClosure() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
|
|
function extractPageText(pageIndex) {
|
|
|
|
|
self.pdfViewer.getPageTextContent(pageIndex).then(
|
|
|
|
|
function textContentResolved(textContent) {
|
|
|
|
|
@ -1211,6 +1207,7 @@ var PDFFindController = (function PDFFindControllerClosure() {
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extractPageText(0);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
@ -1532,6 +1529,7 @@ var PDFHistory = {
|
|
|
|
|
// since 'beforeunload' prevents Firefox from caching the document.
|
|
|
|
|
window.removeEventListener('beforeunload', pdfHistoryBeforeUnload, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.addEventListener('beforeunload', pdfHistoryBeforeUnload, false);
|
|
|
|
|
|
|
|
|
|
window.addEventListener('pageshow', function pdfHistoryPageShow(evt) {
|
|
|
|
|
@ -1815,8 +1813,10 @@ var SecondaryToolbar = {
|
|
|
|
|
{element: this.toggleButton, handler: this.toggle},
|
|
|
|
|
// All items within the secondary toolbar
|
|
|
|
|
// (except for toggleHandTool, hand_tool.js is responsible for it):
|
|
|
|
|
{ element: this.presentationModeButton,
|
|
|
|
|
handler: this.presentationModeClick },
|
|
|
|
|
{
|
|
|
|
|
element: this.presentationModeButton,
|
|
|
|
|
handler: this.presentationModeClick
|
|
|
|
|
},
|
|
|
|
|
{element: this.openFile, handler: this.openFileClick},
|
|
|
|
|
{element: this.print, handler: this.printClick},
|
|
|
|
|
{element: this.download, handler: this.downloadClick},
|
|
|
|
|
@ -1825,8 +1825,10 @@ var SecondaryToolbar = {
|
|
|
|
|
{element: this.lastPage, handler: this.lastPageClick},
|
|
|
|
|
{element: this.pageRotateCw, handler: this.pageRotateCwClick},
|
|
|
|
|
{element: this.pageRotateCcw, handler: this.pageRotateCcwClick},
|
|
|
|
|
{ element: this.documentPropertiesButton,
|
|
|
|
|
handler: this.documentPropertiesClick }
|
|
|
|
|
{
|
|
|
|
|
element: this.documentPropertiesButton,
|
|
|
|
|
handler: this.documentPropertiesClick
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
for (var item in elements) {
|
|
|
|
|
@ -1840,6 +1842,36 @@ var SecondaryToolbar = {
|
|
|
|
|
// Event handling functions.
|
|
|
|
|
presentationModeClick: function secondaryToolbarPresentationModeClick(evt) {
|
|
|
|
|
PDFViewerApplication.requestPresentationMode();
|
|
|
|
|
$("#viewer").append("<div id='fullScreamBtn' class='fullScreamBtn'><i class='fa fa-search-plus fa-lg' id='plus' title='放大(快捷键ctrl+↑)'></i><i class='fa fa-search-minus fa-lg' id='minus' title='缩小(快捷键ctrl+↓)'></i><i class='fa fa-lg fa-undo' id='undo' title='逆时针旋转(快捷键ctrl+→)'></i><i class='fa fa-repeat fa-lg' id='repeat' title='顺时针旋转(快捷键ctrl+←)'></i><i class='fa fa-hand-paper-o fa-lg' id='hand-paper' title='启用手形工具(键盘按下Tab键)'></i></div>")
|
|
|
|
|
//阻止外层div鼠标点击冒泡事件
|
|
|
|
|
document.getElementById("fullScreamBtn").addEventListener("mousedown", function (evt) {
|
|
|
|
|
evt.stopPropagation();
|
|
|
|
|
}, false);
|
|
|
|
|
//图片放大
|
|
|
|
|
document.getElementById("plus").addEventListener("click",
|
|
|
|
|
function () {
|
|
|
|
|
PDFViewerApplication.zoomIn();
|
|
|
|
|
},false);
|
|
|
|
|
//图片缩小
|
|
|
|
|
document.getElementById("minus").addEventListener("click",
|
|
|
|
|
function () {
|
|
|
|
|
PDFViewerApplication.zoomOut();
|
|
|
|
|
},false);
|
|
|
|
|
//顺时针旋转
|
|
|
|
|
document.getElementById("repeat").addEventListener("click",
|
|
|
|
|
function () {
|
|
|
|
|
PDFViewerApplication.rotatePages(90);
|
|
|
|
|
},false);
|
|
|
|
|
//逆时针旋转
|
|
|
|
|
document.getElementById("undo").addEventListener("click",
|
|
|
|
|
function () {
|
|
|
|
|
PDFViewerApplication.rotatePages(-90);
|
|
|
|
|
},false);
|
|
|
|
|
//启用手型选取
|
|
|
|
|
document.getElementById("hand-paper").addEventListener("click",
|
|
|
|
|
function () {
|
|
|
|
|
HandTool.toggle();
|
|
|
|
|
},false);
|
|
|
|
|
this.close();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
@ -2357,6 +2389,7 @@ var GrabToPan = (function GrabToPanClosure() {
|
|
|
|
|
var overlay = this.overlay = document.createElement('div');
|
|
|
|
|
overlay.className = 'grab-to-pan-grabbing';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GrabToPan.prototype = {
|
|
|
|
|
/**
|
|
|
|
|
* Class name of element which can be grabbed
|
|
|
|
|
@ -2560,7 +2593,8 @@ var HandTool = {
|
|
|
|
|
if (value) {
|
|
|
|
|
this.handTool.activate();
|
|
|
|
|
}
|
|
|
|
|
}.bind(this), function rejected(reason) {});
|
|
|
|
|
}.bind(this), function rejected(reason) {
|
|
|
|
|
});
|
|
|
|
|
}.bind(this));
|
|
|
|
|
|
|
|
|
|
window.addEventListener('presentationmodechanged', function (evt) {
|
|
|
|
|
@ -2624,10 +2658,12 @@ var OverlayManager = {
|
|
|
|
|
} else if (this.overlays[name]) {
|
|
|
|
|
throw new Error('The overlay is already registered.');
|
|
|
|
|
}
|
|
|
|
|
this.overlays[name] = { element: element,
|
|
|
|
|
this.overlays[name] = {
|
|
|
|
|
element: element,
|
|
|
|
|
container: container,
|
|
|
|
|
callerCloseMethod: (callerCloseMethod || null),
|
|
|
|
|
canForceClose: (canForceClose || false) };
|
|
|
|
|
canForceClose: (canForceClose || false)
|
|
|
|
|
};
|
|
|
|
|
resolve();
|
|
|
|
|
}.bind(this));
|
|
|
|
|
},
|
|
|
|
|
@ -3528,6 +3564,7 @@ var PDFPageView = (function PDFPageViewClosure() {
|
|
|
|
|
// Rendering area
|
|
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
|
|
function pageViewDrawCallback(error) {
|
|
|
|
|
// The renderTask may have been replaced by a new one, so only remove
|
|
|
|
|
// the reference to the renderTask if it matches the one that is
|
|
|
|
|
@ -3620,8 +3657,7 @@ var PDFPageView = (function PDFPageViewClosure() {
|
|
|
|
|
|
|
|
|
|
if (this.annotationsLayerFactory) {
|
|
|
|
|
if (!this.annotationLayer) {
|
|
|
|
|
this.annotationLayer = this.annotationsLayerFactory.
|
|
|
|
|
createAnnotationsLayerBuilder(div, this.pdfPage);
|
|
|
|
|
this.annotationLayer = this.annotationsLayerFactory.createAnnotationsLayerBuilder(div, this.pdfPage);
|
|
|
|
|
}
|
|
|
|
|
this.annotationLayer.setupAnnotations(this.viewport);
|
|
|
|
|
}
|
|
|
|
|
@ -4085,7 +4121,9 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
|
|
|
|
|
* @constructor
|
|
|
|
|
* @implements IPDFTextLayerFactory
|
|
|
|
|
*/
|
|
|
|
|
function DefaultTextLayerFactory() {}
|
|
|
|
|
function DefaultTextLayerFactory() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DefaultTextLayerFactory.prototype = {
|
|
|
|
|
/**
|
|
|
|
|
* @param {HTMLDivElement} textLayerDiv
|
|
|
|
|
@ -4125,6 +4163,7 @@ var AnnotationsLayerBuilder = (function AnnotationsLayerBuilderClosure() {
|
|
|
|
|
|
|
|
|
|
this.div = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AnnotationsLayerBuilder.prototype =
|
|
|
|
|
/** @lends AnnotationsLayerBuilder.prototype */ {
|
|
|
|
|
|
|
|
|
|
@ -4246,7 +4285,9 @@ var AnnotationsLayerBuilder = (function AnnotationsLayerBuilderClosure() {
|
|
|
|
|
* @constructor
|
|
|
|
|
* @implements IPDFAnnotationsLayerFactory
|
|
|
|
|
*/
|
|
|
|
|
function DefaultAnnotationsLayerFactory() {}
|
|
|
|
|
function DefaultAnnotationsLayerFactory() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DefaultAnnotationsLayerFactory.prototype = {
|
|
|
|
|
/**
|
|
|
|
|
* @param {HTMLDivElement} pageDiv
|
|
|
|
|
@ -4966,6 +5007,7 @@ var SimpleLinkService = (function SimpleLinkServiceClosure() {
|
|
|
|
|
function SimpleLinkService(pdfViewer) {
|
|
|
|
|
this.pdfViewer = pdfViewer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SimpleLinkService.prototype = {
|
|
|
|
|
/**
|
|
|
|
|
* @returns {number}
|
|
|
|
|
@ -4982,7 +5024,8 @@ var SimpleLinkService = (function SimpleLinkServiceClosure() {
|
|
|
|
|
/**
|
|
|
|
|
* @param dest - The PDF destination object.
|
|
|
|
|
*/
|
|
|
|
|
navigateTo: function (dest) {},
|
|
|
|
|
navigateTo: function (dest) {
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* @param dest - The PDF destination object.
|
|
|
|
|
* @returns {string} The hyperlink to the PDF object.
|
|
|
|
|
@ -5000,11 +5043,13 @@ var SimpleLinkService = (function SimpleLinkServiceClosure() {
|
|
|
|
|
/**
|
|
|
|
|
* @param {string} hash
|
|
|
|
|
*/
|
|
|
|
|
setHash: function (hash) {},
|
|
|
|
|
setHash: function (hash) {
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* @param {string} action
|
|
|
|
|
*/
|
|
|
|
|
executeNamedAction: function (action) {},
|
|
|
|
|
executeNamedAction: function (action) {
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
return SimpleLinkService;
|
|
|
|
|
})();
|
|
|
|
|
@ -5214,6 +5259,7 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
|
|
function thumbnailDrawCallback(error) {
|
|
|
|
|
// The renderTask may have been replaced by a new one, so only remove
|
|
|
|
|
// the reference to the renderTask if it matches the one that is
|
|
|
|
|
@ -5802,14 +5848,22 @@ var PDFViewerApplication = {
|
|
|
|
|
viewer: viewer,
|
|
|
|
|
pdfThumbnailViewer: this.pdfThumbnailViewer,
|
|
|
|
|
contextMenuItems: [
|
|
|
|
|
{ element: document.getElementById('contextFirstPage'),
|
|
|
|
|
handler: toolbar.firstPageClick.bind(toolbar) },
|
|
|
|
|
{ element: document.getElementById('contextLastPage'),
|
|
|
|
|
handler: toolbar.lastPageClick.bind(toolbar) },
|
|
|
|
|
{ element: document.getElementById('contextPageRotateCw'),
|
|
|
|
|
handler: toolbar.pageRotateCwClick.bind(toolbar) },
|
|
|
|
|
{ element: document.getElementById('contextPageRotateCcw'),
|
|
|
|
|
handler: toolbar.pageRotateCcwClick.bind(toolbar) }
|
|
|
|
|
{
|
|
|
|
|
element: document.getElementById('contextFirstPage'),
|
|
|
|
|
handler: toolbar.firstPageClick.bind(toolbar)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
element: document.getElementById('contextLastPage'),
|
|
|
|
|
handler: toolbar.lastPageClick.bind(toolbar)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
element: document.getElementById('contextPageRotateCw'),
|
|
|
|
|
handler: toolbar.pageRotateCwClick.bind(toolbar)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
element: document.getElementById('contextPageRotateCcw'),
|
|
|
|
|
handler: toolbar.pageRotateCcwClick.bind(toolbar)
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -5864,7 +5918,8 @@ var PDFViewerApplication = {
|
|
|
|
|
PDFJS.useOnlyCssZoom = value;
|
|
|
|
|
})
|
|
|
|
|
// TODO move more preferences and other async stuff here
|
|
|
|
|
]).catch(function (reason) { });
|
|
|
|
|
]).catch(function (reason) {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return initializedPromise.then(function () {
|
|
|
|
|
PDFViewerApplication.initialized = true;
|
|
|
|
|
@ -6483,7 +6538,6 @@ var PDFViewerApplication = {
|
|
|
|
|
self.metadata = metadata;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var pdfTitle;
|
|
|
|
|
if (metadata && metadata.has('dc:title')) {
|
|
|
|
|
var title = metadata.get('dc:title');
|
|
|
|
|
@ -6947,8 +7001,7 @@ function webViewerInitialized() {
|
|
|
|
|
|
|
|
|
|
if (!PDFViewerApplication.supportsFullscreen) {
|
|
|
|
|
//document.getElementById('presentationMode').classList.add('hidden');
|
|
|
|
|
document.getElementById('secondaryPresentationMode').
|
|
|
|
|
classList.add('hidden');
|
|
|
|
|
document.getElementById('secondaryPresentationMode').classList.add('hidden');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* if (PDFViewerApplication.supportsIntegratedFind) {
|
|
|
|
|
@ -7085,8 +7138,7 @@ document.addEventListener('pagerendered', function (e) {
|
|
|
|
|
var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex);
|
|
|
|
|
|
|
|
|
|
if (PDFViewerApplication.sidebarOpen) {
|
|
|
|
|
var thumbnailView = PDFViewerApplication.pdfThumbnailViewer.
|
|
|
|
|
getThumbnail(pageIndex);
|
|
|
|
|
var thumbnailView = PDFViewerApplication.pdfThumbnailViewer.getThumbnail(pageIndex);
|
|
|
|
|
thumbnailView.setImage(pageView);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -7211,8 +7263,7 @@ window.addEventListener('change', function webViewerChange(evt) {
|
|
|
|
|
|
|
|
|
|
// URL does not reflect proper document location - hiding some icons.
|
|
|
|
|
document.getElementById('viewBookmark').setAttribute('hidden', 'true');
|
|
|
|
|
document.getElementById('secondaryViewBookmark').
|
|
|
|
|
setAttribute('hidden', 'true');
|
|
|
|
|
document.getElementById('secondaryViewBookmark').setAttribute('hidden', 'true');
|
|
|
|
|
document.getElementById('download').setAttribute('hidden', 'true');
|
|
|
|
|
document.getElementById('secondaryDownload').setAttribute('hidden', 'true');
|
|
|
|
|
}, true);
|
|
|
|
|
@ -7332,7 +7383,7 @@ function handleMouseWheel(evt) {
|
|
|
|
|
var direction = (ticks < 0) ? 'zoomOut' : 'zoomIn';
|
|
|
|
|
|
|
|
|
|
if (PDFViewerApplication.pdfViewer.isInPresentationMode) {
|
|
|
|
|
evt.preventDefault();
|
|
|
|
|
//evt.preventDefault();
|
|
|
|
|
PDFViewerApplication.scrollPresentationMode(ticks *
|
|
|
|
|
MOUSE_WHEEL_DELTA_FACTOR);
|
|
|
|
|
} else if (evt.ctrlKey || evt.metaKey) {
|
|
|
|
|
@ -7609,4 +7660,7 @@ window.addEventListener('afterprint', function afterPrint(evt) {
|
|
|
|
|
});
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
function fullScreamBtn() {
|
|
|
|
|
PDFViewerApplication.rotatePages(-90);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|