зеркало из https://github.com/mozilla/pjs.git
Bug 317107: new search service, r=mconnor, sr=ben
This commit is contained in:
Родитель
92a2265118
Коммит
0933676efd
|
@ -916,6 +916,7 @@ browser/components/migration/Makefile
|
|||
browser/components/migration/public/Makefile
|
||||
browser/components/migration/src/Makefile
|
||||
browser/components/preferences/Makefile
|
||||
browser/components/search/Makefile
|
||||
browser/components/sidebar/Makefile
|
||||
browser/components/sidebar/src/Makefile
|
||||
browser/components/shell/Makefile
|
||||
|
|
|
@ -205,8 +205,10 @@ pref("browser.download.manager.flashCount", 2);
|
|||
|
||||
// pointer to the default engine name
|
||||
pref("browser.search.defaultenginename", "chrome://browser-region/locale/region.properties");
|
||||
// pointer to the Web Search url (content area context menu)
|
||||
pref("browser.search.defaulturl", "chrome://browser-region/locale/region.properties");
|
||||
|
||||
// disable logging for the search service by default
|
||||
pref("browser.search.log", false);
|
||||
|
||||
// Ordering of Search Engines in the Engine list.
|
||||
pref("browser.search.order.1", "chrome://browser-region/locale/region.properties");
|
||||
pref("browser.search.order.2", "chrome://browser-region/locale/region.properties");
|
||||
|
@ -217,10 +219,6 @@ pref("browser.search.order.Yahoo.1", "chrome://branding/content/searchc
|
|||
pref("browser.search.order.Yahoo.2", "chrome://branding/content/searchconfig.properties");
|
||||
pref("browser.search.order.Yahoo", "chrome://branding/content/searchconfig.properties");
|
||||
|
||||
// basic search popup constraint: minimum sherlock plugin version displayed
|
||||
// (note: must be a string representation of a float or it'll default to 0.0)
|
||||
pref("browser.search.basic.min_ver", "0.0");
|
||||
|
||||
// search bar results always open in a new tab
|
||||
pref("browser.search.openintab", false);
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@
|
|||
oncommand="AddKeywordForSearchField();"/>
|
||||
<menuitem id="context-searchselect"
|
||||
accesskey="&search.accesskey;"
|
||||
oncommand="OpenSearch('internet', gContextMenu.searchSelected(), true);"/>
|
||||
oncommand="BrowserSearch.loadSearch(getBrowserSelection(), true);"/>
|
||||
<menuseparator id="frame-sep"/>
|
||||
<menu id="frame" label="&thisFrameMenu.label;" accesskey="&thisFrameMenu.accesskey;">
|
||||
<menupopup>
|
||||
|
@ -262,4 +262,3 @@
|
|||
accesskey="&bidiSwitchPageDirectionItem.accesskey;"
|
||||
oncommand="SwitchDocumentDirection(window.content);"/>
|
||||
</popup>
|
||||
|
||||
|
|
|
@ -406,7 +406,7 @@
|
|||
|
||||
#ifndef MOZ_PLACES
|
||||
<menu id="bookmarks-menu" label="&bookmarksMenu.label;" accesskey="&bookmarksMenu.accesskey;"
|
||||
datasources="rdf:bookmarks rdf:files rdf:localsearch"
|
||||
datasources="rdf:bookmarks rdf:files"
|
||||
ref="NC:BookmarksRoot" flags="dont-test-empty"
|
||||
template='bookmarks-template'
|
||||
infer="forward-proxy"
|
||||
|
|
|
@ -163,7 +163,7 @@
|
|||
<command id="cmd_textZoomReset" oncommand="ZoomManager.prototype.getInstance().reset();"/>
|
||||
<command id="Browser:OpenLocation" oncommand="openLocation();"/>
|
||||
|
||||
<command id="Tools:Search" oncommand="WebSearch();"/>
|
||||
<command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/>
|
||||
<command id="Tools:Downloads" oncommand="toOpenWindowByType('Download:Manager',
|
||||
'chrome://mozapps/content/downloads/downloads.xul',
|
||||
'chrome,dialog=no,resizable');"/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
searchbar {
|
||||
-moz-binding: url("chrome://browser/content/search.xml#searchbar");
|
||||
-moz-binding: url("chrome://browser/content/search/search.xml#searchbar");
|
||||
}
|
||||
|
||||
/* ::::: print preview toolbar ::::: */
|
||||
|
|
|
@ -1806,27 +1806,6 @@ function BrowserLoadURL(aTriggeringEvent, aPostData)
|
|||
content.focus();
|
||||
}
|
||||
|
||||
function delayedSearchLoadURL(aURL, aInNewTab) {
|
||||
setTimeout(SearchLoadURL, 0, aURL, aInNewTab);
|
||||
}
|
||||
|
||||
function SearchLoadURL(aURL, aInNewTab)
|
||||
{
|
||||
if (!aURL)
|
||||
return;
|
||||
|
||||
if (gBrowser.localName == "tabbrowser" && aInNewTab) {
|
||||
content.focus();
|
||||
// Modal action, remember last viewed tab
|
||||
gBrowser.loadOneTab(aURL, null, null, null, false);
|
||||
if (gURLBar)
|
||||
gURLBar.value = aURL;
|
||||
}
|
||||
else
|
||||
loadURI(aURL, null, null);
|
||||
content.focus();
|
||||
}
|
||||
|
||||
function getShortcutOrURI(aURL, aPostDataRef)
|
||||
{
|
||||
// rjc: added support for URL shortcuts (3/30/1999)
|
||||
|
@ -2788,107 +2767,83 @@ var DownloadsButtonDNDObserver = {
|
|||
}
|
||||
}
|
||||
|
||||
function WebSearch()
|
||||
{
|
||||
const BrowserSearch = {
|
||||
/**
|
||||
* Gives focus to the search bar, if it is present on the toolbar, or loads
|
||||
* the default engine's search form otherwise. For Mac, opens a new window
|
||||
* or focuses an existing window, if necessary.
|
||||
*/
|
||||
webSearch: function BrowserSearch_webSearch() {
|
||||
#ifdef XP_MACOSX
|
||||
if (window.location.href != getBrowserURL()) {
|
||||
var win = getTopWin();
|
||||
if (win) {
|
||||
// If there's an open browser window, it should handle this command
|
||||
win.focus()
|
||||
win.WebSearch();
|
||||
}
|
||||
else {
|
||||
win.BrowserSearch.webSearch();
|
||||
} else {
|
||||
// If there are no open browser windows, open a new one
|
||||
win = window.openDialog("chrome://browser/content/", "_blank",
|
||||
"chrome,all,dialog=no", "about:blank");
|
||||
win.addEventListener("load", WebSearchCallback, false);
|
||||
win.addEventListener("load", BrowserSearch.WebSearch, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
var searchBar = document.getElementById("searchbar");
|
||||
if (searchBar && !searchBar.parentNode.parentNode.collapsed &&
|
||||
!(window.getComputedStyle(searchBar.parentNode, null).display == "none")) {
|
||||
var searchBar = this.getSearchBar();
|
||||
if (searchBar) {
|
||||
searchBar.select();
|
||||
searchBar.focus();
|
||||
} else {
|
||||
openDialog("chrome://browser/content/searchDialog.xul", "",
|
||||
"chrome,dialog,resizable,modal");
|
||||
var ss = Cc["@mozilla.org/browser/search-service;1"].
|
||||
getService(Ci.nsIBrowserSearchService);
|
||||
var searchForm = ss.defaultEngine.searchForm;
|
||||
loadURI(searchForm, null, null);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
function WebSearchCallback() {
|
||||
// make sure the DOM is ready
|
||||
setTimeout(function() { this.WebSearch(); }, 0);
|
||||
}
|
||||
/**
|
||||
* Loads a search results page, given a set of search terms. Uses the current
|
||||
* engine if the search bar is visible, or the default engine otherwise.
|
||||
*
|
||||
* @param searchText
|
||||
* The search terms to use for the search.
|
||||
*
|
||||
* @param useNewTab
|
||||
* Boolean indicating whether or not the search should load in a new
|
||||
* tab.
|
||||
*/
|
||||
loadSearch: function BrowserSearch_search(searchText, useNewTab) {
|
||||
var ss = Cc["@mozilla.org/browser/search-service;1"].
|
||||
getService(Ci.nsIBrowserSearchService);
|
||||
var engine;
|
||||
|
||||
function OpenSearch(tabName, searchStr, newTabFlag)
|
||||
{
|
||||
//This function needs to be split up someday.
|
||||
//XXXnoririty I don't want any prefs switching open by tabs to window
|
||||
//XXXpch: this routine needs to be cleaned up.
|
||||
// If the search bar is visible, use the current engine, otherwise, fall back
|
||||
// to the default engine.
|
||||
if (this.getSearchBar())
|
||||
engine = ss.currentEngine;
|
||||
else
|
||||
engine = ss.defaultEngine;
|
||||
|
||||
var defaultSearchURL = null;
|
||||
var navigatorRegionBundle = document.getElementById("bundle_browser_region");
|
||||
var fallbackDefaultSearchURL = navigatorRegionBundle.getString("fallbackDefaultSearchURL");
|
||||
var submission = engine.getSubmission(searchText);
|
||||
|
||||
//Check to see if search string contains "://" or "ftp." or white space.
|
||||
//If it does treat as url and match for pattern
|
||||
if (useNewTab) {
|
||||
getBrowser().loadOneTab(submission.uri.spec, null, null,
|
||||
submission.postData, false);
|
||||
} else
|
||||
loadURI(submission.uri.spec, null, submission.postData);
|
||||
},
|
||||
|
||||
var urlmatch= /(:\/\/|^ftp\.)[^ \S]+$/
|
||||
var forceAsURL = urlmatch.test(searchStr);
|
||||
|
||||
try {
|
||||
defaultSearchURL = gPrefService.getComplexValue("browser.search.defaulturl",
|
||||
Components.interfaces.nsIPrefLocalizedString).data;
|
||||
} catch (ex) {
|
||||
}
|
||||
|
||||
// Fallback to a default url (one that we can get sidebar search results for)
|
||||
if (!defaultSearchURL)
|
||||
defaultSearchURL = fallbackDefaultSearchURL;
|
||||
|
||||
if (!searchStr) {
|
||||
BrowserSearchInternet();
|
||||
} else {
|
||||
|
||||
//Check to see if location bar field is a url
|
||||
//If it is a url go to URL. A Url is "://" or "." as commented above
|
||||
//Otherwise search on entry
|
||||
if (forceAsURL) {
|
||||
BrowserLoadURL(null, null)
|
||||
} else {
|
||||
if (searchStr) {
|
||||
var escapedSearchStr = encodeURIComponent(searchStr);
|
||||
defaultSearchURL += escapedSearchStr;
|
||||
var searchDS = Components.classes["@mozilla.org/rdf/datasource;1?name=internetsearch"]
|
||||
.getService(Components.interfaces.nsIInternetSearchService);
|
||||
|
||||
searchDS.RememberLastSearchText(escapedSearchStr);
|
||||
try {
|
||||
var searchEngineURI = gPrefService.getCharPref("browser.search.defaultengine");
|
||||
if (searchEngineURI) {
|
||||
var searchURL = getSearchUrl("actionButton");
|
||||
if (searchURL) {
|
||||
defaultSearchURL = searchURL + escapedSearchStr;
|
||||
} else {
|
||||
searchURL = searchDS.GetInternetSearchURL(searchEngineURI, escapedSearchStr, 0, 0, {value:0});
|
||||
if (searchURL)
|
||||
defaultSearchURL = searchURL;
|
||||
}
|
||||
}
|
||||
} catch (ex) {
|
||||
}
|
||||
|
||||
if (!newTabFlag) {
|
||||
loadURI(defaultSearchURL, null, null);
|
||||
}
|
||||
else {
|
||||
getBrowser().loadOneTab(defaultSearchURL);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the search bar element if it is present in the toolbar and not
|
||||
* hidden, null otherwise.
|
||||
*/
|
||||
getSearchBar: function BrowserSearch_getSearchBar() {
|
||||
var searchBar = document.getElementById("searchbar");
|
||||
if (searchBar && !searchBar.parentNode.parentNode.collapsed &&
|
||||
!(window.getComputedStyle(searchBar.parentNode, null).display == "none"))
|
||||
return searchBar;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4903,24 +4858,35 @@ nsContextMenu.prototype = {
|
|||
return text;
|
||||
},
|
||||
|
||||
// Get selected object and convert it to a string to get
|
||||
// selected text. Only display the first 15 chars.
|
||||
// Get selected text. Only display the first 15 chars.
|
||||
isTextSelection : function() {
|
||||
var result = false;
|
||||
var selection = this.searchSelected(16);
|
||||
// Get 16 characters, so that we can trim the selection if it's greater
|
||||
// than 15 chars
|
||||
var selectedText = getBrowserSelection(16);
|
||||
|
||||
var searchSelectText;
|
||||
if (selection) {
|
||||
searchSelectText = selection.toString();
|
||||
if (searchSelectText.length > 15)
|
||||
searchSelectText = searchSelectText.substr(0,15) + "...";
|
||||
result = true;
|
||||
if (!selectedText)
|
||||
return false;
|
||||
|
||||
// format "Search for <selection>" string to show in menu
|
||||
searchSelectText = gNavigatorBundle.getFormattedString("searchText", [searchSelectText]);
|
||||
this.setItemAttr("context-searchselect", "label", searchSelectText);
|
||||
}
|
||||
return result;
|
||||
if (selectedText.length > 15)
|
||||
selectedText = selectedText.substr(0,15) + "...";
|
||||
|
||||
// Use the current engine if the search bar is visible, the default
|
||||
// engine otherwise.
|
||||
var engineName = "";
|
||||
var ss = Cc["@mozilla.org/browser/search-service;1"].
|
||||
getService(Ci.nsIBrowserSearchService);
|
||||
if (BrowserSearch.getSearchBar())
|
||||
engineName = ss.currentEngine.name;
|
||||
else
|
||||
engineName = ss.defaultEngine.name;
|
||||
|
||||
// format "Search <engine> for <selection>" string to show in menu
|
||||
var menuLabel = gNavigatorBundle.getFormattedString("contextMenuSearchText",
|
||||
[engineName,
|
||||
selectedText]);
|
||||
this.setItemAttr("context-searchselect", "label", menuLabel);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
// Returns true if anything is selected.
|
||||
|
@ -4928,25 +4894,6 @@ nsContextMenu.prototype = {
|
|||
return !document.commandDispatcher.focusedWindow.getSelection().isCollapsed;
|
||||
},
|
||||
|
||||
searchSelected : function( charlen ) {
|
||||
var focusedWindow = document.commandDispatcher.focusedWindow;
|
||||
var searchStr = focusedWindow.getSelection();
|
||||
searchStr = searchStr.toString();
|
||||
// searching for more than 150 chars makes no sense
|
||||
if (!charlen)
|
||||
charlen = 150;
|
||||
if (charlen < searchStr.length) {
|
||||
// only use the first charlen important chars. see bug 221361
|
||||
var pattern = new RegExp("^(?:\\s*.){0," + charlen + "}");
|
||||
pattern.test(searchStr);
|
||||
searchStr = RegExp.lastMatch;
|
||||
}
|
||||
searchStr = searchStr.replace(/^\s+/, "");
|
||||
searchStr = searchStr.replace(/\s+$/, "");
|
||||
searchStr = searchStr.replace(/\s+/g, " ");
|
||||
return searchStr;
|
||||
},
|
||||
|
||||
toString : function () {
|
||||
return "contextMenu.target = " + this.target + "\n" +
|
||||
"contextMenu.onImage = " + this.onImage + "\n" +
|
||||
|
@ -4955,6 +4902,7 @@ nsContextMenu.prototype = {
|
|||
"contextMenu.inFrame = " + this.inFrame + "\n" +
|
||||
"contextMenu.hasBGImage = " + this.hasBGImage + "\n";
|
||||
},
|
||||
|
||||
isTargetATextBox : function ( node )
|
||||
{
|
||||
if (node instanceof HTMLInputElement)
|
||||
|
@ -5001,6 +4949,41 @@ nsContextMenu.prototype = {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the selected text in the active browser. Leading and trailing
|
||||
* whitespace is removed, and consecutive whitespace is replaced by a single
|
||||
* space. A maximum of 150 characters will be returned, regardless of the value
|
||||
* of aCharLen.
|
||||
*
|
||||
* @param aCharLen
|
||||
* The maximum number of characters to return.
|
||||
*/
|
||||
function getBrowserSelection(aCharLen) {
|
||||
// selections of more than 150 characters aren't useful
|
||||
const kMaxSelectionLen = 150;
|
||||
const charLen = Math.min(aCharLen || kMaxSelectionLen, kMaxSelectionLen);
|
||||
|
||||
var focusedWindow = document.commandDispatcher.focusedWindow;
|
||||
var selection = focusedWindow.getSelection().toString();
|
||||
|
||||
if (selection) {
|
||||
if (selection.length > charLen) {
|
||||
// only use the first charLen important chars. see bug 221361
|
||||
var pattern = new RegExp("^(?:\\s*.){0," + charLen + "}");
|
||||
pattern.test(selection);
|
||||
selection = RegExp.lastMatch;
|
||||
}
|
||||
|
||||
selection = selection.replace(/^\s+/, "")
|
||||
.replace(/\s+$/, "")
|
||||
.replace(/\s+/g, " ");
|
||||
|
||||
if (selection.length > charLen)
|
||||
selection = selection.substr(0, charLen);
|
||||
}
|
||||
return selection;
|
||||
}
|
||||
|
||||
var gWebPanelURI;
|
||||
function openWebPanel(aTitle, aURI)
|
||||
{
|
||||
|
@ -6557,3 +6540,4 @@ var BookmarksEventHandler = {
|
|||
#include ../../../toolkit/content/debug.js
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -301,7 +301,7 @@
|
|||
onpopuphidden="BookmarksToolbar.unsetOpenedMenu(event);">
|
||||
<hbox id="bookmarks-ptf" class="bookmarks-toolbar-items" contextmenu="bookmarks-context-menu"
|
||||
flex="1" style="min-width:0px; width:0px;padding-left: 3px;"
|
||||
datasources="rdf:bookmarks rdf:files rdf:localsearch"
|
||||
datasources="rdf:bookmarks rdf:files"
|
||||
template="bookmarks-template" flags="dont-test-empty"
|
||||
infer="forward-proxy"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Folder"
|
||||
|
@ -320,7 +320,7 @@
|
|||
<toolbarbutton id="bookmarks-chevron" type="menu" class="chevron"
|
||||
chromedir="&locale.dir;"
|
||||
mousethrough="never" collapsed="true"
|
||||
datasources="rdf:bookmarks rdf:files rdf:localsearch"
|
||||
datasources="rdf:bookmarks rdf:files"
|
||||
template="bookmarks-template" flags="dont-test-empty"
|
||||
onpopupshowing="BookmarksMenu.onShowMenu(event.target)"
|
||||
onpopuphidden="BookmarksMenu.onHideMenu(event.target)"
|
||||
|
|
|
@ -31,11 +31,6 @@ browser.jar:
|
|||
* content/browser/safeMode.xul (content/safeMode.xul)
|
||||
* content/browser/sanitize.js (content/sanitize.js)
|
||||
* content/browser/sanitize.xul (content/sanitize.xul)
|
||||
* content/browser/search.xml (content/search.xml)
|
||||
* content/browser/searchDialog.js (content/searchDialog.js)
|
||||
* content/browser/searchDialog.xul (content/searchDialog.xul)
|
||||
* content/browser/searchDialog.css (content/searchDialog.css)
|
||||
content/browser/searchbarBindings.css (content/searchbarBindings.css)
|
||||
* content/browser/utilityOverlay.js (content/utilityOverlay.js)
|
||||
* content/browser/web-panels.js (content/web-panels.js)
|
||||
* content/browser/web-panels.xul (content/web-panels.xul)
|
||||
|
|
|
@ -59,6 +59,7 @@ DIRS = \
|
|||
dirprovider \
|
||||
migration \
|
||||
preferences \
|
||||
search \
|
||||
shell \
|
||||
sidebar \
|
||||
$(NULL)
|
||||
|
|
|
@ -849,7 +849,7 @@
|
|||
onkeypress="event.preventBubble();"/>
|
||||
<vbox flex="1">
|
||||
<tree anonid="bookmarks-tree" flex="1" class="plain" enableColumnDrag="true"
|
||||
datasources="rdf:bookmarks rdf:files rdf:localsearch" ref="NC:BookmarksTopRoot" flags="dont-build-content"
|
||||
datasources="rdf:bookmarks rdf:files" ref="NC:BookmarksTopRoot" flags="dont-build-content"
|
||||
onkeypress="if (event.keyCode == 13) this.parentNode.parentNode.openItemKey();"
|
||||
onclick="this.parentNode.parentNode.openItemClick(event, 1);"
|
||||
ondblclick="this.parentNode.parentNode.openItemClick(event, 2);"
|
||||
|
@ -945,7 +945,7 @@
|
|||
onclick="event.preventBubble();"
|
||||
onkeypress="event.preventBubble();"/>
|
||||
<tree anonid="bookmarks-tree" flex="1" class="plain" hidecolumnpicker="true"
|
||||
datasources="rdf:bookmarks rdf:files rdf:localsearch" ref="NC:BookmarksRoot" flags="dont-build-content"
|
||||
datasources="rdf:bookmarks rdf:files" ref="NC:BookmarksRoot" flags="dont-build-content"
|
||||
onselect="this.parentNode.treeBoxObject.view.selectionChanged();" seltype="single">
|
||||
<template xmlns:nc="http://home.netscape.com/NC-rdf#">
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
|
@ -985,7 +985,7 @@
|
|||
<xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
<tree anonid="bookmarks-tree" class="bookmarksTree" flex="1" hidecolumnpicker="true"
|
||||
xbl:inherits="rows,seltype"
|
||||
datasources="rdf:bookmarks rdf:files rdf:localsearch" ref="NC:BookmarksTopRoot" flags="dont-build-content"
|
||||
datasources="rdf:bookmarks rdf:files" ref="NC:BookmarksTopRoot" flags="dont-build-content"
|
||||
onselect="this.parentNode.treeBoxObject.view.selectionChanged();">
|
||||
<template>
|
||||
<!-- I don't want these things to appear at all, but that's not an option -->
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Browser Search Service.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Google Inc.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2005
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <beng@google.com> (Original author)
|
||||
# Gavin Sharp <gavin@gavinsharp.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK ***** */
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = browsersearch
|
||||
XPIDL_MODULE = browsersearch
|
||||
|
||||
XPIDLSRCS = nsIBrowserSearchService.idl
|
||||
|
||||
EXTRA_PP_COMPONENTS = nsSearchService.js
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
|
@ -1,5 +1,4 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: HTML -*-
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
@ -22,8 +21,9 @@
|
|||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Pierre Chanial V 2.0 (p_ch@verizon.net)
|
||||
# Gavin Sharp (gavin@gavinsharp.com)
|
||||
# Pierre Chanial (v2) <p_ch@verizon.net>
|
||||
# Gavin Sharp (v3) <gavin@gavinsharp.com>
|
||||
# Ben Goodger <beng@google.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -46,58 +46,237 @@
|
|||
|
||||
<binding id="searchbar-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://browser/content/searchbarBindings.css"/>
|
||||
<stylesheet src="chrome://browser/content/search/searchbarBindings.css"/>
|
||||
<stylesheet src="chrome://browser/skin/searchbar.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="searchbar" extends="chrome://browser/content/search.xml#searchbar-base">
|
||||
<binding id="searchbar"
|
||||
extends="chrome://browser/content/search/search.xml#searchbar-base">
|
||||
<content>
|
||||
<xul:stringbundle src="chrome://browser/locale/searchbar.properties"/>
|
||||
<xul:textbox class="searchbar-textbox" type="autocomplete" flex="1"
|
||||
<xul:stringbundle src="chrome://browser/locale/search.properties"/>
|
||||
<xul:textbox class="searchbar-textbox"
|
||||
type="autocomplete"
|
||||
flex="1"
|
||||
autocompletepopup="PopupAutoComplete"
|
||||
autocompletesearch="form-history"
|
||||
autocompletesearchparam="searchbar-history"
|
||||
completeselectedindex="true"
|
||||
tabscrolling="true"
|
||||
xbl:inherits="disableautocomplete,searchengine,src">
|
||||
<xul:button class="searchbar-dropmarker" type="menu"
|
||||
id="searchbar-dropmarker" popup="_child" xbl:inherits="src">
|
||||
<xul:menupopup anonid="searchbar-popup" position="after_start"
|
||||
datasources="rdf:internetsearch"
|
||||
ref="NC:SearchEngineRoot"
|
||||
oncommand="this.parentNode.parentNode.onEnginePopupCommand(event);"
|
||||
onpopupshowing="this.parentNode.parentNode.onEnginePopupShowing(event);"
|
||||
onpopuphidden="this.parentNode.parentNode.onEnginePopupHidden(event);">
|
||||
<xul:template>
|
||||
<xul:menuitem type="checkbox"
|
||||
uri="rdf:*" value="rdf:*"
|
||||
src="rdf:http://home.netscape.com/NC-rdf#Icon"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</xul:template>
|
||||
</xul:menupopup>
|
||||
<xul:button class="searchbar-dropmarker"
|
||||
type="menu"
|
||||
anonid="searchbar-dropmarker"
|
||||
popup="_child"
|
||||
xbl:inherits="src">
|
||||
<xul:menupopup anonid="searchbar-popup"
|
||||
class="searchbar-popup"
|
||||
position="after_start"
|
||||
oncommand="this.parentNode.parentNode
|
||||
.parentNode
|
||||
.onEnginePopupCommand(event);"/>
|
||||
</xul:button>
|
||||
</xul:textbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="mStringBundle"> document.getAnonymousNodes(this)[0] </field>
|
||||
<field name="mTextbox"> document.getAnonymousNodes(this)[1] </field>
|
||||
<implementation implements="nsIObserver">
|
||||
|
||||
<constructor><![CDATA[
|
||||
// Refresh the display (updating icon, etc)
|
||||
this.updateDisplay();
|
||||
this.populatePopup();
|
||||
|
||||
var os =
|
||||
Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
os.addObserver(this, "browser-search-engine-modified", false);
|
||||
]]></constructor>
|
||||
|
||||
<destructor><![CDATA[
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
os.removeObserver(this, "browser-search-engine-modified");
|
||||
]]></destructor>
|
||||
|
||||
<field name="_stringBundle">document.getAnonymousNodes(this)[0];</field>
|
||||
<field name="_textbox">document.getAnonymousNodes(this)[1];</field>
|
||||
<field name="_popup">
|
||||
document.getAnonymousElementByAttribute(this,
|
||||
"anonid",
|
||||
"searchbar-popup");
|
||||
</field>
|
||||
<field name="_ss">null</field>
|
||||
|
||||
<property name="currentEngine" onset="this.searchService.currentEngine = val;"
|
||||
onget="return this.searchService.currentEngine;"/>
|
||||
|
||||
<property name="searchService" readonly="true">
|
||||
<getter><![CDATA[
|
||||
if (!this._ss) {
|
||||
const nsIBSS = Components.interfaces.nsIBrowserSearchService;
|
||||
this._ss =
|
||||
Components.classes["@mozilla.org/browser/search-service;1"]
|
||||
.getService(nsIBSS);
|
||||
}
|
||||
return this._ss;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<property name="value"
|
||||
onget="return this._textbox.value;"
|
||||
onset="this._textbox.value = val; return val;"/>
|
||||
|
||||
<method name="focus">
|
||||
<body><![CDATA[
|
||||
this.mTextbox.focus();
|
||||
this._textbox.focus();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="select">
|
||||
<body><![CDATA[
|
||||
this.mTextbox.select();
|
||||
this._textbox.select();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="observe">
|
||||
<parameter name="aEngine"/>
|
||||
<parameter name="aTopic"/>
|
||||
<parameter name="aVerb"/>
|
||||
<body><![CDATA[
|
||||
switch (aVerb) {
|
||||
case "engine-removed":
|
||||
case "engine-added":
|
||||
case "engine-changed":
|
||||
// An engine was removed (or hidden), added, or an icon was
|
||||
// changed
|
||||
this.populatePopup();
|
||||
// Fall through
|
||||
case "engine-current":
|
||||
// The current engine was changed
|
||||
this.updateDisplay();
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="updateDisplay">
|
||||
<body><![CDATA[
|
||||
var uri = this.currentEngine.iconURI;
|
||||
if (uri)
|
||||
this.setAttribute("src", uri.spec);
|
||||
|
||||
var name = this.currentEngine.name;
|
||||
var text = this._stringBundle.getFormattedString("searchtip", [name]);
|
||||
this.setAttribute("tooltiptext", text);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="populatePopup">
|
||||
<body><![CDATA[
|
||||
var popup = this._popup;
|
||||
|
||||
// Clear the popup
|
||||
while (popup.firstChild)
|
||||
popup.removeChild(popup.firstChild);
|
||||
|
||||
var engines = this.searchService.getVisibleEngines({ });
|
||||
const kXULNS =
|
||||
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
for (var i = 0; i < engines.length; ++i) {
|
||||
var menuitem = document.createElementNS(kXULNS, "menuitem");
|
||||
menuitem.setAttribute("label", engines[i].name);
|
||||
menuitem.setAttribute("id", engines[i].name);
|
||||
menuitem.setAttribute("class", "menuitem-iconic");
|
||||
if (engines[i].iconURI)
|
||||
menuitem.setAttribute("src", engines[i].iconURI.spec);
|
||||
popup.appendChild(menuitem);
|
||||
menuitem.engine = engines[i];
|
||||
}
|
||||
|
||||
// Add the "Get more engines" item
|
||||
// XXX this will become "edit this list"
|
||||
var separator = document.createElementNS(kXULNS, "menuseparator");
|
||||
popup.appendChild(separator);
|
||||
|
||||
menuitem = document.createElementNS(kXULNS, "menuitem");
|
||||
/* XXX
|
||||
const label = this._stringBundle.getString("cmd_editList");
|
||||
const accesskey = this._stringBundle.getString("cmd_editListAccesskey");
|
||||
*/
|
||||
const label = this._stringBundle.getString("cmd_addEngine");
|
||||
const accesskey = this._stringBundle.getString("cmd_addEngine_accesskey");
|
||||
menuitem.setAttribute("label", label);
|
||||
menuitem.setAttribute("accesskey", accesskey);
|
||||
menuitem.setAttribute("id", "editlist");
|
||||
popup.appendChild(menuitem);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onEnginePopupCommand">
|
||||
<parameter name="aEvent"/>
|
||||
<body><![CDATA[
|
||||
if (aEvent.target.id == "editlist") {
|
||||
// XXX
|
||||
/* openDialog("chrome://browser/content/search/edit-engines.xul", "",
|
||||
"modal,centerscreen"); */
|
||||
var regionBundle = document.getElementById("bundle_browser_region");
|
||||
loadURI(regionBundle.getString("searchEnginesURL"), null, null);
|
||||
} else {
|
||||
this.currentEngine = aEvent.target.engine;
|
||||
this.focus();
|
||||
this.select();
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="selectEngine">
|
||||
<parameter name="aEvent"/>
|
||||
<parameter name="isNextEngine"/>
|
||||
<body><![CDATA[
|
||||
// XXX this seems suboptimal...
|
||||
var currentEngine = this.currentEngine;
|
||||
if (currentEngine) {
|
||||
var engines = this.searchService.getVisibleEngines({ });
|
||||
for (var i = 0; i < engines.length; ++i) {
|
||||
if (engines[i] == currentEngine) {
|
||||
var nextIndex = i + (isNextEngine ? 1 : -1);
|
||||
if (nextIndex >= 0 && nextIndex < engines.length)
|
||||
this.currentEngine = engines[nextIndex];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
aEvent.preventDefault();
|
||||
aEvent.stopPropagation();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="doSearch">
|
||||
<parameter name="aData"/>
|
||||
<parameter name="aInNewTab"/>
|
||||
<body><![CDATA[
|
||||
var postData = { value: null };
|
||||
var submission = this.currentEngine.getSubmission(aData);
|
||||
if (submission) {
|
||||
url = submission.uri.spec;
|
||||
postData.value = submission.postData;
|
||||
}
|
||||
|
||||
if (aInNewTab) {
|
||||
content.focus();
|
||||
getBrowser().loadOneTab(url, null, null, postData.value, false);
|
||||
if (gURLBar)
|
||||
gURLBar.value = url;
|
||||
} else
|
||||
loadURI(url, null, postData.value);
|
||||
content.focus();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="searchbar-textbox" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete">
|
||||
<binding id="searchbar-textbox"
|
||||
extends="chrome://global/content/bindings/autocomplete.xml#autocomplete">
|
||||
<implementation>
|
||||
|
||||
<constructor><![CDATA[
|
||||
if (this.parentNode.parentNode.parentNode.localName ==
|
||||
"toolbarpaletteitem")
|
||||
|
@ -113,82 +292,49 @@
|
|||
} catch (ex) { }
|
||||
]]></destructor>
|
||||
|
||||
<property name="mContextMenu" readonly="true">
|
||||
<getter>
|
||||
var textBox = document.getAnonymousElementByAttribute(this,
|
||||
"anonid", "textbox-input-box");
|
||||
return document.getAnonymousElementByAttribute(textBox,
|
||||
"anonid", "input-box-contextmenu");
|
||||
</getter>
|
||||
</property>
|
||||
<field name="_stringBundle">this.parentNode._stringBundle</field>
|
||||
<field name="_formHistSvc"/>
|
||||
<field name="_prefBranch"/>
|
||||
|
||||
<method name="initialize">
|
||||
<body><![CDATA[
|
||||
this.rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"]
|
||||
.getService(Components.interfaces.nsIRDFService);
|
||||
this.internetSearchDS = this.rdfService.GetDataSource("rdf:internetsearch");
|
||||
this.formHistSvc = Components
|
||||
.classes["@mozilla.org/satchel/form-history;1"]
|
||||
this._formHistSvc =
|
||||
Components.classes["@mozilla.org/satchel/form-history;1"]
|
||||
.getService(Components.interfaces.nsIFormHistory);
|
||||
|
||||
this.prefService =
|
||||
this._prefBranch =
|
||||
Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch2);
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
if (this.prefService.getBoolPref("browser.urlbar.clickSelectsAll"))
|
||||
if (this._prefBranch.getBoolPref("browser.urlbar.clickSelectsAll"))
|
||||
this.setAttribute("clickSelectsAll", true);
|
||||
|
||||
this._initializeEngine();
|
||||
var textBox = document.getAnonymousElementByAttribute(this,
|
||||
"anonid", "textbox-input-box");
|
||||
var cxmenu = document.getAnonymousElementByAttribute(textBox,
|
||||
"anonid", "input-box-contextmenu");
|
||||
|
||||
var element;
|
||||
element = document.createElementNS(XUL_NS, "menuseparator");
|
||||
this.mContextMenu.appendChild(element);
|
||||
var element = document.createElementNS(XUL_NS, "menuseparator");
|
||||
cxmenu.appendChild(element);
|
||||
element = document.createElementNS(XUL_NS, "menuitem");
|
||||
element.setAttribute("label", this.mStringBundle
|
||||
.getString("cmd_clearHistory"));
|
||||
element.setAttribute("accesskey", this.mStringBundle
|
||||
.getString("cmd_clearHistory_accesskey"));
|
||||
const label = this._stringBundle.getString("cmd_clearHistory");
|
||||
const akey = this._stringBundle.getString("cmd_clearHistory_accesskey");
|
||||
element.setAttribute("label", label);
|
||||
element.setAttribute("accesskey", akey);
|
||||
element.setAttribute("cmd", "cmd_clearhistory");
|
||||
this.mContextMenu.appendChild(element);
|
||||
|
||||
cxmenu.appendChild(element);
|
||||
|
||||
this.controllers.appendController(this.searchbarController);
|
||||
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_initializeEngine">
|
||||
<body><![CDATA[
|
||||
var selectedEngineName;
|
||||
try {
|
||||
selectedEngineName =
|
||||
this.prefService
|
||||
.getComplexValue("browser.search.selectedEngine",
|
||||
this.nsIPrefLocalizedString).data;
|
||||
} catch (ex) { }
|
||||
|
||||
// try to set the engine by name
|
||||
this.currentEngineName = selectedEngineName;
|
||||
|
||||
// check to see whether it failed
|
||||
var engine = this.currentEngine;
|
||||
if (!engine)
|
||||
this.currentEngine = this.getDefaultEngine();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<field name="nsIPrefLocalizedString">
|
||||
Components.interfaces.nsIPrefLocalizedString;
|
||||
</field>
|
||||
<field name="mStringBundle"> this.parentNode.mStringBundle </field>
|
||||
<field name="rdfService"/>
|
||||
<field name="internetSearchDS"/>
|
||||
<field name="formHistSvc"/>
|
||||
|
||||
<method name="openSearch">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!this.popupOpen) { // Don't open search popup if history popup is open
|
||||
// Don't open search popup if history popup is open
|
||||
if (!this.popupOpen) {
|
||||
document.getAnonymousElementByAttribute(this.parentNode,
|
||||
"id", "searchbar-dropmarker").click();
|
||||
"anonid", "searchbar-dropmarker").click();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -196,217 +342,44 @@
|
|||
</body>
|
||||
</method>
|
||||
|
||||
<property name="currentEngine"
|
||||
onget="return this.parentNode.getAttribute('searchengine');">
|
||||
<setter><![CDATA[
|
||||
|
||||
if (!val) {
|
||||
if (this.parentNode)
|
||||
this.parentNode.removeAttribute("searchengine");
|
||||
return;
|
||||
}
|
||||
|
||||
this.parentNode.setAttribute("searchengine", val);
|
||||
const kNC_Icon = this.rdfService.GetResource("http://home.netscape.com/NC-rdf#Icon");
|
||||
var rEngine = this.rdfService.GetResource(val);
|
||||
|
||||
this.parentNode.setAttribute("src", this.readRDFString(rEngine, kNC_Icon));
|
||||
|
||||
const kNC_Name = this.rdfService.GetResource("http://home.netscape.com/NC-rdf#Name");
|
||||
var pls = Components.classes["@mozilla.org/pref-localizedstring;1"]
|
||||
.createInstance(this.nsIPrefLocalizedString);
|
||||
pls.data = this.readRDFString(rEngine, kNC_Name);
|
||||
|
||||
this.prefService.setComplexValue("browser.search.selectedEngine",
|
||||
this.nsIPrefLocalizedString, pls);
|
||||
|
||||
var toolTipText = this.mStringBundle
|
||||
.getFormattedString("searchtip", [pls]);
|
||||
this.parentNode.setAttribute("tooltiptext", toolTipText);
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="currentEngineName"
|
||||
onget="return this.parentNode.getAttribute('searchenginename');"
|
||||
onset="this.setEngineByName(val);"/>
|
||||
|
||||
<method name="setEngineByName">
|
||||
<parameter name="aName"/>
|
||||
<body><![CDATA[
|
||||
// XXX this shouldn't be necessary, but it avoids errors
|
||||
// because the searchbar isn't currently destroyed when
|
||||
// removed from the toolbar
|
||||
if (!this.parentNode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const kNC_Root = this.rdfService.GetResource("NC:SearchEngineRoot");
|
||||
const kNC_Child = this.rdfService.GetResource("http://home.netscape.com/NC-rdf#child");
|
||||
const kNC_Name = this.rdfService.GetResource("http://home.netscape.com/NC-rdf#Name");
|
||||
|
||||
var arcs = this.internetSearchDS.GetTargets(kNC_Root, kNC_Child, true);
|
||||
while (arcs.hasMoreElements()) {
|
||||
var rEngine = arcs.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
var name = this.readRDFString(rEngine, kNC_Name);
|
||||
if (name == aName) {
|
||||
this.currentEngine = rEngine.Value;
|
||||
this.parentNode.setAttribute('searchenginename', name);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
this.currentEngine = null;
|
||||
this.parentNode.removeAttribute('searchenginename')
|
||||
return false;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="getDefaultEngine">
|
||||
<body><![CDATA[
|
||||
var defaultName = this.prefService
|
||||
.getComplexValue("browser.search.defaultenginename",
|
||||
this.nsIPrefLocalizedString).data;
|
||||
|
||||
const kNC_Root = this.rdfService.GetResource("NC:SearchEngineRoot");
|
||||
const kNC_child = this.rdfService.GetResource("http://home.netscape.com/NC-rdf#child");
|
||||
const kNC_Name = this.rdfService.GetResource("http://home.netscape.com/NC-rdf#Name");
|
||||
|
||||
var arcs = this.internetSearchDS.GetTargets(kNC_Root, kNC_child, true);
|
||||
while (arcs.hasMoreElements()) {
|
||||
var rEngine = arcs.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
var name = this.readRDFString(rEngine, kNC_Name);
|
||||
if (name == defaultName)
|
||||
return rEngine.Value;
|
||||
}
|
||||
return null;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="readRDFString">
|
||||
<parameter name="aRes"/>
|
||||
<parameter name="aProp"/>
|
||||
<body><![CDATA[
|
||||
var n = this.internetSearchDS.GetTarget(aRes, aProp, true);
|
||||
return n ? n.QueryInterface(Components.interfaces.nsIRDFLiteral).Value : null;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
// overload |onTextEntered| in autocomplete.xml
|
||||
<!-- overload |onTextEntered| in autocomplete.xml -->
|
||||
<method name="onTextEntered">
|
||||
<parameter name="aEvent"/>
|
||||
<body><![CDATA[
|
||||
// Save the current value in the form history
|
||||
if (this.value && !this.hasAttribute("disableautocomplete"))
|
||||
this.formHistSvc.addEntry(this.getAttribute(
|
||||
this._formHistSvc.addEntry(this.getAttribute(
|
||||
"autocompletesearchparam"), this.value);
|
||||
|
||||
var ISEARCHSVC = Components.classes["@mozilla.org/rdf/datasource;1?name=internetsearch"]
|
||||
.getService(Components.interfaces.nsIInternetSearchService);
|
||||
//XXX Bug 269994: Add in dummy search text "ABC" if the field is empty to ensure a result
|
||||
var searchURL = ISEARCHSVC.GetInternetSearchURL(this.currentEngine,
|
||||
this.value? encodeURIComponent(this.value):"ABC",
|
||||
0, 0, {value:0});
|
||||
|
||||
// if the search box is empty, let's load the host
|
||||
if (!this.value) {
|
||||
var uri = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService)
|
||||
.newURI(searchURL, null, null);
|
||||
|
||||
try {
|
||||
searchURL = uri.host;
|
||||
} catch (ex) {}
|
||||
}
|
||||
var evt = aEvent || this.mEnterEvent;
|
||||
var openInTab = this.prefService.getBoolPref("browser.search.openintab");
|
||||
SearchLoadURL(searchURL, ((evt && evt.altKey) ^ openInTab));
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onEnginePopupCommand">
|
||||
<parameter name="aEvent"/>
|
||||
<body><![CDATA[
|
||||
var target = aEvent.target
|
||||
if (target.getAttribute("anonid") == "addengine-menuitem") {
|
||||
var regionBundle = document.getElementById("bundle_browser_region");
|
||||
loadURI(regionBundle.getString("searchEnginesURL"), null, null);
|
||||
} else {
|
||||
this.currentEngine = target.id;
|
||||
this.focus();
|
||||
this.select();
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onEnginePopupShowing">
|
||||
<parameter name="aEvent"/>
|
||||
<body><![CDATA[
|
||||
var target = aEvent.target;
|
||||
var element = document.getAnonymousElementByAttribute(this.parentNode,
|
||||
"anonid", "addengine-menuitem");
|
||||
if (element)
|
||||
return;
|
||||
|
||||
element = document.createElementNS(XUL_NS, "menuseparator");
|
||||
target.appendChild(element);
|
||||
element = document.createElementNS(XUL_NS, "menuitem");
|
||||
element.setAttribute("label", this.mStringBundle
|
||||
.getString("cmd_addEngine"));
|
||||
element.setAttribute("accesskey", this.mStringBundle
|
||||
.getString("cmd_addEngine_accesskey"));
|
||||
element.setAttribute("anonid", "addengine-menuitem");
|
||||
target.appendChild(element);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onEnginePopupHidden">
|
||||
<parameter name="aEvent"/>
|
||||
<body><![CDATA[
|
||||
var target = aEvent.target;
|
||||
var element = document.getAnonymousElementByAttribute(this.parentNode,
|
||||
"anonid", "addengine-menuitem");
|
||||
if (element) {
|
||||
target.removeChild(target.lastChild);
|
||||
target.removeChild(target.lastChild);
|
||||
}
|
||||
var newTab = this._prefBranch.getBoolPref("browser.search.openintab");
|
||||
this.parentNode.doSearch(this.value, ((evt && evt.altKey) ^ newTab));
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- nsIController -->
|
||||
<field name="searchbarController" readonly="true"><![CDATA[
|
||||
({
|
||||
mOuter: this,
|
||||
|
||||
supportsCommand: function (aCommand)
|
||||
{
|
||||
<field name="searchbarController" readonly="true"><![CDATA[({
|
||||
_self: this,
|
||||
supportsCommand: function(aCommand) {
|
||||
return aCommand == "cmd_clearhistory";
|
||||
},
|
||||
|
||||
isCommandEnabled: function (aCommand)
|
||||
{
|
||||
return this.mOuter.formHistSvc.nameExists(
|
||||
this.mOuter.getAttribute("autocompletesearchparam"));
|
||||
isCommandEnabled: function(aCommand) {
|
||||
return this._self._formHistSvc.nameExists(
|
||||
this._self.getAttribute("autocompletesearchparam"));
|
||||
},
|
||||
|
||||
doCommand: function (aCommand)
|
||||
{
|
||||
// Clear the searchbar and its undo history
|
||||
this.mOuter.value = "";
|
||||
this.mOuter.editor.enableUndo(false);
|
||||
this.mOuter.editor.enableUndo(true);
|
||||
|
||||
this.mOuter.formHistSvc.removeEntriesForName(
|
||||
this.mOuter.getAttribute("autocompletesearchparam"));
|
||||
doCommand: function (aCommand) {
|
||||
this._self._formHistSvc.removeEntriesForName(
|
||||
this._self.getAttribute("autocompletesearchparam"));
|
||||
this._self.value = "";
|
||||
}
|
||||
})
|
||||
]]></field>
|
||||
})]]></field>
|
||||
|
||||
<!-- DND Observer -->
|
||||
<field name="searchbarDNDObserver" readonly="true"><![CDATA[
|
||||
({
|
||||
<field name="searchbarDNDObserver" readonly="true"><![CDATA[({
|
||||
mOuter: this,
|
||||
|
||||
onDrop: function (aEvent, aXferData, aDragSession)
|
||||
{
|
||||
onDrop: function (aEvent, aXferData, aDragSession) {
|
||||
var data = transferUtils.retrieveURLFromData(aXferData.data,
|
||||
aXferData.flavour.contentType);
|
||||
if (data) {
|
||||
|
@ -415,8 +388,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
getSupportedFlavours: function ()
|
||||
{
|
||||
getSupportedFlavours: function () {
|
||||
var flavourSet = new FlavourSet();
|
||||
|
||||
flavourSet.appendFlavour("text/unicode");
|
||||
|
@ -424,66 +396,44 @@
|
|||
flavourSet.appendFlavour("application/x-moz-file", "nsIFile");
|
||||
return flavourSet;
|
||||
}
|
||||
})
|
||||
]]></field>
|
||||
|
||||
})]]></field>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="vk_up" modifiers="accel"
|
||||
phase="capturing"
|
||||
action="this.parentNode.selectEngine(event, false);"/>
|
||||
|
||||
<handler event="keypress" keycode="vk_up" modifiers="accel" phase="capturing">
|
||||
<![CDATA[
|
||||
var currentEngine = this.currentEngine;
|
||||
if (currentEngine) {
|
||||
var searchEngineMenuitem = document.getAnonymousElementByAttribute(this.parentNode, "id", currentEngine);
|
||||
var newEngine = searchEngineMenuitem.previousSibling;
|
||||
if (newEngine && newEngine.localName == "menuitem")
|
||||
this.currentEngine = newEngine.id;
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="keypress" keycode="vk_down" modifiers="accel"
|
||||
phase="capturing"
|
||||
action="this.parentNode.selectEngine(event, true);"/>
|
||||
|
||||
<handler event="keypress" keycode="vk_down" modifiers="alt" phase="capturing"
|
||||
<handler event="keypress" keycode="vk_down" modifiers="alt"
|
||||
phase="capturing"
|
||||
action="return this.openSearch();"/>
|
||||
|
||||
<handler event="keypress" keycode="vk_up" modifiers="alt" phase="capturing"
|
||||
<handler event="keypress" keycode="vk_up" modifiers="alt"
|
||||
phase="capturing"
|
||||
action="return this.openSearch();"/>
|
||||
|
||||
#ifndef XP_MACOSX
|
||||
<handler event="keypress" keycode="vk_f4" phase="capturing"
|
||||
<handler event="keypress" keycode="vk_f4"
|
||||
phase="capturing"
|
||||
action="return this.openSearch();"/>
|
||||
#endif
|
||||
|
||||
<handler event="keypress" keycode="vk_down" modifiers="accel" phase="capturing">
|
||||
<![CDATA[
|
||||
var currentEngine = this.currentEngine;
|
||||
if (currentEngine) {
|
||||
var searchEngineMenuitem = document.getAnonymousElementByAttribute(this.parentNode, "id", currentEngine);
|
||||
|
||||
var newEngine = searchEngineMenuitem.nextSibling;
|
||||
|
||||
if (newEngine && newEngine.localName == "menuitem")
|
||||
this.currentEngine = newEngine.id;
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="dragdrop" phase="capturing">
|
||||
nsDragAndDrop.drop(event, this.searchbarDNDObserver);
|
||||
</handler>
|
||||
|
||||
</handlers>
|
||||
|
||||
</binding>
|
||||
|
||||
<binding id="searchbar-dropmarker" extends="chrome://browser/content/search.xml#searchbar-base">
|
||||
<binding id="searchbar-dropmarker"
|
||||
extends="chrome://browser/content/search/search.xml#searchbar-base">
|
||||
<content>
|
||||
<xul:stack flex="1">
|
||||
<xul:hbox align="center">
|
||||
<xul:hbox align="center" class="searchbar-engine-image-container">
|
||||
<xul:image class="searchbar-engine-image" xbl:inherits="src"/>
|
||||
</xul:hbox>
|
||||
<xul:image class="searchbar-dropmarker-image"/>
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
.searchbar-textbox {
|
||||
-moz-binding: url("chrome://browser/content/search.xml#searchbar-textbox");
|
||||
-moz-binding: url("chrome://browser/content/search/search.xml#searchbar-textbox");
|
||||
}
|
||||
|
||||
.searchbar-dropmarker {
|
||||
-moz-binding: url("chrome://browser/content/search.xml#searchbar-dropmarker");
|
||||
-moz-binding: url("chrome://browser/content/search/search.xml#searchbar-dropmarker");
|
||||
-moz-user-focus: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
browser.jar:
|
||||
* content/browser/search/search.xml (content/search.xml)
|
||||
content/browser/search/searchbarBindings.css (content/searchbarBindings.css)
|
|
@ -0,0 +1,288 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Browser Search Service.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Google Inc.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2005
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <beng@google.com> (Original author)
|
||||
# Gavin Sharp <gavin@gavinsharp.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIURI;
|
||||
interface nsIInputStream;
|
||||
|
||||
[scriptable, uuid(1163b8bf-3446-4a36-a4df-9e870125b076)]
|
||||
interface nsISearchSubmission : nsISupports
|
||||
{
|
||||
/**
|
||||
* The POST data associated with a search submission, wrapped in a MIME
|
||||
* input stream. May be null.
|
||||
*/
|
||||
readonly attribute nsIInputStream postData;
|
||||
|
||||
/**
|
||||
* The URI to submit a search to.
|
||||
*/
|
||||
readonly attribute nsIURI uri;
|
||||
};
|
||||
|
||||
[scriptable, uuid(b64edb5b-4d05-44df-b9bf-2098d9069f88)]
|
||||
interface nsISearchEngine : nsISupports
|
||||
{
|
||||
/**
|
||||
* Gets a nsISearchSubmission object that contains information about what to
|
||||
* send to the search engine, including the URI and postData, if applicable.
|
||||
*
|
||||
* @param data
|
||||
* Data to add to the submission object.
|
||||
* i.e. the search terms.
|
||||
*
|
||||
* @returns A nsISearchSubmission object that contains information about what
|
||||
* to send to the search engine.
|
||||
*/
|
||||
nsISearchSubmission getSubmission(in AString data);
|
||||
|
||||
/**
|
||||
* Adds a parameter to the search engine's submission data. This should only
|
||||
* be called on engine's created via addEngineWithDetails.
|
||||
*
|
||||
* @param name
|
||||
* The parameter's name. Must not be null.
|
||||
*
|
||||
* @param value
|
||||
* The value to pass. If value is "{searchTerms}", it will be
|
||||
* substituted with the user-entered data when retrieving the
|
||||
* submission. Must not be null.
|
||||
*
|
||||
* @throws NS_ERROR_FAILURE if the search engine is read-only.
|
||||
* @throws NS_ERROR_INVALID_ARG if name or value are null.
|
||||
*/
|
||||
void addParam(in AString name, in AString value);
|
||||
|
||||
/**
|
||||
* Supported search engine types.
|
||||
*/
|
||||
const unsigned long TYPE_MOZSEARCH = 1;
|
||||
const unsigned long TYPE_SHERLOCK = 2;
|
||||
const unsigned long TYPE_OPENSEARCH = 3;
|
||||
|
||||
/**
|
||||
* Supported search engine data types.
|
||||
*/
|
||||
const unsigned long DATA_XML = 1;
|
||||
const unsigned long DATA_TEXT = 2;
|
||||
|
||||
/**
|
||||
* The shortcut alias of the engine. This is a unique identifier.
|
||||
*/
|
||||
attribute AString alias;
|
||||
|
||||
/**
|
||||
* Whether the engine should be hidden from the user.
|
||||
*/
|
||||
attribute boolean hidden;
|
||||
|
||||
/**
|
||||
* A nsIURI corresponding to the engine's icon, stored locally. May be null.
|
||||
*/
|
||||
readonly attribute nsIURI iconURI;
|
||||
|
||||
/**
|
||||
* The display name of the search engine. This is a unique identifier.
|
||||
*/
|
||||
readonly attribute AString name;
|
||||
|
||||
/**
|
||||
* The search engine type.
|
||||
*/
|
||||
readonly attribute long type;
|
||||
|
||||
/**
|
||||
* A URL string pointing to the engine's search form.
|
||||
*/
|
||||
readonly attribute AString searchForm;
|
||||
|
||||
};
|
||||
|
||||
[scriptable, uuid(eaa8c60f-a0d7-4afe-b629-ab5ac9434298)]
|
||||
interface nsIBrowserSearchService : nsISupports
|
||||
{
|
||||
/**
|
||||
* Adds a new search engine from the file at the supplied URI.
|
||||
*
|
||||
* @param engineURL
|
||||
* The URL to the search engine's description file.
|
||||
*
|
||||
* @param type
|
||||
* An integer representing the plugin file format. Must be one
|
||||
* of the supported search engine data types defined above.
|
||||
*
|
||||
* @param iconURL the URL to an icon file to be used as the search engine's
|
||||
* icon.
|
||||
*
|
||||
* @throws NS_ERROR_FAILURE if the type is invalid, or if the description
|
||||
* file cannot be successfully loaded.
|
||||
*/
|
||||
void addEngine(in AString engineURL, in long type, in AString iconURL);
|
||||
|
||||
/**
|
||||
* Adds a new search engine.
|
||||
*
|
||||
* @param name
|
||||
* The search engine's name. Must be unique. Must not be null.
|
||||
*
|
||||
* @param iconURL
|
||||
* Optional: A URL string pointing to the icon to be used to represent
|
||||
* the engine.
|
||||
*
|
||||
* @param alias
|
||||
* Optional: A unique shortcut that can be used to retrieve the
|
||||
* search engine.
|
||||
*
|
||||
* @param description
|
||||
* Optional: a description of the search engine.
|
||||
*
|
||||
* @param method
|
||||
* The HTTP request method used when submitting a search query.
|
||||
* Must be a case insensitive value of either "get" or "post".
|
||||
*
|
||||
* @param url
|
||||
* The URL to which search queries should be sent.
|
||||
* Must not be null.
|
||||
*/
|
||||
void addEngineWithDetails(in AString name,
|
||||
in AString iconURL,
|
||||
in AString alias,
|
||||
in AString description,
|
||||
in AString method,
|
||||
in AString url);
|
||||
|
||||
/**
|
||||
* Returns an engine with the specified alias.
|
||||
*
|
||||
* @param alias
|
||||
* The search engine's alias.
|
||||
* @returns The corresponding nsISearchEngine object, or null if it doesn't
|
||||
* exist.
|
||||
*/
|
||||
nsISearchEngine getEngineByAlias(in AString alias);
|
||||
|
||||
/**
|
||||
* Returns an engine with the specified name.
|
||||
*
|
||||
* @param aEngineName
|
||||
* The name of the engine.
|
||||
* @returns The corresponding nsISearchEngine object, or null if it doesn't
|
||||
* exist.
|
||||
*/
|
||||
nsISearchEngine getEngineByName(in AString aEngineName);
|
||||
|
||||
/**
|
||||
* Returns an array of all installed search engines.
|
||||
*
|
||||
* @returns an array of nsISearchEngine objects.
|
||||
*/
|
||||
void getEngines(
|
||||
out unsigned long engineCount,
|
||||
[retval, array, size_is(engineCount)] out nsISearchEngine engines);
|
||||
|
||||
/**
|
||||
* Returns an array of all installed search engines whose hidden attribute is
|
||||
* false.
|
||||
*
|
||||
* @returns an array of nsISearchEngine objects.
|
||||
*/
|
||||
void getVisibleEngines(
|
||||
out unsigned long engineCount,
|
||||
[retval, array, size_is(engineCount)] out nsISearchEngine engines);
|
||||
|
||||
/**
|
||||
* Removes the search engine. If the search engine is installed in a global
|
||||
* location, this will just hide the engine. If the engine is in the user's
|
||||
* profile directory, it will be removed from disk.
|
||||
*
|
||||
* @param engine
|
||||
* The engine to remove.
|
||||
*/
|
||||
void removeEngine(in nsISearchEngine engine);
|
||||
|
||||
/**
|
||||
* The default search engine.
|
||||
*/
|
||||
readonly attribute nsISearchEngine defaultEngine;
|
||||
|
||||
/**
|
||||
* The currently active search engine.
|
||||
*/
|
||||
attribute nsISearchEngine currentEngine;
|
||||
|
||||
};
|
||||
|
||||
%{ C++
|
||||
/**
|
||||
* The observer topic to listen to for actions performed on installed
|
||||
* search engines.
|
||||
*/
|
||||
#define SEARCH_ENGINE_TOPIC "browser-search-engine-modified"
|
||||
|
||||
/**
|
||||
* Sent when an engine is removed from the data store.
|
||||
*/
|
||||
#define SEARCH_ENGINE_REMOVED "engine-removed"
|
||||
|
||||
/**
|
||||
* Sent when an engine is changed. This includes when the engine's "hidden"
|
||||
* property is changed.
|
||||
*/
|
||||
#define SEARCH_ENGINE_CHANGED "engine-changed"
|
||||
|
||||
/**
|
||||
* Sent when an engine is added to the list of available engines.
|
||||
*/
|
||||
#define SEARCH_ENGINE_ADDED "engine-added"
|
||||
|
||||
/**
|
||||
* Sent when a search engine being installed from a remote plugin description
|
||||
* file is completely loaded. This is used internally by the search service as
|
||||
* an indication of when the engine can be added to the internal store, and
|
||||
* therefore should not be used to detect engine availability. It is always
|
||||
* followed by an "added" notification.
|
||||
*/
|
||||
#define SEARCH_ENGINE_LOADED "engine-loaded"
|
||||
|
||||
/**
|
||||
* Sent when the "current" engine is changed.
|
||||
*/
|
||||
#define SEARCH_ENGINE_CURRENT "engine-current";
|
||||
|
||||
%}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -128,6 +128,7 @@ function (engineURL, iconURL, suggestedTitle, suggestedCategory)
|
|||
debug("addSearchEngine(" + engineURL + ", " + iconURL + ", " +
|
||||
suggestedCategory + ", " + suggestedTitle + ")");
|
||||
|
||||
// XXXBug 312560: Localize me!
|
||||
try
|
||||
{
|
||||
// make sure using HTTP or HTTPS and refering to a .src file
|
||||
|
@ -154,7 +155,6 @@ function (engineURL, iconURL, suggestedTitle, suggestedCategory)
|
|||
titleMessage = stringBundle.GetStringFromName("addEngineConfirmTitle");
|
||||
dialogMessage = stringBundle.GetStringFromName("addEngineConfirmMessage");
|
||||
dialogMessage = dialogMessage.replace(/%title%/, suggestedTitle);
|
||||
dialogMessage = dialogMessage.replace(/%category%/, suggestedCategory);
|
||||
dialogMessage = dialogMessage.replace(/%url%/, engineURL);
|
||||
dialogMessage = dialogMessage.replace(/#/g, "\n");
|
||||
}
|
||||
|
@ -162,7 +162,6 @@ function (engineURL, iconURL, suggestedTitle, suggestedCategory)
|
|||
catch (e) {
|
||||
titleMessage = "Add Search Engine";
|
||||
dialogMessage = "Add the following search engine?\n\nName: " + suggestedTitle;
|
||||
dialogMessage += "\nSearch Category: " + suggestedCategory;
|
||||
dialogMessage += "\nSource: " + engineURL;
|
||||
}
|
||||
|
||||
|
@ -171,14 +170,11 @@ function (engineURL, iconURL, suggestedTitle, suggestedCategory)
|
|||
if (!rv)
|
||||
return;
|
||||
|
||||
var internetSearch = Components.classes[NETSEARCH_CONTRACTID].getService();
|
||||
if (internetSearch)
|
||||
internetSearch = internetSearch.QueryInterface(nsIInternetSearchService);
|
||||
if (internetSearch)
|
||||
{
|
||||
internetSearch.AddSearchEngine(engineURL, iconURL, suggestedTitle,
|
||||
suggestedCategory);
|
||||
}
|
||||
var searchService = Components.classes["@mozilla.org/browser/search-service;1"]
|
||||
.getService(Components.interfaces.nsIBrowserSearchService);
|
||||
const typeText = Components.interfaces.nsISearchEngine.DATA_TEXT;
|
||||
if (searchService)
|
||||
searchService.addEngine(engineURL, typeText, iconURL);
|
||||
}
|
||||
|
||||
// property of nsIClassInfo
|
||||
|
|
|
@ -23,6 +23,18 @@ extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/install.rdf
|
|||
extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/
|
||||
searchplugins/dictionary.src
|
||||
searchplugins/dictionary.png
|
||||
searchplugins/amazondotcom.src
|
||||
searchplugins/amazondotcom.png
|
||||
searchplugins/creativecommons.src
|
||||
searchplugins/creativecommons.png
|
||||
searchplugins/answers.src
|
||||
searchplugins/answers.png
|
||||
searchplugins/eBay.src
|
||||
searchplugins/eBay.gif
|
||||
searchplugins/google.src
|
||||
searchplugins/google.gif
|
||||
searchplugins/yahoo.src
|
||||
searchplugins/yahoo.gif
|
||||
searchplugins/
|
||||
components/component.reg
|
||||
components/compreg.dat
|
||||
|
|
|
@ -58,6 +58,7 @@ bin/components/autocomplete.xpt
|
|||
bin/components/autoconfig.xpt
|
||||
bin/components/bookmarks.xpt
|
||||
bin/components/browsercompsbase.xpt
|
||||
bin/components/browsersearch.xpt
|
||||
bin/components/caps.xpt
|
||||
bin/components/chardet.xpt
|
||||
bin/components/chrome.xpt
|
||||
|
@ -178,6 +179,7 @@ bin/components/shellservice.xpt
|
|||
bin/components/nsBrowserContentHandler.js
|
||||
bin/components/nsBrowserGlue.js
|
||||
bin/components/nsSetDefaultBrowser.js
|
||||
bin/components/nsSearchService.js
|
||||
bin/components/jsconsole-clhandler.js
|
||||
bin/components/nsCloseAllWindows.js
|
||||
bin/components/nsDictionary.js
|
||||
|
|
|
@ -62,6 +62,7 @@ bin\components\autocomplete.xpt
|
|||
bin\components\autoconfig.xpt
|
||||
bin\components\bookmarks.xpt
|
||||
bin\components\browsercompsbase.xpt
|
||||
bin\components\browsersearch.xpt
|
||||
bin\components\caps.xpt
|
||||
bin\components\chardet.xpt
|
||||
bin\components\chrome.xpt
|
||||
|
@ -194,6 +195,7 @@ bin\components\nsCloseAllWindows.js
|
|||
bin\components\nsDictionary.js
|
||||
bin\components\nsHelperAppDlg.js
|
||||
bin\components\nsProxyAutoConfig.js
|
||||
bin\components\nsSearchService.js
|
||||
bin\components\nsSidebar.js
|
||||
bin\components\nsXmlRpcClient.js
|
||||
bin\components\nsExtensionManager.js
|
||||
|
|
|
@ -125,10 +125,10 @@ install:: $(addprefix $(LOCALE_SRCDIR)/profile/chrome/,$(PROFILE_CHROME))
|
|||
SEARCH_PLUGINS = $(shell cat $(LOCALE_SRCDIR)/searchplugins/list.txt)
|
||||
SEARCH_PLUGIN_PREFIX = $(addprefix $(LOCALE_SRCDIR)/searchplugins/,$(SEARCH_PLUGINS))
|
||||
|
||||
libs:: $(addsuffix .src,$(SEARCH_PLUGIN_PREFIX)) $(foreach base,$(SEARCH_PLUGIN_PREFIX),$(wildcard $(base).gif)$(wildcard $(base).png))
|
||||
libs:: $(addsuffix .xml,$(SEARCH_PLUGIN_PREFIX)) $(foreach base,$(SEARCH_PLUGIN_PREFIX),$(wildcard $(base).gif)$(wildcard $(base).png))
|
||||
$(INSTALL) $^ $(FINAL_TARGET)/searchplugins
|
||||
|
||||
install:: $(addsuffix .src,$(SEARCH_PLUGIN_PREFIX)) $(foreach base,$(SEARCH_PLUGIN_PREFIX),$(wildcard $(base).gif)$(wildcard $(base).png))
|
||||
install:: $(addsuffix .xml,$(SEARCH_PLUGIN_PREFIX)) $(foreach base,$(SEARCH_PLUGIN_PREFIX),$(wildcard $(base).gif)$(wildcard $(base).png))
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/searchplugins
|
||||
|
||||
libs-%:
|
||||
|
|
|
@ -10,14 +10,14 @@ browser.startup.homepage=http://start.mozilla.org/firefox
|
|||
browser.throbber.url=http://www.mozilla.org/products/firefox/central.html
|
||||
browser.search.defaulturl=http://www.google.com/search?lr=&ie=UTF-8&oe=UTF-8&q=
|
||||
|
||||
# Search engine order (order displayed in the search bar dropdown)s
|
||||
browser.search.order.1=Google
|
||||
browser.search.order.2=Yahoo
|
||||
|
||||
#config.js
|
||||
startup.homepage_override_url=http://www.mozilla.org/products/firefox/releases/whatsnew/
|
||||
|
||||
# search-panel.properties
|
||||
defaultSearchURL=http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=
|
||||
# Default search engine
|
||||
browser.search.defaultenginename=Google
|
||||
|
||||
# update notifications: new update page
|
||||
|
|
|
@ -29,7 +29,7 @@ showskinsdescription=true
|
|||
|
||||
# context menu strings
|
||||
|
||||
searchText=Search Web for "%S"
|
||||
contextMenuSearchText=Search %S for "%S"
|
||||
|
||||
blockImages=Block Images from %S
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
searchtip=Search %S
|
||||
cmd_addEngine=Add Engines...
|
||||
cmd_addEngine_accesskey=A
|
||||
cmd_clearHistory=Clear Search History
|
||||
cmd_clearHistory_accesskey=C
|
||||
cmd_editList=Edit this list...
|
||||
cmd_editListAccesskey=E
|
||||
error_loading_engine_title=Download Error
|
||||
error_loading_engine_msg=%S could not download the search plugin from:\n%S\n\nPlease try again or contact the author.
|
||||
remove_engine_title=Remove Engine?
|
||||
remove_engine_msg=If you remove '%S' you will not be able to search using it from the Search Box any more. Are you sure you want to remove it?
|
||||
edit_name_title=Edit Name
|
||||
edit_name_msg=Enter a new Name:
|
||||
edit_alias_title=Edit Alias
|
||||
edit_alias_msg=Enter a new Alias:
|
|
@ -1,2 +1,2 @@
|
|||
addEngineConfirmTitle=Add Search Engine
|
||||
addEngineConfirmMessage=Add the following search engine to the Search Bar?##Name: %title%#Search Category: %category%#Source: %url%
|
||||
addEngineConfirmMessage=Add the following search engine to the Search Bar?##Name: %title%#Source: %url%
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearchdescription/1.1/">
|
||||
<os:ShortName>Amazon.com</os:ShortName>
|
||||
<os:Description>Amazon.com Search</os:Description>
|
||||
<os:InputEncoding>ISO-8859-1</os:InputEncoding>
|
||||
<os:Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsQAAALEAGtI711AAAAB3RJTUUH0wESEi0MqTATXwAAAjVJREFUeJyFUlGLElEU/mbVHd2aaaRgWGyJgmXRINiXfJCeRgaiLEiKgYXoRQrqRejNH7D1uNBDPvbWtGxvS64IG2IIQQhxScpYMpt1l1qdptVVZ+z2oM6qu9KBC4dzv/Od73z3AmPROmjeVlWVKopCRVGkHMdRURSpoig0lUrRcfxI6LoelWV5GwCddOLx+PEklmVej0QiI80Oh4OyLHuE5Fgl/aJ9gsEgzefzm4SQzVgs9n8VqqqO7EwIsUGEkEscx9kEsizbd85BEo3eenzzRkRstTsfAVwRBOH+EP/DSb4x4wVN0wq5XE7MZDKz5XIZlUoFtVoNu7u7NkaWZaTTaWZEQV8qDYfDKBaLkwZOVkAI8UuS9GkwiWVZNBr7sLZeo1V6hb/GFrxGwW6s84twzYbgGBRM0/yZzWZtQCKRQGhuD80PT0DbdUzxF9DmA2jzAbiNIjztHUzvvT+UIoqi7TLHcVTX9QeWZVLLMikh5Nzwf2h9USlNgtIk6NSAoNlsYjgXBOG50+liAGCe3/72ayOGP28f9fZ2ewEAv89GYRMEAgGboNvtYjBtf0PB9BsZJz8/Q7dR7d3Xeia75+/0XsGyTEqNrzC/p9HVSzCr7w4N+7GGOr+IE6GnOH3+KgCgo2XhAeCak+DU16PUWL0Mr1EYfdO+027/PZxaWIKJmY4kSaX1lysXnat+HARXMOM5wzA0iSP/etDILixhp9aGz+djAEDTtLt8aflFt1GFcG2NAYB/rN8dqx12fbIAAAAASUVORK5CYII=</os:Image>
|
||||
<os:Url type="text/html" method="GET" template="http://www.amazon.com/exec/obidos/external-search/">
|
||||
<os:Param name="field-keywords" value="{searchTerms}"/>
|
||||
<os:Param name="mode" value="blended"/>
|
||||
<os:Param name="tag" value="mozilla-20"/>
|
||||
<os:Param name="sourceid" value="Mozilla-search"/>
|
||||
</os:Url>
|
||||
</SearchPlugin>
|
|
@ -0,0 +1,10 @@
|
|||
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearchdescription/1.1/">
|
||||
<os:ShortName>Answers.com</os:ShortName>
|
||||
<os:Description>Dictionary Search on Answers.com</os:Description>
|
||||
<os:InputEncoding>UTF-8</os:InputEncoding>
|
||||
<os:Image width="16" height="16">data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAABMLAAATCwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////K////4f////E////5f///+n////P////mv///0EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8E////fv///+//////////////////////7NnP/+LFtv/////+////of///xYAAAAAAAAAAAAAAAD///8D////lf////////////j0//bi1v/OlXf/tGU9/6FCEv/OmH3////////////////D////FgAAAAAAAAAA////avPm4P/evaz/8NbI//7r3//23M3/xYRi/5kzAP/Df1z//u/l//749P/v4dn/+PPw/////6j///8B////GP///+W/f1//smM7//bczf/+69///uvf/9ytlP+ZMwD/5se3/+/f1//AgmP/nj0N/927qv/////+////QP///2z/////8NvQ/8WCYP/+69///uvf//7r3/+7ckz/pUkb/9m1ov+ePQ3/okUW/8+fh//38O3//////////5r///+t//////7y6v/Cflv/58Cr//DRwP/mwKv/okQU/8ODYv/cuqj/yZN4//Tq5f/+9e///vDn///////////Q////yf/////+7+b/05yA/65ZLv+9dVD/sF40/5kzAP/kvKb//vTu//Tr5v/7+Pb//vfz//707f//////////6f///8X//////vDm/+K4ov/KjGz//ure/8uNbf+jRBX/+OTX/+3b0v+jSBr/pk0h/717Wv/Wrpr//Pn4/////+b///+i//////7z7f/02Mj/wn5b//vl2P+uWS7/vXhU//v49//48u//1q6a/717Wv+oUSb/tWxH//jz8P/////K////V///////+/j//ure/8aFZP/fs5v/oEAQ/9q1o/+zaEL/1ayX//718P/+9/P/+PHu//jz8P//////////h////wr////O///////38v/YpYr/tGQ7/6ZLHf/06eX/s2dB/549Df/x49z//vDn//7x6f//////////8////yoAAAAA////R/////v/////7dXI/5kzAP+7cUv//vHp/+vYzv+bNwX/vHlY//38/P///////////////30AAAAAAAAAAAAAAAD///9n////+/z5+P++e1n/3LGc//7w5//++PT/0KKL/8OIa//9/Pv//////////5X///8GAAAAAAAAAAAAAAAAAAAAAP///0n////K///////////////////////////+/v7/////5v///2z///8CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////Cv///1f///+g////xP///8n///+r////bP///xoAAAAAAAAAAAAAAAAAAAAA+B////AH///AA///wAH//4AB//+AAP//AAD//wAA//8AAP//AAD//4AA//+AAf//wAP//+AD///wD////D///w==</os:Image>
|
||||
<os:Url type="text/html" method="GET" template="http://www.answers.com/main/ntquery">
|
||||
<os:Param name="s" value="{searchTerms}"/>
|
||||
<os:Param name="gwp" value="13"/>
|
||||
</os:Url>
|
||||
</SearchPlugin>
|
|
@ -0,0 +1,10 @@
|
|||
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearchdescription/1.1/">
|
||||
<os:ShortName>Creative Commons</os:ShortName>
|
||||
<os:Description>Find photos, movies, music, and text to rip, sample, mash, and share.</os:Description>
|
||||
<os:InputEncoding>utf-8</os:InputEncoding>
|
||||
<os:Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAA2UExURf///wAAAD8/P+/v7y8vL19fX9/f37+/vw8PD8/Pz09PT5+fn4+Pj6+vr29vbx8fH39/f////3TGU44AAAASdFJOU///////////////////////AOK/vxIAAACWSURBVHjaNI8LEsQgCEMJIvi3vf9lN3bbN6MD0USUm3QFaVNYc7kBuvLZ0xG8oLkQV1iiYBjyktFE+tk+FCEGl3oFT0aSQBaoVDAmAyWkmOCitVfHTvV4BEsWxqyleE+PYLQAi5b9WJShPnh7MnQytDP1IxmfvZXq22dkTkpZ4/TT/qPfiX/dqoXJz+dItE0tx6l/AgwA0e4FeJjn5bsAAAAASUVORK5CYII=</os:Image>
|
||||
<os:Url type="text/html" method="GET" template="http://search.creativecommons.org/">
|
||||
<os:Param name="q" value="{searchTerms}"/>
|
||||
<os:Param name="sourceid" value="Mozilla-search"/>
|
||||
</os:Url>
|
||||
</SearchPlugin>
|
|
@ -0,0 +1,16 @@
|
|||
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearchdescription/1.1/">
|
||||
<os:ShortName>eBay</os:ShortName>
|
||||
<os:Description>eBay - Online actions</os:Description>
|
||||
<os:InputEncoding>ISO-8859-1</os:InputEncoding>
|
||||
<os:Image width="16" height="16">data:image/x-icon;base64,R0lGODlhEAAQAMQAAAAAAMz/zMwAADMAzOfn1sxmAP///5kAZpnM////AACZM/777zPMAP+ZAP8AAP9mmf/MzMwAZjNmAADMM/+ZM/9mM//MMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAQUAP8ALAAAAAAQABAAAAVPoCGOZGmeaKqiQDkMYqAoBqMELpxUlVTfBohjeHjBLJLZZCF0GASOAWJQSFAUE1FTwIUNKoYKTQslGCLSb6MBFD2G3Zdo0k4tVvi8fl8KAQA7</os:Image>
|
||||
<os:Url type="text/html" method="GET" template="http://search.ebay.com/search/search.dll">
|
||||
<os:Param name="query" value="{searchTerms}"/>
|
||||
<os:Param name="MfcISAPICommand" value="GetResult"/>
|
||||
<os:Param name="ht" value="1"/>
|
||||
<os:Param name="ebaytag1" value="ebayreg"/>
|
||||
<os:Param name="srchdesc" value="n"/>
|
||||
<os:Param name="maxRecordsReturned" value="300"/>
|
||||
<os:Param name="maxRecordsPerPage" value="50"/>
|
||||
<os:Param name="SortProperty" value="MetaEndSort"/>
|
||||
</os:Url>
|
||||
</SearchPlugin>
|
|
@ -0,0 +1,15 @@
|
|||
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearchdescription/1.1/">
|
||||
<os:ShortName>Google</os:ShortName>
|
||||
<os:Description>Google Search</os:Description>
|
||||
<os:InputEncoding>UTF-8</os:InputEncoding>
|
||||
<os:Image width="16" height="16">data:image/x-icon;base64,R0lGODlhEAAQAPfLAAATVikwdA8SnxUfgAsWpAAilholjxw4jBc7kwAlvQQ2sRMsoBUqqhMzuhY/vxw4tSgmiyM1mSUztiQ6sTE3sQ4qyxMxxRoyxiAuxR1CtBxJsBxasSJuuTFguBte0Rlf2xVc9h9W9xVjzxVr0gdj6BRh4R1o5yBcyiZbyydT1i9b2Ddb1iFY6CJg2Vpor1dzvEJu20Z0yi23QDy1REi2OUy0O1WzOVC4PU+tVUe5Sk2xQU2zRUO4UE21Ula2SmKEqWWF2HyPx2+a6X6e6Xqk1m+s78sUDs4UGdEQB9YfDdwaANEfHd0YEscjAM4mAM0qANIoD9IkGdslGswuItYgL4aP0ImP2YGZ36Opzaq2wq/S+rzX/7/e8MrS1MLO/sTb48rT8snX/83c89PZ+crq+cH1/9Dl/9Ln/93r/9fy/+Hf7P/42eDm/O7u/+T29uX2/eT2/+f4/+f5/+j/9u//8+3/9u7/9ur5/+j//+n//+v//u3//+7//e7//+////b66/T/6vX/6/f/7f/07fj/4fv/4Pj/5v/45v7/4/r+7/3/6fDw+Pfx//D/9/X/8fT/8/f/8ff/8/D///H///L8/fL///P///X7//b6/ff/+/T///b9//f///v19//w9v/09P/29v/x+f/y///z///1+v/1///2///3//j79P/58/z/8/z99/z/9v7/9P7/9vn7//v6//j9//n9//j///n///v//vv////4+v/5+//6+P/4///6/P/6/v/6///7///9+P/8+v/9+v7/+Pz////8/f/9/f79///8///9//7//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAMsALAAAAAAQABAAAAj/AEn4oIFjBw8bOnrMuJGjhowZM1T8UdYJUZ5ZcNRYWjSrVK5QU0DMmtUnzRAXEy4o6FCEy6NDTkQIq1MmRgM0eZTlCXMgQJtRSE4gmgUkwh1EiZTNUiamy6NUUExcuoJgDCdDjQg9KgVL2SNFT1hwEvKglLBWuixZ+jSrlSBdRlL04bBBkTBdpZTpIqWsFaBcTEr0QaEhl6dWlswKW6poDRUPlmAUQKWMkTJLc76QMQNGUZMWgIgkCFJnlq5WXigwkFClVZQQyuRgELAlk7JBymCZGYAF0ZEPrQixgUDAihxVdPpoAZAFUZIRfThxgvPCwAILDipk+OFG2ZIVoxApERtPfvwlvZ+kQFzPvv0MJQEBADs=</os:Image>
|
||||
<os:Url type="text/html" method="GET" template="http://www.google.com/search">
|
||||
<os:Param name="q" value="{searchTerms}"/>
|
||||
<os:Param name="start" value="0"/>
|
||||
<os:Param name="ie" value="utf-8"/>
|
||||
<os:Param name="oe" value="utf-8"/>
|
||||
<os:Param name="client" value="firefox"/>
|
||||
<!-- XXX Hard coded for now - will be removed -->
|
||||
<os:Param name="rls" value="org.mozilla:en-US:unofficial"/>
|
||||
</os:Url>
|
||||
</SearchPlugin>
|
|
@ -1,6 +1,6 @@
|
|||
google
|
||||
amazondotcom
|
||||
eBay
|
||||
yahoo
|
||||
creativecommons
|
||||
answers
|
||||
creativecommons
|
||||
eBay
|
||||
google
|
||||
yahoo
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearchdescription/1.1/">
|
||||
<os:ShortName>Yahoo</os:ShortName>
|
||||
<os:Description>Yahoo Search</os:Description>
|
||||
<os:InputEncoding>UTF-8</os:InputEncoding>
|
||||
<os:Image width="16" height="16">data:image/x-icon;base64,R0lGODlhEAAQAJECAP8AAAAAAP///wAAACH5BAEAAAIALAAAAAAQABAAAAIplI+py+0NogQuyBDEnEd2kHkfFWUamEzmpZSfmaIHPHrRguUm/fT+UwAAOw==</os:Image>
|
||||
<os:Url type="text/html" method="GET" template="http://search.yahoo.com/search">
|
||||
<os:Param name="p" value="{searchTerms}"/>
|
||||
<os:Param name="ei" value="UTF-8"/>
|
||||
<os:Param name="fr" value="moz2"/>
|
||||
</os:Url>
|
||||
</SearchPlugin>
|
|
@ -18,8 +18,7 @@
|
|||
locale/browser/pageReportFirstTime.dtd (%chrome/browser/pageReportFirstTime.dtd)
|
||||
* locale/browser/safeMode.dtd (%chrome/browser/safeMode.dtd)
|
||||
locale/browser/sanitize.dtd (%chrome/browser/sanitize.dtd)
|
||||
locale/browser/searchbar.properties (%chrome/browser/searchbar.properties)
|
||||
* locale/browser/searchDialog.dtd (%chrome/browser/searchDialog.dtd)
|
||||
locale/browser/search.properties (%chrome/browser/search.properties)
|
||||
locale/browser/setDesktopBackground.dtd (%chrome/browser/setDesktopBackground.dtd)
|
||||
locale/browser/shellservice.properties (%chrome/browser/shellservice.properties)
|
||||
#ifdef MOZ_PLACES
|
||||
|
|
Загрузка…
Ссылка в новой задаче