<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE bindings SYSTEM "/entities.dtd"><?xml-stylesheet type="text/css" href="/styles/style.css"?>

<bindings xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

    <binding extends="chrome://global/content/bindings/button.xml#button-base" id="button">
        <content>
            <xul:toolbarbutton anonid="button" class="ybar-button-text-counter" id="ybar-button-odnoklassniki-marks" oncommand="OnCommand(event)" orient="horizontal" tooltiptext="&widget.tooltip.marks;" type="menu-button">
                <xul:menupopup>
                    <xul:menuitem anonid="update" label="&widget.menuitem.update;"/>
                    <xul:menuseparator/>
                    <xul:menuitem anonid="menu-marks" class="menuitem-iconic" label="&widget.menuitem.marks-follow;"/>
                </xul:menupopup>
            </xul:toolbarbutton>
        </content>
        <implementation implements="nsISupports, nsIDOMEventListener">
            <field name="odnoklassniki">this.parentNode.app.odnoklassniki</field>
            <field name="settings">this.parentNode.app.settings</field>
            <field name="button">document.getAnonymousElementByAttribute(this, "anonid", "button")</field>
            
            <constructor><![CDATA[if (this.settings.counters)
{
this.SetCounter(this.settings.counters.marks);
}
]]></constructor>
            
            <method name="OnCommand">
                <parameter name="event"/>
                <body><![CDATA[var anonid = event.target.getAttribute("anonid","");
switch (anonid) {
case "button":

case "menu-marks":
this.odnoklassniki.Navigate("marks");
break;
case "update":
this.odnoklassniki.ShowThrobber("marks");
this.odnoklassniki.Update();
break;
}
]]></body>
            </method>
            
            <method name="SetCounter">
                <parameter name="counter"/>
                <body><![CDATA[this.button.label = counter ? counter : "";
this.button.setAttribute("throbber",false);]]></body>
            </method>
        </implementation>
    </binding>
</bindings>