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