# -*- Mode: HTML -*- # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. %searchBarDTD; %browserDTD; ]> document.getAnonymousElementByAttribute(this, "anonid", "searchbar-stringbundle"); document.getAnonymousElementByAttribute(this, "anonid", "searchbar-textbox"); document.getAnonymousElementByAttribute(this, "anonid", "searchbar-popup"); null null (Components.utils.import("resource://gre/modules/FormHistory.jsm", {})).FormHistory; document.getAnonymousElementByAttribute(this, "anonid", "searchbar-engine-button"); = 0; i--) { if (items[i].classList.contains("addengine-item") || items[i].classList.contains("addengine-separator")) popup.removeChild(items[i]); } var addengines = getBrowser().mCurrentBrowser.engines; if (addengines && addengines.length > 0) { const kXULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; // Find the (first) separator in the remaining menu, or the first item // if no separators are present. var insertLocation = popup.firstChild; while (insertLocation.nextSibling && insertLocation.localName != "menuseparator") { insertLocation = insertLocation.nextSibling; } if (insertLocation.localName != "menuseparator") insertLocation = popup.firstChild; var separator = document.createElementNS(kXULNS, "menuseparator"); separator.setAttribute("class", "addengine-separator"); popup.insertBefore(separator, insertLocation); // Insert the "add this engine" items. for (var i = 0; i < addengines.length; i++) { var menuitem = document.createElement("menuitem"); var engineInfo = addengines[i]; var labelStr = this._stringBundle.getFormattedString("cmd_addFoundEngine", [engineInfo.title]); menuitem = document.createElementNS(kXULNS, "menuitem"); menuitem.setAttribute("class", "menuitem-iconic addengine-item"); menuitem.setAttribute("label", labelStr); menuitem.setAttribute("tooltiptext", engineInfo.uri); menuitem.setAttribute("uri", engineInfo.uri); if (engineInfo.icon) this.setIcon(menuitem, engineInfo.icon); menuitem.setAttribute("title", engineInfo.title); popup.insertBefore(menuitem, insertLocation); } } ]]> = 0; --i) { var menuitem = document.createElementNS(kXULNS, "menuitem"); var name = engines[i].name; menuitem.setAttribute("label", name); menuitem.setAttribute("id", name); menuitem.setAttribute("class", "menuitem-iconic searchbar-engine-menuitem menuitem-with-favicon"); // Since this menu is rebuilt by the observer method whenever a new // engine is selected, the "selected" attribute does not need to be // explicitly cleared anywhere. if (engines[i] == this.currentEngine) menuitem.setAttribute("selected", "true"); var tooltip = this._stringBundle.getFormattedString("searchtip", [name]); menuitem.setAttribute("tooltiptext", tooltip); if (engines[i].iconURI) this.setIcon(menuitem, engines[i].iconURI.spec); popup.insertBefore(menuitem, popup.firstChild); menuitem.engine = engines[i]; } this._needToBuildPopup = false; ]]> = 0 && newIndex < this.engines.length) { this.currentEngine = this.engines[newIndex]; } aEvent.preventDefault(); aEvent.stopPropagation(); ]]> this.currentEngine = engine } searchService.addEngine(target.getAttribute("uri"), type, target.getAttribute("src"), false, installCallback); } else return; this.focus(); this.select(); ]]> 100 ? width : 100); var yOffset = outerRect.bottom - innerRect.bottom; popup.openPopup(this.inputField, "after_start", 0, yOffset, false, false); } ]]> #ifndef XP_MACOSX #endif