Bug 317107: new search service, r=mconnor, sr=ben

This commit is contained in:
gavin%gavinsharp.com 2006-03-17 07:16:00 +00:00
Родитель e10fa6108b
Коммит 56ee1324c9
57 изменённых файлов: 2969 добавлений и 2053 удалений

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

@ -916,6 +916,7 @@ browser/components/migration/Makefile
browser/components/migration/public/Makefile browser/components/migration/public/Makefile
browser/components/migration/src/Makefile browser/components/migration/src/Makefile
browser/components/preferences/Makefile browser/components/preferences/Makefile
browser/components/search/Makefile
browser/components/sidebar/Makefile browser/components/sidebar/Makefile
browser/components/sidebar/src/Makefile browser/components/sidebar/src/Makefile
browser/components/shell/Makefile browser/components/shell/Makefile

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

@ -205,8 +205,10 @@ pref("browser.download.manager.flashCount", 2);
// pointer to the default engine name // pointer to the default engine name
pref("browser.search.defaultenginename", "chrome://browser-region/locale/region.properties"); 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. // Ordering of Search Engines in the Engine list.
pref("browser.search.order.1", "chrome://browser-region/locale/region.properties"); pref("browser.search.order.1", "chrome://browser-region/locale/region.properties");
pref("browser.search.order.2", "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.2", "chrome://branding/content/searchconfig.properties");
pref("browser.search.order.Yahoo", "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 // search bar results always open in a new tab
pref("browser.search.openintab", false); pref("browser.search.openintab", false);

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

@ -198,7 +198,7 @@
oncommand="AddKeywordForSearchField();"/> oncommand="AddKeywordForSearchField();"/>
<menuitem id="context-searchselect" <menuitem id="context-searchselect"
accesskey="&search.accesskey;" accesskey="&search.accesskey;"
oncommand="OpenSearch('internet', gContextMenu.searchSelected(), true);"/> oncommand="BrowserSearch.loadSearch(getBrowserSelection(), true);"/>
<menuseparator id="frame-sep"/> <menuseparator id="frame-sep"/>
<menu id="frame" label="&thisFrameMenu.label;" accesskey="&thisFrameMenu.accesskey;"> <menu id="frame" label="&thisFrameMenu.label;" accesskey="&thisFrameMenu.accesskey;">
<menupopup> <menupopup>
@ -262,4 +262,3 @@
accesskey="&bidiSwitchPageDirectionItem.accesskey;" accesskey="&bidiSwitchPageDirectionItem.accesskey;"
oncommand="SwitchDocumentDirection(window.content);"/> oncommand="SwitchDocumentDirection(window.content);"/>
</popup> </popup>

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

@ -406,7 +406,7 @@
#ifndef MOZ_PLACES #ifndef MOZ_PLACES
<menu id="bookmarks-menu" label="&bookmarksMenu.label;" accesskey="&bookmarksMenu.accesskey;" <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" ref="NC:BookmarksRoot" flags="dont-test-empty"
template='bookmarks-template' template='bookmarks-template'
infer="forward-proxy" infer="forward-proxy"

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

@ -163,7 +163,7 @@
<command id="cmd_textZoomReset" oncommand="ZoomManager.prototype.getInstance().reset();"/> <command id="cmd_textZoomReset" oncommand="ZoomManager.prototype.getInstance().reset();"/>
<command id="Browser:OpenLocation" oncommand="openLocation();"/> <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', <command id="Tools:Downloads" oncommand="toOpenWindowByType('Download:Manager',
'chrome://mozapps/content/downloads/downloads.xul', 'chrome://mozapps/content/downloads/downloads.xul',
'chrome,dialog=no,resizable');"/> 'chrome,dialog=no,resizable');"/>

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

@ -1,5 +1,5 @@
searchbar { searchbar {
-moz-binding: url("chrome://browser/content/search.xml#searchbar"); -moz-binding: url("chrome://browser/content/search/search.xml#searchbar");
} }
/* ::::: print preview toolbar ::::: */ /* ::::: print preview toolbar ::::: */

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

@ -1806,27 +1806,6 @@ function BrowserLoadURL(aTriggeringEvent, aPostData)
content.focus(); 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) function getShortcutOrURI(aURL, aPostDataRef)
{ {
// rjc: added support for URL shortcuts (3/30/1999) // 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 #ifdef XP_MACOSX
if (window.location.href != getBrowserURL()) { if (window.location.href != getBrowserURL()) {
var win = getTopWin(); var win = getTopWin();
if (win) { if (win) {
// If there's an open browser window, it should handle this command // If there's an open browser window, it should handle this command
win.focus() win.focus()
win.WebSearch(); win.BrowserSearch.webSearch();
} } else {
else { // If there are no open browser windows, open a new one
// If there are no open browser windows, open a new one win = window.openDialog("chrome://browser/content/", "_blank",
win = window.openDialog("chrome://browser/content/", "_blank", "chrome,all,dialog=no", "about:blank");
"chrome,all,dialog=no", "about:blank"); win.addEventListener("load", BrowserSearch.WebSearch, false);
win.addEventListener("load", WebSearchCallback, false);
}
return;
}
#endif
var searchBar = document.getElementById("searchbar");
if (searchBar && !searchBar.parentNode.parentNode.collapsed &&
!(window.getComputedStyle(searchBar.parentNode, null).display == "none")) {
searchBar.select();
searchBar.focus();
} else {
openDialog("chrome://browser/content/searchDialog.xul", "",
"chrome,dialog,resizable,modal");
}
}
function WebSearchCallback() {
// make sure the DOM is ready
setTimeout(function() { this.WebSearch(); }, 0);
}
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.
var defaultSearchURL = null;
var navigatorRegionBundle = document.getElementById("bundle_browser_region");
var fallbackDefaultSearchURL = navigatorRegionBundle.getString("fallbackDefaultSearchURL");
//Check to see if search string contains "://" or "ftp." or white space.
//If it does treat as url and match for pattern
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);
}
} }
return;
} }
#endif
var searchBar = this.getSearchBar();
if (searchBar) {
searchBar.select();
searchBar.focus();
} else {
var ss = Cc["@mozilla.org/browser/search-service;1"].
getService(Ci.nsIBrowserSearchService);
var searchForm = ss.defaultEngine.searchForm;
loadURI(searchForm, null, null);
}
},
/**
* 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;
// 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 submission = engine.getSubmission(searchText);
if (useNewTab) {
getBrowser().loadOneTab(submission.uri.spec, null, null,
submission.postData, false);
} else
loadURI(submission.uri.spec, null, submission.postData);
},
/**
* 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; return text;
}, },
// Get selected object and convert it to a string to get // Get selected text. Only display the first 15 chars.
// selected text. Only display the first 15 chars.
isTextSelection : function() { isTextSelection : function() {
var result = false; // Get 16 characters, so that we can trim the selection if it's greater
var selection = this.searchSelected(16); // than 15 chars
var selectedText = getBrowserSelection(16);
var searchSelectText; if (!selectedText)
if (selection) { return false;
searchSelectText = selection.toString();
if (searchSelectText.length > 15)
searchSelectText = searchSelectText.substr(0,15) + "...";
result = true;
// format "Search for <selection>" string to show in menu if (selectedText.length > 15)
searchSelectText = gNavigatorBundle.getFormattedString("searchText", [searchSelectText]); selectedText = selectedText.substr(0,15) + "...";
this.setItemAttr("context-searchselect", "label", searchSelectText);
} // Use the current engine if the search bar is visible, the default
return result; // 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. // Returns true if anything is selected.
@ -4928,25 +4894,6 @@ nsContextMenu.prototype = {
return !document.commandDispatcher.focusedWindow.getSelection().isCollapsed; 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 () { toString : function () {
return "contextMenu.target = " + this.target + "\n" + return "contextMenu.target = " + this.target + "\n" +
"contextMenu.onImage = " + this.onImage + "\n" + "contextMenu.onImage = " + this.onImage + "\n" +
@ -4955,6 +4902,7 @@ nsContextMenu.prototype = {
"contextMenu.inFrame = " + this.inFrame + "\n" + "contextMenu.inFrame = " + this.inFrame + "\n" +
"contextMenu.hasBGImage = " + this.hasBGImage + "\n"; "contextMenu.hasBGImage = " + this.hasBGImage + "\n";
}, },
isTargetATextBox : function ( node ) isTargetATextBox : function ( node )
{ {
if (node instanceof HTMLInputElement) 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; var gWebPanelURI;
function openWebPanel(aTitle, aURI) function openWebPanel(aTitle, aURI)
{ {
@ -6557,3 +6540,4 @@ var BookmarksEventHandler = {
#include ../../../toolkit/content/debug.js #include ../../../toolkit/content/debug.js
#endif #endif

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

@ -301,7 +301,7 @@
onpopuphidden="BookmarksToolbar.unsetOpenedMenu(event);"> onpopuphidden="BookmarksToolbar.unsetOpenedMenu(event);">
<hbox id="bookmarks-ptf" class="bookmarks-toolbar-items" contextmenu="bookmarks-context-menu" <hbox id="bookmarks-ptf" class="bookmarks-toolbar-items" contextmenu="bookmarks-context-menu"
flex="1" style="min-width:0px; width:0px;padding-left: 3px;" 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" template="bookmarks-template" flags="dont-test-empty"
infer="forward-proxy" infer="forward-proxy"
rdf:type="http://home.netscape.com/NC-rdf#Folder" rdf:type="http://home.netscape.com/NC-rdf#Folder"
@ -320,7 +320,7 @@
<toolbarbutton id="bookmarks-chevron" type="menu" class="chevron" <toolbarbutton id="bookmarks-chevron" type="menu" class="chevron"
chromedir="&locale.dir;" chromedir="&locale.dir;"
mousethrough="never" collapsed="true" mousethrough="never" collapsed="true"
datasources="rdf:bookmarks rdf:files rdf:localsearch" datasources="rdf:bookmarks rdf:files"
template="bookmarks-template" flags="dont-test-empty" template="bookmarks-template" flags="dont-test-empty"
onpopupshowing="BookmarksMenu.onShowMenu(event.target)" onpopupshowing="BookmarksMenu.onShowMenu(event.target)"
onpopuphidden="BookmarksMenu.onHideMenu(event.target)" onpopuphidden="BookmarksMenu.onHideMenu(event.target)"

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

@ -1,494 +0,0 @@
<?xml version="1.0"?>
# -*- Mode: HTML -*-
# ***** 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 mozilla.org browser.
#
# The Initial Developer of the Original Code is
# Joe Hewitt.
# Portions created by the Initial Developer are Copyright (C) 2003
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Pierre Chanial V 2.0 (p_ch@verizon.net)
# 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 *****
<bindings id="SearchBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="searchbar-base">
<resources>
<stylesheet src="chrome://browser/content/searchbarBindings.css"/>
<stylesheet src="chrome://browser/skin/searchbar.css"/>
</resources>
</binding>
<binding id="searchbar" extends="chrome://browser/content/search.xml#searchbar-base">
<content>
<xul:stringbundle src="chrome://browser/locale/searchbar.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>
</xul:textbox>
</content>
<implementation>
<field name="mStringBundle"> document.getAnonymousNodes(this)[0] </field>
<field name="mTextbox"> document.getAnonymousNodes(this)[1] </field>
<method name="focus">
<body><![CDATA[
this.mTextbox.focus();
]]></body>
</method>
<method name="select">
<body><![CDATA[
this.mTextbox.select();
]]></body>
</method>
</implementation>
</binding>
<binding id="searchbar-textbox" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete">
<implementation>
<constructor><![CDATA[
if (this.parentNode.parentNode.parentNode.localName ==
"toolbarpaletteitem")
return;
setTimeout(function(a) { a.initialize(); }, 0, this);
]]></constructor>
<destructor><![CDATA[
// Because XBL and the customize toolbar code interacts poorly,
// there may not be anything to remove here
try {
this.controllers.removeController(this.searchbarController);
} 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>
<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"]
.getService(Components.interfaces.nsIFormHistory);
this.prefService =
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
if (this.prefService.getBoolPref("browser.urlbar.clickSelectsAll"))
this.setAttribute("clickSelectsAll", true);
this._initializeEngine();
var element;
element = document.createElementNS(XUL_NS, "menuseparator");
this.mContextMenu.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"));
element.setAttribute("cmd", "cmd_clearhistory");
this.mContextMenu.appendChild(element);
this.controllers.appendController(this.searchbarController);
]]></body>
</method>
<method name="_initializeEngine">
<body><![CDATA[
var selectedEngineName = null;
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
if (!this.currentEngine)
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
document.getAnonymousElementByAttribute(this.parentNode,
"id", "searchbar-dropmarker").click();
return false;
}
return true;
]]>
</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
<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(
"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);
}
]]></body>
</method>
<!-- nsIController -->
<field name="searchbarController" readonly="true"><![CDATA[
({
mOuter: this,
supportsCommand: function (aCommand)
{
return aCommand == "cmd_clearhistory";
},
isCommandEnabled: function (aCommand)
{
return this.mOuter.formHistSvc.nameExists(
this.mOuter.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"));
}
})
]]></field>
<!-- DND Observer -->
<field name="searchbarDNDObserver" readonly="true"><![CDATA[
({
mOuter: this,
onDrop: function (aEvent, aXferData, aDragSession)
{
var data = transferUtils.retrieveURLFromData(aXferData.data,
aXferData.flavour.contentType);
if (data) {
this.mOuter.value = data;
this.mOuter.onTextEntered(aEvent);
}
},
getSupportedFlavours: function ()
{
var flavourSet = new FlavourSet();
flavourSet.appendFlavour("text/unicode");
flavourSet.appendFlavour("text/x-moz-url");
flavourSet.appendFlavour("application/x-moz-file", "nsIFile");
return flavourSet;
}
})
]]></field>
</implementation>
<handlers>
<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="alt" phase="capturing"
action="return this.openSearch();"/>
<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"
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">
<content>
<xul:stack flex="1">
<xul:hbox align="center">
<xul:image class="searchbar-engine-image" xbl:inherits="src"/>
</xul:hbox>
<xul:image class="searchbar-dropmarker-image"/>
</xul:stack>
<children/>
</content>
</binding>
</bindings>

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

@ -1,53 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
%if 0
* 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 Mozilla Search Dialog.
*
* The Initial Developer of the Original Code is
* Gavin Sharp <gavin@gavinsharp.com>.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* 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.
*
%endif
* ***** END LICENSE BLOCK ***** */
#searchEngineList {
min-height: 24px;
}
.engine-icon > .menulist-label-box > .menulist-icon,
.engine-icon > .menu-iconic-left > .menu-iconic-icon {
width: 16px;
height: 16px;
min-height: 16px;
}
.engine-icon > .menu-iconic-left {
display: -moz-box;
min-height: 16px;
}

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

@ -1,211 +0,0 @@
#if 0
/* ***** 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 Mozilla Search Dialog.
*
* The Initial Developer of the Original Code is
* Gavin Sharp <gavin@gavinsharp.com>.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Pierre Chanial <p_ch@verizon.net>
*
* 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 LGPL or the GPL. 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 ***** */
#endif
var gDialog = {};
var gSelectedEngineIndex;
const kTabPref = "browser.tabs.opentabfor.searchdialog";
const kEnginePref = "browser.search.selectedEngineInDialog";
const kDefEnginePref = "browser.search.defaultenginename";
const nsIPLS = Components.interfaces.nsIPrefLocalizedString;
const kXUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
function onLoad() {
setTimeout(onAfterLoad, 0);
}
function onAfterLoad() {
gDialog.list = document.getElementById("searchEngineList");
gDialog.list.addEventListener("ValueChange", onEnginesListValueChange, false);
gDialog.input = document.getElementById("searchInput");
gDialog.newtab = document.getElementById("searchInNewTab");
gDialog.searchbundle = document.getElementById("searchbarBundle");
gDialog.browserbundle = document.getElementById("browserBundle");
var el = document.getAnonymousElementByAttribute(gDialog.input, "anonid",
"textbox-input-box");
gDialog.contextmenu = document.getAnonymousElementByAttribute(el,
"anonid", "input-box-contextmenu");
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
var selectedEngine;
var tabChecked = false;
try {
selectedEngine = pref.getComplexValue(kEnginePref, nsIPLS).data;
} catch (ex) {
selectedEngine = pref.getComplexValue(kDefEnginePref, nsIPLS).data;
}
try {
tabChecked = pref.getBoolPref(kTabPref);
} catch (ex) { }
gDialog.newtab.setAttribute("checked", tabChecked);
for (var i=0; i < gDialog.list.menupopup.childNodes.length; i++) {
var label = gDialog.list.menupopup.childNodes[i].getAttribute("label");
if (label == selectedEngine)
gDialog.list.selectedIndex = i;
}
// Make sure we have a selected item
if (gDialog.list.selectedIndex == -1)
gDialog.list.selectedIndex = 0;
gSelectedEngineIndex = gDialog.list.selectedIndex;
// Add "Clear Search History" item to the text box context menu
var sep = document.createElementNS(kXUL_NS, "menuseparator");
gDialog.contextmenu.appendChild(sep);
var element = document.createElementNS(kXUL_NS, "menuitem");
var label = gDialog.searchbundle.getString("cmd_clearHistory");
var accesskey = gDialog.searchbundle.getString("cmd_clearHistory_accesskey");
element.setAttribute("label", label);
element.setAttribute("accesskey", accesskey);
element.setAttribute("cmd", "cmd_clearhistory");
gDialog.contextmenu.appendChild(element);
gDialog.input.controllers.appendController(clearHistoryController);
}
function onEnginesListValueChange() {
if (gDialog.list.value == "addengines") {
var url = gDialog.browserbundle.getString("searchEnginesURL");
window.opener.openNewWindowWith(url, null, false);
gDialog.list.selectedIndex = gSelectedEngineIndex;
} else {
gSelectedEngineIndex = gDialog.list.selectedIndex;
}
}
function updateAddEnginesItem(aAdd) {
// Remove the old item if it exists
var elem = document.getElementById("addenginemenuitem");
var sep = document.getElementById("addenginesep");
if (elem)
gDialog.list.menupopup.removeChild(elem);
if (sep)
gDialog.list.menupopup.removeChild(sep);
if (aAdd) {
// Add "Add Engines" item to the drop down
var sep = document.createElementNS(kXUL_NS, "menuseparator");
sep.setAttribute("id", "addenginesep");
gDialog.list.menupopup.appendChild(sep);
var label = gDialog.searchbundle.getString("cmd_addEngine");
var newItem = gDialog.list.appendItem(label, "addengines");
newItem.setAttribute("id", "addenginemenuitem");
newItem.setAttribute("class", "menuitem-iconic engine-icon");
}
}
function onDialogAccept() {
var searchText = gDialog.input.value;
var engine = gDialog.list.value;
var searchURL;
var searchSvc =
Components.classes["@mozilla.org/rdf/datasource;1?name=internetsearch"]
.getService(Components.interfaces.nsIInternetSearchService);
// XXX Bug 269994: Use dummy string if there is no user entered string
searchURL = searchSvc.GetInternetSearchURL(engine,
searchText ? encodeURIComponent(searchText):"A",
0, 0, {value:0});
if (searchText) {
// Add item to form history
var frmHistSvc = Components.classes["@mozilla.org/satchel/form-history;1"]
.getService(Components.interfaces.nsIFormHistory);
frmHistSvc.addEntry("searchbar-history", searchText);
} else {
try {
// Get the engine's base URL
searchURL = makeURI(searchURL).host;
} catch (ex) {}
}
setPrefs();
gDialog.input.controllers.removeController(clearHistoryController);
window.opener.delayedSearchLoadURL(searchURL, gDialog.newtab.checked);
// Delay closing slightly to avoid timing bug on Linux.
window.close();
return false;
}
function setPrefs() {
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
var pls = Components.classes["@mozilla.org/pref-localizedstring;1"]
.createInstance(nsIPLS);
var name = gDialog.list.selectedItem.getAttribute("label");
pls.data = name;
pref.setComplexValue(kEnginePref, nsIPLS, pls);
pref.setBoolPref(kTabPref, gDialog.newtab.checked);
}
var clearHistoryController = {
frmHistSvc: Components.classes["@mozilla.org/satchel/form-history;1"]
.getService(Components.interfaces.nsIFormHistory),
autocompleteSearchParam: "searchbar-history",
supportsCommand: function (aCommand) {
return aCommand == "cmd_clearhistory";
},
isCommandEnabled: function (aCommand) {
return this.frmHistSvc.nameExists(this.autocompleteSearchParam);
},
doCommand: function (aCommand) {
this.frmHistSvc.removeEntriesForName(this.autocompleteSearchParam);
gDialog.input.value = "";
}
}

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

@ -1,110 +0,0 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
#if 0
- 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 Mozilla Search Dialog.
-
- The Initial Developer of the Original Code is
- Gavin Sharp <gavin@gavinsharp.com>.
- Portions created by the Initial Developer are Copyright (C) 2005
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- 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 LGPL or the GPL. 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.
-
#endif
- ***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/searchDialog.css"?>
<!DOCTYPE dialog SYSTEM "chrome://browser/locale/searchDialog.dtd">
<dialog id="searchDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&searchCaption.label;"
onload="onLoad()"
ondialogaccept="onDialogAccept()"
buttonlabelaccept="&searchButton.label;"
persist="screenX screenY width height"
screenX="24" screenY="24"
style="&searchDialog.style;">
<stringbundle id="searchbarBundle"
src="chrome://browser/locale/searchbar.properties"/>
<stringbundle id="browserBundle"
src="chrome://browser-region/locale/region.properties"/>
<script type="application/x-javascript"
src="chrome://browser/content/searchDialog.js"/>
<script type="application/x-javascript"
src="chrome://global/content/contentAreaUtils.js"/>
<grid>
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row align="center">
<label value="&searchFor.label;"
accesskey="&searchFor.accesskey;" control="searchInput"/>
<textbox id="searchInput"
class="padded"
type="autocomplete"
autocompletepopup="PopupAutoComplete"
autocompletesearch="form-history"
autocompletesearchparam="searchbar-history"
completeselectedindex="true"
tabscrolling="true"/>
</row>
<row align="center">
<label value="&searchWith.label;"
accesskey="&searchWith.accesskey;" control="searchEngineList"/>
<menulist id="searchEngineList" flex="1"
onselect="addEngines();">
<menupopup id="searchEnginePopup" position="after_start"
datasources="rdf:internetsearch"
ref="NC:SearchEngineRoot"
onpopupshowing="updateAddEnginesItem(true);"
onpopuphiding="updateAddEnginesItem(false);">
<template>
<menuitem type="checkbox"
class="menuitem-iconic engine-icon"
uri="rdf:*" value="rdf:*"
src="rdf:http://home.netscape.com/NC-rdf#Icon"
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
</template>
</menupopup>
</menulist>
</row>
<row>
<spacer/>
<checkbox id="searchInNewTab" label="&searchInNewTab.label;"
accesskey="&searchInNewTab.accesskey;"/>
</row>
</rows>
</grid>
</dialog>

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

@ -1,10 +0,0 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
.searchbar-textbox {
-moz-binding: url("chrome://browser/content/search.xml#searchbar-textbox");
}
.searchbar-dropmarker {
-moz-binding: url("chrome://browser/content/search.xml#searchbar-dropmarker");
-moz-user-focus: none;
}

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

@ -31,11 +31,6 @@ browser.jar:
* content/browser/safeMode.xul (content/safeMode.xul) * content/browser/safeMode.xul (content/safeMode.xul)
* content/browser/sanitize.js (content/sanitize.js) * content/browser/sanitize.js (content/sanitize.js)
* content/browser/sanitize.xul (content/sanitize.xul) * 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/utilityOverlay.js (content/utilityOverlay.js)
* content/browser/web-panels.js (content/web-panels.js) * content/browser/web-panels.js (content/web-panels.js)
* content/browser/web-panels.xul (content/web-panels.xul) * content/browser/web-panels.xul (content/web-panels.xul)

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

@ -59,6 +59,7 @@ DIRS = \
dirprovider \ dirprovider \
migration \ migration \
preferences \ preferences \
search \
shell \ shell \
sidebar \ sidebar \
$(NULL) $(NULL)

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

@ -849,7 +849,7 @@
onkeypress="event.preventBubble();"/> onkeypress="event.preventBubble();"/>
<vbox flex="1"> <vbox flex="1">
<tree anonid="bookmarks-tree" flex="1" class="plain" enableColumnDrag="true" <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();" onkeypress="if (event.keyCode == 13) this.parentNode.parentNode.openItemKey();"
onclick="this.parentNode.parentNode.openItemClick(event, 1);" onclick="this.parentNode.parentNode.openItemClick(event, 1);"
ondblclick="this.parentNode.parentNode.openItemClick(event, 2);" ondblclick="this.parentNode.parentNode.openItemClick(event, 2);"
@ -945,7 +945,7 @@
onclick="event.preventBubble();" onclick="event.preventBubble();"
onkeypress="event.preventBubble();"/> onkeypress="event.preventBubble();"/>
<tree anonid="bookmarks-tree" flex="1" class="plain" hidecolumnpicker="true" <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"> onselect="this.parentNode.treeBoxObject.view.selectionChanged();" seltype="single">
<template xmlns:nc="http://home.netscape.com/NC-rdf#"> <template xmlns:nc="http://home.netscape.com/NC-rdf#">
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"> <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"> <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" <tree anonid="bookmarks-tree" class="bookmarksTree" flex="1" hidecolumnpicker="true"
xbl:inherits="rows,seltype" 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();"> onselect="this.parentNode.treeBoxObject.view.selectionChanged();">
<template> <template>
<!-- I don't want these things to appear at all, but that's not an option --> <!-- 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"?> <?xml version="1.0"?>
# -*- Mode: HTML -*- # -*- Mode: HTML -*-
# ***** BEGIN LICENSE BLOCK ***** # ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
@ -22,8 +21,9 @@
# the Initial Developer. All Rights Reserved. # the Initial Developer. All Rights Reserved.
# #
# Contributor(s): # Contributor(s):
# Pierre Chanial V 2.0 (p_ch@verizon.net) # Pierre Chanial (v2) <p_ch@verizon.net>
# Gavin Sharp (gavin@gavinsharp.com) # Gavin Sharp (v3) <gavin@gavinsharp.com>
# Ben Goodger <beng@google.com>
# #
# Alternatively, the contents of this file may be used under the terms of # 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 # either the GNU General Public License Version 2 or later (the "GPL"), or
@ -40,64 +40,243 @@
# ***** END LICENSE BLOCK ***** # ***** END LICENSE BLOCK *****
<bindings id="SearchBindings" <bindings id="SearchBindings"
xmlns="http://www.mozilla.org/xbl" xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl"> xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="searchbar-base"> <binding id="searchbar-base">
<resources> <resources>
<stylesheet src="chrome://browser/content/searchbarBindings.css"/> <stylesheet src="chrome://browser/content/search/searchbarBindings.css"/>
<stylesheet src="chrome://browser/skin/searchbar.css"/> <stylesheet src="chrome://browser/skin/searchbar.css"/>
</resources> </resources>
</binding> </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> <content>
<xul:stringbundle src="chrome://browser/locale/searchbar.properties"/> <xul:stringbundle src="chrome://browser/locale/search.properties"/>
<xul:textbox class="searchbar-textbox" type="autocomplete" flex="1" <xul:textbox class="searchbar-textbox"
type="autocomplete"
flex="1"
autocompletepopup="PopupAutoComplete" autocompletepopup="PopupAutoComplete"
autocompletesearch="form-history" autocompletesearch="form-history"
autocompletesearchparam="searchbar-history" autocompletesearchparam="searchbar-history"
completeselectedindex="true" completeselectedindex="true"
tabscrolling="true" tabscrolling="true"
xbl:inherits="disableautocomplete,searchengine,src"> xbl:inherits="disableautocomplete,searchengine,src">
<xul:button class="searchbar-dropmarker" type="menu" <xul:button class="searchbar-dropmarker"
id="searchbar-dropmarker" popup="_child" xbl:inherits="src"> type="menu"
<xul:menupopup anonid="searchbar-popup" position="after_start" anonid="searchbar-dropmarker"
datasources="rdf:internetsearch" popup="_child"
ref="NC:SearchEngineRoot" xbl:inherits="src">
oncommand="this.parentNode.parentNode.onEnginePopupCommand(event);" <xul:menupopup anonid="searchbar-popup"
onpopupshowing="this.parentNode.parentNode.onEnginePopupShowing(event);" class="searchbar-popup"
onpopuphidden="this.parentNode.parentNode.onEnginePopupHidden(event);"> position="after_start"
<xul:template> oncommand="this.parentNode.parentNode
<xul:menuitem type="checkbox" .parentNode
uri="rdf:*" value="rdf:*" .onEnginePopupCommand(event);"/>
src="rdf:http://home.netscape.com/NC-rdf#Icon"
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
</xul:template>
</xul:menupopup>
</xul:button> </xul:button>
</xul:textbox> </xul:textbox>
</content> </content>
<implementation> <implementation implements="nsIObserver">
<field name="mStringBundle"> document.getAnonymousNodes(this)[0] </field>
<field name="mTextbox"> document.getAnonymousNodes(this)[1] </field> <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"> <method name="focus">
<body><![CDATA[ <body><![CDATA[
this.mTextbox.focus(); this._textbox.focus();
]]></body> ]]></body>
</method> </method>
<method name="select"> <method name="select">
<body><![CDATA[ <body><![CDATA[
this.mTextbox.select(); this._textbox.select();
]]></body> ]]></body>
</method> </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> </implementation>
</binding> </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> <implementation>
<constructor><![CDATA[ <constructor><![CDATA[
if (this.parentNode.parentNode.parentNode.localName == if (this.parentNode.parentNode.parentNode.localName ==
"toolbarpaletteitem") "toolbarpaletteitem")
@ -113,82 +292,49 @@
} catch (ex) { } } catch (ex) { }
]]></destructor> ]]></destructor>
<property name="mContextMenu" readonly="true"> <field name="_stringBundle">this.parentNode._stringBundle</field>
<getter> <field name="_formHistSvc"/>
var textBox = document.getAnonymousElementByAttribute(this, <field name="_prefBranch"/>
"anonid", "textbox-input-box");
return document.getAnonymousElementByAttribute(textBox,
"anonid", "input-box-contextmenu");
</getter>
</property>
<method name="initialize"> <method name="initialize">
<body><![CDATA[ <body><![CDATA[
this.rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"] this._formHistSvc =
.getService(Components.interfaces.nsIRDFService); Components.classes["@mozilla.org/satchel/form-history;1"]
this.internetSearchDS = this.rdfService.GetDataSource("rdf:internetsearch"); .getService(Components.interfaces.nsIFormHistory);
this.formHistSvc = Components this._prefBranch =
.classes["@mozilla.org/satchel/form-history;1"]
.getService(Components.interfaces.nsIFormHistory);
this.prefService =
Components.classes["@mozilla.org/preferences-service;1"] 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.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; var element = document.createElementNS(XUL_NS, "menuseparator");
element = document.createElementNS(XUL_NS, "menuseparator"); cxmenu.appendChild(element);
this.mContextMenu.appendChild(element);
element = document.createElementNS(XUL_NS, "menuitem"); element = document.createElementNS(XUL_NS, "menuitem");
element.setAttribute("label", this.mStringBundle const label = this._stringBundle.getString("cmd_clearHistory");
.getString("cmd_clearHistory")); const akey = this._stringBundle.getString("cmd_clearHistory_accesskey");
element.setAttribute("accesskey", this.mStringBundle element.setAttribute("label", label);
.getString("cmd_clearHistory_accesskey")); element.setAttribute("accesskey", akey);
element.setAttribute("cmd", "cmd_clearhistory"); element.setAttribute("cmd", "cmd_clearhistory");
this.mContextMenu.appendChild(element);
cxmenu.appendChild(element);
this.controllers.appendController(this.searchbarController); this.controllers.appendController(this.searchbarController);
]]></body> ]]></body>
</method> </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"> <method name="openSearch">
<body> <body>
<![CDATA[ <![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, document.getAnonymousElementByAttribute(this.parentNode,
"id", "searchbar-dropmarker").click(); "anonid", "searchbar-dropmarker").click();
return false; return false;
} }
return true; return true;
@ -196,217 +342,44 @@
</body> </body>
</method> </method>
<property name="currentEngine" <!-- overload |onTextEntered| in autocomplete.xml -->
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
<method name="onTextEntered"> <method name="onTextEntered">
<parameter name="aEvent"/> <parameter name="aEvent"/>
<body><![CDATA[ <body><![CDATA[
// Save the current value in the form history // Save the current value in the form history
if (this.value && !this.hasAttribute("disableautocomplete")) if (this.value && !this.hasAttribute("disableautocomplete"))
this.formHistSvc.addEntry(this.getAttribute( this._formHistSvc.addEntry(this.getAttribute(
"autocompletesearchparam"), this.value); "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 evt = aEvent || this.mEnterEvent;
var openInTab = this.prefService.getBoolPref("browser.search.openintab"); var newTab = this._prefBranch.getBoolPref("browser.search.openintab");
SearchLoadURL(searchURL, ((evt && evt.altKey) ^ openInTab)); this.parentNode.doSearch(this.value, ((evt && evt.altKey) ^ newTab));
]]></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);
}
]]></body> ]]></body>
</method> </method>
<!-- nsIController --> <!-- nsIController -->
<field name="searchbarController" readonly="true"><![CDATA[ <field name="searchbarController" readonly="true"><![CDATA[({
({ _self: this,
mOuter: this, supportsCommand: function(aCommand) {
supportsCommand: function (aCommand)
{
return aCommand == "cmd_clearhistory"; return aCommand == "cmd_clearhistory";
}, },
isCommandEnabled: function (aCommand) isCommandEnabled: function(aCommand) {
{ return this._self._formHistSvc.nameExists(
return this.mOuter.formHistSvc.nameExists( this._self.getAttribute("autocompletesearchparam"));
this.mOuter.getAttribute("autocompletesearchparam"));
}, },
doCommand: function (aCommand) doCommand: function (aCommand) {
{ this._self._formHistSvc.removeEntriesForName(
// Clear the searchbar and its undo history this._self.getAttribute("autocompletesearchparam"));
this.mOuter.value = ""; this._self.value = "";
this.mOuter.editor.enableUndo(false);
this.mOuter.editor.enableUndo(true);
this.mOuter.formHistSvc.removeEntriesForName(
this.mOuter.getAttribute("autocompletesearchparam"));
} }
}) })]]></field>
]]></field>
<!-- DND Observer --> <!-- DND Observer -->
<field name="searchbarDNDObserver" readonly="true"><![CDATA[ <field name="searchbarDNDObserver" readonly="true"><![CDATA[({
({
mOuter: this, mOuter: this,
onDrop: function (aEvent, aXferData, aDragSession) onDrop: function (aEvent, aXferData, aDragSession) {
{
var data = transferUtils.retrieveURLFromData(aXferData.data, var data = transferUtils.retrieveURLFromData(aXferData.data,
aXferData.flavour.contentType); aXferData.flavour.contentType);
if (data) { if (data) {
@ -414,82 +387,59 @@
this.mOuter.onTextEntered(aEvent); this.mOuter.onTextEntered(aEvent);
} }
}, },
getSupportedFlavours: function () getSupportedFlavours: function () {
{
var flavourSet = new FlavourSet(); var flavourSet = new FlavourSet();
flavourSet.appendFlavour("text/unicode"); flavourSet.appendFlavour("text/unicode");
flavourSet.appendFlavour("text/x-moz-url"); flavourSet.appendFlavour("text/x-moz-url");
flavourSet.appendFlavour("application/x-moz-file", "nsIFile"); flavourSet.appendFlavour("application/x-moz-file", "nsIFile");
return flavourSet; return flavourSet;
} }
}) })]]></field>
]]></field>
</implementation> </implementation>
<handlers> <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"> <handler event="keypress" keycode="vk_down" modifiers="accel"
<![CDATA[ phase="capturing"
var currentEngine = this.currentEngine; action="this.parentNode.selectEngine(event, true);"/>
if (currentEngine) {
var searchEngineMenuitem = document.getAnonymousElementByAttribute(this.parentNode, "id", currentEngine); <handler event="keypress" keycode="vk_down" modifiers="alt"
var newEngine = searchEngineMenuitem.previousSibling; phase="capturing"
if (newEngine && newEngine.localName == "menuitem")
this.currentEngine = newEngine.id;
}
event.preventDefault();
event.stopPropagation();
]]>
</handler>
<handler event="keypress" keycode="vk_down" modifiers="alt" phase="capturing"
action="return this.openSearch();"/> 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();"/> action="return this.openSearch();"/>
#ifndef XP_MACOSX #ifndef XP_MACOSX
<handler event="keypress" keycode="vk_f4" phase="capturing" <handler event="keypress" keycode="vk_f4"
phase="capturing"
action="return this.openSearch();"/> action="return this.openSearch();"/>
#endif #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"> <handler event="dragdrop" phase="capturing">
nsDragAndDrop.drop(event, this.searchbarDNDObserver); nsDragAndDrop.drop(event, this.searchbarDNDObserver);
</handler> </handler>
</handlers> </handlers>
</binding> </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> <content>
<xul:stack flex="1"> <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:image class="searchbar-engine-image" xbl:inherits="src"/>
</xul:hbox> </xul:hbox>
<xul:image class="searchbar-dropmarker-image"/> <xul:image class="searchbar-dropmarker-image"/>
</xul:stack> </xul:stack>
<children/> <children/>
</content> </content>
</binding> </binding>
</bindings> </bindings>

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

@ -1,53 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
%if 0
* 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 Mozilla Search Dialog.
*
* The Initial Developer of the Original Code is
* Gavin Sharp <gavin@gavinsharp.com>.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* 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.
*
%endif
* ***** END LICENSE BLOCK ***** */
#searchEngineList {
min-height: 24px;
}
.engine-icon > .menulist-label-box > .menulist-icon,
.engine-icon > .menu-iconic-left > .menu-iconic-icon {
width: 16px;
height: 16px;
min-height: 16px;
}
.engine-icon > .menu-iconic-left {
display: -moz-box;
min-height: 16px;
}

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

@ -1,211 +0,0 @@
#if 0
/* ***** 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 Mozilla Search Dialog.
*
* The Initial Developer of the Original Code is
* Gavin Sharp <gavin@gavinsharp.com>.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Pierre Chanial <p_ch@verizon.net>
*
* 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 LGPL or the GPL. 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 ***** */
#endif
var gDialog = {};
var gSelectedEngineIndex;
const kTabPref = "browser.tabs.opentabfor.searchdialog";
const kEnginePref = "browser.search.selectedEngineInDialog";
const kDefEnginePref = "browser.search.defaultenginename";
const nsIPLS = Components.interfaces.nsIPrefLocalizedString;
const kXUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
function onLoad() {
setTimeout(onAfterLoad, 0);
}
function onAfterLoad() {
gDialog.list = document.getElementById("searchEngineList");
gDialog.list.addEventListener("ValueChange", onEnginesListValueChange, false);
gDialog.input = document.getElementById("searchInput");
gDialog.newtab = document.getElementById("searchInNewTab");
gDialog.searchbundle = document.getElementById("searchbarBundle");
gDialog.browserbundle = document.getElementById("browserBundle");
var el = document.getAnonymousElementByAttribute(gDialog.input, "anonid",
"textbox-input-box");
gDialog.contextmenu = document.getAnonymousElementByAttribute(el,
"anonid", "input-box-contextmenu");
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
var selectedEngine;
var tabChecked = false;
try {
selectedEngine = pref.getComplexValue(kEnginePref, nsIPLS).data;
} catch (ex) {
selectedEngine = pref.getComplexValue(kDefEnginePref, nsIPLS).data;
}
try {
tabChecked = pref.getBoolPref(kTabPref);
} catch (ex) { }
gDialog.newtab.setAttribute("checked", tabChecked);
for (var i=0; i < gDialog.list.menupopup.childNodes.length; i++) {
var label = gDialog.list.menupopup.childNodes[i].getAttribute("label");
if (label == selectedEngine)
gDialog.list.selectedIndex = i;
}
// Make sure we have a selected item
if (gDialog.list.selectedIndex == -1)
gDialog.list.selectedIndex = 0;
gSelectedEngineIndex = gDialog.list.selectedIndex;
// Add "Clear Search History" item to the text box context menu
var sep = document.createElementNS(kXUL_NS, "menuseparator");
gDialog.contextmenu.appendChild(sep);
var element = document.createElementNS(kXUL_NS, "menuitem");
var label = gDialog.searchbundle.getString("cmd_clearHistory");
var accesskey = gDialog.searchbundle.getString("cmd_clearHistory_accesskey");
element.setAttribute("label", label);
element.setAttribute("accesskey", accesskey);
element.setAttribute("cmd", "cmd_clearhistory");
gDialog.contextmenu.appendChild(element);
gDialog.input.controllers.appendController(clearHistoryController);
}
function onEnginesListValueChange() {
if (gDialog.list.value == "addengines") {
var url = gDialog.browserbundle.getString("searchEnginesURL");
window.opener.openNewWindowWith(url, null, false);
gDialog.list.selectedIndex = gSelectedEngineIndex;
} else {
gSelectedEngineIndex = gDialog.list.selectedIndex;
}
}
function updateAddEnginesItem(aAdd) {
// Remove the old item if it exists
var elem = document.getElementById("addenginemenuitem");
var sep = document.getElementById("addenginesep");
if (elem)
gDialog.list.menupopup.removeChild(elem);
if (sep)
gDialog.list.menupopup.removeChild(sep);
if (aAdd) {
// Add "Add Engines" item to the drop down
var sep = document.createElementNS(kXUL_NS, "menuseparator");
sep.setAttribute("id", "addenginesep");
gDialog.list.menupopup.appendChild(sep);
var label = gDialog.searchbundle.getString("cmd_addEngine");
var newItem = gDialog.list.appendItem(label, "addengines");
newItem.setAttribute("id", "addenginemenuitem");
newItem.setAttribute("class", "menuitem-iconic engine-icon");
}
}
function onDialogAccept() {
var searchText = gDialog.input.value;
var engine = gDialog.list.value;
var searchURL;
var searchSvc =
Components.classes["@mozilla.org/rdf/datasource;1?name=internetsearch"]
.getService(Components.interfaces.nsIInternetSearchService);
// XXX Bug 269994: Use dummy string if there is no user entered string
searchURL = searchSvc.GetInternetSearchURL(engine,
searchText ? encodeURIComponent(searchText):"A",
0, 0, {value:0});
if (searchText) {
// Add item to form history
var frmHistSvc = Components.classes["@mozilla.org/satchel/form-history;1"]
.getService(Components.interfaces.nsIFormHistory);
frmHistSvc.addEntry("searchbar-history", searchText);
} else {
try {
// Get the engine's base URL
searchURL = makeURI(searchURL).host;
} catch (ex) {}
}
setPrefs();
gDialog.input.controllers.removeController(clearHistoryController);
window.opener.delayedSearchLoadURL(searchURL, gDialog.newtab.checked);
// Delay closing slightly to avoid timing bug on Linux.
window.close();
return false;
}
function setPrefs() {
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
var pls = Components.classes["@mozilla.org/pref-localizedstring;1"]
.createInstance(nsIPLS);
var name = gDialog.list.selectedItem.getAttribute("label");
pls.data = name;
pref.setComplexValue(kEnginePref, nsIPLS, pls);
pref.setBoolPref(kTabPref, gDialog.newtab.checked);
}
var clearHistoryController = {
frmHistSvc: Components.classes["@mozilla.org/satchel/form-history;1"]
.getService(Components.interfaces.nsIFormHistory),
autocompleteSearchParam: "searchbar-history",
supportsCommand: function (aCommand) {
return aCommand == "cmd_clearhistory";
},
isCommandEnabled: function (aCommand) {
return this.frmHistSvc.nameExists(this.autocompleteSearchParam);
},
doCommand: function (aCommand) {
this.frmHistSvc.removeEntriesForName(this.autocompleteSearchParam);
gDialog.input.value = "";
}
}

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

@ -1,110 +0,0 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
#if 0
- 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 Mozilla Search Dialog.
-
- The Initial Developer of the Original Code is
- Gavin Sharp <gavin@gavinsharp.com>.
- Portions created by the Initial Developer are Copyright (C) 2005
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- 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 LGPL or the GPL. 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.
-
#endif
- ***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/searchDialog.css"?>
<!DOCTYPE dialog SYSTEM "chrome://browser/locale/searchDialog.dtd">
<dialog id="searchDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&searchCaption.label;"
onload="onLoad()"
ondialogaccept="onDialogAccept()"
buttonlabelaccept="&searchButton.label;"
persist="screenX screenY width height"
screenX="24" screenY="24"
style="&searchDialog.style;">
<stringbundle id="searchbarBundle"
src="chrome://browser/locale/searchbar.properties"/>
<stringbundle id="browserBundle"
src="chrome://browser-region/locale/region.properties"/>
<script type="application/x-javascript"
src="chrome://browser/content/searchDialog.js"/>
<script type="application/x-javascript"
src="chrome://global/content/contentAreaUtils.js"/>
<grid>
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row align="center">
<label value="&searchFor.label;"
accesskey="&searchFor.accesskey;" control="searchInput"/>
<textbox id="searchInput"
class="padded"
type="autocomplete"
autocompletepopup="PopupAutoComplete"
autocompletesearch="form-history"
autocompletesearchparam="searchbar-history"
completeselectedindex="true"
tabscrolling="true"/>
</row>
<row align="center">
<label value="&searchWith.label;"
accesskey="&searchWith.accesskey;" control="searchEngineList"/>
<menulist id="searchEngineList" flex="1"
onselect="addEngines();">
<menupopup id="searchEnginePopup" position="after_start"
datasources="rdf:internetsearch"
ref="NC:SearchEngineRoot"
onpopupshowing="updateAddEnginesItem(true);"
onpopuphiding="updateAddEnginesItem(false);">
<template>
<menuitem type="checkbox"
class="menuitem-iconic engine-icon"
uri="rdf:*" value="rdf:*"
src="rdf:http://home.netscape.com/NC-rdf#Icon"
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
</template>
</menupopup>
</menulist>
</row>
<row>
<spacer/>
<checkbox id="searchInNewTab" label="&searchInNewTab.label;"
accesskey="&searchInNewTab.accesskey;"/>
</row>
</rows>
</grid>
</dialog>

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

@ -1,11 +1,10 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
.searchbar-textbox { .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 { .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; -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 + ", " + debug("addSearchEngine(" + engineURL + ", " + iconURL + ", " +
suggestedCategory + ", " + suggestedTitle + ")"); suggestedCategory + ", " + suggestedTitle + ")");
// XXXBug 312560: Localize me!
try try
{ {
// make sure using HTTP or HTTPS and refering to a .src file // 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"); titleMessage = stringBundle.GetStringFromName("addEngineConfirmTitle");
dialogMessage = stringBundle.GetStringFromName("addEngineConfirmMessage"); dialogMessage = stringBundle.GetStringFromName("addEngineConfirmMessage");
dialogMessage = dialogMessage.replace(/%title%/, suggestedTitle); dialogMessage = dialogMessage.replace(/%title%/, suggestedTitle);
dialogMessage = dialogMessage.replace(/%category%/, suggestedCategory);
dialogMessage = dialogMessage.replace(/%url%/, engineURL); dialogMessage = dialogMessage.replace(/%url%/, engineURL);
dialogMessage = dialogMessage.replace(/#/g, "\n"); dialogMessage = dialogMessage.replace(/#/g, "\n");
} }
@ -162,7 +162,6 @@ function (engineURL, iconURL, suggestedTitle, suggestedCategory)
catch (e) { catch (e) {
titleMessage = "Add Search Engine"; titleMessage = "Add Search Engine";
dialogMessage = "Add the following search engine?\n\nName: " + suggestedTitle; dialogMessage = "Add the following search engine?\n\nName: " + suggestedTitle;
dialogMessage += "\nSearch Category: " + suggestedCategory;
dialogMessage += "\nSource: " + engineURL; dialogMessage += "\nSource: " + engineURL;
} }
@ -171,14 +170,11 @@ function (engineURL, iconURL, suggestedTitle, suggestedCategory)
if (!rv) if (!rv)
return; return;
var internetSearch = Components.classes[NETSEARCH_CONTRACTID].getService(); var searchService = Components.classes["@mozilla.org/browser/search-service;1"]
if (internetSearch) .getService(Components.interfaces.nsIBrowserSearchService);
internetSearch = internetSearch.QueryInterface(nsIInternetSearchService); const typeText = Components.interfaces.nsISearchEngine.DATA_TEXT;
if (internetSearch) if (searchService)
{ searchService.addEngine(engineURL, typeText, iconURL);
internetSearch.AddSearchEngine(engineURL, iconURL, suggestedTitle,
suggestedCategory);
}
} }
// property of nsIClassInfo // property of nsIClassInfo

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

@ -23,6 +23,18 @@ extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/install.rdf
extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/ extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/
searchplugins/dictionary.src searchplugins/dictionary.src
searchplugins/dictionary.png 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/ searchplugins/
components/component.reg components/component.reg
components/compreg.dat components/compreg.dat

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

@ -58,6 +58,7 @@ bin/components/autocomplete.xpt
bin/components/autoconfig.xpt bin/components/autoconfig.xpt
bin/components/bookmarks.xpt bin/components/bookmarks.xpt
bin/components/browsercompsbase.xpt bin/components/browsercompsbase.xpt
bin/components/browsersearch.xpt
bin/components/caps.xpt bin/components/caps.xpt
bin/components/chardet.xpt bin/components/chardet.xpt
bin/components/chrome.xpt bin/components/chrome.xpt
@ -178,6 +179,7 @@ bin/components/shellservice.xpt
bin/components/nsBrowserContentHandler.js bin/components/nsBrowserContentHandler.js
bin/components/nsBrowserGlue.js bin/components/nsBrowserGlue.js
bin/components/nsSetDefaultBrowser.js bin/components/nsSetDefaultBrowser.js
bin/components/nsSearchService.js
bin/components/jsconsole-clhandler.js bin/components/jsconsole-clhandler.js
bin/components/nsCloseAllWindows.js bin/components/nsCloseAllWindows.js
bin/components/nsDictionary.js bin/components/nsDictionary.js

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

@ -62,6 +62,7 @@ bin\components\autocomplete.xpt
bin\components\autoconfig.xpt bin\components\autoconfig.xpt
bin\components\bookmarks.xpt bin\components\bookmarks.xpt
bin\components\browsercompsbase.xpt bin\components\browsercompsbase.xpt
bin\components\browsersearch.xpt
bin\components\caps.xpt bin\components\caps.xpt
bin\components\chardet.xpt bin\components\chardet.xpt
bin\components\chrome.xpt bin\components\chrome.xpt
@ -194,6 +195,7 @@ bin\components\nsCloseAllWindows.js
bin\components\nsDictionary.js bin\components\nsDictionary.js
bin\components\nsHelperAppDlg.js bin\components\nsHelperAppDlg.js
bin\components\nsProxyAutoConfig.js bin\components\nsProxyAutoConfig.js
bin\components\nsSearchService.js
bin\components\nsSidebar.js bin\components\nsSidebar.js
bin\components\nsXmlRpcClient.js bin\components\nsXmlRpcClient.js
bin\components\nsExtensionManager.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_PLUGINS = $(shell cat $(LOCALE_SRCDIR)/searchplugins/list.txt)
SEARCH_PLUGIN_PREFIX = $(addprefix $(LOCALE_SRCDIR)/searchplugins/,$(SEARCH_PLUGINS)) 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) $^ $(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 $(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/searchplugins
libs-%: 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.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= 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.1=Google
browser.search.order.2=Yahoo browser.search.order.2=Yahoo
#config.js #config.js
startup.homepage_override_url=http://www.mozilla.org/products/firefox/releases/whatsnew/ startup.homepage_override_url=http://www.mozilla.org/products/firefox/releases/whatsnew/
# search-panel.properties # Default search engine
defaultSearchURL=http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=
browser.search.defaultenginename=Google browser.search.defaultenginename=Google
# update notifications: new update page # update notifications: new update page

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

@ -29,7 +29,7 @@ showskinsdescription=true
# context menu strings # context menu strings
searchText=Search Web for "%S" contextMenuSearchText=Search %S for "%S"
blockImages=Block Images from %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,46 +0,0 @@
<!-- ***** BEGIN LICENSE BLOCK *****
#if 0
- 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 Mozilla Search Dialog.
-
- The Initial Developer of the Original Code is
- Gavin Sharp <gavin@gavinsharp.com>.
- Portions created by the Initial Developer are Copyright (C) 2005
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- 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 LGPL or the GPL. 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.
-
#endif
- ***** END LICENSE BLOCK ***** -->
<!ENTITY searchCaption.label "Web Search">
<!ENTITY searchButton.label "Search">
<!ENTITY searchFor.label "Search For:">
<!ENTITY searchFor.accesskey "S">
<!ENTITY searchWith.label "Search With:">
<!ENTITY searchWith.accesskey "W">
<!ENTITY searchInNewTab.label "Open search results in a new tab">
<!ENTITY searchInNewTab.accesskey "O">
<!ENTITY searchDialog.style "width: 30em;">

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

@ -1,5 +0,0 @@
cmd_addEngine = Add Engines...
cmd_addEngine_accesskey = A
cmd_clearHistory = Clear Search History
cmd_clearHistory_accesskey = S
searchtip = Search %S

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

@ -1,2 +1,2 @@
addEngineConfirmTitle=Add Search Engine 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%

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 680 B

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

@ -1,26 +0,0 @@
# Search Plug-in for Amazon.com (http://www.amazon.com)
# by Paul Millar <dazzle@edazzle.net> created: 18 January 2003
# updated by Rafael Ebron <rebron@meer.net>
<SEARCH
version = "7.1"
name="Amazon.com"
description="Amazon.com Search"
method="GET"
action="http://www.amazon.com/exec/obidos/external-search/"
queryCharset="ISO-8859-1"
>
<input name="field-keywords" user>
<input name="mode" value="blended">
<input name="tag" value="mozilla-20">
<input name="sourceid" value="Mozilla-search">
</search>
<BROWSER
update="https://addons.mozilla.org/searchplugins/updates/amazondotcom.src"
updateIcon="https://addons.mozilla.org/searchplugins/updates/amazondotcom.png"
updateCheckDays="3"
>

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

@ -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>

Двоичные данные
browser/locales/en-US/searchplugins/answers.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.1 KiB

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

@ -1,17 +0,0 @@
# Firefox Answers.com Sherlock Plugin by ben@mozilla.org
# 4/6/2005
<SEARCH version="1.0"
name="Answers.com"
description="Dictionary Search on Answers.com"
method="GET"
action="http://www.answers.com/main/ntquery"
queryCharset="UTF-8">
<input name="s" user>
<input name="gwp" value="13">
</search>
<BROWSER update="https://addons.mozilla.org/searchplugins/updates/answers.src"
updateIcon="https://addons.mozilla.org/searchplugins/updates/answers.png"
updateCheckDays="3">

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

@ -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>

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 356 B

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

@ -1,38 +0,0 @@
#
# Mozilla/Netscape 6+ MyCroft Plugin for search.creativecommons.org for Mike Linksvayer #495.
# Created by Ben Snider on April 1, 2004.
# E-Mail: stupergenius@columbus.rr.com.
#
# Updated by Matt Haughey on August 26, 2004.
# E-Mail: matt@creativecommons.org
#
<search
version="7.1"
name="Creative Commons"
description="Find photos, movies, music, and text to rip, sample, mash, and share"
action="http://search.creativecommons.org/"
searchForm="http://search.creativecommons.org/"
queryCharset="utf-8"
method="GET"
>
<input name="q" user>
<input name="sourceid" value="Mozilla-search">
<interpret
browserResultType="result"
charset="utf-8"
resultListStart="<!-- start results -->"
resultListEnd="<!-- end results -->"
resultItemStart='<p class="resultitem">'
resultItemEnd="</p>"
>
<browser
update="https://addons.mozilla.org/searchplugins/updates/creativecommons.src"
updateIcon="https://addons.mozilla.org/searchplugins/updates/creativecommons.png"
updateCheckDays="3"
>
</search>

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

@ -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>

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

@ -1,29 +0,0 @@
# Mozilla/Dictionary.com plug-in by fissure@netscape.net
# Updated by rebron@meer.net on 11 August 2004
<SEARCH
version = "7.1"
name="Dictionary.com"
description="Dictionary.com Search"
method="get"
action="http://www.dictionary.com/search"
queryCharset="ISO-8859-1"
>
<input name="q" user>
<interpret
browserResultType="result"
resultListStart="<!-- Content -->"
resultListEnd="For better results"
resultItemStart="<p>"
resultItemEnd="</p>"
>
</search>
<BROWSER
update="http://www.mozilla.org/products/firefox/plugins/dictionary.src"
updateIcon="http://www.mozilla.org/products/firefox/plugins/dictionary.png"
updateCheckDays="3"
>

Двоичные данные
browser/locales/en-US/searchplugins/eBay.gif

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 210 B

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

@ -1,37 +0,0 @@
<SEARCH
version = "7.1"
name="eBay"
description="eBay - Online actions"
action="http://search.ebay.com/search/search.dll"
method="GET"
queryCharset="ISO-8859-1"
>
<input name="query" user />
<input name="MfcISAPICommand" value="GetResult" />
<input name="ht" value="1" />
<input name="ebaytag1" value="ebayreg" />
<input name="srchdesc" value="n" />
<input name="maxRecordsReturned" value="300" />
<input name="maxRecordsPerPage" value="50" />
<input name="SortProperty" value="MetaEndSort" />
<interpret
resultListStart = "<!-- eBayCacheStart -->"
resultListEnd = "<!-- eBayCacheEnd -->"
resultItemStart='<td valign=top width=52%><font size=3>'
resultItemEnd="</font></td>"
priceStart='<font size=3><b>'
priceEnd="</b>"
dateStart='<td align="right" valign="top" width="18%" ><font color="#FF0000" size=3>'
dateEnd='</font></td></tr></table>'
/>
</search>
<BROWSER
update="https://addons.mozilla.org/searchplugins/updates/eBay.src"
updateIcon="https://addons.mozilla.org/searchplugins/updates/eBay.gif"
updateCheckDays="3"
>

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

@ -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>

Двоичные данные
browser/locales/en-US/searchplugins/google.gif

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.1 KiB

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

@ -1,31 +0,0 @@
# Mozilla/Google plug-in by amitp+mozilla@google.com
<search
name="Google"
description="Google Search"
method="GET"
action="http://www.google.com/search"
queryCharset="utf-8"
>
<input name="q" user>
<inputnext name="start" factor="10">
<inputprev>
<input name="ie" value="utf-8">
<input name="oe" value="utf-8">
<interpret
browserResultType="result"
charset = "UTF-8"
resultListStart="<!--a-->"
resultListEnd="<!--z-->"
resultItemStart="<!--m-->"
resultItemEnd="<!--n-->"
>
</search>
<browser
update="https://addons.mozilla.org/searchplugins/updates/google.src"
updateIcon="https://addons.mozilla.org/searchplugins/updates/google.gif"
updateCheckDays="1"
>

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

@ -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 amazondotcom
eBay
yahoo
creativecommons
answers answers
creativecommons
eBay
google
yahoo

Двоичные данные
browser/locales/en-US/searchplugins/yahoo.gif

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 88 B

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

@ -1,45 +0,0 @@
# Yahoo Search Plug-in for Mozilla
#
# Created by Robert Fernandes <robert@bovilexics.com>, Matthew A. McGuigan <webnugget.com>, Rafael Ebron <rebron@meer.net>
# Last Edited May 31, 2002
# Last updated August 11, 2004
<SEARCH
version = "7.1"
name="Yahoo"
description="Yahoo Search"
searchForm="http://www.yahoo.com/r/so"
method="GET"
action="http://search.yahoo.com/search"
queryCharset="utf-8"
>
<input name="p" user>
<input name="ei" value="UTF-8">
<interpret
browserResultType="category"
charset="UTF-8"
resultListStart="<div class=padrc>"
resultListEnd="SPONSOR RESULTS"
resultItemStart="149"
# resultItemEnd="</a>"
>
<interpret
browserResultType="result"
charset="UTF-8"
resultListStart="<div id=web>"
resultListEnd="MORE SPONSOR RESULTS"
resultItemStart="<li>"
# resultItemEnd="</a>"
>
<browser
alsomatch="http://search.yahoo.com/bin/search"
update="https://addons.mozilla.org/searchplugins/updates/yahoo.src"
updateIcon="https://addons.mozilla.org/searchplugins/updates/yahoo.gif"
updateCheckDays="3"
>
</search>

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

@ -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/pageReportFirstTime.dtd (%chrome/browser/pageReportFirstTime.dtd)
* locale/browser/safeMode.dtd (%chrome/browser/safeMode.dtd) * locale/browser/safeMode.dtd (%chrome/browser/safeMode.dtd)
locale/browser/sanitize.dtd (%chrome/browser/sanitize.dtd) locale/browser/sanitize.dtd (%chrome/browser/sanitize.dtd)
locale/browser/searchbar.properties (%chrome/browser/searchbar.properties) locale/browser/search.properties (%chrome/browser/search.properties)
* locale/browser/searchDialog.dtd (%chrome/browser/searchDialog.dtd)
locale/browser/setDesktopBackground.dtd (%chrome/browser/setDesktopBackground.dtd) locale/browser/setDesktopBackground.dtd (%chrome/browser/setDesktopBackground.dtd)
locale/browser/shellservice.properties (%chrome/browser/shellservice.properties) locale/browser/shellservice.properties (%chrome/browser/shellservice.properties)
#ifdef MOZ_PLACES #ifdef MOZ_PLACES