2
0
Эх сурвалжийг харах

PDF.js version 1.8.316 - See mozilla/pdf.js@b0a796ced30d5295cffe468bdf6b0d287c0b1e5a

pdfjsbot 8 жил өмнө
parent
commit
9c9a11bba3

+ 1 - 1
bower.json

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

+ 6 - 6
build/pdf.combined.js

@@ -12773,8 +12773,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
 }();
 var version, build;
 {
-  exports.version = version = '1.8.314';
-  exports.build = build = '3adda80f';
+  exports.version = version = '1.8.316';
+  exports.build = build = 'b0a796ce';
 }
 exports.getDocument = getDocument;
 exports.LoopbackPort = LoopbackPort;
@@ -28178,8 +28178,8 @@ if (!_util.globalScope.PDFJS) {
 }
 var PDFJS = _util.globalScope.PDFJS;
 {
-  PDFJS.version = '1.8.314';
-  PDFJS.build = '3adda80f';
+  PDFJS.version = '1.8.316';
+  PDFJS.build = 'b0a796ce';
 }
 PDFJS.pdfBug = false;
 if (PDFJS.verbosity !== undefined) {
@@ -43765,8 +43765,8 @@ exports.TilingPattern = TilingPattern;
 "use strict";
 
 
-var pdfjsVersion = '1.8.314';
-var pdfjsBuild = '3adda80f';
+var pdfjsVersion = '1.8.316';
+var pdfjsBuild = 'b0a796ce';
 var pdfjsSharedUtil = __w_pdfjs_require__(0);
 var pdfjsDisplayGlobal = __w_pdfjs_require__(26);
 var pdfjsDisplayAPI = __w_pdfjs_require__(10);

+ 6 - 6
build/pdf.js

@@ -3480,8 +3480,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
 }();
 var version, build;
 {
-  exports.version = version = '1.8.314';
-  exports.build = build = '3adda80f';
+  exports.version = version = '1.8.316';
+  exports.build = build = 'b0a796ce';
 }
 exports.getDocument = getDocument;
 exports.LoopbackPort = LoopbackPort;
