<?xml version="1.0"?>
<!--
    Digg Sidebar - Shows Digg stories in the Firefox sidebar in real time.
    Copyright (C) 2008  Abhinav Sarkar <abhinav dot sarkar at gmail dot com>

    This file is a part of Digg Sidebar.

    Digg Sidebar is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Digg Sidebar is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Digg Sidebar.  If not, see <http://www.gnu.org/licenses/>.
-->
<bindings id="diggstory"
   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"
   xmlns:html="http://www.w3.org/1999/xhtml">
    <binding id="diggstoryitem" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
        <resources>
            <stylesheet src="chrome://diggsidebar/skin/diggsidebar.css"/>
        </resources>
        <content>
            <xul:vbox flex="1">
            <xul:vbox class="storyHeader" flex="1">
                <xul:description xbl:inherits="xbl:text=title" class="storyTitle"/>
            </xul:vbox>
            <xul:vbox class="storyDetails" flex="1">
                <html:div class="storyCategory">
                    <html:span xbl:inherits="xbl:text=container" class="storyContainer"></html:span> &gt;
                    <html:span xbl:inherits="xbl:text=topic" class="storyTopic"></html:span> /
                    <html:span xbl:inherits="xbl:text=status" class="storyStatus"></html:span>
                </html:div>
                <html:div>
                    <html:span xbl:inherits="xbl:text=desc" class="storyDesc"></html:span>
                    <html:a xbl:inherits="href=link" class="storyLink"
                            onclick="DiggSidebar.Utils.openUrlInTab(this.href); return false">
                        <html:img src="chrome://diggsidebar/content/image/external.png" />
                    </html:a>
                </html:div>
                <html:div style="text-align:center;">
                    <html:a xbl:inherits="href=href" class="storyHref"
                            onclick="DiggSidebar.Utils.openUrlInTab(this.href); return false">
                        Digg This
                    </html:a>
                </html:div>
                <html:div>
                    <html:span class="storyPopularity">
                        <html:img src="chrome://diggsidebar/content/image/digg.gif" width="15px" />
                        <html:span xbl:inherits="xbl:text=diggs" class="storyDiggs"></html:span>
                        <html:img src="chrome://diggsidebar/content/image/comments.png" width="15px" />
                        <html:span xbl:inherits="xbl:text=comments" class="storyComments"></html:span>
                    </html:span>
                    by
                    <html:a xbl:inherits="href=userlink,xbl:text=username"
                            class="storyUserLink"
                            onclick="DiggSidebar.Utils.openUrlInTab(this.href); return false"></html:a>
                    <html:span xbl:inherits="xbl:text=date" class="storyDate"></html:span>
                </html:div>
            </xul:vbox>
            </xul:vbox>
        </content>
        <implementation>
            <constructor>
                <![CDATA[
                this.d = {};
                this.d.read = false;
                ]]>
            </constructor>
            <property name="read"
                onget="return this.d.read;"
                onset="this.d.read = val; if(val==true) this.markAsRead();"/>
            <method name="markAsRead">
                <body>
                <![CDATA[
                    with (document.getAnonymousElementByAttribute(this, "class", "storyTitle")) {
                        style.color = "#333333";
                    }
                ]]>
                </body>
            </method>
            <method name="showDescription">
                <body>
                <![CDATA[
                    document.getAnonymousElementByAttribute(this, "class", "storyDetails").style.display = 'block';
                    this.read = true;
                    this.selected = true;
                ]]>
                </body>
            </method>
            <method name="hideDescription">
                <body>
                <![CDATA[
                    document.getAnonymousElementByAttribute(this, "class", "storyDetails").style.display = 'none';
                    this.selected = false;
                ]]>
                </body>
            </method>
        </implementation>
        <handlers></handlers>
    </binding>
</bindings>
