Converting PDFFindBar and PDFFindController to classes
This commit is contained in:
parent
2e98f9095e
commit
dbe22475e1
5 changed files with 442 additions and 440 deletions
|
@ -14,13 +14,13 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals PDFJS, PDFBug, FirefoxCom, Stats, Cache, PDFFindBar, CustomStyle,
|
||||
PDFFindController, ProgressBar, TextLayerBuilder, DownloadManager,
|
||||
getFileName, scrollIntoView, getPDFFileNameFromURL, PDFHistory,
|
||||
Preferences, SidebarView, ViewHistory, PageView, ThumbnailView, URL,
|
||||
noContextMenuHandler, SecondaryToolbar, PasswordPrompt,
|
||||
PresentationMode, HandTool, Promise, DocumentProperties,
|
||||
DocumentOutlineView, DocumentAttachmentsView, OverlayManager */
|
||||
/* globals PDFJS, PDFBug, FirefoxCom, Stats, Cache, CustomStyle, ProgressBar,
|
||||
DownloadManager, getFileName, scrollIntoView, getPDFFileNameFromURL,
|
||||
PDFHistory, Preferences, SidebarView, ViewHistory, PageView,
|
||||
ThumbnailView, URL, noContextMenuHandler, SecondaryToolbar,
|
||||
PasswordPrompt, PresentationMode, HandTool, Promise,
|
||||
DocumentProperties, DocumentOutlineView, DocumentAttachmentsView,
|
||||
OverlayManager, PDFFindController, PDFFindBar */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -144,7 +144,12 @@ var PDFView = {
|
|||
|
||||
Preferences.initialize();
|
||||
|
||||
PDFFindBar.initialize({
|
||||
this.findController = new PDFFindController({
|
||||
pdfPageSource: this,
|
||||
integratedFind: this.supportsIntegratedFind
|
||||
});
|
||||
|
||||
this.findBar = new PDFFindBar({
|
||||
bar: document.getElementById('findbar'),
|
||||
toggleButton: document.getElementById('viewFind'),
|
||||
findField: document.getElementById('findInput'),
|
||||
|
@ -153,13 +158,11 @@ var PDFView = {
|
|||
findMsg: document.getElementById('findMsg'),
|
||||
findStatusIcon: document.getElementById('findStatusIcon'),
|
||||
findPreviousButton: document.getElementById('findPrevious'),
|
||||
findNextButton: document.getElementById('findNext')
|
||||
findNextButton: document.getElementById('findNext'),
|
||||
findController: this.findController
|
||||
});
|
||||
|
||||
PDFFindController.initialize({
|
||||
pdfPageSource: this,
|
||||
integratedFind: this.supportsIntegratedFind
|
||||
});
|
||||
this.findController.setFindBar(this.findBar);
|
||||
|
||||
HandTool.initialize({
|
||||
container: container,
|
||||
|
@ -938,7 +941,7 @@ var PDFView = {
|
|||
};
|
||||
}
|
||||
|
||||
PDFFindController.reset();
|
||||
PDFView.findController.reset();
|
||||
|
||||
this.pdfDocument = pdfDocument;
|
||||
|
||||
|
@ -1027,7 +1030,7 @@ var PDFView = {
|
|||
|
||||
PDFView.loadingBar.setWidth(container);
|
||||
|
||||
PDFFindController.resolveFirstPage();
|
||||
PDFView.findController.resolveFirstPage();
|
||||
|
||||
// Initialize the browsing history.
|
||||
PDFHistory.initialize(self.documentFingerprint);
|
||||
|
@ -2236,13 +2239,13 @@ window.addEventListener('keydown', function keydown(evt) {
|
|||
switch (evt.keyCode) {
|
||||
case 70: // f
|
||||
if (!PDFView.supportsIntegratedFind) {
|
||||
PDFFindBar.open();
|
||||
PDFView.findBar.open();
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
case 71: // g
|
||||
if (!PDFView.supportsIntegratedFind) {
|
||||
PDFFindBar.dispatchEvent('again', cmd === 5 || cmd === 12);
|
||||
PDFView.findBar.dispatchEvent('again', cmd === 5 || cmd === 12);
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
|
@ -2343,8 +2346,8 @@ window.addEventListener('keydown', function keydown(evt) {
|
|||
SecondaryToolbar.close();
|
||||
handled = true;
|
||||
}
|
||||
if (!PDFView.supportsIntegratedFind && PDFFindBar.opened) {
|
||||
PDFFindBar.close();
|
||||
if (!PDFView.supportsIntegratedFind && PDFView.findBar.opened) {
|
||||
PDFView.findBar.close();
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue