Просмотр исходного кода

PDF.js version 1.8.425 - See mozilla/pdf.js@fccb0b5cf889885873f5d27168e372ddbe5715fe

pdfjsbot 8 лет назад
Родитель
Сommit
e55550f693

+ 1 - 1
bower.json

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

+ 6 - 6
build/pdf.combined.js

@@ -12809,8 +12809,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
 }();
 var version, build;
 {
-  exports.version = version = '1.8.423';
-  exports.build = build = '8654635b';
+  exports.version = version = '1.8.425';
+  exports.build = build = 'fccb0b5c';
 }
 exports.getDocument = getDocument;
 exports.LoopbackPort = LoopbackPort;
@@ -28147,8 +28147,8 @@ if (!_util.globalScope.PDFJS) {
 }
 var PDFJS = _util.globalScope.PDFJS;
 {
-  PDFJS.version = '1.8.423';
-  PDFJS.build = '8654635b';
+  PDFJS.version = '1.8.425';
+  PDFJS.build = 'fccb0b5c';
 }
 PDFJS.pdfBug = false;
 if (PDFJS.verbosity !== undefined) {
@@ -46762,8 +46762,8 @@ exports.TilingPattern = TilingPattern;
 "use strict";
 
 
-var pdfjsVersion = '1.8.423';
-var pdfjsBuild = '8654635b';
+var pdfjsVersion = '1.8.425';
+var pdfjsBuild = 'fccb0b5c';
 var pdfjsSharedUtil = __w_pdfjs_require__(0);
 var pdfjsDisplayGlobal = __w_pdfjs_require__(26);
 var pdfjsDisplayAPI = __w_pdfjs_require__(10);

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
build/pdf.combined.js.map


+ 6 - 6
build/pdf.js

@@ -3538,8 +3538,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
 }();
 var version, build;
 {
-  exports.version = version = '1.8.423';
-  exports.build = build = '8654635b';
+  exports.version = version = '1.8.425';
+  exports.build = build = 'fccb0b5c';
 }
 exports.getDocument = getDocument;
 exports.LoopbackPort = LoopbackPort;
