From 6864a072215619c6c650a4600ea21a98c1288903 Mon Sep 17 00:00:00 2001 From: Artur Adib Date: Tue, 25 Sep 2012 16:17:27 -0400 Subject: [PATCH] Use "find" instead of both find & search --- .../firefox/components/PdfStreamConverter.js | 4 +- l10n/ar/viewer.properties | 10 +-- l10n/da/viewer.properties | 8 +- l10n/en-US/viewer.properties | 10 +-- l10n/es/viewer.properties | 10 +-- l10n/fi/viewer.properties | 10 +-- l10n/ja/viewer.properties | 10 +-- l10n/nl/viewer.properties | 10 +-- l10n/sv/viewer.properties | 10 +-- l10n/zh-TW/viewer.properties | 8 +- web/viewer.css | 16 ++-- web/viewer.html | 14 ++-- web/viewer.js | 82 +++++++++---------- 13 files changed, 101 insertions(+), 101 deletions(-) diff --git a/extensions/firefox/components/PdfStreamConverter.js b/extensions/firefox/components/PdfStreamConverter.js index 76b7788a8..58d142204 100644 --- a/extensions/firefox/components/PdfStreamConverter.js +++ b/extensions/firefox/components/PdfStreamConverter.js @@ -317,8 +317,8 @@ ChromeActions.prototype = { pdfBugEnabled: function() { return getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false); }, - searchEnabled: function() { - return getBoolPref(PREF_PREFIX + '.searchEnabled', false); + findEnabled: function() { + return getBoolPref(PREF_PREFIX + '.findEnabled', false); }, fallback: function(url, sendResponse) { var self = this; diff --git a/l10n/ar/viewer.properties b/l10n/ar/viewer.properties index 3ef9c1cd0..d1ceae44e 100644 --- a/l10n/ar/viewer.properties +++ b/l10n/ar/viewer.properties @@ -36,8 +36,8 @@ outline.title=إظهار ملخص المستند outline_label=ملخص المستند thumbs.title=إظهار الصور المصغرة thumbs_label=الصور المصغرة -search_panel.title=البحث في المستند -search_panel_label=بحث +find_panel.title=البحث في المستند +find_panel_label=بحث # Document outline messages no_outline=لا يوجد ملخص @@ -54,9 +54,9 @@ thumb_page_canvas=صورة مصغرة من الصفحة {{page}} page_rotate_cw.label=تدوير مع عقارب الساعة page_rotate_ccw.label=تدوير عكس عقارب الساعة -# Search panel button title and messages -search=بحث -search_terms_not_found=(لا يوجد) +# Find panel button title and messages +find=بحث +find_terms_not_found=(لا يوجد) # Error panel labels error_more_info=مزيد من المعلومات diff --git a/l10n/da/viewer.properties b/l10n/da/viewer.properties index 72e04bb62..90231c7ca 100644 --- a/l10n/da/viewer.properties +++ b/l10n/da/viewer.properties @@ -36,8 +36,8 @@ outline.title=Vis dokumentoversigt outline_label=Dokumentoversigt thumbs.title=Vis thumbnails thumbs_label=Thumbnails -search_panel.title=Søg i dokumentet -search_panel_label=Søg +find_panel.title=Søg i dokumentet +find_panel_label=Søg # Dokumentoversigtsbeskeder no_outline=Ingen dokumentoversigt tilgængelig @@ -51,8 +51,8 @@ thumb_page_title=Side {{page}} thumb_page_canvas=Thumbnail af side {{page}} # Søgepanelet -search=Søg -search_terms_not_found=(Ikke fundet) +find=Søg +find_terms_not_found=(Ikke fundet) # Fejlpanel error_more_info=Mere information diff --git a/l10n/en-US/viewer.properties b/l10n/en-US/viewer.properties index 6afb232e7..678e23c8e 100644 --- a/l10n/en-US/viewer.properties +++ b/l10n/en-US/viewer.properties @@ -36,8 +36,8 @@ outline.title=Show Document Outline outline_label=Document Outline thumbs.title=Show Thumbnails thumbs_label=Thumbnails -search_panel.title=Search Document -search_panel_label=Search +find_panel.title=Find in Document +find_panel_label=Find # Document outline messages no_outline=No Outline Available @@ -54,9 +54,9 @@ thumb_page_canvas=Thumbnail of Page {{page}} page_rotate_cw.label=Rotate Clockwise page_rotate_ccw.label=Rotate Counter-Clockwise -# Search panel button title and messages -search=Find -search_terms_not_found=(Not found) +# Find panel button title and messages +find=Find +find_terms_not_found=(Not found) # Error panel labels error_more_info=More Information diff --git a/l10n/es/viewer.properties b/l10n/es/viewer.properties index 8485cbf17..bac4cee67 100644 --- a/l10n/es/viewer.properties +++ b/l10n/es/viewer.properties @@ -36,8 +36,8 @@ outline.title=Mostrar esquema del documento outline_label=Esquema del documento thumbs.title=Mostrar miniaturas thumbs_label=Miniaturas -search_panel.title=Buscar en el documento -search_panel_label=Buscar +find_panel.title=Buscar en el documento +find_panel_label=Buscar # Document outline messages no_outline=No hay un esquema disponible @@ -50,9 +50,9 @@ thumb_page_title=Página {{page}} # number. thumb_page_canvas=Miniatura de la página {{page}} -# Search panel button title and messages -search=Buscar -search_terms_not_found=(No encontrado) +# Find panel button title and messages +find=Buscar +find_terms_not_found=(No encontrado) # Error panel labels error_more_info=Más información diff --git a/l10n/fi/viewer.properties b/l10n/fi/viewer.properties index 4cc0ba70e..5fcde5eaf 100644 --- a/l10n/fi/viewer.properties +++ b/l10n/fi/viewer.properties @@ -36,8 +36,8 @@ outline.title=Näytä asiakirjan jäsennys outline_label=Asiakirjan jäsennys thumbs.title=Näytä esikatselukuvat thumbs_label=Esikatselukuvat -search_panel.title=Etsi asiakirjasta -search_panel_label=Etsi +find_panel.title=Etsi asiakirjasta +find_panel_label=Etsi # Document outline messages no_outline=Jäsennystä ei ole tarjolla @@ -50,9 +50,9 @@ thumb_page_title=Sivu {{page}} # number. thumb_page_canvas=Sivun {{page}} esikatselukuva -# Search panel button title and messages -search=Etsi -search_terms_not_found=(Ei löytynyt) +# Find panel button title and messages +find=Etsi +find_terms_not_found=(Ei löytynyt) # Error panel labels error_more_info=Enemmän tietoa diff --git a/l10n/ja/viewer.properties b/l10n/ja/viewer.properties index 33f00ac4c..a79d65940 100644 --- a/l10n/ja/viewer.properties +++ b/l10n/ja/viewer.properties @@ -36,8 +36,8 @@ outline.title=文書の目次 outline_label=文書の目次 thumbs.title=縮小版 thumbs_label=縮小版 -search_panel.title=検索 -search_panel_label=検索 +find_panel.title=検索 +find_panel_label=検索 # Document outline messages no_outline=利用可能な目次はありません @@ -54,9 +54,9 @@ thumb_page_canvas=ページの縮小版 {{page}} page_rotate_cw.label=右回転 page_rotate_ccw.label=左回転 -# Search panel button title and messages -search=検索 -search_terms_not_found=(見つかりませんでした) +# Find panel button title and messages +find=検索 +find_terms_not_found=(見つかりませんでした) # Error panel labels error_more_info=詳細情報 diff --git a/l10n/nl/viewer.properties b/l10n/nl/viewer.properties index 5164862ea..45bbec253 100644 --- a/l10n/nl/viewer.properties +++ b/l10n/nl/viewer.properties @@ -34,8 +34,8 @@ outline.title=Toon document structuur outline_label=Document structuur thumbs.title=Toon miniaturen thumbs_label=Miniaturen -search_panel.title=Doorzoek document -search_panel_label=Zoek +find_panel.title=Doorzoek document +find_panel_label=Zoek # Document outline messages no_outline=Geen structuur beschikbaar @@ -48,9 +48,9 @@ thumb_page_title=Pagina {{page}} # number. thumb_page_canvas=Miniatuur van pagina {{page}} -# Search panel button title and messages -search=Zoek -search_terms_not_found=(Niet gevonden) +# Find panel button title and messages +find=Zoek +find_terms_not_found=(Niet gevonden) # Error panel labels error_more_info=Meer informatie diff --git a/l10n/sv/viewer.properties b/l10n/sv/viewer.properties index 81d4a3958..e09418442 100644 --- a/l10n/sv/viewer.properties +++ b/l10n/sv/viewer.properties @@ -34,8 +34,8 @@ outline.title=Visa dokumentdisposition outline_label=Dokumentdisposition thumbs.title=Visa miniatyrer thumbs_label=Miniatyrer -search_panel.title=Sök i dokumentet -search_panel_label=Sök +find_panel.title=Sök i dokumentet +find_panel_label=Sök # Document outline messages no_outline=Ingen dokumentdisposition tillgänglig @@ -48,9 +48,9 @@ thumb_page_title=Sida {{page}} # number. thumb_page_canvas=Miniatyr av sida {{page}} -# Search panel button title and messages -search=Hitta -search_terms_not_found=(hittades inte) +# Find panel button title and messages +find=Hitta +find_terms_not_found=(hittades inte) # Error panel labels error_more_info=Mer information diff --git a/l10n/zh-TW/viewer.properties b/l10n/zh-TW/viewer.properties index b7ff63235..99d85811b 100644 --- a/l10n/zh-TW/viewer.properties +++ b/l10n/zh-TW/viewer.properties @@ -34,8 +34,8 @@ outline.title=顯示文件綱要 outline_label=文件綱要 thumbs.title=顯示縮圖 thumbs_label=縮圖 -search_panel.title=搜索文件 -search_panel_label=搜索 +find_panel.title=搜索文件 +find_panel_label=搜索 # 文件綱要相關訊息 no_outline=無可用的綱要 @@ -51,8 +51,8 @@ page_rotate_cw.label=順時針旋轉 page_rotate_ccw.label=逆時針旋轉 # 搜尋面板按鍵文字及訊息 -search=搜索 -search_terms_not_found=(沒有找到) +find=搜索 +find_terms_not_found=(沒有找到) # 錯誤面板標籤 error_more_info=更多資訊 diff --git a/web/viewer.css b/web/viewer.css index caf3a09f1..bf172fe5b 100644 --- a/web/viewer.css +++ b/web/viewer.css @@ -728,7 +728,7 @@ html[dir='rtl'] .toolbarButton.pageDown::before { content: url(images/toolbarButton-viewOutline.png); } -#viewSearch.toolbarButton::before { +#viewFind.toolbarButton::before { display: inline-block; content: url(images/toolbarButton-search.png); } @@ -871,7 +871,7 @@ a:focus > .thumbnail > .thumbnailSelectionRing, } .outlineItem > a, -#searchResults > a { +#findResults > a { text-decoration: none; display: inline-block; min-width: 95%; @@ -888,7 +888,7 @@ a:focus > .thumbnail > .thumbnailSelectionRing, } .outlineItem > a:hover, -#searchResults > a:hover { +#findResults > a:hover { background-color: hsla(0,0%,100%,.02); background-image: -moz-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); background-clip: padding-box; @@ -915,7 +915,7 @@ a:focus > .thumbnail > .thumbnailSelectionRing, font-style: italic; } -#searchScrollView { +#findScrollView { position: absolute; top: 10px; bottom: 10px; @@ -923,26 +923,26 @@ a:focus > .thumbnail > .thumbnailSelectionRing, width: 280px; } -#searchToolbar { +#findToolbar { padding-left: 0px; right: 0px; padding-top: 0px; padding-bottom: 5px; } -#searchToolbar > input { +#findToolbar > input { margin-left: 4px; width: 124px; } -#searchToolbar button { +#findToolbar button { width: auto; margin: 0; padding: 0 6px; height: 22px; } -#searchResults { +#findResults { overflow: auto; position: absolute; top: 30px; diff --git a/web/viewer.html b/web/viewer.html index 0ee6313a6..836cc554a 100644 --- a/web/viewer.html +++ b/web/viewer.html @@ -88,8 +88,8 @@ limitations under the License. -
@@ -97,12 +97,12 @@ limitations under the License.
- diff --git a/web/viewer.js b/web/viewer.js index aa91f5da0..f7ed8a7aa 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -211,7 +211,7 @@ var currentPageNumber = 1; var PDFFindController = { startedTextExtraction: false, - // If active, search resulsts will be highlighted. + // If active, find results will be highlighted. active: false, // Stores the text for each page. @@ -244,7 +244,7 @@ var PDFFindController = { }, calcFindMatch: function(pageContent) { - // TODO: Handle the other search options here as well. + // TODO: Handle the other find options here as well. var query = this.state.query; var queryLen = query.length; @@ -274,7 +274,7 @@ var PDFFindController = { function extractPageText(pageIndex) { PDFView.pages[pageIndex].getTextContent().then( function textContentResolved(data) { - // Bulid the search string. + // Build the find string. var bidiTexts = data.bidiTexts; var str = ''; @@ -434,7 +434,7 @@ var PDFFindBar = { initialize: function() { this.bar = document.getElementById('findbar'); - this.toggleButton = document.getElementById('viewSearch'); + this.toggleButton = document.getElementById('viewFind'); this.findField = document.getElementById('findInput'); this.highlightAll = document.getElementById('findHighlightAll'); this.caseSensitive = document.getElementById('findMatchCase'); @@ -1224,39 +1224,39 @@ var PDFView = { return true; }, - search: function pdfViewStartSearch() { - // Limit this function to run every ms. - var SEARCH_TIMEOUT = 250; - var lastSearch = this.lastSearch; + find: function pdfViewStartFind() { + // Limit this function to run every ms. + var FIND_TIMEOUT = 250; + var lastFind = this.lastFind; var now = Date.now(); - if (lastSearch && (now - lastSearch) < SEARCH_TIMEOUT) { - if (!this.searchTimer) { - this.searchTimer = setTimeout(function resumeSearch() { - PDFView.search(); + if (lastFind && (now - lastFind) < FIND_TIMEOUT) { + if (!this.findTimer) { + this.findTimer = setTimeout(function resumeFind() { + PDFView.find(); }, - SEARCH_TIMEOUT - (now - lastSearch) + FIND_TIMEOUT - (now - lastFind) ); } return; } - this.searchTimer = null; - this.lastSearch = now; + this.FindTimer = null; + this.lastFind = now; function bindLink(link, pageNumber) { link.href = '#' + pageNumber; - link.onclick = function searchBindLink() { + link.onclick = function findBindLink() { PDFView.page = pageNumber; return false; }; } - var searchResults = document.getElementById('searchResults'); + var findResults = document.getElementById('findResults'); - var searchTermsInput = document.getElementById('searchTermsInput'); - searchResults.removeAttribute('hidden'); - searchResults.textContent = ''; + var findTermsInput = document.getElementById('findTermsInput'); + findResults.removeAttribute('hidden'); + findResults.textContent = ''; - var terms = searchTermsInput.value; + var terms = findTermsInput.value; if (!terms) return; @@ -1276,17 +1276,17 @@ var PDFView = { var link = document.createElement('a'); bindLink(link, pageNumber); link.textContent = 'Page ' + pageNumber + ': ' + textSample; - searchResults.appendChild(link); + findResults.appendChild(link); pageFound = true; } if (!pageFound) { - searchResults.textContent = ''; + findResults.textContent = ''; var noResults = document.createElement('div'); noResults.classList.add('noResults'); - noResults.textContent = mozL10n.get('search_terms_not_found', null, + noResults.textContent = mozL10n.get('find_terms_not_found', null, '(Not found)'); - searchResults.appendChild(noResults); + findResults.appendChild(noResults); } }, @@ -1331,20 +1331,20 @@ var PDFView = { switchSidebarView: function pdfViewSwitchSidebarView(view) { var thumbsView = document.getElementById('thumbnailView'); var outlineView = document.getElementById('outlineView'); - var searchView = document.getElementById('searchView'); + var findView = document.getElementById('findView'); var thumbsButton = document.getElementById('viewThumbnail'); var outlineButton = document.getElementById('viewOutline'); - var searchButton = document.getElementById('viewSearch'); + var findButton = document.getElementById('viewFind'); switch (view) { case 'thumbs': thumbsButton.classList.add('toggled'); outlineButton.classList.remove('toggled'); - searchButton.classList.remove('toggled'); + findButton.classList.remove('toggled'); thumbsView.classList.remove('hidden'); outlineView.classList.add('hidden'); - searchView.classList.add('hidden'); + findView.classList.add('hidden'); PDFView.renderHighestPriority(); break; @@ -1352,25 +1352,25 @@ var PDFView = { case 'outline': thumbsButton.classList.remove('toggled'); outlineButton.classList.add('toggled'); - searchButton.classList.remove('toggled'); + findButton.classList.remove('toggled'); thumbsView.classList.add('hidden'); outlineView.classList.remove('hidden'); - searchView.classList.add('hidden'); + findView.classList.add('hidden'); if (outlineButton.getAttribute('disabled')) return; break; - case 'search': + case 'find': thumbsButton.classList.remove('toggled'); outlineButton.classList.remove('toggled'); - searchButton.classList.add('toggled'); + findButton.classList.add('toggled'); thumbsView.classList.add('hidden'); outlineView.classList.add('hidden'); - searchView.classList.remove('hidden'); + findView.classList.remove('hidden'); - var searchTermsInput = document.getElementById('searchTermsInput'); - searchTermsInput.focus(); + var findTermsInput = document.getElementById('findTermsInput'); + findTermsInput.focus(); // Start text extraction as soon as the search gets displayed. this.extractText(); break; @@ -1386,7 +1386,7 @@ var PDFView = { self.pages[pageIndex].pdfPage.getTextContent().then( function textContentResolved(textContent) { self.pageText[pageIndex] = textContent.join(''); - self.search(); + self.find(); if ((pageIndex + 1) < self.pages.length) extractPageText(pageIndex + 1); } @@ -2545,8 +2545,8 @@ document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) { //#if !(FIREFOX || MOZCENTRAL) //#else -//if (FirefoxCom.requestSync('searchEnabled')) { -// document.querySelector('#viewSearch').classList.remove('hidden'); +//if (FirefoxCom.requestSync('findEnabled')) { +// document.querySelector('#viewFind').classList.remove('hidden'); //} //#endif @@ -2636,10 +2636,10 @@ document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) { PDFView.download(); }); - document.getElementById('searchTermsInput').addEventListener('keydown', + document.getElementById('findTermsInput').addEventListener('keydown', function(event) { if (event.keyCode == 13) { - PDFView.search(); + PDFView.find(); } });