home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2011 November
/
CHIP_2011_11.iso
/
Programy
/
Narzedzia
/
AIMP2
/
aimp_2.61.583.exe
/
$TEMP
/
YandexPackSetup.msi
/
fil451188DCEBAEC54758D94E04D9589B74
< prev
next >
Wrap
Extensible Markup Language
|
2010-07-12
|
34KB
|
918 lines
<?xml version="1.0"?>
<!DOCTYPE bindings [
<!ENTITY % yasearchDTD SYSTEM "chrome://yasearch/locale/yasearch.dtd" >
%yasearchDTD;
]>
<bindings id="YaSearchBindings"
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="yasearch-bar"
extends="chrome://global/content/bindings/toolbar.xml#toolbar">
<implementation>
<constructor><![CDATA[
Components.classes["@yandex.ru/yasearch;1"]
.getService(Components.interfaces.nsIYaSearch)
.wrappedJSObject
.checkToolbarSet(this.getAttribute("yaNmbSaved"), this);
]]></constructor>
</implementation>
</binding>
<binding id="calendar-day-image"
extends="chrome://global/content/bindings/general.xml#image">
<implementation>
<constructor><![CDATA[
var day = (new Date().getDate() - 1) * 16;
this.setAttribute("style", (this.getAttribute("style") || "")
+ "background: url('" + this.src + "') -" + day + "px 0 no-repeat;"
+ "min-width:16px; min-height:16px;"
);
this.src = "";
]]></constructor>
</implementation>
</binding>
<binding id="extend-toolbarbutton" display="xul:button"
extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton">
<resources>
<stylesheet src="chrome://yasearch/skin/toolbarbutton.css"/>
</resources>
<content>
<children includes="observes|template|menupopup|tooltip"/>
<xul:stack class="icons-holder">
<xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,toolbarmode,buttonstyle"/>
<xul:vbox anonid="state-icons-container" onclick="this.previousSibling.click()">
<xul:image anonid="pause-icon" xbl:inherits="paused=yaAuthDisabled"/>
</xul:vbox>
</xul:stack>
<xul:label class="toolbarbutton-text" crop="right" flex="1"
xbl:inherits="value=label,accesskey,crop,toolbarmode,buttonstyle"/>
<xul:label class="yasearch-toolbarbutton-text" crop="right" flex="1"
xbl:inherits="value=yaLabel,accesskey,crop,toolbarmode,buttonstyle"/>
</content>
</binding>
<binding id="extend-toolbarbutton-base" display="xul:menu"
extends="chrome://global/content/bindings/button.xml#menu-button-base">
<resources>
<stylesheet src="chrome://global/skin/toolbarbutton.css"/>
</resources>
<content>
<children includes="observes|template|menupopup|tooltip"/>
<xul:toolbarbutton class="box-inherit toolbarbutton-menubutton-button"
anonid="button" flex="1" allowevents="true"
xbl:inherits="yaLabel,yaAuthDisabled,disabled,crop,image,label,accesskey,command,
align,dir,pack,orient,toolbarmode,buttonstyle"/>
<xul:dropmarker type="menu-button" class="toolbarbutton-menubutton-dropmarker"
xbl:inherits="align,dir,pack,orient,disabled,toolbarmode,buttonstyle,label"/>
</content>
<implementation>
<property name="disabled">
<getter><![CDATA[
var attrName = this.hasAttribute("yaAuthDisabled") ? "yaAuthDisabled" : "disabled";
return this.getAttribute(attrName) == "true";
]]></getter>
<setter><![CDATA[
var attrName = this.hasAttribute("yaAuthDisabled") ? "yaAuthDisabled" : "disabled";
if (!val && attrName == "disabled")
this.removeAttribute("disabled");
else
this.setAttribute(attrName, !!val);
return this.disabled;
]]></setter>
</property>
<property name="_isItemNeedAuth" readonly="true">
<getter><![CDATA[
return this.hasAttribute("yaAuthDisabled");
]]></getter>
</property>
<property name="_isCounter" readonly="true">
<getter><![CDATA[
return /yasearch\-counter/.test(this.getAttribute("class"));
]]></getter>
</property>
<constructor>
<![CDATA[
if (this.parentNode.parentNode.localName == "toolbarpaletteitem" || !this._isItemNeedAuth)
return;
var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var tooltipId = "yasearch-toolbarbutton-counter-tooltip";
var tooltip = document.getElementById(tooltipId);
if (!tooltip) {
tooltip = document.createElementNS(XULNS, "tooltip");
tooltip.setAttribute("id", tooltipId);
tooltip.setAttribute("noautohide", "true");
tooltip.setAttribute("style", "-moz-binding: url('chrome://yasearch/content/yasearch.xml#extend-counters-tooltip') !important");
document.getElementById("mainPopupSet").appendChild(tooltip);
}
this.setAttribute("tooltip", tooltipId);
this.setAttribute("yaCounterTooltiptext", this.getAttribute("tooltiptext") ||
this.getAttribute("yaCounterTooltiptext"));//"double" constr from Customize
this.removeAttribute("tooltiptext");
]]>
</constructor>
</implementation>
<handlers>
<handler event="mousedown"><![CDATA[
if (!event.cancelBubble && event.target == this && this.disabled) {
Ya.checkOnCommandEvent(event);
}
]]></handler>
<handler event="popupshowing"><![CDATA[
return !this.disabled;
]]></handler>
</handlers>
</binding>
<binding id="extend-mail-toolbarbutton"
extends="chrome://yasearch/content/yasearch.xml#extend-toolbarbutton-base">
<handlers>
<handler event="mousedown" phase="capturing"><![CDATA[
event.stopPropagation();
return true;
]]></handler>
<handler event="popupshowing" phase="capturing"><![CDATA[
event.stopPropagation();
return true;
]]></handler>
</handlers>
</binding>
<binding id="extend-counters-tooltip"
extends="chrome://global/content/bindings/popup.xml#tooltip">
<resources>
<stylesheet src="chrome://yasearch/skin/toolbar-items/counters-tooltip.css"/>
</resources>
<content>
<children>
<xul:hbox>
<xul:label anonid="main-label" class="tooltip-label" flex="1"
yaLabelNoAuthPrefix="&yasearch.counters.noauth.prefix;"
yaLabelNoAuthPostfix="&yasearch.counters.noauth.postfix;"/>
</xul:hbox>
<xul:label class="tooltip-label" flex="1" value="&yasearch.counters.noauth.label;"/>
</children>
</content>
<implementation>
<field name="_mainLabel">document.getAnonymousElementByAttribute(this, "anonid", "main-label");</field>
<property name="_isUserHasAuth" readonly="true">
<getter><![CDATA[
return Components.classes["@yandex.ru/yasearch;1"]
.getService(Components.interfaces.nsIYaSearch)
.wrappedJSObject
.isLogin;
]]></getter>
</property>
</implementation>
<handlers>
<handler event="popupshowing">
<![CDATA[
var ttNode = document.tooltipNode;
if (!ttNode || !ttNode.hasAttribute("yaCounterTooltiptext"))
return false;
var showAuthTooltip = !ttNode.disabled || this._isUserHasAuth;
var nodeIsCounter = ttNode._isCounter;
this.setAttribute("yaHasAuthMode", showAuthTooltip);
var tooltiptext =
(showAuthTooltip ? "" : ttNode.getAttribute("yaNeedAuthTooltiptext")) ||
ttNode.getAttribute("yaCounterTooltiptext") ||
"";
let textArray = [tooltiptext];
let label = this._mainLabel;
if (nodeIsCounter && tooltiptext && !showAuthTooltip) {
let fix = label.getAttribute("yaLabelNoAuthPrefix");
if (fix) {
textArray.unshift(fix);
if (nodeIsCounter && tooltiptext)
textArray[1] = tooltiptext.replace(/^./, function(aChar) aChar.toLowerCase());
}
fix = label.getAttribute("yaLabelNoAuthPostfix");
if (fix)
textArray.push(fix);
}
label.setAttribute("value", textArray.join(" "));
return true;
]]>
</handler>
</handlers>
</binding>
<binding id="extend-login-toolbarbutton"
extends="chrome://yasearch/content/yasearch.xml#extend-toolbarbutton">
<resources>
<stylesheet src="chrome://yasearch/skin/toolbar-items/login.css"/>
</resources>
<content>
<children includes="observes|template|menupopup|tooltip"/>
<xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,toolbarmode,buttonstyle"/>
<xul:label class="toolbarbutton-text" crop="right" flex="1"
xbl:inherits="value=label,accesskey,crop,toolbarmode,buttonstyle"/>
<xul:yasearchloginlabel xbl:inherits="value=yaLabel,accesskey,crop,toolbarmode,buttonstyle"
yaHiddenLoginLabel="&yasearch.go-login.hidden-login.label;"/>
</content>
</binding>
<binding id="extend-login-toolbarbutton-label">
<content>
<xul:label anonid="login-start"/>
<xul:label anonid="login-middle"/>
<xul:label anonid="login-middle-3"/>
<xul:label anonid="login-middle-2"/>
<xul:label anonid="login-middle-1"/>
</content>
<implementation implements="nsIObserver">
<field name="_kMaxLength">12</field>
<field name="_isChanging">false</field>
<field name="_showLoginPrefName">"yasearch.general.ui.mybar.login.show"</field>
<constructor>
<![CDATA[
this._refreshLabel();
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranchInternal)
.addObserver(this._showLoginPrefName, this, false);
this._isInited = true;
]]>
</constructor>
<destructor>
<![CDATA[
if (!this._isInited)
return;
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranchInternal)
.removeObserver(this._showLoginPrefName, this);
this._isInited = false;
]]>
</destructor>
<property name="isLoginVisible" readonly="true">
<getter><![CDATA[
return Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2)
.getBoolPref(this._showLoginPrefName);
]]></getter>
</property>
<method name="_refreshLabel">
<body><![CDATA[
this._isChanging = true;
var newValue = this.getAttribute("value") || "";
if (newValue == "0")
newValue = "";
if (!this.isLoginVisible)
newValue = this.getAttribute("yaHiddenLoginLabel") || "";
document.getBindingParent(this).parentNode.setAttribute("yaDisplayedLogin", newValue);
var me = this;
function setLabelValue(aType, aValue) {
document.getAnonymousElementByAttribute(me, "anonid", "login-" + aType)
.setAttribute("value", aValue);
}
if (newValue.length > this._kMaxLength) {
var i=0;
setLabelValue("start", newValue[i++]);
setLabelValue("middle", newValue.substr(i, i += (this._kMaxLength-5)));
setLabelValue("middle-3", newValue.substr(++i, 1));
setLabelValue("middle-2", newValue.substr(++i, 1));
setLabelValue("middle-1", newValue.substr(++i, 1));
} else {
setLabelValue("start", newValue[0] || "");
setLabelValue("middle", newValue.substr(1));
setLabelValue("middle-3", "");
setLabelValue("middle-2", "");
setLabelValue("middle-1", "");
}
this._isChanging = false;
]]></body>
</method>
<method name="observe">
<parameter name="aSubject"/>
<parameter name="aTopic"/>
<parameter name="aData"/>
<body><![CDATA[
switch (aTopic) {
case "nsPref:changed":
if (aData == this._showLoginPrefName)
this._refreshLabel();
break;
default:
break;
}
]]></body>
</method>
</implementation>
<handlers>
<handler event="DOMAttrModified">
<![CDATA[
if (!this._isChanging && "value" == event.attrName.toLowerCase() && event.prevValue != event.newValue)
this._refreshLabel();
]]>
</handler>
</handlers>
</binding>
<binding id="extend-bookmarks-toolbarbutton"
extends="chrome://yasearch/content/yasearch.xml#extend-toolbarbutton-base">
<implementation implements="nsIDOMEventListener, nsIObserver">
<property name="nsIYa">
<getter><![CDATA[
if (!this._nsIYa)
this._nsIYa = Components.classes["@yandex.ru/yasearch;1"]
.getService(Components.interfaces.nsIYaSearch)
.wrappedJSObject;
return this._nsIYa;
]]></getter>
</property>
<property name="mTooltip" readonly="true"
onget="return document.getElementById('yasearch-bookmarks-tooltip')"/>
<field name="mPrefsNamePrefix">"yasearch.general.ui.bookmarks."</field>
<field name="CLICK_ACTIONS">({
OPEN_MENU: 0,
ADD_IN_DIALOG: 1,
ADD_IN_BACKGROUND: 2
})</field>
<property name="addInBackgroundEnabled">
<getter><![CDATA[
return !!(this.mCurrentClickAction === this.CLICK_ACTIONS.ADD_IN_BACKGROUND);
]]></getter>
</property>
<property name="mCurrentClickAction">
<getter><![CDATA[
return parseInt(this.getAttribute("yaCurrentClickAction"), 10) || 0;
]]></getter>
<setter><![CDATA[
this.setAttribute("yaCurrentClickAction", val);
this.setAttribute("yaCounterTooltiptext",
this.nsIYa.getString(val == this.CLICK_ACTIONS.OPEN_MENU ?
"bookmark.button.tooltiptext.open" :
"bookmark.button.tooltiptext.add"));
]]></setter>
</property>
<constructor><![CDATA[
if (this.parentNode.parentNode.localName == "toolbarpaletteitem")
return;
if (this.mTooltip)
this.mTooltip.addEventListener("popupshowing", this, true);
this.mCurrentClickAction = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2)
.getIntPref(this.mPrefsNamePrefix + "action");
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranchInternal)
.addObserver(this.mPrefsNamePrefix, this, false);
YaProgressListener.addListener(this.mLocationListener);
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
os.addObserver(this, "Ya-Refresh-Data", false);
this.rebuildMenupopup();
this._isInited = true;
]]></constructor>
<destructor><![CDATA[
this.yaDestroy();
]]></destructor>
<method name="yaDestroy">
<body><![CDATA[
if (!this._isInited)
return;
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
os.removeObserver(this, "Ya-Refresh-Data");
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranchInternal)
.removeObserver(this.mPrefsNamePrefix, this);
YaProgressListener.removeListener(this.mLocationListener);
this._clearUpdateBookmarkedTimer();
if (this.mTooltip)
this.mTooltip.removeEventListener("popupshowing", this, true);
this._isInited = false;
]]></body>
</method>
<method name="observe">
<parameter name="aSubject"/>
<parameter name="aTopic"/>
<parameter name="aData"/>
<body><![CDATA[
switch (aTopic) {
case "nsPref:changed":
var prefsvc = aSubject.QueryInterface(Components.interfaces.nsIPrefBranch2);
var prefName = aData.split(this.mPrefsNamePrefix)[1];
switch (prefName) {
case "action":
this.mCurrentClickAction = prefsvc.getIntPref(aData);
break;
case "showaddtofolderontop":
this.nsIYa.yaBookmarks.refreshBookmarksDOMMenu();
break;
default:
break;
}
break;
case "Ya-Refresh-Data":
switch (aData) {
case "bookmarks":
this.rebuildMenupopup();
case "bookmarks-url-status":
this.updateBookmarkedState(gBrowser.currentURI);
break;
}
break;
default:
break;
}
]]></body>
</method>
<method name="rebuildMenupopup">
<body><![CDATA[
if (this.open)
this.open = false;
this.nsIYa.DOMUtils.replaceChildNodes(this.nsIYa.bookmarksDOMMenu, this);
this.getBookmarkedURI();
]]></body>
</method>
<method name="_yaFillTooltip">
<parameter name="aAttrArray"/>
<body>
<![CDATA[
var rows = this.mTooltip.getElementsByTagName("row");
var row, i=0;
while ((row = rows.item(i))) {
if (aAttrArray[i]) {
row.style.display = "";
row.lastChild.setAttribute("value", aAttrArray[i].replace(/[\r\n]/g, " "));
} else {
row.style.display = "none";
}
i++;
}
]]>
</body>
</method>
<method name="handleEvent">
<parameter name="aEvent"/>
<body><![CDATA[
switch (aEvent.type) {
case "popupshowing":
var tooltipNode = document.tooltipNode;
this._yaFillTooltip([tooltipNode.getAttribute("statustext"),
tooltipNode.getAttribute("label"),
tooltipNode.getAttribute("descr")]);
break;
default:
break;
}
]]></body>
</method>
<field name="mLocationListener"><![CDATA[({
_self: this,
observe: function() {
if (arguments[0] == "onWindowLocationChange")
this._self.updateBookmarkedState(arguments[3]);
}
})]]></field>
<field name="_updateBookmarkedStateTimer">null</field>
<method name="_clearUpdateBookmarkedTimer">
<body><![CDATA[
if (this._updateBookmarkedStateTimer) {
this._updateBookmarkedStateTimer.cancel();
this._updateBookmarkedStateTimer = null;
}
]]></body>
</method>
<method name="updateBookmarkedState">
<parameter name="aLocation"/>
<body><![CDATA[
this._clearUpdateBookmarkedTimer();
var yaBookmarks = this.nsIYa.yaBookmarks;
var isBookmarked = yaBookmarks.isBookmarkedURIinCache(aLocation);
this.setAttribute("yaBookmarked", isBookmarked);
if (isBookmarked === null) {
var me = this;
this._updateBookmarkedStateTimer = new this.nsIYa.utils.G_Timer(
function() {
me.setAttribute("yaBookmarked", me.getBookmarkedURI(aLocation).bookmarked);
}, 0
)
}
]]></body>
</method>
<method name="getBookmarkedURI">
<parameter name="aURI"/>
<body><![CDATA[
var uri = (typeof aURI !== "undefined") ?
aURI :
((gBrowser && gBrowser.currentURI) ? gBrowser.currentURI : null);
return this.nsIYa.yaBookmarks.isBookmarkedURI(uri);
]]></body>
</method>
<method name="conditionalAddBookmark">
<parameter name="aAddBookmarkInBackground"/>
<body><![CDATA[
var res = this.getBookmarkedURI();
if (res && res.bookmarked === "url") {
Ya.addBookmark(res.folderId, res.id);
} else {
aAddBookmarkInBackground ?
this.nsIYa.yaBookmarks.addBookmarkInBackground(gBrowser) :
Ya.addBookmark();
}
]]></body>
</method>
<!-- not just 'handler'; menupopup in chevron -->
<method name="_doCommand">
<parameter name="aTarget"/>
<body><![CDATA[
if (aTarget.hasAttribute("anonid")) {
switch (aTarget.getAttribute("anonid")) {
case "menuitem-add":
case "menuitem-edit":
this.conditionalAddBookmark();
break;
default:
break;
}
}
]]></body>
</method>
</implementation>
<handlers>
<handler event="command">
<![CDATA[
if (Ya.checkOnCommandEvent(event)) {
if (event.ctrlKey || event.metaKey || event.shiftKey) {
Ya.loadURI("zakladki.yandex.ru", event);
} else if (this.mCurrentClickAction == this.CLICK_ACTIONS.OPEN_MENU) {
this.open = !this.open;
} else {
this.conditionalAddBookmark(this.addInBackgroundEnabled);
}
}
]]>
</handler>
<handler event="popupshowing"><![CDATA[
if (event.target.localName == "menupopup" && event.target.parentNode == this) {
var res = this.getBookmarkedURI();
this.setAttribute("yaBookmarked", res ? res.bookmarked : null);
if (this.mCurrentClickAction == this.CLICK_ACTIONS.OPEN_MENU)
this.setAttribute("checked", "true");
}
]]></handler>
<handler event="popuphiding"><![CDATA[
if (event.target.localName == "menupopup" && event.target.parentNode == this) {
this.setAttribute("checked", "false");
}
]]></handler>
</handlers>
</binding>
<binding id="yawintitle">
<resources>
<stylesheet src="chrome://yasearch/skin/misc.css"/>
</resources>
<content>
<xul:stack anonid="yawintitle-stack" xbl:inherits="mode" flex="1">
<xul:image anonid="yawintitle-stack-bg"/>
<xul:hbox flex="1" pack="center" align="center" yadraggable="true">
<xul:label crop="end" xbl:inherits="value=label"/>
</xul:hbox>
<xul:vbox flex="1" pack="center" align="right">
<xul:hbox anonid="buttons-box">
<xul:toolbarbutton class="title-button-top" tooltiptext="&yasearch._gen.window.top;"
xbl:inherits="label,oncommand=onmode"/>
<xul:toolbarbutton class="title-button-bottom" tooltiptext="&yasearch._gen.window.bottom;"
xbl:inherits="label,oncommand=onmode"/>
<xul:toolbarbutton tooltiptext="&yasearch._gen.window.close;"
xbl:inherits="label,oncommand=onclose,disabled=dontclose"/>
</xul:hbox>
</xul:vbox>
</xul:stack>
</content>
</binding>
<binding id="extend-tooltip-mail" extends="chrome://global/content/bindings/popup.xml#tooltip">
<content>
<children>
<xul:grid flex="1">
<xul:columns><xul:column/><xul:column flex="1"/></xul:columns>
<xul:rows>
<xul:row>
<xul:hbox pack="end"><xul:description value="&yasearch.mail.tooltip.from;"/></xul:hbox>
<xul:vbox><xul:description anonid="from" crop="end"> </xul:description></xul:vbox>
</xul:row>
<xul:row>
<xul:hbox pack="end"><xul:description value="&yasearch.mail.tooltip.subject;"/></xul:hbox>
<xul:vbox><xul:description anonid="subject" crop="end"> </xul:description></xul:vbox>
</xul:row>
</xul:rows>
</xul:grid>
</children>
</content>
<implementation>
<field name="from">document.getAnonymousElementByAttribute(this, "anonid", "from");</field>
<field name="subject">document.getAnonymousElementByAttribute(this, "anonid", "subject");</field>
</implementation>
<handlers>
<handler event="popupshowing">
<![CDATA[
var node = document.tooltipNode;
if (!(node && node.hasAttribute("yamailfrom") && node.hasAttribute("yamailsubject")))
return false;
if ("state" in this) {
function safe(s) {
s = s.replace(/^\s+/, "").replace(/\s+$/, "")
.replace(/([\/\-&\?\.])/g, "$1\u200B")
.replace(/(\S{5})(\S{5})/g, "$1\u200B$2");
if (s.length > 512)
s = s.substr(0, 512) + "\u2026";
return s;
}
this.from.textContent = safe(node.getAttribute("yamailfrom"));
this.subject.textContent = safe(node.getAttribute("yamailsubject"));
} else {
this.from.setAttribute("value", node.getAttribute("yamailfrom"));
this.subject.setAttribute("value", node.getAttribute("yamailsubject"));
}
return true;
]]>
</handler>
</handlers>
</binding>
<binding id="extend-cy-toolbarbutton"
extends="chrome://yasearch/content/yasearch.xml#extend-toolbarbutton-base">
<implementation implements="nsIObserver">
<field name="_showCyValuePrefName">"yasearch.general.ui.show.cy.value"</field>
<field name="mShowCyValue">false</field>
<field name="mCurrentCyData">({ rang: 0 })</field>
<field name="mTooltip">(this.hasAttribute('tooltip') ? document.getElementById(this.getAttribute('tooltip')) : null)</field>
<method name="setCYData">
<parameter name="aCYData"/>
<body><![CDATA[
let data = aCYData || { rang: 0 };
let stateEnabed = !!(data.state & 8);
let label = stateEnabed ? data.value : "0";
this.disabled = !stateEnabed;
this.setAttribute("yaLabel", label);
this.style.MozImageRegion = "rect(0px, " + 16 * (data.rang+1) + "px, 16px, " + 16 * data.rang + "px)";
this.mCurrentCyData = data;
if (this.mTooltip && this.mTooltip.state == "open")
this.mTooltip.refreshCYData();
]]></body>
</method>
<method name="refreshLabel">
<body><![CDATA[
this.mShowCyValue = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2)
.getBoolPref(this._showCyValuePrefName);
this.setAttribute("yaLabelHidden", !this.mShowCyValue);
]]></body>
</method>
<method name="observe">
<parameter name="aSubject"/>
<parameter name="aTopic"/>
<parameter name="aData"/>
<body><![CDATA[
switch (aTopic) {
case "nsPref:changed":
if (aData == this._showCyValuePrefName)
this.refreshLabel();
break;
default:
break;
}
]]></body>
</method>
<constructor><![CDATA[
if (this._isInited)
return;
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranchInternal)
.addObserver(this._showCyValuePrefName, this, false);
this.refreshLabel();
this._isInited = true;
]]></constructor>
<destructor><![CDATA[
if (!this._isInited)
return;
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranchInternal)
.removeObserver(this._showCyValuePrefName, this);
this._isInited = false;
]]></destructor>
</implementation>
</binding>
<binding id="extend-tooltip-cy"
extends="chrome://global/content/bindings/popup.xml#tooltip">
<content>
<children>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<description value="&yasearch.cy.full.label;"
style="text-align:center; font-weight:bold"/>
</vbox>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xbl:inherits="hidden=yaCYHasData">
<hbox>
<grid flex="1">
<columns><column flex="1"/></columns>
<rows>
<row align="center">
<description value="(...&yasearch.no-data.label;...)"
style="margin-right:0px; text-align:center"/>
</row>
</rows>
</grid>
</hbox>
</vbox>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xbl:inherits="hidden=yaCYNoData">
<hbox>
<grid flex="1">
<columns><column/><column flex="1"/></columns>
<rows>
<row>
<label value="&yasearch.cy.data.theme.label;:" style="text-align:right"/>
<label xbl:inherits="value=yaCYtheme"/>
</row>
<row>
<label value="&yasearch.cy.data.domain.label;:" style="text-align:right"/>
<label xbl:inherits="value=yaCYdomain"/>
</row>
<row>
<label value="&yasearch.cy.data.region.label;:" style="text-align:right"/>
<label xbl:inherits="value=yaCYregion"/>
</row>
<row>
<label value="&yasearch.cy.data.value.label;:" style="text-align:right"/>
<label xbl:inherits="value=yaCYvalue"/>
</row>
</rows>
</grid>
</hbox>
</vbox>
</children>
</content>
<implementation>
<property name="mTooltip" readonly="true"
onget="return this.hasAttribute('tooltip') ? document.getElementById(this.getAttribute('tooltip')) : null"/>
<method name="refreshCYData">
<body><![CDATA[
let tooltipNode = document.tooltipNode;
if (!(tooltipNode && tooltipNode.tagName === "toolbarbutton"))
return false;
let data = tooltipNode.mCurrentCyData;
let stateEnabed = !!(data.state & 8);
if (stateEnabed) {
["theme", "domain", "region", "value"]
.forEach(function(aCyProp) {
this.setAttribute("yaCY" + aCyProp, data[aCyProp]);
}, this);
}
this.setAttribute("yaCYNoData", !stateEnabed);
this.setAttribute("yaCYHasData", stateEnabed);
return true;
]]></body>
</method>
</implementation>
<handlers>
<handler event="popupshowing">
<![CDATA[
return this.refreshCYData();
]]>
</handler>
</handlers>
</binding>
</bindings>