@@ -5512,8 +5512,8 @@ if (!_util.globalScope.PDFJS) {
 }
 var PDFJS = _util.globalScope.PDFJS;
 {
-  PDFJS.version = '1.8.423';
-  PDFJS.build = '8654635b';
+  PDFJS.version = '1.8.425';
+  PDFJS.build = 'fccb0b5c';
 }
 PDFJS.pdfBug = false;
 if (PDFJS.verbosity !== undefined) {
@@ -11052,8 +11052,8 @@ exports.TilingPattern = TilingPattern;
 "use strict";
 
 
-var pdfjsVersion = '1.8.423';
-var pdfjsBuild = '8654635b';
+var pdfjsVersion = '1.8.425';
+var pdfjsBuild = 'fccb0b5c';
 var pdfjsSharedUtil = __w_pdfjs_require__(0);
 var pdfjsDisplayGlobal = __w_pdfjs_require__(9);
 var pdfjsDisplayAPI = __w_pdfjs_require__(3);

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
build/pdf.js.map


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
build/pdf.min.js


+ 2 - 2
build/pdf.worker.js

@@ -40061,8 +40061,8 @@ exports.Type1Parser = Type1Parser;
 "use strict";
 
 
-var pdfjsVersion = '1.8.423';
-var pdfjsBuild = '8654635b';
+var pdfjsVersion = '1.8.425';
+var pdfjsBuild = 'fccb0b5c';
 var pdfjsCoreWorker = __w_pdfjs_require__(8);
 {
   __w_pdfjs_require__(19);

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
build/pdf.worker.js.map


+ 2 - 2
lib/display/api.js

@@ -1418,8 +1418,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
 }();
 var version, build;
 {
-  exports.version = version = '1.8.423';
-  exports.build = build = '8654635b';
+  exports.version = version = '1.8.425';
+  exports.build = build = 'fccb0b5c';
 }
 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.423';
-  PDFJS.build = '8654635b';
+  PDFJS.version = '1.8.425';
+  PDFJS.build = 'fccb0b5c';
 }
 PDFJS.pdfBug = false;
 if (PDFJS.verbosity !== undefined) {

+ 2 - 2
lib/pdf.js

@@ -14,8 +14,8 @@
  */
 'use strict';
 
-var pdfjsVersion = '1.8.423';
-var pdfjsBuild = '8654635b';
+var pdfjsVersion = '1.8.425';
+var pdfjsBuild = 'fccb0b5c';
 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.423';
-var pdfjsBuild = '8654635b';
+var pdfjsVersion = '1.8.425';
+var pdfjsBuild = 'fccb0b5c';
 var pdfjsCoreWorker = require('./core/worker.js');
 {
   require('./core/network.js');

+ 4 - 4
lib/web/pdf_find_bar.js

@@ -112,16 +112,16 @@ var PDFFindBar = function () {
       var findMsg = '';
       var status = '';
       switch (state) {
-        case _pdf_find_controller.FindStates.FIND_FOUND:
+        case _pdf_find_controller.FindState.FOUND:
           break;
-        case _pdf_find_controller.FindStates.FIND_PENDING:
+        case _pdf_find_controller.FindState.PENDING:
           status = 'pending';
           break;
-        case _pdf_find_controller.FindStates.FIND_NOTFOUND:
+        case _pdf_find_controller.FindState.NOT_FOUND:
           findMsg = this.l10n.get('find_not_found', null, 'Phrase not found');
           notFound = true;
           break;
-        case _pdf_find_controller.FindStates.FIND_WRAPPED:
+        case _pdf_find_controller.FindState.WRAPPED:
           if (previous) {
             findMsg = this.l10n.get('find_reached_top', null, 'Reached top of document, continued from bottom');
           } else {

+ 108 - 63
lib/web/pdf_find_controller.js

@@ -17,20 +17,25 @@
 Object.defineProperty(exports, "__esModule", {
   value: true
 });
-exports.PDFFindController = exports.FindStates = undefined;
+exports.PDFFindController = exports.FindState = undefined;
+
+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
 
 var _pdf = require('../pdf');
 
 var _ui_utils = require('./ui_utils');
 
-var FindStates = {
-  FIND_FOUND: 0,
-  FIND_NOTFOUND: 1,
-  FIND_WRAPPED: 2,
-  FIND_PENDING: 3
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+var FindState = {
+  FOUND: 0,
+  NOT_FOUND: 1,
+  WRAPPED: 2,
+  PENDING: 3
 };
 var FIND_SCROLL_OFFSET_TOP = -50;
 var FIND_SCROLL_OFFSET_LEFT = -400;
+var FIND_TIMEOUT = 250;
 var CHARACTERS_TO_NORMALIZE = {
   '\u2018': '\'',
   '\u2019': '\'',
@@ -44,17 +49,24 @@ var CHARACTERS_TO_NORMALIZE = {
   '\xBD': '1/2',
   '\xBE': '3/4'
 };
-var PDFFindController = function PDFFindControllerClosure() {
-  function PDFFindController(options) {
-    this.pdfViewer = options.pdfViewer || null;
+
+var PDFFindController = function () {
+  function PDFFindController(_ref) {
+    var pdfViewer = _ref.pdfViewer;
+
+    _classCallCheck(this, PDFFindController);
+
+    this.pdfViewer = pdfViewer;
     this.onUpdateResultsCount = null;
     this.onUpdateState = null;
     this.reset();
     var replace = Object.keys(CHARACTERS_TO_NORMALIZE).join('');
     this.normalizationRegex = new RegExp('[' + replace + ']', 'g');
   }
-  PDFFindController.prototype = {
-    reset: function PDFFindController_reset() {
+
+  _createClass(PDFFindController, [{
+    key: 'reset',
+    value: function reset() {
       var _this = this;
 
       this.startedTextExtraction = false;
@@ -81,23 +93,26 @@ var PDFFindController = function PDFFindControllerClosure() {
       this._firstPagePromise = new Promise(function (resolve) {
         _this.resolveFirstPage = resolve;
       });
-    },
-    normalize: function PDFFindController_normalize(text) {
+    }
+  }, {
+    key: 'normalize',
+    value: function normalize(text) {
       return text.replace(this.normalizationRegex, function (ch) {
         return CHARACTERS_TO_NORMALIZE[ch];
       });
-    },
-    _prepareMatches: function PDFFindController_prepareMatches(matchesWithLength, matches, matchesLength) {
+    }
+  }, {
+    key: '_prepareMatches',
+    value: function _prepareMatches(matchesWithLength, matches, matchesLength) {
       function isSubTerm(matchesWithLength, currentIndex) {
-        var currentElem, prevElem, nextElem;
-        currentElem = matchesWithLength[currentIndex];
-        nextElem = matchesWithLength[currentIndex + 1];
+        var currentElem = matchesWithLength[currentIndex];
+        var nextElem = matchesWithLength[currentIndex + 1];
         if (currentIndex < matchesWithLength.length - 1 && currentElem.match === nextElem.match) {
           currentElem.skipped = true;
           return true;
         }
         for (var i = currentIndex - 1; i >= 0; i--) {
-          prevElem = matchesWithLength[i];
+          var prevElem = matchesWithLength[i];
           if (prevElem.skipped) {
             continue;
           }
@@ -111,19 +126,20 @@ var PDFFindController = function PDFFindControllerClosure() {
         }
         return false;
       }
-      var i, len;
       matchesWithLength.sort(function (a, b) {
         return a.match === b.match ? a.matchLength - b.matchLength : a.match - b.match;
       });
-      for (i = 0, len = matchesWithLength.length; i < len; i++) {
+      for (var i = 0, len = matchesWithLength.length; i < len; i++) {
         if (isSubTerm(matchesWithLength, i)) {
           continue;
         }
         matches.push(matchesWithLength[i].match);
         matchesLength.push(matchesWithLength[i].matchLength);
       }
-    },
-    calcFindPhraseMatch: function PDFFindController_calcFindPhraseMatch(query, pageIndex, pageContent) {
+    }
+  }, {
+    key: 'calcFindPhraseMatch',
+    value: function calcFindPhraseMatch(query, pageIndex, pageContent) {
       var matches = [];
       var queryLen = query.length;
       var matchIdx = -queryLen;
@@ -135,15 +151,16 @@ var PDFFindController = function PDFFindControllerClosure() {
         matches.push(matchIdx);
       }
       this.pageMatches[pageIndex] = matches;
-    },
-    calcFindWordMatch: function PDFFindController_calcFindWordMatch(query, pageIndex, pageContent) {
+    }
+  }, {
+    key: 'calcFindWordMatch',
+    value: function calcFindWordMatch(query, pageIndex, pageContent) {
       var matchesWithLength = [];
       var queryArray = query.match(/\S+/g);
-      var subquery, subqueryLen, matchIdx;
       for (var i = 0, len = queryArray.length; i < len; i++) {
-        subquery = queryArray[i];
-        subqueryLen = subquery.length;
-        matchIdx = -subqueryLen;
+        var subquery = queryArray[i];
+        var subqueryLen = subquery.length;
+        var matchIdx = -subqueryLen;
         while (true) {
           matchIdx = pageContent.indexOf(subquery, matchIdx + subqueryLen);
           if (matchIdx === -1) {
@@ -162,8 +179,10 @@ var PDFFindController = function PDFFindControllerClosure() {
       this.pageMatchesLength[pageIndex] = [];
       this.pageMatches[pageIndex] = [];
       this._prepareMatches(matchesWithLength, this.pageMatches[pageIndex], this.pageMatchesLength[pageIndex]);
-    },
-    calcFindMatch: function PDFFindController_calcFindMatch(pageIndex) {
+    }
+  }, {
+    key: 'calcFindMatch',
+    value: function calcFindMatch(pageIndex) {
       var pageContent = this.normalize(this.pageContents[pageIndex]);
       var query = this.normalize(this.state.query);
       var caseSensitive = this.state.caseSensitive;
@@ -190,8 +209,10 @@ var PDFFindController = function PDFFindControllerClosure() {
         this.matchCount += this.pageMatches[pageIndex].length;
         this.updateUIResultsCount();
       }
-    },
-    extractText: function extractText() {
+    }
+  }, {
+    key: 'extractText',
+    value: function extractText() {
       var _this2 = this;
 
       if (this.startedTextExtraction) {
@@ -220,27 +241,30 @@ var PDFFindController = function PDFFindControllerClosure() {
       for (var i = 0, ii = this.pdfViewer.pagesCount; i < ii; i++) {
         _loop(i, ii);
       }
-    },
-
-    executeCommand: function PDFFindController_executeCommand(cmd, state) {
+    }
+  }, {
+    key: 'executeCommand',
+    value: function executeCommand(cmd, state) {
       var _this3 = this;
 
       if (this.state === null || cmd !== 'findagain') {
         this.dirtyMatch = true;
       }
       this.state = state;
-      this.updateUIState(FindStates.FIND_PENDING);
+      this.updateUIState(FindState.PENDING);
       this._firstPagePromise.then(function () {
         _this3.extractText();
         clearTimeout(_this3.findTimeout);
         if (cmd === 'find') {
-          _this3.findTimeout = setTimeout(_this3.nextMatch.bind(_this3), 250);
+          _this3.findTimeout = setTimeout(_this3.nextMatch.bind(_this3), FIND_TIMEOUT);
         } else {
           _this3.nextMatch();
         }
       });
-    },
-    updatePage: function PDFFindController_updatePage(index) {
+    }
+  }, {
+    key: 'updatePage',
+    value: function updatePage(index) {
       if (this.selected.pageIdx === index) {
         this.pdfViewer.currentPageNumber = index + 1;
       }
@@ -248,8 +272,10 @@ var PDFFindController = function PDFFindControllerClosure() {
       if (page.textLayer) {
         page.textLayer.updateMatches();
       }
-    },
-    nextMatch: function PDFFindController_nextMatch() {
+    }
+  }, {
+    key: 'nextMatch',
+    value: function nextMatch() {
       var _this4 = this;
 
       var previous = this.state.findPrevious;
@@ -278,7 +304,7 @@ var PDFFindController = function PDFFindControllerClosure() {
         }
       }
       if (this.state.query === '') {
-        this.updateUIState(FindStates.FIND_FOUND);
+        this.updateUIState(FindState.FOUND);
         return;
       }
       if (this.resumePageIdx) {
@@ -297,8 +323,10 @@ var PDFFindController = function PDFFindControllerClosure() {
         this.advanceOffsetPage(previous);
       }
       this.nextPageMatch();
-    },
-    matchesReady: function PDFFindController_matchesReady(matches) {
+    }
+  }, {
+    key: 'matchesReady',
+    value: function matchesReady(matches) {
       var offset = this.offset;
       var numMatches = matches.length;
       var previous = this.state.findPrevious;
@@ -317,30 +345,37 @@ var PDFFindController = function PDFFindControllerClosure() {
         }
       }
       return false;
-    },
-    updateMatchPosition: function PDFFindController_updateMatchPosition(pageIndex, index, elements, beginIdx) {
-      if (this.selected.matchIdx === index && this.selected.pageIdx === pageIndex) {
+    }
+  }, {
+    key: 'updateMatchPosition',
+    value: function updateMatchPosition(pageIndex, matchIndex, elements, beginIdx) {
+      if (this.selected.matchIdx === matchIndex && this.selected.pageIdx === pageIndex) {
         var spot = {
           top: FIND_SCROLL_OFFSET_TOP,
           left: FIND_SCROLL_OFFSET_LEFT
         };
         (0, _ui_utils.scrollIntoView)(elements[beginIdx], spot, true);
       }
-    },
-    nextPageMatch: function PDFFindController_nextPageMatch() {
+    }
+  }, {
+    key: 'nextPageMatch',
+    value: function nextPageMatch() {
       if (this.resumePageIdx !== null) {
         console.error('There can only be one pending page.');
       }
+      var matches = null;
       do {
         var pageIdx = this.offset.pageIdx;
-        var matches = this.pageMatches[pageIdx];
+        matches = this.pageMatches[pageIdx];
         if (!matches) {
           this.resumePageIdx = pageIdx;
           break;
         }
       } while (!this.matchesReady(matches));
-    },
-    advanceOffsetPage: function PDFFindController_advanceOffsetPage(previous) {
+    }
+  }, {
+    key: 'advanceOffsetPage',
+    value: function advanceOffsetPage(previous) {
       var offset = this.offset;
       var numPages = this.extractTextPromises.length;
       offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1;
@@ -350,16 +385,20 @@ var PDFFindController = function PDFFindControllerClosure() {
         offset.pageIdx = previous ? numPages - 1 : 0;
         offset.wrapped = true;
       }
-    },
-    updateMatch: function PDFFindController_updateMatch(found) {
-      var state = FindStates.FIND_NOTFOUND;
+    }
+  }, {
+    key: 'updateMatch',
+    value: function updateMatch() {
+      var found = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+      var state = FindState.NOT_FOUND;
       var wrapped = this.offset.wrapped;
       this.offset.wrapped = false;
       if (found) {
         var previousPage = this.selected.pageIdx;
         this.selected.pageIdx = this.offset.pageIdx;
         this.selected.matchIdx = this.offset.matchIdx;
-        state = wrapped ? FindStates.FIND_WRAPPED : FindStates.FIND_FOUND;
+        state = wrapped ? FindState.WRAPPED : FindState.FOUND;
         if (previousPage !== -1 && previousPage !== this.selected.pageIdx) {
           this.updatePage(previousPage);
         }
@@ -368,19 +407,25 @@ var PDFFindController = function PDFFindControllerClosure() {
       if (this.selected.pageIdx !== -1) {
         this.updatePage(this.selected.pageIdx);
       }
-    },
-    updateUIResultsCount: function PDFFindController_updateUIResultsCount() {
+    }
+  }, {
+    key: 'updateUIResultsCount',
+    value: function updateUIResultsCount() {
       if (this.onUpdateResultsCount) {
         this.onUpdateResultsCount(this.matchCount);
       }
-    },
-    updateUIState: function PDFFindController_updateUIState(state, previous) {
+    }
+  }, {
+    key: 'updateUIState',
+    value: function updateUIState(state, previous) {
       if (this.onUpdateState) {
         this.onUpdateState(state, previous, this.matchCount);
       }
     }
-  };
+  }]);
+
   return PDFFindController;
 }();
-exports.FindStates = FindStates;
+
+exports.FindState = FindState;
 exports.PDFFindController = PDFFindController;

+ 1 - 1
package.json

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

+ 108 - 63
web/pdf_viewer.js

@@ -2207,20 +2207,25 @@ exports.GenericL10n = GenericL10n;
 Object.defineProperty(exports, "__esModule", {
   value: true
 });
-exports.PDFFindController = exports.FindStates = undefined;
+exports.PDFFindController = exports.FindState = undefined;
+
+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
 
 var _pdfjsLib = __w_pdfjs_require__(0);
 
 var _ui_utils = __w_pdfjs_require__(1);
 
-var FindStates = {
-  FIND_FOUND: 0,
-  FIND_NOTFOUND: 1,
-  FIND_WRAPPED: 2,
-  FIND_PENDING: 3
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+var FindState = {
+  FOUND: 0,
+  NOT_FOUND: 1,
+  WRAPPED: 2,
+  PENDING: 3
 };
 var FIND_SCROLL_OFFSET_TOP = -50;
 var FIND_SCROLL_OFFSET_LEFT = -400;
+var FIND_TIMEOUT = 250;
 var CHARACTERS_TO_NORMALIZE = {
   '\u2018': '\'',
   '\u2019': '\'',
@@ -2234,17 +2239,24 @@ var CHARACTERS_TO_NORMALIZE = {
   '\xBD': '1/2',
   '\xBE': '3/4'
 };
-var PDFFindController = function PDFFindControllerClosure() {
-  function PDFFindController(options) {
-    this.pdfViewer = options.pdfViewer || null;
+
+var PDFFindController = function () {
+  function PDFFindController(_ref) {
+    var pdfViewer = _ref.pdfViewer;
+
+    _classCallCheck(this, PDFFindController);
+
+    this.pdfViewer = pdfViewer;
     this.onUpdateResultsCount = null;
     this.onUpdateState = null;
     this.reset();
     var replace = Object.keys(CHARACTERS_TO_NORMALIZE).join('');
     this.normalizationRegex = new RegExp('[' + replace + ']', 'g');
   }
-  PDFFindController.prototype = {
-    reset: function PDFFindController_reset() {
+
+  _createClass(PDFFindController, [{
+    key: 'reset',
+    value: function reset() {
       var _this = this;
 
       this.startedTextExtraction = false;
@@ -2271,23 +2283,26 @@ var PDFFindController = function PDFFindControllerClosure() {
       this._firstPagePromise = new Promise(function (resolve) {
         _this.resolveFirstPage = resolve;
       });
-    },
-    normalize: function PDFFindController_normalize(text) {
+    }
+  }, {
+    key: 'normalize',
+    value: function normalize(text) {
       return text.replace(this.normalizationRegex, function (ch) {
         return CHARACTERS_TO_NORMALIZE[ch];
       });
-    },
-    _prepareMatches: function PDFFindController_prepareMatches(matchesWithLength, matches, matchesLength) {
+    }
+  }, {
+    key: '_prepareMatches',
+    value: function _prepareMatches(matchesWithLength, matches, matchesLength) {
       function isSubTerm(matchesWithLength, currentIndex) {
-        var currentElem, prevElem, nextElem;
-        currentElem = matchesWithLength[currentIndex];
-        nextElem = matchesWithLength[currentIndex + 1];
+        var currentElem = matchesWithLength[currentIndex];
+        var nextElem = matchesWithLength[currentIndex + 1];
         if (currentIndex < matchesWithLength.length - 1 && currentElem.match === nextElem.match) {
           currentElem.skipped = true;
           return true;
         }
         for (var i = currentIndex - 1; i >= 0; i--) {
-          prevElem = matchesWithLength[i];
+          var prevElem = matchesWithLength[i];
           if (prevElem.skipped) {
             continue;
           }
@@ -2301,19 +2316,20 @@ var PDFFindController = function PDFFindControllerClosure() {
         }
         return false;
       }
-      var i, len;
       matchesWithLength.sort(function (a, b) {
         return a.match === b.match ? a.matchLength - b.matchLength : a.match - b.match;
       });
-      for (i = 0, len = matchesWithLength.length; i < len; i++) {
+      for (var i = 0, len = matchesWithLength.length; i < len; i++) {
         if (isSubTerm(matchesWithLength, i)) {
           continue;
         }
         matches.push(matchesWithLength[i].match);
         matchesLength.push(matchesWithLength[i].matchLength);
       }
-    },
-    calcFindPhraseMatch: function PDFFindController_calcFindPhraseMatch(query, pageIndex, pageContent) {
+    }
+  }, {
+    key: 'calcFindPhraseMatch',
+    value: function calcFindPhraseMatch(query, pageIndex, pageContent) {
       var matches = [];
       var queryLen = query.length;
       var matchIdx = -queryLen;
@@ -2325,15 +2341,16 @@ var PDFFindController = function PDFFindControllerClosure() {
         matches.push(matchIdx);
       }
       this.pageMatches[pageIndex] = matches;
-    },
-    calcFindWordMatch: function PDFFindController_calcFindWordMatch(query, pageIndex, pageContent) {
+    }
+  }, {
+    key: 'calcFindWordMatch',
+    value: function calcFindWordMatch(query, pageIndex, pageContent) {
       var matchesWithLength = [];
       var queryArray = query.match(/\S+/g);
-      var subquery, subqueryLen, matchIdx;
       for (var i = 0, len = queryArray.length; i < len; i++) {
-        subquery = queryArray[i];
-        subqueryLen = subquery.length;
-        matchIdx = -subqueryLen;
+        var subquery = queryArray[i];
+        var subqueryLen = subquery.length;
+        var matchIdx = -subqueryLen;
         while (true) {
           matchIdx = pageContent.indexOf(subquery, matchIdx + subqueryLen);
           if (matchIdx === -1) {
@@ -2352,8 +2369,10 @@ var PDFFindController = function PDFFindControllerClosure() {
       this.pageMatchesLength[pageIndex] = [];
       this.pageMatches[pageIndex] = [];
       this._prepareMatches(matchesWithLength, this.pageMatches[pageIndex], this.pageMatchesLength[pageIndex]);
-    },
-    calcFindMatch: function PDFFindController_calcFindMatch(pageIndex) {
+    }
+  }, {
+    key: 'calcFindMatch',
+    value: function calcFindMatch(pageIndex) {
       var pageContent = this.normalize(this.pageContents[pageIndex]);
       var query = this.normalize(this.state.query);
       var caseSensitive = this.state.caseSensitive;
@@ -2380,8 +2399,10 @@ var PDFFindController = function PDFFindControllerClosure() {
         this.matchCount += this.pageMatches[pageIndex].length;
         this.updateUIResultsCount();
       }
-    },
-    extractText: function extractText() {
+    }
+  }, {
+    key: 'extractText',
+    value: function extractText() {
       var _this2 = this;
 
       if (this.startedTextExtraction) {
@@ -2410,27 +2431,30 @@ var PDFFindController = function PDFFindControllerClosure() {
       for (var i = 0, ii = this.pdfViewer.pagesCount; i < ii; i++) {
         _loop(i, ii);
       }
-    },
-
-    executeCommand: function PDFFindController_executeCommand(cmd, state) {
+    }
+  }, {
+    key: 'executeCommand',
+    value: function executeCommand(cmd, state) {
       var _this3 = this;
 
       if (this.state === null || cmd !== 'findagain') {
         this.dirtyMatch = true;
       }
       this.state = state;
-      this.updateUIState(FindStates.FIND_PENDING);
+      this.updateUIState(FindState.PENDING);
       this._firstPagePromise.then(function () {
         _this3.extractText();
         clearTimeout(_this3.findTimeout);
         if (cmd === 'find') {
-          _this3.findTimeout = setTimeout(_this3.nextMatch.bind(_this3), 250);
+          _this3.findTimeout = setTimeout(_this3.nextMatch.bind(_this3), FIND_TIMEOUT);
         } else {
           _this3.nextMatch();
         }
       });
-    },
-    updatePage: function PDFFindController_updatePage(index) {
+    }
+  }, {
+    key: 'updatePage',
+    value: function updatePage(index) {
       if (this.selected.pageIdx === index) {
         this.pdfViewer.currentPageNumber = index + 1;
       }
@@ -2438,8 +2462,10 @@ var PDFFindController = function PDFFindControllerClosure() {
       if (page.textLayer) {
         page.textLayer.updateMatches();
       }
-    },
-    nextMatch: function PDFFindController_nextMatch() {
+    }
+  }, {
+    key: 'nextMatch',
+    value: function nextMatch() {
       var _this4 = this;
 
       var previous = this.state.findPrevious;
@@ -2468,7 +2494,7 @@ var PDFFindController = function PDFFindControllerClosure() {
         }
       }
       if (this.state.query === '') {
-        this.updateUIState(FindStates.FIND_FOUND);
+        this.updateUIState(FindState.FOUND);
         return;
       }
       if (this.resumePageIdx) {
@@ -2487,8 +2513,10 @@ var PDFFindController = function PDFFindControllerClosure() {
         this.advanceOffsetPage(previous);
       }
       this.nextPageMatch();
-    },
-    matchesReady: function PDFFindController_matchesReady(matches) {
+    }
+  }, {
+    key: 'matchesReady',
+    value: function matchesReady(matches) {
       var offset = this.offset;
       var numMatches = matches.length;
       var previous = this.state.findPrevious;
@@ -2507,30 +2535,37 @@ var PDFFindController = function PDFFindControllerClosure() {
         }
       }
       return false;
-    },
-    updateMatchPosition: function PDFFindController_updateMatchPosition(pageIndex, index, elements, beginIdx) {
-      if (this.selected.matchIdx === index && this.selected.pageIdx === pageIndex) {
+    }
+  }, {
+    key: 'updateMatchPosition',
+    value: function updateMatchPosition(pageIndex, matchIndex, elements, beginIdx) {
+      if (this.selected.matchIdx === matchIndex && this.selected.pageIdx === pageIndex) {
         var spot = {
           top: FIND_SCROLL_OFFSET_TOP,
           left: FIND_SCROLL_OFFSET_LEFT
         };
         (0, _ui_utils.scrollIntoView)(elements[beginIdx], spot, true);
       }
-    },
-    nextPageMatch: function PDFFindController_nextPageMatch() {
+    }
+  }, {
+    key: 'nextPageMatch',
+    value: function nextPageMatch() {
       if (this.resumePageIdx !== null) {
         console.error('There can only be one pending page.');
       }
+      var matches = null;
       do {
         var pageIdx = this.offset.pageIdx;
-        var matches = this.pageMatches[pageIdx];
+        matches = this.pageMatches[pageIdx];
         if (!matches) {
           this.resumePageIdx = pageIdx;
           break;
         }
       } while (!this.matchesReady(matches));
-    },
-    advanceOffsetPage: function PDFFindController_advanceOffsetPage(previous) {
+    }
+  }, {
+    key: 'advanceOffsetPage',
+    value: function advanceOffsetPage(previous) {
       var offset = this.offset;
       var numPages = this.extractTextPromises.length;
       offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1;
@@ -2540,16 +2575,20 @@ var PDFFindController = function PDFFindControllerClosure() {
         offset.pageIdx = previous ? numPages - 1 : 0;
         offset.wrapped = true;
       }
-    },
-    updateMatch: function PDFFindController_updateMatch(found) {
-      var state = FindStates.FIND_NOTFOUND;
+    }
+  }, {
+    key: 'updateMatch',
+    value: function updateMatch() {
+      var found = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+      var state = FindState.NOT_FOUND;
       var wrapped = this.offset.wrapped;
       this.offset.wrapped = false;
       if (found) {
         var previousPage = this.selected.pageIdx;
         this.selected.pageIdx = this.offset.pageIdx;
         this.selected.matchIdx = this.offset.matchIdx;
-        state = wrapped ? FindStates.FIND_WRAPPED : FindStates.FIND_FOUND;
+        state = wrapped ? FindState.WRAPPED : FindState.FOUND;
         if (previousPage !== -1 && previousPage !== this.selected.pageIdx) {
           this.updatePage(previousPage);
         }
@@ -2558,21 +2597,27 @@ var PDFFindController = function PDFFindControllerClosure() {
       if (this.selected.pageIdx !== -1) {
         this.updatePage(this.selected.pageIdx);
       }
-    },
-    updateUIResultsCount: function PDFFindController_updateUIResultsCount() {
+    }
+  }, {
+    key: 'updateUIResultsCount',
+    value: function updateUIResultsCount() {
       if (this.onUpdateResultsCount) {
         this.onUpdateResultsCount(this.matchCount);
       }
-    },
-    updateUIState: function PDFFindController_updateUIState(state, previous) {
+    }
+  }, {
+    key: 'updateUIState',
+    value: function updateUIState(state, previous) {
       if (this.onUpdateState) {
         this.onUpdateState(state, previous, this.matchCount);
       }
     }
-  };
+  }]);
+
   return PDFFindController;
 }();
-exports.FindStates = FindStates;
+
+exports.FindState = FindState;
 exports.PDFFindController = PDFFindController;
 
 /***/ }),

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
web/pdf_viewer.js.map


Некоторые файлы не были показаны из-за большого количества измененных файлов