@@ -5453,8 +5453,8 @@ if (!_util.globalScope.PDFJS) {
 }
 var PDFJS = _util.globalScope.PDFJS;
 {
-  PDFJS.version = '1.8.314';
-  PDFJS.build = '3adda80f';
+  PDFJS.version = '1.8.316';
+  PDFJS.build = 'b0a796ce';
 }
 PDFJS.pdfBug = false;
 if (PDFJS.verbosity !== undefined) {
@@ -7949,8 +7949,8 @@ exports.TilingPattern = TilingPattern;
 "use strict";
 
 
-var pdfjsVersion = '1.8.314';
-var pdfjsBuild = '3adda80f';
+var pdfjsVersion = '1.8.316';
+var pdfjsBuild = 'b0a796ce';
 var pdfjsSharedUtil = __w_pdfjs_require__(0);
 var pdfjsDisplayGlobal = __w_pdfjs_require__(9);
 var pdfjsDisplayAPI = __w_pdfjs_require__(3);

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
build/pdf.min.js


+ 2 - 2
build/pdf.worker.js

@@ -37131,8 +37131,8 @@ exports.Type1Parser = Type1Parser;
 "use strict";
 
 
-var pdfjsVersion = '1.8.314';
-var pdfjsBuild = '3adda80f';
+var pdfjsVersion = '1.8.316';
+var pdfjsBuild = 'b0a796ce';
 var pdfjsCoreWorker = __w_pdfjs_require__(8);
 {
   __w_pdfjs_require__(19);

+ 2 - 2
lib/display/api.js

@@ -1405,8 +1405,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
 }();
 var version, build;
 {
-  exports.version = version = '1.8.314';
-  exports.build = build = '3adda80f';
+  exports.version = version = '1.8.316';
+  exports.build = build = 'b0a796ce';
 }
 exports.getDocument = getDocument;
 exports.LoopbackPort = LoopbackPort;

+ 2 - 2
lib/display/global.js

@@ -39,8 +39,8 @@ if (!_util.globalScope.PDFJS) {
 }
 var PDFJS = _util.globalScope.PDFJS;
 {
-  PDFJS.version = '1.8.314';
-  PDFJS.build = '3adda80f';
+  PDFJS.version = '1.8.316';
+  PDFJS.build = 'b0a796ce';
 }
 PDFJS.pdfBug = false;
 if (PDFJS.verbosity !== undefined) {

+ 2 - 2
lib/pdf.js

@@ -14,8 +14,8 @@
  */
 'use strict';
 
-var pdfjsVersion = '1.8.314';
-var pdfjsBuild = '3adda80f';
+var pdfjsVersion = '1.8.316';
+var pdfjsBuild = 'b0a796ce';
 var pdfjsSharedUtil = require('./shared/util.js');
 var pdfjsDisplayGlobal = require('./display/global.js');
 var pdfjsDisplayAPI = require('./display/api.js');

+ 2 - 2
lib/pdf.worker.js

@@ -14,8 +14,8 @@
  */
 'use strict';
 
-var pdfjsVersion = '1.8.314';
-var pdfjsBuild = '3adda80f';
+var pdfjsVersion = '1.8.316';
+var pdfjsBuild = 'b0a796ce';
 var pdfjsCoreWorker = require('./core/worker.js');
 {
   require('./core/network.js');

+ 21 - 19
lib/web/app.js

@@ -561,6 +561,8 @@ var PDFViewerApplication = {
     errorMoreInfo.value = moreInfoText;
   },
   progress: function pdfViewProgress(level) {
+    var _this4 = this;
+
     var percent = Math.round(level * 100);
     if (percent > this.loadingBar.percent || isNaN(percent)) {
       this.loadingBar.percent = percent;
@@ -571,14 +573,14 @@ var PDFViewerApplication = {
         }
         this.loadingBar.show();
         this.disableAutoFetchLoadingBarTimeout = setTimeout(function () {
-          this.loadingBar.hide();
-          this.disableAutoFetchLoadingBarTimeout = null;
-        }.bind(this), DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT);
+          _this4.loadingBar.hide();
+          _this4.disableAutoFetchLoadingBarTimeout = null;
+        }, DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT);
       }
     }
   },
   load: function pdfViewLoad(pdfDocument, scale) {
-    var _this4 = this;
+    var _this5 = this;
 
     var self = this;
     scale = scale || _ui_utils.UNKNOWN_SCALE;
@@ -621,14 +623,14 @@ var PDFViewerApplication = {
         }
       }
       var initialParams = {
-        destination: _this4.initialDestination,
-        bookmark: _this4.initialBookmark,
+        destination: _this5.initialDestination,
+        bookmark: _this5.initialBookmark,
         hash: null
       };
