Use "find" instead of both find & search
This commit is contained in:
parent
d94bbad575
commit
6864a07221
@ -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;
|
||||
|
@ -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=مزيد من المعلومات
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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=詳細情報
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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=更多資訊
|
||||
|
@ -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;
|
||||
|
@ -88,8 +88,8 @@ limitations under the License.
|
||||
<button id="viewOutline" class="toolbarButton group" title="Show Document Outline" tabindex="2" data-l10n-id="outline">
|
||||
<span data-l10n-id="outline_label">Document Outline</span>
|
||||
</button>
|
||||
<button id="viewSearch" class="toolbarButton group hidden" title="Search Document" tabindex="3" data-l10n-id="search_panel">
|
||||
<span data-l10n-id="search_panel_label">Search Document</span>
|
||||
<button id="viewFind" class="toolbarButton group" title="Find in Document" tabindex="3" data-l10n-id="find_panel">
|
||||
<span data-l10n-id="find_panel_label">Find in Document</span>
|
||||
</button>
|
||||
</div>
|
||||
<div id="sidebarContent">
|
||||
@ -97,12 +97,12 @@ limitations under the License.
|
||||
</div>
|
||||
<div id="outlineView" class="hidden">
|
||||
</div>
|
||||
<div id="searchView" class="hidden">
|
||||
<div id="searchToolbar">
|
||||
<input id="searchTermsInput" class="toolbarField">
|
||||
<button id="searchButton" class="textButton toolbarButton" data-l10n-id="search">Find</button>
|
||||
<div id="findView" class="hidden">
|
||||
<div id="findToolbar">
|
||||
<input id="findTermsInput" class="toolbarField">
|
||||
<button id="findButton" class="textButton toolbarButton" data-l10n-id="find">Find</button>
|
||||
</div>
|
||||
<div id="searchResults"></div>
|
||||
<div id="findResults"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- sidebarContainer -->
|
||||
|
@ -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 <SEARCH_TIMEOUT>ms.
|
||||
var SEARCH_TIMEOUT = 250;
|
||||
var lastSearch = this.lastSearch;
|
||||
find: function pdfViewStartFind() {
|
||||
// Limit this function to run every <FIND_TIMEOUT>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();
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user