@@ -47,11 +47,11 @@ var PDFViewerApplication = {
47
47
* @returns {Promise } - Returns the promise, which is resolved when document
48
48
* is opened.
49
49
*/
50
- open : function ( params ) {
50
+ open : function ( params ) {
51
51
if ( this . pdfLoadingTask ) {
52
52
// We need to destroy already opened document
53
53
return this . close ( ) . then (
54
- function ( ) {
54
+ function ( ) {
55
55
// ... and repeat the open() call.
56
56
return this . open ( params ) ;
57
57
} . bind ( this )
@@ -71,12 +71,12 @@ var PDFViewerApplication = {
71
71
} ) ;
72
72
this . pdfLoadingTask = loadingTask ;
73
73
74
- loadingTask . onProgress = function ( progressData ) {
74
+ loadingTask . onProgress = function ( progressData ) {
75
75
self . progress ( progressData . loaded / progressData . total ) ;
76
76
} ;
77
77
78
78
return loadingTask . promise . then (
79
- function ( pdfDocument ) {
79
+ function ( pdfDocument ) {
80
80
// Document loaded, specifying document for the viewer.
81
81
self . pdfDocument = pdfDocument ;
82
82
self . pdfViewer . setDocument ( pdfDocument ) ;
@@ -86,7 +86,7 @@ var PDFViewerApplication = {
86
86
self . loadingBar . hide ( ) ;
87
87
self . setTitleUsingMetadata ( pdfDocument ) ;
88
88
} ,
89
- function ( exception ) {
89
+ function ( exception ) {
90
90
var message = exception && exception . message ;
91
91
var l10n = self . l10n ;
92
92
var loadingErrorMessage ;
@@ -119,7 +119,7 @@ var PDFViewerApplication = {
119
119
) ;
120
120
}
121
121
122
- loadingErrorMessage . then ( function ( msg ) {
122
+ loadingErrorMessage . then ( function ( msg ) {
123
123
self . error ( msg , { message : message } ) ;
124
124
} ) ;
125
125
self . loadingBar . hide ( ) ;
@@ -132,7 +132,7 @@ var PDFViewerApplication = {
132
132
* @returns {Promise } - Returns the promise, which is resolved when all
133
133
* destruction is completed.
134
134
*/
135
- close : function ( ) {
135
+ close : function ( ) {
136
136
var errorWrapper = document . getElementById ( "errorWrapper" ) ;
137
137
errorWrapper . setAttribute ( "hidden" , "true" ) ;
138
138
@@ -175,9 +175,9 @@ var PDFViewerApplication = {
175
175
this . setTitle ( title ) ;
176
176
} ,
177
177
178
- setTitleUsingMetadata : function ( pdfDocument ) {
178
+ setTitleUsingMetadata : function ( pdfDocument ) {
179
179
var self = this ;
180
- pdfDocument . getMetadata ( ) . then ( function ( data ) {
180
+ pdfDocument . getMetadata ( ) . then ( function ( data ) {
181
181
var info = data . info ,
182
182
metadata = data . metadata ;
183
183
self . documentInfo = info ;
@@ -275,27 +275,27 @@ var PDFViewerApplication = {
275
275
errorMessage . textContent = message ;
276
276
277
277
var closeButton = document . getElementById ( "errorClose" ) ;
278
- closeButton . onclick = function ( ) {
278
+ closeButton . onclick = function ( ) {
279
279
errorWrapper . setAttribute ( "hidden" , "true" ) ;
280
280
} ;
281
281
282
282
var errorMoreInfo = document . getElementById ( "errorMoreInfo" ) ;
283
283
var moreInfoButton = document . getElementById ( "errorShowMore" ) ;
284
284
var lessInfoButton = document . getElementById ( "errorShowLess" ) ;
285
- moreInfoButton . onclick = function ( ) {
285
+ moreInfoButton . onclick = function ( ) {
286
286
errorMoreInfo . removeAttribute ( "hidden" ) ;
287
287
moreInfoButton . setAttribute ( "hidden" , "true" ) ;
288
288
lessInfoButton . removeAttribute ( "hidden" ) ;
289
289
errorMoreInfo . style . height = errorMoreInfo . scrollHeight + "px" ;
290
290
} ;
291
- lessInfoButton . onclick = function ( ) {
291
+ lessInfoButton . onclick = function ( ) {
292
292
errorMoreInfo . setAttribute ( "hidden" , "true" ) ;
293
293
moreInfoButton . removeAttribute ( "hidden" ) ;
294
294
lessInfoButton . setAttribute ( "hidden" , "true" ) ;
295
295
} ;
296
296
moreInfoButton . removeAttribute ( "hidden" ) ;
297
297
lessInfoButton . setAttribute ( "hidden" , "true" ) ;
298
- Promise . all ( moreInfoText ) . then ( function ( parts ) {
298
+ Promise . all ( moreInfoText ) . then ( function ( parts ) {
299
299
errorMoreInfo . value = parts . join ( "\n" ) ;
300
300
} ) ;
301
301
} ,
@@ -369,29 +369,31 @@ var PDFViewerApplication = {
369
369
} ) ;
370
370
linkService . setHistory ( this . pdfHistory ) ;
371
371
372
- document . getElementById ( "previous" ) . addEventListener ( "click" , function ( ) {
372
+ document . getElementById ( "previous" ) . addEventListener ( "click" , function ( ) {
373
373
PDFViewerApplication . page -- ;
374
374
} ) ;
375
375
376
- document . getElementById ( "next" ) . addEventListener ( "click" , function ( ) {
376
+ document . getElementById ( "next" ) . addEventListener ( "click" , function ( ) {
377
377
PDFViewerApplication . page ++ ;
378
378
} ) ;
379
379
380
- document . getElementById ( "zoomIn" ) . addEventListener ( "click" , function ( ) {
380
+ document . getElementById ( "zoomIn" ) . addEventListener ( "click" , function ( ) {
381
381
PDFViewerApplication . zoomIn ( ) ;
382
382
} ) ;
383
383
384
- document . getElementById ( "zoomOut" ) . addEventListener ( "click" , function ( ) {
384
+ document . getElementById ( "zoomOut" ) . addEventListener ( "click" , function ( ) {
385
385
PDFViewerApplication . zoomOut ( ) ;
386
386
} ) ;
387
387
388
- document . getElementById ( "pageNumber" ) . addEventListener ( "click" , function ( ) {
389
- this . select ( ) ;
390
- } ) ;
388
+ document
389
+ . getElementById ( "pageNumber" )
390
+ . addEventListener ( "click" , function ( ) {
391
+ this . select ( ) ;
392
+ } ) ;
391
393
392
394
document
393
395
. getElementById ( "pageNumber" )
394
- . addEventListener ( "change" , function ( ) {
396
+ . addEventListener ( "change" , function ( ) {
395
397
PDFViewerApplication . page = this . value | 0 ;
396
398
397
399
// Ensure that the page number input displays the correct value,
@@ -402,14 +404,14 @@ var PDFViewerApplication = {
402
404
}
403
405
} ) ;
404
406
405
- eventBus . on ( "pagesinit" , function ( ) {
407
+ eventBus . on ( "pagesinit" , function ( ) {
406
408
// We can use pdfViewer now, e.g. let's change default scale.
407
409
pdfViewer . currentScaleValue = DEFAULT_SCALE_VALUE ;
408
410
} ) ;
409
411
410
412
eventBus . on (
411
413
"pagechanging" ,
412
- function ( evt ) {
414
+ function ( evt ) {
413
415
var page = evt . pageNumber ;
414
416
var numPages = PDFViewerApplication . pagesCount ;
415
417
@@ -424,7 +426,7 @@ var PDFViewerApplication = {
424
426
425
427
document . addEventListener (
426
428
"DOMContentLoaded" ,
427
- function ( ) {
429
+ function ( ) {
428
430
PDFViewerApplication . initUI ( ) ;
429
431
} ,
430
432
true
@@ -433,13 +435,15 @@ document.addEventListener(
433
435
( function animationStartedClosure ( ) {
434
436
// The offsetParent is not set until the PDF.js iframe or object is visible.
435
437
// Waiting for first animation.
436
- PDFViewerApplication . animationStartedPromise = new Promise ( function ( resolve ) {
438
+ PDFViewerApplication . animationStartedPromise = new Promise ( function (
439
+ resolve
440
+ ) {
437
441
window . requestAnimationFrame ( resolve ) ;
438
442
} ) ;
439
443
} ) ( ) ;
440
444
441
445
// We need to delay opening until all HTML is loaded.
442
- PDFViewerApplication . animationStartedPromise . then ( function ( ) {
446
+ PDFViewerApplication . animationStartedPromise . then ( function ( ) {
443
447
PDFViewerApplication . open ( {
444
448
url : DEFAULT_URL ,
445
449
} ) ;
0 commit comments