зеркало из https://github.com/mozilla/pjs.git
Google is the default search bar engine.
This commit is contained in:
Родитель
6ef6f731d0
Коммит
86e65ef137
|
@ -1385,28 +1385,12 @@ function PageProxyDragGesture(aEvent)
|
|||
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)
|
||||
{
|
||||
var searchBar = document.getElementById("search-bar");
|
||||
|
||||
if (aEvent.target.id == "miSearchModeFind") {
|
||||
searchBar.removeAttribute("searchmode");
|
||||
searchBar.setAttribute("searchmode", "__PhoenixFindInPage");
|
||||
searchBar.setAttribute("autocompletesearchparam", "__PhoenixFindInPage");
|
||||
gPrefService.setCharPref("browser.search.defaultengine", "");
|
||||
|
||||
|
@ -1434,7 +1418,7 @@ function handleSearchBarCommand(aEvent)
|
|||
gFormHistory.addEntry(searchBar.getAttribute("autocompletesearchparam"), searchBar.value);
|
||||
}
|
||||
|
||||
if (searchBar.hasAttribute("searchmode")) {
|
||||
if (searchBar.getAttribute("searchmode") != "__PhoenixFindInPage") {
|
||||
gURLBar.value = searchBar.searchValue;
|
||||
BrowserLoadURL(aEvent);
|
||||
} else {
|
||||
|
|
|
@ -159,8 +159,6 @@
|
|||
<command id="cmd_textZoomEnlarge" oncommand="ZoomManager.prototype.getInstance().enlarge();"/>
|
||||
<command id="Browser:OpenLocation" oncommand="openLocation();"/>
|
||||
|
||||
<command id="Tools:Search" oncommand="focusSearchBar();"/>
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
<command id="minimizeWindow" label="&minimizeWindow.label;" disabled="true"/>
|
||||
#endif
|
||||
|
@ -194,7 +192,7 @@
|
|||
<key id="key_newNavigatorTab" key="&tabCmd.commandkey;" modifiers="accel" command="cmd_newNavigatorTab"/>
|
||||
<key id="focusURLBar" key="&openCmd.commandkey;" command="Browser:OpenLocation"
|
||||
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="key_savePage" key="&savePageCmd.commandkey;" command="Browser:SavePage" modifiers="accel"/>
|
||||
<key id="printKb" key="&printCmd.commandkey;" command="Browser:Print" modifiers="accel"/>
|
||||
|
@ -282,10 +280,9 @@
|
|||
|
||||
<popup id="SearchBarPopup" position="after_start"
|
||||
datasources="rdf:internetsearch" ref="NC:SearchEngineRoot"
|
||||
oncommand="return SearchBarPopupCommand(event);"
|
||||
onpopupshowing="return SearchBarPopupShowing(event);">
|
||||
<menuitem id="miSearchModeFind" type="checkbox"
|
||||
label="&findOnSearchBarCmd.label;" accesskey="&findOnCmd.accesskey;"/>
|
||||
oncommand="return SearchBarPopupCommand(event);">
|
||||
<menuitem id="miSearchModeFind" class="menuitem-iconic"
|
||||
label="&findOnSearchBarCmd.label;"/>
|
||||
<menuseparator/>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -8,12 +8,7 @@
|
|||
<binding id="searchbar" extends="chrome://global/content/widgets/autocomplete.xml#autocomplete">
|
||||
<implementation>
|
||||
<constructor><![CDATA[
|
||||
var pbi = this.mPrefs.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
|
||||
if (pbi)
|
||||
pbi.addObserver("browser.search", this.mPrefObserver, false);
|
||||
|
||||
if (this.hasAttribute("searchmode"))
|
||||
updateEngines();
|
||||
setTimeout(function(a) { a.initialize(); }, 0, this);
|
||||
]]></constructor>
|
||||
|
||||
<destructor><![CDATA[
|
||||
|
@ -70,8 +65,19 @@
|
|||
</getter>
|
||||
</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">
|
||||
<body><![CDATA[
|
||||
if (this.getAttribute("searchmode") == "__PhoenixFindInPage")
|
||||
return;
|
||||
var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
|
||||
.getService(Components.interfaces.nsIRDFService);
|
||||
try {
|
||||
|
|
|
@ -587,6 +587,10 @@ statusbarpanel#statusbar-display {
|
|||
list-style-image: url("chrome://browser/skin/Search-bar.png");
|
||||
}
|
||||
|
||||
#miSearchModeFind {
|
||||
list-style-image: url("chrome://browser/skin/Search-bar.png");
|
||||
}
|
||||
|
||||
/* ::::: autocomplete ::::: */
|
||||
|
||||
.autocomplete-treebody::-moz-tree-cell-text(treecolAutoCompleteComment) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче