mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 22:32:51 +00:00
Add support for automatically opening the "Search Results" panel in the sidebar when the "Search" button is clicked on. [Note: this behavior can be turned off via a preference in the "Search" preferences panel.]
This commit is contained in:
parent
3ed100c043
commit
0e8c89168c
@ -881,14 +881,18 @@ function OpenSearch(tabName, searchStr)
|
||||
{
|
||||
var searchMode = 0;
|
||||
var searchEngineURI = null;
|
||||
var autoOpenSearchPanel = false;
|
||||
try
|
||||
{
|
||||
searchMode = pref.GetIntPref("browser.search.powermode");
|
||||
searchEngineURI = pref.CopyCharPref("browser.search.defaultengine");
|
||||
autoOpenSearchPanel = pref.GetBoolPref("browser.search.opensidebarsearchpanel");
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
searchMode = 0;
|
||||
searchEngineURI = null;
|
||||
autoOpenSearchPanel = false;
|
||||
}
|
||||
if (searchMode == 1)
|
||||
{
|
||||
@ -925,6 +929,43 @@ function OpenSearch(tabName, searchStr)
|
||||
}
|
||||
window.content.location.href = defaultSearchURL;
|
||||
}
|
||||
|
||||
// rjc Note: the following is all a hack until the sidebar has appropriate APIs
|
||||
// to check whether its shown/hidden, open/closed, and can show a particular panel
|
||||
|
||||
// should we try and open up the sidebar to show the "Search Results" panel?
|
||||
if (autoOpenSearchPanel == true)
|
||||
{
|
||||
var sidebar = document.getElementById('sidebar-box');
|
||||
var sidebar_splitter = document.getElementById('sidebar-splitter');
|
||||
var searchPanel = document.getElementById("urn:sidebar:panel:search");
|
||||
|
||||
if (sidebar && sidebar_splitter && searchPanel)
|
||||
{
|
||||
var is_hidden = sidebar.getAttribute('hidden');
|
||||
if (is_hidden && is_hidden == "true")
|
||||
{
|
||||
{
|
||||
sidebarShowHide();
|
||||
}
|
||||
}
|
||||
var sidebar_style = sidebar.getAttribute("style");
|
||||
if (sidebar_style)
|
||||
{
|
||||
var visibility = sidebar_style.match('visibility:([^;]*)')
|
||||
if (visibility)
|
||||
{
|
||||
visibility = visibility[1];
|
||||
if (visibility.indexOf("collapse") >= 0)
|
||||
{
|
||||
sidebar.removeAttribute("style");
|
||||
sidebar.setAttribute("style", "width:100%; height:100%; hidden:false; visibility:show;");
|
||||
}
|
||||
}
|
||||
}
|
||||
sidebarOpenClosePanel(searchPanel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function BrowserNewWindow()
|
||||
|
@ -47,7 +47,7 @@
|
||||
</html:legend>
|
||||
|
||||
<html:div>
|
||||
<html:input name="fonts" type="radio" id="pref:0:int:browser.search.powermode" val="checked" />
|
||||
<html:input name="powermode" type="radio" id="pref:0:int:browser.search.powermode" val="checked" />
|
||||
<html:label for="pref:0:int:browser.search.powermode" accesskey="t" tabindex="0">
|
||||
&browserSearchButtonText.label;
|
||||
</html:label>
|
||||
@ -68,12 +68,23 @@
|
||||
</html:div>
|
||||
|
||||
<html:div>
|
||||
<html:input name="fonts" type="radio" id="pref:1:int:browser.search.powermode" val="checked" />
|
||||
<html:label for="pref:1:int:browser.search.powermode" accesskey="t" tabindex="0">
|
||||
<html:input name="powermode" type="radio" id="pref:1:int:browser.search.powermode" val="checked" />
|
||||
<html:label for="pref:1:int:browser.search.powermode" accesskey="t" tabindex="1">
|
||||
&enablePowerSearch.label;
|
||||
</html:label>
|
||||
</html:div>
|
||||
|
||||
<html:div>
|
||||
<html:hr width="100%" align="center" size="1" />
|
||||
</html:div>
|
||||
|
||||
<html:div>
|
||||
<html:input name="opensearchpanel" type="checkbox" id="pref:0:bool:browser.search.opensidebarsearchpanel" val="checked" />
|
||||
<html:label for="pref:0:bool:browser.search.opensidebarsearchpanel" accesskey="t" tabindex="2">
|
||||
&openSidebarSearchPanel.label;
|
||||
</html:label>
|
||||
</html:div>
|
||||
|
||||
</html:fieldset>
|
||||
</box>
|
||||
</window>
|
||||
|
@ -8,5 +8,6 @@
|
||||
<!ENTITY lHeader "Search">
|
||||
<!ENTITY rHeader "Configure Search">
|
||||
<!ENTITY legendHeader "When clicking the 'Search' button:">
|
||||
<!ENTITY browserSearchButtonText.label "use a single search engine:">
|
||||
<!ENTITY enablePowerSearch.label "open the Search window (search multiple engines)">
|
||||
<!ENTITY browserSearchButtonText.label "Search using:">
|
||||
<!ENTITY enablePowerSearch.label "Open the Search window (search multiple engines)">
|
||||
<!ENTITY openSidebarSearchPanel.label "Automatically open the 'Search Results' panel in the Sidebar">
|
||||
|
@ -881,14 +881,18 @@ function OpenSearch(tabName, searchStr)
|
||||
{
|
||||
var searchMode = 0;
|
||||
var searchEngineURI = null;
|
||||
var autoOpenSearchPanel = false;
|
||||
try
|
||||
{
|
||||
searchMode = pref.GetIntPref("browser.search.powermode");
|
||||
searchEngineURI = pref.CopyCharPref("browser.search.defaultengine");
|
||||
autoOpenSearchPanel = pref.GetBoolPref("browser.search.opensidebarsearchpanel");
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
searchMode = 0;
|
||||
searchEngineURI = null;
|
||||
autoOpenSearchPanel = false;
|
||||
}
|
||||
if (searchMode == 1)
|
||||
{
|
||||
@ -925,6 +929,43 @@ function OpenSearch(tabName, searchStr)
|
||||
}
|
||||
window.content.location.href = defaultSearchURL;
|
||||
}
|
||||
|
||||
// rjc Note: the following is all a hack until the sidebar has appropriate APIs
|
||||
// to check whether its shown/hidden, open/closed, and can show a particular panel
|
||||
|
||||
// should we try and open up the sidebar to show the "Search Results" panel?
|
||||
if (autoOpenSearchPanel == true)
|
||||
{
|
||||
var sidebar = document.getElementById('sidebar-box');
|
||||
var sidebar_splitter = document.getElementById('sidebar-splitter');
|
||||
var searchPanel = document.getElementById("urn:sidebar:panel:search");
|
||||
|
||||
if (sidebar && sidebar_splitter && searchPanel)
|
||||
{
|
||||
var is_hidden = sidebar.getAttribute('hidden');
|
||||
if (is_hidden && is_hidden == "true")
|
||||
{
|
||||
{
|
||||
sidebarShowHide();
|
||||
}
|
||||
}
|
||||
var sidebar_style = sidebar.getAttribute("style");
|
||||
if (sidebar_style)
|
||||
{
|
||||
var visibility = sidebar_style.match('visibility:([^;]*)')
|
||||
if (visibility)
|
||||
{
|
||||
visibility = visibility[1];
|
||||
if (visibility.indexOf("collapse") >= 0)
|
||||
{
|
||||
sidebar.removeAttribute("style");
|
||||
sidebar.setAttribute("style", "width:100%; height:100%; hidden:false; visibility:show;");
|
||||
}
|
||||
}
|
||||
}
|
||||
sidebarOpenClosePanel(searchPanel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function BrowserNewWindow()
|
||||
|
@ -47,7 +47,7 @@
|
||||
</html:legend>
|
||||
|
||||
<html:div>
|
||||
<html:input name="fonts" type="radio" id="pref:0:int:browser.search.powermode" val="checked" />
|
||||
<html:input name="powermode" type="radio" id="pref:0:int:browser.search.powermode" val="checked" />
|
||||
<html:label for="pref:0:int:browser.search.powermode" accesskey="t" tabindex="0">
|
||||
&browserSearchButtonText.label;
|
||||
</html:label>
|
||||
@ -68,12 +68,23 @@
|
||||
</html:div>
|
||||
|
||||
<html:div>
|
||||
<html:input name="fonts" type="radio" id="pref:1:int:browser.search.powermode" val="checked" />
|
||||
<html:label for="pref:1:int:browser.search.powermode" accesskey="t" tabindex="0">
|
||||
<html:input name="powermode" type="radio" id="pref:1:int:browser.search.powermode" val="checked" />
|
||||
<html:label for="pref:1:int:browser.search.powermode" accesskey="t" tabindex="1">
|
||||
&enablePowerSearch.label;
|
||||
</html:label>
|
||||
</html:div>
|
||||
|
||||
<html:div>
|
||||
<html:hr width="100%" align="center" size="1" />
|
||||
</html:div>
|
||||
|
||||
<html:div>
|
||||
<html:input name="opensearchpanel" type="checkbox" id="pref:0:bool:browser.search.opensidebarsearchpanel" val="checked" />
|
||||
<html:label for="pref:0:bool:browser.search.opensidebarsearchpanel" accesskey="t" tabindex="2">
|
||||
&openSidebarSearchPanel.label;
|
||||
</html:label>
|
||||
</html:div>
|
||||
|
||||
</html:fieldset>
|
||||
</box>
|
||||
</window>
|
||||
|
@ -8,5 +8,6 @@
|
||||
<!ENTITY lHeader "Search">
|
||||
<!ENTITY rHeader "Configure Search">
|
||||
<!ENTITY legendHeader "When clicking the 'Search' button:">
|
||||
<!ENTITY browserSearchButtonText.label "use a single search engine:">
|
||||
<!ENTITY enablePowerSearch.label "open the Search window (search multiple engines)">
|
||||
<!ENTITY browserSearchButtonText.label "Search using:">
|
||||
<!ENTITY enablePowerSearch.label "Open the Search window (search multiple engines)">
|
||||
<!ENTITY openSidebarSearchPanel.label "Automatically open the 'Search Results' panel in the Sidebar">
|
||||
|
Loading…
x
Reference in New Issue
Block a user