Google is the default search bar engine.

This commit is contained in:
blakeross%telocity.com 2003-08-07 09:00:28 +00:00
Родитель 6ef6f731d0
Коммит 86e65ef137
4 изменённых файлов: 22 добавлений и 31 удалений

Просмотреть файл

@ -1385,28 +1385,12 @@ function PageProxyDragGesture(aEvent)
return false; return false;
} }
function SearchBarPopupShowing(aEvent)
{
var searchBar = document.getElementById("search-bar");
var searchMode = searchBar.searchMode;
var popup = document.getElementById("SearchBarPopup");
var node = popup.firstChild;
while (node) {
node.setAttribute("checked", node.id == searchMode);
node = node.nextSibling;
}
var findItem = document.getElementById("miSearchModeFind");
findItem.setAttribute("checked", !searchMode);
}
function SearchBarPopupCommand(aEvent) function SearchBarPopupCommand(aEvent)
{ {
var searchBar = document.getElementById("search-bar"); var searchBar = document.getElementById("search-bar");
if (aEvent.target.id == "miSearchModeFind") { if (aEvent.target.id == "miSearchModeFind") {
searchBar.removeAttribute("searchmode"); searchBar.setAttribute("searchmode", "__PhoenixFindInPage");
searchBar.setAttribute("autocompletesearchparam", "__PhoenixFindInPage"); searchBar.setAttribute("autocompletesearchparam", "__PhoenixFindInPage");
gPrefService.setCharPref("browser.search.defaultengine", ""); gPrefService.setCharPref("browser.search.defaultengine", "");
@ -1434,7 +1418,7 @@ function handleSearchBarCommand(aEvent)
gFormHistory.addEntry(searchBar.getAttribute("autocompletesearchparam"), searchBar.value); gFormHistory.addEntry(searchBar.getAttribute("autocompletesearchparam"), searchBar.value);
} }
if (searchBar.hasAttribute("searchmode")) { if (searchBar.getAttribute("searchmode") != "__PhoenixFindInPage") {
gURLBar.value = searchBar.searchValue; gURLBar.value = searchBar.searchValue;
BrowserLoadURL(aEvent); BrowserLoadURL(aEvent);
} else { } else {

Просмотреть файл

@ -159,8 +159,6 @@
<command id="cmd_textZoomEnlarge" oncommand="ZoomManager.prototype.getInstance().enlarge();"/> <command id="cmd_textZoomEnlarge" oncommand="ZoomManager.prototype.getInstance().enlarge();"/>
<command id="Browser:OpenLocation" oncommand="openLocation();"/> <command id="Browser:OpenLocation" oncommand="openLocation();"/>
<command id="Tools:Search" oncommand="focusSearchBar();"/>
#ifdef XP_MACOSX #ifdef XP_MACOSX
<command id="minimizeWindow" label="&minimizeWindow.label;" disabled="true"/> <command id="minimizeWindow" label="&minimizeWindow.label;" disabled="true"/>
#endif #endif
@ -194,7 +192,7 @@
<key id="key_newNavigatorTab" key="&tabCmd.commandkey;" modifiers="accel" command="cmd_newNavigatorTab"/> <key id="key_newNavigatorTab" key="&tabCmd.commandkey;" modifiers="accel" command="cmd_newNavigatorTab"/>
<key id="focusURLBar" key="&openCmd.commandkey;" command="Browser:OpenLocation" <key id="focusURLBar" key="&openCmd.commandkey;" command="Browser:OpenLocation"
modifiers="accel"/> modifiers="accel"/>
<key id="focusSearchBar" key="&searchFocus.commandkey;" command="Tools:Search" modifiers="accel"/> <key id="focusSearchBar" key="&searchFocus.commandkey;" oncommand="focusSearchBar();" modifiers="accel"/>
<key id="openFileKb" key="&openFileCmd.commandkey;" command="Browser:OpenFile" modifiers="accel"/> <key id="openFileKb" key="&openFileCmd.commandkey;" command="Browser:OpenFile" modifiers="accel"/>
<key id="key_savePage" key="&savePageCmd.commandkey;" command="Browser:SavePage" modifiers="accel"/> <key id="key_savePage" key="&savePageCmd.commandkey;" command="Browser:SavePage" modifiers="accel"/>
<key id="printKb" key="&printCmd.commandkey;" command="Browser:Print" modifiers="accel"/> <key id="printKb" key="&printCmd.commandkey;" command="Browser:Print" modifiers="accel"/>
@ -282,10 +280,9 @@
<popup id="SearchBarPopup" position="after_start" <popup id="SearchBarPopup" position="after_start"
datasources="rdf:internetsearch" ref="NC:SearchEngineRoot" datasources="rdf:internetsearch" ref="NC:SearchEngineRoot"
oncommand="return SearchBarPopupCommand(event);" oncommand="return SearchBarPopupCommand(event);">
onpopupshowing="return SearchBarPopupShowing(event);"> <menuitem id="miSearchModeFind" class="menuitem-iconic"
<menuitem id="miSearchModeFind" type="checkbox" label="&findOnSearchBarCmd.label;"/>
label="&findOnSearchBarCmd.label;" accesskey="&findOnCmd.accesskey;"/>
<menuseparator/> <menuseparator/>
<template> <template>

Просмотреть файл

@ -8,12 +8,7 @@
<binding id="searchbar" extends="chrome://global/content/widgets/autocomplete.xml#autocomplete"> <binding id="searchbar" extends="chrome://global/content/widgets/autocomplete.xml#autocomplete">
<implementation> <implementation>
<constructor><![CDATA[ <constructor><![CDATA[
var pbi = this.mPrefs.QueryInterface(Components.interfaces.nsIPrefBranchInternal); setTimeout(function(a) { a.initialize(); }, 0, this);
if (pbi)
pbi.addObserver("browser.search", this.mPrefObserver, false);
if (this.hasAttribute("searchmode"))
updateEngines();
]]></constructor> ]]></constructor>
<destructor><![CDATA[ <destructor><![CDATA[
@ -70,8 +65,19 @@
</getter> </getter>
</property> </property>
<method name="initialize">
<body><![CDATA[
var pbi = this.mPrefs.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
if (pbi)
pbi.addObserver("browser.search", this.mPrefObserver, false);
this.updateEngines();
]]></body>
</method>
<method name="updateEngines"> <method name="updateEngines">
<body><![CDATA[ <body><![CDATA[
if (this.getAttribute("searchmode") == "__PhoenixFindInPage")
return;
var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"] var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
.getService(Components.interfaces.nsIRDFService); .getService(Components.interfaces.nsIRDFService);
try { try {

Просмотреть файл

@ -587,6 +587,10 @@ statusbarpanel#statusbar-display {
list-style-image: url("chrome://browser/skin/Search-bar.png"); list-style-image: url("chrome://browser/skin/Search-bar.png");
} }
#miSearchModeFind {
list-style-image: url("chrome://browser/skin/Search-bar.png");
}
/* ::::: autocomplete ::::: */ /* ::::: autocomplete ::::: */
.autocomplete-treebody::-moz-tree-cell-text(treecolAutoCompleteComment) { .autocomplete-treebody::-moz-tree-cell-text(treecolAutoCompleteComment) {