Refactor PDFDocumentProperties to be more class-like
This commit is contained in:
parent
ca8f842d87
commit
7cf440c560
2 changed files with 177 additions and 179 deletions
|
@ -109,6 +109,8 @@ var PDFViewerApplication = {
|
|||
pdfRenderingQueue: null,
|
||||
/** @type {PDFPresentationMode} */
|
||||
pdfPresentationMode: null,
|
||||
/** @type {PDFDocumentProperties} */
|
||||
pdfDocumentProperties: null,
|
||||
pageRotation: 0,
|
||||
updateScaleControls: true,
|
||||
isInitialViewSet: false,
|
||||
|
@ -172,6 +174,23 @@ var PDFViewerApplication = {
|
|||
toggleHandTool: document.getElementById('toggleHandTool')
|
||||
});
|
||||
|
||||
this.pdfDocumentProperties = new PDFDocumentProperties({
|
||||
overlayName: 'documentPropertiesOverlay',
|
||||
closeButton: document.getElementById('documentPropertiesClose'),
|
||||
fileNameField: document.getElementById('fileNameField'),
|
||||
fileSizeField: document.getElementById('fileSizeField'),
|
||||
titleField: document.getElementById('titleField'),
|
||||
authorField: document.getElementById('authorField'),
|
||||
subjectField: document.getElementById('subjectField'),
|
||||
keywordsField: document.getElementById('keywordsField'),
|
||||
creationDateField: document.getElementById('creationDateField'),
|
||||
modificationDateField: document.getElementById('modificationDateField'),
|
||||
creatorField: document.getElementById('creatorField'),
|
||||
producerField: document.getElementById('producerField'),
|
||||
versionField: document.getElementById('versionField'),
|
||||
pageCountField: document.getElementById('pageCountField')
|
||||
});
|
||||
|
||||
SecondaryToolbar.initialize({
|
||||
toolbar: document.getElementById('secondaryToolbar'),
|
||||
toggleButton: document.getElementById('secondaryToolbarToggle'),
|
||||
|
@ -185,7 +204,7 @@ var PDFViewerApplication = {
|
|||
lastPage: document.getElementById('lastPage'),
|
||||
pageRotateCw: document.getElementById('pageRotateCw'),
|
||||
pageRotateCcw: document.getElementById('pageRotateCcw'),
|
||||
documentProperties: PDFDocumentProperties,
|
||||
documentProperties: this.pdfDocumentProperties,
|
||||
documentPropertiesButton: document.getElementById('documentProperties')
|
||||
});
|
||||
|
||||
|
@ -216,23 +235,6 @@ var PDFViewerApplication = {
|
|||
passwordCancel: document.getElementById('passwordCancel')
|
||||
});
|
||||
|
||||
PDFDocumentProperties.initialize({
|
||||
overlayName: 'documentPropertiesOverlay',
|
||||
closeButton: document.getElementById('documentPropertiesClose'),
|
||||
fileNameField: document.getElementById('fileNameField'),
|
||||
fileSizeField: document.getElementById('fileSizeField'),
|
||||
titleField: document.getElementById('titleField'),
|
||||
authorField: document.getElementById('authorField'),
|
||||
subjectField: document.getElementById('subjectField'),
|
||||
keywordsField: document.getElementById('keywordsField'),
|
||||
creationDateField: document.getElementById('creationDateField'),
|
||||
modificationDateField: document.getElementById('modificationDateField'),
|
||||
creatorField: document.getElementById('creatorField'),
|
||||
producerField: document.getElementById('producerField'),
|
||||
versionField: document.getElementById('versionField'),
|
||||
pageCountField: document.getElementById('pageCountField')
|
||||
});
|
||||
|
||||
var self = this;
|
||||
var initializedPromise = Promise.all([
|
||||
Preferences.get('enableWebGL').then(function resolved(value) {
|
||||
|
@ -410,7 +412,8 @@ var PDFViewerApplication = {
|
|||
pdfDataRangeTransport);
|
||||
|
||||
if (args.length) {
|
||||
PDFDocumentProperties.setFileSize(args.length);
|
||||
PDFViewerApplication.pdfDocumentProperties
|
||||
.setFileSize(args.length);
|
||||
}
|
||||
break;
|
||||
case 'range':
|
||||
|
@ -556,7 +559,7 @@ var PDFViewerApplication = {
|
|||
);
|
||||
|
||||
if (args && args.length) {
|
||||
PDFDocumentProperties.setFileSize(args.length);
|
||||
PDFViewerApplication.pdfDocumentProperties.setFileSize(args.length);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -853,9 +856,9 @@ var PDFViewerApplication = {
|
|||
|
||||
this.pdfDocument = pdfDocument;
|
||||
|
||||
PDFDocumentProperties.url = this.url;
|
||||
PDFDocumentProperties.pdfDocument = pdfDocument;
|
||||
PDFDocumentProperties.resolveDataAvailable();
|
||||
this.pdfDocumentProperties.url = this.url;
|
||||
this.pdfDocumentProperties.pdfDocument = pdfDocument;
|
||||
this.pdfDocumentProperties.resolveDataAvailable();
|
||||
|
||||
var downloadedPromise = pdfDocument.getDownloadInfo().then(function() {
|
||||
self.downloadComplete = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue