Bug 337654 - Find (ctrl-f) and FAYT (/ or ') should be visually distinct. ui=beltzner, r=mconnor

git-svn-id: svn://10.0.0.236/trunk@199445 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jwalden%mit.edu 2006-06-07 20:33:38 +00:00
parent a4475004a2
commit 4a162a2938
4 changed files with 53 additions and 14 deletions

View File

@ -2,8 +2,8 @@
<toolbarbutton id="find-closebutton" tooltiptext="&findCloseButton.tooltip;"
oncommand="gFindBar.closeFindBar();"/>
<label control="find-field" value="&find.label;"/>
<hbox id="find-field-container">
<label control="find-field" id="find-label" class="find-fast"/>
<hbox id="find-field-container" class="find-fast">
<textbox id="find-field" oninput="gFindBar.find(this.value);"
onkeypress="gFindBar.onFindBarKeyPress(event);"
onblur="gFindBar.onFindBarBlur();"
@ -32,4 +32,3 @@
<image id="find-status-icon"/>
<label id="find-status"/>
</toolbar>

View File

@ -400,23 +400,37 @@ var gFindBar = {
}
},
openFindBar: function ()
/**
* Opens and displays the find bar.
*
* @param showMinimalUI
* true if the find bar is to contain minimalist UI, false (or
* undefined, as happens if no arguments are provided) if the find
* bar is to display more generalized search UI
* @returns bool
* true if the find bar wasn't previously open, false otherwise
*/
openFindBar: function (showMinimalUI)
{
// Notify anyone else that might want to handle this event
var findActivatedEvent = document.createEvent("Events");
findActivatedEvent.initEvent("find-activated", false, true);
window.dispatchEvent(findActivatedEvent);
if (!this.mFindEnabled)
throw Components.results.NS_OK;
// Notify anyone else that might want to handle this event
var findActivatedEvent = document.createEvent("Events");
findActivatedEvent.initEvent("find-activated", false, true);
window.dispatchEvent(findActivatedEvent);
if (!this.mFindEnabled)
throw Components.results.NS_OK;
if (!this.mNotFoundStr || !this.mWrappedToTopStr ||
!this.mWrappedToBottomStr) {
!this.mWrappedToBottomStr || !this.mNormalFindStr ||
!this.mFastFindStr) {
var bundle = document.getElementById("bundle_findBar");
this.mNotFoundStr = bundle.getString("NotFound");
this.mWrappedToTopStr = bundle.getString("WrappedToTop");
this.mWrappedToBottomStr = bundle.getString("WrappedToBottom");
this.mNormalFindStr = bundle.getString("NormalFindLabel");
this.mFastFindStr = bundle.getString("FastFindLabel");
}
this.updateFindUI(showMinimalUI);
var findToolbar = document.getElementById("FindToolbar");
if (findToolbar.hidden) {
findToolbar.hidden = false;
@ -667,7 +681,7 @@ var gFindBar = {
FIND_LINKS : FIND_TYPEAHEAD;
this.setFindMode(findMode);
try {
var opened = this.openFindBar();
var opened = this.openFindBar(true);
}
catch (e) {
return;
@ -767,6 +781,32 @@ var gFindBar = {
findNext.disabled = findPrev.disabled = highlight.disabled = !aEnable;
},
/**
* Determines whether minimalist or general-purpose search UI is to be
* displayed when the find bar is activated.
*
* @param showMinimalUI
* true if minimalist UI should be used, false if general-purpose UI
* should be used
*/
updateFindUI: function (showMinimalUI)
{
var findBar = document.getElementById("FindToolbar");
for (var i = 0; i < findBar.childNodes.length; i++) {
var node = findBar.childNodes[i];
if (node.className == "find-fast")
continue;
node.hidden = showMinimalUI;
}
var findLabel = document.getElementById("find-label");
if (showMinimalUI)
findLabel.value = this.mFastFindStr;
else
findLabel.value = this.mNormalFindStr;
},
updateFoundLink: function (res)
{
var val = document.getElementById("find-field").value;

View File

@ -2,7 +2,6 @@
<!-- LOCALIZATION NOTE : FILE use the Find Bar. -->
<!-- entities split out from browser.dtd -->
<!ENTITY find.label "Find:">
<!ENTITY next.label "Next">
<!ENTITY next.accesskey "N">
<!ENTITY next.tooltip "Find the next occurrence of the phrase">
@ -16,4 +15,3 @@
<!ENTITY highlight.macTooltip "Highlight all occurrences of the phrase (Cmd+Return)">
<!ENTITY caseSensitiveCheckbox.label "Match case">
<!ENTITY caseSensitiveCheckbox.accesskey "c">

View File

@ -2,3 +2,5 @@
NotFound=Phrase not found
WrappedToTop=Reached end of page, continued from top
WrappedToBottom=Reached top of page, continued from bottom
NormalFindLabel=Find:
FastFindLabel=Quick Find: