gecko/mobile/chrome/content/bindings/extensions.xml

164 lines
6.8 KiB
XML
Raw Normal View History

<?xml version="1.0"?>
<!DOCTYPE bindings [
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
%browserDTD;
2009-08-26 17:44:35 -07:00
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
%brandDTD;
]>
<bindings
xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="extension-local" extends="chrome://browser/content/bindings.xml#richlistitem">
<content orient="vertical">
<xul:hbox align="start">
<xul:image xbl:inherits="src=iconURL"/>
<xul:vbox flex="1">
<xul:hbox align="center">
<xul:label class="title" xbl:inherits="value=name"/>
<xul:label class="normal" xbl:inherits="value=version"/>
2009-08-26 17:44:35 -07:00
<xul:spacer flex="1"/>
<xul:label class="normal" crop="end" xbl:inherits="value=typeLabel"/>
</xul:hbox>
<xul:vbox>
<xul:label class="normal hide-on-select" xbl:inherits="value=description" crop="end" flex="1"/>
<xul:description class="normal show-on-select" xbl:inherits="xbl:text=description" flex="1"/>
<xul:label class="normal-bold" xbl:inherits="value=updateStatus"/>
</xul:vbox>
</xul:vbox>
</xul:hbox>
<xul:hbox class="show-on-select buttons-box">
<xul:button anonid="options-button" class="addon-options" label="&addonOptions.label;"
oncommand="document.getBindingParent(this).toggleOptions();"/>
<xul:spacer flex="1"/>
<xul:button anonid="enable-button" class="show-on-disable hide-on-enable hide-on-uninstall addon-enable" label="&addonEnable.label;"
oncommand="ExtensionsView.enable(document.getBindingParent(this));"/>
<xul:button class="show-on-enable hide-on-disable hide-on-uninstall addon-disable" label="&addonDisable.label;"
oncommand="ExtensionsView.disable(document.getBindingParent(this));"/>
<xul:button class="hide-on-uninstall addon-uninstall" label="&addonUninstall.label;"
oncommand="ExtensionsView.uninstall(document.getBindingParent(this));"/>
<xul:button class="show-on-uninstall addon-cancel" label="&addonCancel.label;"
oncommand="ExtensionsView.cancelUninstall(document.getBindingParent(this));"/>
</xul:hbox>
<!-- options are generated dynamically from the optionsURL -->
<xul:vbox class="options-box" anonid="options-box" collapsed="true" flex="1" />
</content>
<implementation>
<constructor>
<![CDATA[
let isDisabled = this.getAttribute("isDisabled");
let optionsURL = this.getAttribute("optionsURL");
if (optionsURL == "" || isDisabled == "true")
document.getAnonymousElementByAttribute(this, "anonid", "options-button").setAttribute("disabled", "true");
let appDisabled = this.getAttribute("appDisabled");
if (appDisabled == "true")
document.getAnonymousElementByAttribute(this, "anonid", "enable-button").setAttribute("disabled", "true");
]]>
</constructor>
<method name="hideOptions">
<body>
<![CDATA[
let box = document.getAnonymousElementByAttribute(this, "anonid", "options-box");
if (!box.collapsed)
this.toggleOptions();
]]>
</body>
</method>
<method name="showOptions">
<body>
<![CDATA[
let box = document.getAnonymousElementByAttribute(this, "anonid", "options-box");
if (box.collapsed)
this.toggleOptions();
]]>
</body>
</method>
<method name="toggleOptions">
<body>
<![CDATA[
let box = document.getAnonymousElementByAttribute(this, "anonid", "options-box");
box.collapsed = !box.collapsed;
if (box.hasChildNodes())
return;
// retrieve the extensions prefs
let optionsURL = this.getAttribute("optionsURL");
let xhr = new XMLHttpRequest();
xhr.open("GET", optionsURL, false);
xhr.send();
if (!xhr.responseXML)
return;
// Only allow <setting> for now
let prefs = xhr.responseXML.querySelectorAll(":root > setting");
for (let i = 0; i < prefs.length; i++)
box.appendChild(prefs.item(i));
]]>
</body>
</method>
</implementation>
</binding>
<binding id="extension-search" extends="chrome://browser/content/bindings.xml#richlistitem">
<content orient="vertical">
<xul:hbox align="start">
<xul:image xbl:inherits="src=iconURL"/>
<xul:vbox flex="1">
<xul:hbox align="center">
<xul:label class="title" xbl:inherits="value=name"/>
<xul:label class="normal" xbl:inherits="value=version"/>
<xul:spacer flex="1"/>
<xul:hbox class="addon-type-or-rating" align="center" xbl:inherits="rating"/>
</xul:hbox>
<xul:vbox>
<xul:label class="normal hide-on-select" xbl:inherits="value=description" crop="end" flex="1"/>
<xul:description class="normal show-on-select" xbl:inherits="xbl:text=description" flex="1"/>
</xul:vbox>
</xul:vbox>
</xul:hbox>
<xul:vbox flex="1">
<xul:hbox class="show-on-select">
<xul:button class="addon-install hide-on-install hide-on-restart" label="&addonShowPage.label;"
oncommand="ExtensionsView.showPage(document.getBindingParent(this));"/>
<xul:spacer flex="1"/>
2009-08-26 17:44:35 -07:00
<xul:button class="addon-install hide-on-install hide-on-restart" label="&addonInstall2.label;"
oncommand="ExtensionsView.installFromRepo(document.getBindingParent(this));"/>
</xul:hbox>
<xul:progressmeter class="show-on-install" mode="normal" value="0" xbl:inherits="value=progress"/>
</xul:vbox>
</content>
</binding>
<binding id="extension-message" extends="chrome://browser/content/bindings.xml#richlistitem">
<content orient="vertical" align="center">
<xul:hbox>
<xul:image src="chrome://browser/skin/images/throbber.png" xbl:inherits="hidden=hidethrobber"/>
<xul:label class="normal" xbl:inherits="value=message"/>
</xul:hbox>
<xul:button xbl:inherits="label=button,hidden=hidebutton" oncommand="ExtensionsView.resetSearch();"/>
</content>
</binding>
2009-08-26 17:44:35 -07:00
<binding id="extension-search-recommended">
<content>
<xul:label class="normal" value="&addonsSearch.recommended;" crop="end"/>
</content>
</binding>
<binding id="extension-search-rating">
<content>
<xul:image class="addon-rating" xbl:inherits="rating"/>
</content>
</binding>
</bindings>