Skip to content

Instantly share code, notes, and snippets.

@aurimasv
Created September 23, 2012 09:39
Show Gist options
  • Save aurimasv/3769513 to your computer and use it in GitHub Desktop.
Save aurimasv/3769513 to your computer and use it in GitHub Desktop.
<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="tab-counter" extends="chrome://global/content/bindings/tabbox.xml#tab">
<content>
<xul:hbox class="tab-middle box-inherit" xbl:inherits="align,dir,pack,orient,selected" flex="1">
<xul:image class="tab-icon" xbl:inherits="validate,src=image" role="presentation"/>
<xul:label class="tab-text" xbl:inherits="value=label,accesskey,crop,disabled" flex="1" role="presentation"/>
<xul:label class="tab-counter" xbl:inherits="value=_counterLabel" role="presentation"/>
</xul:hbox>
</content>
<implementation>
<property name="count">
<setter>
<![CDATA[
var v = parseInt(val, 10);
if(!isNaN(v) && v >= 0) {
this.setAttribute('count', v);
this.setAttribute('_counterLabel', '(' + v + ')');
}
]]>
</setter>
<getter>
return this.getAttribute('count');
</getter>
</property>
<property name="_counterLabel" onget="return this.getAttribute('_counterLabel');" onset="this.setAttribute('_counterLabel', val);"/>
</implementation>
</binding>
</bindings>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment