From 6cd9ae01cc2cea9d6fbd22670b0b2a1ebf3eef48 Mon Sep 17 00:00:00 2001 From: Artur Adib Date: Mon, 21 May 2012 11:15:24 -0400 Subject: [PATCH] Enable/disable search via about:config pref --- extensions/firefox/components/PdfStreamConverter.js | 3 +++ web/viewer.html | 2 +- web/viewer.js | 7 ++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/extensions/firefox/components/PdfStreamConverter.js b/extensions/firefox/components/PdfStreamConverter.js index 1bcccbe22..f866a6b2f 100644 --- a/extensions/firefox/components/PdfStreamConverter.js +++ b/extensions/firefox/components/PdfStreamConverter.js @@ -161,6 +161,9 @@ ChromeActions.prototype = { }, pdfBugEnabled: function() { return getBoolPref(EXT_PREFIX + '.pdfBugEnabled', false); + }, + searchEnabled: function() { + return getBoolPref(EXT_PREFIX + '.searchEnabled', false); } }; diff --git a/web/viewer.html b/web/viewer.html index ff3a21455..11c6ad0b7 100644 --- a/web/viewer.html +++ b/web/viewer.html @@ -51,7 +51,7 @@ - diff --git a/web/viewer.js b/web/viewer.js index 1fbd91f1d..b9407305d 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -733,7 +733,7 @@ var PDFView = { var thumbsView = document.getElementById('thumbnailView'); var outlineView = document.getElementById('outlineView'); var searchView = document.getElementById('searchView'); - + var thumbsButton = document.getElementById('viewThumbnail'); var outlineButton = document.getElementById('viewOutline'); var searchButton = document.getElementById('viewSearch'); @@ -1490,6 +1490,11 @@ window.addEventListener('load', function webViewerLoad(evt) { PDFBug.init(); } + if (!PDFJS.isFirefoxExtension || + (PDFJS.isFirefoxExtension && FirefoxCom.request('searchEnabled'))) { + document.querySelector('#viewSearch').classList.remove('hidden'); + } + var thumbsView = document.getElementById('thumbnailView'); thumbsView.addEventListener('scroll', updateThumbViewArea, true);