-      var storedHash = _this4.viewerPrefs['defaultZoomValue'] ? 'zoom=' + _this4.viewerPrefs['defaultZoomValue'] : null;
-      var sidebarView = _this4.viewerPrefs['sidebarViewOnLoad'];
+      var storedHash = _this5.viewerPrefs['defaultZoomValue'] ? 'zoom=' + _this5.viewerPrefs['defaultZoomValue'] : null;
+      var sidebarView = _this5.viewerPrefs['sidebarViewOnLoad'];
       new Promise(function (resolve, reject) {
-        if (!_this4.viewerPrefs['showPreviousViewOnLoad']) {
+        if (!_this5.viewerPrefs['showPreviousViewOnLoad']) {
           resolve();
           return;
         }
@@ -644,33 +646,33 @@ var PDFViewerApplication = {
             resolve();
             return;
           }
-          storedHash = 'page=' + values.page + '&zoom=' + (_this4.viewerPrefs['defaultZoomValue'] || values.zoom) + ',' + values.scrollLeft + ',' + values.scrollTop;
-          sidebarView = _this4.viewerPrefs['sidebarViewOnLoad'] || values.sidebarView | 0;
+          storedHash = 'page=' + values.page + '&zoom=' + (_this5.viewerPrefs['defaultZoomValue'] || values.zoom) + ',' + values.scrollLeft + ',' + values.scrollTop;
+          sidebarView = _this5.viewerPrefs['sidebarViewOnLoad'] || values.sidebarView | 0;
           resolve();
         }).catch(function () {
           resolve();
         });
       }).then(function () {
-        _this4.setInitialView(storedHash, {
+        _this5.setInitialView(storedHash, {
           sidebarView: sidebarView,
           scale: scale
         });
         initialParams.hash = storedHash;
-        if (!_this4.isViewerEmbedded) {
-          _this4.pdfViewer.focus();
+        if (!_this5.isViewerEmbedded) {
+          _this5.pdfViewer.focus();
         }
         return pagesPromise;
       }).then(function () {
         if (!initialParams.destination && !initialParams.bookmark && !initialParams.hash) {
           return;
         }
-        if (_this4.hasEqualPageSizes) {
+        if (_this5.hasEqualPageSizes) {
           return;
         }
-        _this4.initialDestination = initialParams.destination;
-        _this4.initialBookmark = initialParams.bookmark;
-        _this4.pdfViewer.currentScaleValue = _this4.pdfViewer.currentScaleValue;
-        _this4.setInitialView(initialParams.hash);
+        _this5.initialDestination = initialParams.destination;
+        _this5.initialBookmark = initialParams.bookmark;
+        _this5.pdfViewer.currentScaleValue = _this5.pdfViewer.currentScaleValue;
+        _this5.setInitialView(initialParams.hash);
       });
     });
     pdfDocument.getPageLabels().then(function (labels) {

+ 4 - 2
lib/web/debugger.js

@@ -90,6 +90,8 @@ var FontInspector = function FontInspectorClosure() {
       }
     },
     fontAdded: function fontAdded(fontObj, url) {
+      var _this = this;
+
       function properties(obj, list) {
         var moreInfo = document.createElement('table');
         for (var i = 0; i < list.length; i++) {
@@ -142,10 +144,10 @@ var FontInspector = function FontInspectorClosure() {
       font.appendChild(moreInfo);
       fonts.appendChild(font);
       setTimeout(function () {
-        if (this.active) {
+        if (_this.active) {
           resetSelection();
         }
-      }.bind(this), 2000);
+      }, 2000);
     }
   };
 }();

+ 9 - 6
lib/web/firefoxcom.js

@@ -96,17 +96,20 @@ var DownloadManager = function DownloadManagerClosure() {
       });
     },
     download: function DownloadManager_download(blob, url, filename) {
+      var _this = this;
+
       var blobUrl = window.URL.createObjectURL(blob);
+      var onResponse = function onResponse(err) {
+        if (err && _this.onerror) {
+          _this.onerror(err);
+        }
+        window.URL.revokeObjectURL(blobUrl);
+      };
       FirefoxCom.request('download', {
         blobUrl: blobUrl,
         originalUrl: url,
         filename: filename
-      }, function response(err) {
-        if (err && this.onerror) {
-          this.onerror(err);
-        }
-        window.URL.revokeObjectURL(blobUrl);
-      }.bind(this));
+      }, onResponse);
     }
   };
   return DownloadManager;

+ 6 - 6
lib/web/hand_tool.js

@@ -43,16 +43,16 @@ var HandTool = function HandToolClosure() {
         _this.handTool.activate();
       }
     }).catch(function rejected(reason) {});
