add custom search URL pref for about:home (rzHome.customsearch)

This commit is contained in:
rn10950 2016-01-16 19:57:13 -05:00
parent bcb33dcf25
commit 9a10bfc43b
2 changed files with 15 additions and 1 deletions

View File

@ -268,6 +268,10 @@
font-weight: bold;
}
#go-button {
padding-right: 2px;
}
#search-button {
list-style-image: url("chrome://communicator/skin/icons/search.gif");
font-weight: bold;

View File

@ -10,7 +10,16 @@ var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(
var aboutHomeAutofocus = prefs.getBoolPref("rzHome.autofocus");
var searchEngineURL = prefs.getCharPref("keyword.URL");
var searchURL = "http://www.google.com/search?q=";
//check to see if custom search pref url exists
var prefServiceBranch = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService).getBranch("");
if(prefServiceBranch.getPrefType('rzHome.customsearch')){
//key exist!
var searchEngineURL = prefs.getCharPref("rzHome.customsearch");
} else {
// use Google
var searchEngineURL = "http://www.google.com/search?q=";
}
// autofocus function
function autoFocus() {
@ -28,5 +37,6 @@ window.onload = function() {
function rzSearch() {
var searchQuery = document.getElementById("rzSearch").value;
var searchURL = searchEngineURL + searchQuery;
//alert("Location: " + searchURL); // for debug purposes
window.location.replace(searchURL);
}