-    this.eventBus.on('presentationmodechanged', function (e) {
-      if (e.switchInProgress) {
+    this.eventBus.on('presentationmodechanged', function (evt) {
+      if (evt.switchInProgress) {
         return;
       }
-      if (e.active) {
-        this.enterPresentationMode();
+      if (evt.active) {
+        _this.enterPresentationMode();
       } else {
-        this.exitPresentationMode();
+        _this.exitPresentationMode();
       }
-    }.bind(this));
+    });
   }
   HandTool.prototype = {
     get isActive() {

+ 39 - 31
lib/web/overlay_manager.js

@@ -20,78 +20,86 @@ Object.defineProperty(exports, "__esModule", {
 var OverlayManager = {
   overlays: {},
   active: null,
-  register: function overlayManagerRegister(name, element, callerCloseMethod, canForceClose) {
+  register: function register(name, element, callerCloseMethod, canForceClose) {
+    var _this = this;
+
     return new Promise(function (resolve) {
       var container;
       if (!name || !element || !(container = element.parentNode)) {
         throw new Error('Not enough parameters.');
-      } else if (this.overlays[name]) {
+      } else if (_this.overlays[name]) {
         throw new Error('The overlay is already registered.');
       }
-      this.overlays[name] = {
+      _this.overlays[name] = {
         element: element,
         container: container,
         callerCloseMethod: callerCloseMethod || null,
         canForceClose: canForceClose || false
       };
       resolve();
-    }.bind(this));
+    });
   },
-  unregister: function overlayManagerUnregister(name) {
+  unregister: function unregister(name) {
+    var _this2 = this;
+
     return new Promise(function (resolve) {
-      if (!this.overlays[name]) {
+      if (!_this2.overlays[name]) {
         throw new Error('The overlay does not exist.');
-      } else if (this.active === name) {
+      } else if (_this2.active === name) {
         throw new Error('The overlay cannot be removed while it is active.');
       }
-      delete this.overlays[name];
+      delete _this2.overlays[name];
       resolve();
-    }.bind(this));
+    });
   },
-  open: function overlayManagerOpen(name) {
+  open: function open(name) {
+    var _this3 = this;
+
     return new Promise(function (resolve) {
-      if (!this.overlays[name]) {
+      if (!_this3.overlays[name]) {
         throw new Error('The overlay does not exist.');
-      } else if (this.active) {
-        if (this.overlays[name].canForceClose) {
-          this._closeThroughCaller();
-        } else if (this.active === name) {
+      } else if (_this3.active) {
+        if (_this3.overlays[name].canForceClose) {
+          _this3._closeThroughCaller();
+        } else if (_this3.active === name) {
           throw new Error('The overlay is already active.');
         } else {
           throw new Error('Another overlay is currently active.');
         }
       }
-      this.active = name;
-      this.overlays[this.active].element.classList.remove('hidden');
-      this.overlays[this.active].container.classList.remove('hidden');
-      window.addEventListener('keydown', this._keyDown);
+      _this3.active = name;
+      _this3.overlays[_this3.active].element.classList.remove('hidden');
+      _this3.overlays[_this3.active].container.classList.remove('hidden');
+      window.addEventListener('keydown', _this3._keyDown);
       resolve();
-    }.bind(this));
+    });
   },
-  close: function overlayManagerClose(name) {
+  close: function close(name) {
+    var _this4 = this;
+
     return new Promise(function (resolve) {
-      if (!this.overlays[name]) {
+      if (!_this4.overlays[name]) {
         throw new Error('The overlay does not exist.');
-      } else if (!this.active) {
+      } else if (!_this4.active) {
         throw new Error('The overlay is currently not active.');
-      } else if (this.active !== name) {
+      } else if (_this4.active !== name) {
         throw new Error('Another overlay is currently active.');
       }
-      this.overlays[this.active].container.classList.add('hidden');
-      this.overlays[this.active].element.classList.add('hidden');
-      this.active = null;
-      window.removeEventListener('keydown', this._keyDown);
+      _this4.overlays[_this4.active].container.classList.add('hidden');
+      _this4.overlays[_this4.active].element.classList.add('hidden');
+      _this4.active = null;
+      window.removeEventListener('keydown', _this4._keyDown);
       resolve();
-    }.bind(this));
+    });
   },
-  _keyDown: function overlayManager_keyDown(evt) {
+  _keyDown: function _keyDown(evt) {
     var self = OverlayManager;
     if (self.active && evt.keyCode === 27) {
       self._closeThroughCaller();
       evt.preventDefault();
     }
   },
-  _closeThroughCaller: function overlayManager_closeThroughCaller() {
+  _closeThroughCaller: function _closeThroughCaller() {
     if (this.overlays[this.active].callerCloseMethod) {
       this.overlays[this.active].callerCloseMethod();
     }

+ 11 - 5
lib/web/pdf_attachment_viewer.js

@@ -123,9 +123,15 @@ var PDFAttachmentViewer = function () {
     }
   }, {
     key: '_appendAttachment',
-    value: function _appendAttachment(item) {
-      this._renderedCapability.promise.then(function (id, filename, content) {
-        var attachments = this.attachments;
+    value: function _appendAttachment(_ref) {
+      var _this2 = this;
+
+      var id = _ref.id,
+          filename = _ref.filename,
+          content = _ref.content;
+
+      this._renderedCapability.promise.then(function () {
+        var attachments = _this2.attachments;
         if (!attachments) {
           attachments = Object.create(null);
         } else {
@@ -139,11 +145,11 @@ var PDFAttachmentViewer = function () {
           filename: filename,
           content: content
         };
-        this.render({
+        _this2.render({
           attachments: attachments,
           keepRenderedCapability: true
         });
-      }.bind(this, item.id, item.filename, item.content));
+      });
     }
   }]);
 

+ 7 - 5
lib/web/pdf_find_controller.js

@@ -220,20 +220,22 @@ var PDFFindController = function PDFFindControllerClosure() {
       extractPageText(0);
     },
     executeCommand: function PDFFindController_executeCommand(cmd, state) {
+      var _this2 = this;
+
       if (this.state === null || cmd !== 'findagain') {
         this.dirtyMatch = true;
       }
       this.state = state;
       this.updateUIState(FindStates.FIND_PENDING);
       this._firstPagePromise.then(function () {
-        this.extractText();
-        clearTimeout(this.findTimeout);
+        _this2.extractText();
+        clearTimeout(_this2.findTimeout);
         if (cmd === 'find') {
-          this.findTimeout = setTimeout(this.nextMatch.bind(this), 250);
+          _this2.findTimeout = setTimeout(_this2.nextMatch.bind(_this2), 250);
         } else {
-          this.nextMatch();
+          _this2.nextMatch();
         }
-      }.bind(this));
+      });
     },
     updatePage: function PDFFindController_updatePage(index) {
       if (this.selected.pageIdx === index) {

+ 13 - 9
lib/web/pdf_print_service.js

@@ -99,20 +99,22 @@ PDFPrintService.prototype = {
     });
   },
   renderPages: function renderPages() {
+    var _this = this;
+
     var pageCount = this.pagesOverview.length;
-    var renderNextPage = function (resolve, reject) {
-      this.throwIfInactive();
-      if (++this.currentPage >= pageCount) {
+    var renderNextPage = function renderNextPage(resolve, reject) {
+      _this.throwIfInactive();
+      if (++_this.currentPage >= pageCount) {
         renderProgress(pageCount, pageCount);
         resolve();
         return;
       }
-      var index = this.currentPage;
+      var index = _this.currentPage;
       renderProgress(index, pageCount);
-      renderPage(this, this.pdfDocument, index + 1, this.pagesOverview[index]).then(this.useRenderedPage.bind(this)).then(function () {
+      renderPage(_this, _this.pdfDocument, index + 1, _this.pagesOverview[index]).then(_this.useRenderedPage.bind(_this)).then(function () {
         renderNextPage(resolve, reject);
       }, reject);
-    }.bind(this);
+    };
     return new Promise(renderNextPage);
   },
   useRenderedPage: function useRenderedPage(printItem) {
@@ -137,17 +139,19 @@ PDFPrintService.prototype = {
     });
   },
   performPrint: function performPrint() {
+    var _this2 = this;
+
     this.throwIfInactive();
     return new Promise(function (resolve) {
       setTimeout(function () {
-        if (!this.active) {
+        if (!_this2.active) {
           resolve();
           return;
         }
         print.call(window);
         setTimeout(resolve, 20);
-      }.bind(this), 0);
-    }.bind(this));
+      }, 0);
+    });
   },
 
   get active() {

+ 11 - 9
lib/web/pdf_thumbnail_viewer.js

@@ -87,6 +87,8 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() {
       this.container.textContent = '';
     },
     setDocument: function PDFThumbnailViewer_setDocument(pdfDocument) {
+      var _this = this;
+
       if (this.pdfDocument) {
         this._cancelRendering();
         this._resetView();
@@ -100,16 +102,16 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() {
         var viewport = firstPage.getViewport(1.0);
         for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
           var thumbnail = new _pdf_thumbnail_view.PDFThumbnailView({
-            container: this.container,
+            container: _this.container,
             id: pageNum,
             defaultViewport: viewport.clone(),
-            linkService: this.linkService,
-            renderingQueue: this.renderingQueue,
+            linkService: _this.linkService,
+            renderingQueue: _this.renderingQueue,
             disableCanvasToImageConversion: false
           });
-          this.thumbnails.push(thumbnail);
+          _this.thumbnails.push(thumbnail);
         }
-      }.bind(this));
+      });
     },
     _cancelRendering: function PDFThumbnailViewer_cancelRendering() {
       for (var i = 0, ii = this.thumbnails.length; i < ii; i++) {
@@ -137,7 +139,7 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() {
       }
     },
     _ensurePdfPageLoaded: function _ensurePdfPageLoaded(thumbView) {
-      var _this = this;
+      var _this2 = this;
 
       if (thumbView.pdfPage) {
         return Promise.resolve(thumbView.pdfPage);
@@ -148,20 +150,20 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() {
       }
       var promise = this.pdfDocument.getPage(pageNumber).then(function (pdfPage) {
         thumbView.setPdfPage(pdfPage);
-        _this._pagesRequests[pageNumber] = null;
+        _this2._pagesRequests[pageNumber] = null;
         return pdfPage;
       });
       this._pagesRequests[pageNumber] = promise;
       return promise;
     },
     forceRendering: function forceRendering() {
-      var _this2 = this;
+      var _this3 = this;
 
       var visibleThumbs = this._getVisibleThumbs();
       var thumbView = this.renderingQueue.getHighestPriority(visibleThumbs, this.thumbnails, this.scroll.down);
       if (thumbView) {
         this._ensurePdfPageLoaded(thumbView).then(function () {
-          _this2.renderingQueue.renderView(thumbView);
+          _this3.renderingQueue.renderView(thumbView);
         });
         return true;
       }

+ 10 - 5
lib/web/pdf_viewer.js

@@ -271,17 +271,22 @@ var PDFViewer = function pdfViewer() {
             return;
           }
           var getPagesLeft = pagesCount;
-          for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
-            pdfDocument.getPage(pageNum).then(function (pageNum, pdfPage) {
-              var pageView = this._pages[pageNum - 1];
+
+          var _loop = function _loop(_pageNum) {
+            pdfDocument.getPage(_pageNum).then(function (pdfPage) {
+              var pageView = _this._pages[_pageNum - 1];
               if (!pageView.pdfPage) {
                 pageView.setPdfPage(pdfPage);
               }
-              this.linkService.cachePageRef(pageNum, pdfPage.ref);
+              _this.linkService.cachePageRef(_pageNum, pdfPage.ref);
               if (--getPagesLeft === 0) {
                 pagesCapability.resolve();
               }
-            }.bind(_this, pageNum));
+            });
+          };
+
+          for (var _pageNum = 1; _pageNum <= pagesCount; ++_pageNum) {
+            _loop(_pageNum);
           }
         });
         _this.eventBus.dispatch('pagesinit', { source: _this });

+ 17 - 8
lib/web/secondary_toolbar.js

@@ -112,19 +112,28 @@ var SecondaryToolbar = function SecondaryToolbarClosure() {
       items.pageRotateCcw.disabled = this.pagesCount === 0;
     },
     _bindClickListeners: function SecondaryToolbar_bindClickListeners() {
+      var _this = this;
+
       this.toggleButton.addEventListener('click', this.toggle.bind(this));
-      for (var button in this.buttons) {
-        var element = this.buttons[button].element;
-        var eventName = this.buttons[button].eventName;
-        var close = this.buttons[button].close;
-        element.addEventListener('click', function (eventName, close) {
+
+      var _loop = function _loop(button) {
+        var _buttons$button = _this.buttons[button],
+            element = _buttons$button.element,
+            eventName = _buttons$button.eventName,
+            close = _buttons$button.close;
+
+        element.addEventListener('click', function (evt) {
           if (eventName !== null) {
-            this.eventBus.dispatch(eventName, { source: this });
+            _this.eventBus.dispatch(eventName, { source: _this });
           }
           if (close) {
-            this.close();
+            _this.close();
           }
-        }.bind(this, eventName, close));
+        });
+      };
+
+      for (var button in this.buttons) {
+        _loop(button);
       }
     },
     _bindHandToolListener: function SecondaryToolbar_bindHandToolListener(toggleHandToolButton) {

+ 6 - 4
lib/web/text_layer_builder.js

@@ -55,6 +55,8 @@ var TextLayerBuilder = function TextLayerBuilderClosure() {
       });
     },
     render: function TextLayerBuilder_render(timeout) {
+      var _this = this;
+
       if (!this.textContent || this.renderingDone) {
         return;
       }
@@ -70,10 +72,10 @@ var TextLayerBuilder = function TextLayerBuilderClosure() {
         enhanceTextSelection: this.enhanceTextSelection
       });
       this.textLayerRenderTask.promise.then(function () {
-        this.textLayerDiv.appendChild(textLayerFrag);
-        this._finishRendering();
-        this.updateMatches();
-      }.bind(this), function (reason) {});
+        _this.textLayerDiv.appendChild(textLayerFrag);
+        _this._finishRendering();
+        _this.updateMatches();
+      }, function (reason) {});
     },
     cancel: function TextLayerBuilder_cancel() {
       if (this.textLayerRenderTask) {

+ 1 - 1
package.json

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

+ 23 - 14
web/pdf_viewer.js

@@ -1632,6 +1632,8 @@ var TextLayerBuilder = function TextLayerBuilderClosure() {
       });
     },
     render: function TextLayerBuilder_render(timeout) {
+      var _this = this;
+
       if (!this.textContent || this.renderingDone) {
         return;
       }
@@ -1647,10 +1649,10 @@ var TextLayerBuilder = function TextLayerBuilderClosure() {
         enhanceTextSelection: this.enhanceTextSelection
       });
       this.textLayerRenderTask.promise.then(function () {
-        this.textLayerDiv.appendChild(textLayerFrag);
-        this._finishRendering();
-        this.updateMatches();
-      }.bind(this), function (reason) {});
+        _this.textLayerDiv.appendChild(textLayerFrag);
+        _this._finishRendering();
+        _this.updateMatches();
+      }, function (reason) {});
     },
     cancel: function TextLayerBuilder_cancel() {
       if (this.textLayerRenderTask) {
@@ -2286,20 +2288,22 @@ var PDFFindController = function PDFFindControllerClosure() {
       extractPageText(0);
     },
     executeCommand: function PDFFindController_executeCommand(cmd, state) {
+      var _this2 = this;
+
       if (this.state === null || cmd !== 'findagain') {
         this.dirtyMatch = true;
       }
       this.state = state;
       this.updateUIState(FindStates.FIND_PENDING);
       this._firstPagePromise.then(function () {
-        this.extractText();
-        clearTimeout(this.findTimeout);
+        _this2.extractText();
+        clearTimeout(_this2.findTimeout);
         if (cmd === 'find') {
-          this.findTimeout = setTimeout(this.nextMatch.bind(this), 250);
+          _this2.findTimeout = setTimeout(_this2.nextMatch.bind(_this2), 250);
         } else {
-          this.nextMatch();
+          _this2.nextMatch();
         }
-      }.bind(this));
+      });
     },
     updatePage: function PDFFindController_updatePage(index) {
       if (this.selected.pageIdx === index) {
@@ -3016,17 +3020,22 @@ var PDFViewer = function pdfViewer() {
             return;
           }
           var getPagesLeft = pagesCount;
-          for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
-            pdfDocument.getPage(pageNum).then(function (pageNum, pdfPage) {
-              var pageView = this._pages[pageNum - 1];
+
+          var _loop = function _loop(_pageNum) {
+            pdfDocument.getPage(_pageNum).then(function (pdfPage) {
+              var pageView = _this._pages[_pageNum - 1];
               if (!pageView.pdfPage) {
                 pageView.setPdfPage(pdfPage);
               }
-              this.linkService.cachePageRef(pageNum, pdfPage.ref);
+              _this.linkService.cachePageRef(_pageNum, pdfPage.ref);
               if (--getPagesLeft === 0) {
                 pagesCapability.resolve();
               }
-            }.bind(_this, pageNum));
+            });
+          };
+
+          for (var _pageNum = 1; _pageNum <= pagesCount; ++_pageNum) {
+            _loop(_pageNum);
           }
         });
         _this.eventBus.dispatch('pagesinit', { source: _this });

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно