<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="color-scheme" content="dark light" />
    <title>Blasta / {{path}}</title>
    <link rel="shortcut icon" href="/graphic/blasta.svg" />
    <link rel="icon" type="image/svg+xml" href="/graphic/blasta.svg" />
    <link rel="stylesheet" type="text/css" media="screen"
          href="/stylesheet/stylesheet.css" />
    <script src="/script/regulator.js" />
    <link rel="alternate" type="application/atom+xml"
          title="Follow updates on /{% if jid %}jid/{% endif %}{{syndicate}}{% if param_tags %} for Tag: #{{param_tags}}{% endif %}{% if param_url %} for URL: {{param_url}}{% endif %}{% if param_hash %} for hash: {{param_hash}}{% endif %}"
          href="/{% if jid %}jid/{% endif %}{{syndicate}}?mode=feed{% if param_tags %}&amp;tags={{param_tags}}{% endif %}{% if param_url %}&amp;url={{param_url}}{% endif %}{% if param_hash %}&amp;hash={{param_hash}}{% endif %}" />
    <link rel="alternate" type="application/atom+xml"
          title="Subscribe to PubSub /{{syndicate}}{% if param_tags %} for Tag: #{{param_tags}}{% endif %}{% if param_url %} for URL: {{param_url}}{% endif %}{% if param_hash %} for hash: {{param_hash}}{% endif %}"
          href="xmpp:{{pubsub_jid}}?pubsub;action=subscribe;node={{node_id}}" />
</head>
<body>
    <div id="container">
        <div id="header" class="row">
            <h1>
                <img src="/graphic/blasta.svg"/>
                &nbsp;
                <a href="/">
                    Blasta
                </a>
                / {{path}}
                {% if jid and jid != jabber_id %}
                    /
                    <a href="/jid/{{jid}}">
                        {{jid}}
                    </a>
                {% endif %}
            </h1>
            <dl id="navigation">
                <dd>
                    <a href="/">
                        <img alt="Main"
                             src="/graphic/blasta.svg"/>
                    </a>
                </dd>
                {% if jabber_id %}
                    <dd>
                        <a href="/save">Add</a>
                    </dd>
                    <dd>
                        {% if node_type == 'public' %}
                            <b>Public</b>
                        {% else %}
                            <a href="/jid">Public</a>
                        {% endif %}
                    </dd>
                    <dd>
                        {% if node_type == 'private' %}
                            <b>Private</b>
                        {% else %}
                            <a href="/private">Private</a>
                        {% endif %}
                    </dd>
                    <dd>
                        {% if node_type == 'read' %}
                            <b>Read</b>
                        {% else %}
                            <a href="/read">Read</a>
                        {% endif %}
                    </dd>
                {% endif %}
                <dd>
                    <a href="/search{% if jid %}/jid/{{jid}}{% endif %}">Search</a>
                </dd>
                <dd>
                    {% if page_type == 'popular' %}
                        <b>Popular</b>
                    {% else %}
                        <a href="/popular">Popular</a>
                    {% endif %}
                </dd>
                <dd>
                    {% if page_type == 'recent' %}
                        <b>Recent</b>
                    {% else %}
                        <a href="/recent">Recent</a>
                    {% endif %}
                </dd>
                <dd>
                    {% if jabber_id %}
                        <a href="/disconnect">Disconnect</a>
                    {% else %}
                        <a href="/connect">Connect</a>
                    {% endif %}
                </dd>
            </dl>
        </div>
        <div id="main" class="row">
            <div id="content">
                <h2>
                    <img alt="💡" src="/graphic/xmpp.svg" width="18" height="18"/>
                    &nbsp;
                    PubSub bookmarks
                </h2>
                {% if pager %}
                    {% if page_next or page_prev %}
                        <div id="navigate-top">
                            {% if page_prev %}
                                «
                                <a href="?page={{page_prev}}{% if param_tags %}&amp;tags={{param_tags}}{% endif %}{% if param_query %}&amp;q={{param_query}}{% endif %}">
                                    <b>retract</b></a>
                            {% else %}
                                <span class="inactive">« retract</span>
                            {% endif %}
                            or
                            {% if page_next %}
                                <a href="?page={{page_next}}{% if param_tags %}&amp;tags={{param_tags}}{% endif %}{% if param_query %}&amp;q={{param_query}}{% endif %}">
                                    <b>proceed</b></a>
                                »
                            {% else %}
                                <span class="inactive">proceed »</span>
                            {% endif %}
                        </div>
                    {% endif %}
                {% endif %}
                {% if message %}
                    <p>
                        » {{message}}
                        {% if message_link %}
                            <a href="{{message_link['href']}}">
                                {{message_link['text']}}</a>.
                        {% endif %}
                    </p>
                {% endif %}
                <h3>{{description}}</h3>
                {% if start %}
                    <p>
                        <a href="/save">Start</a>
                        your PubSub bookmarks directory with Blasta!
                    </p>
                {% endif %}
                {% if entries %}
                    <dl id="posts">
                        {% for entry in entries %}
                            <dd>
                                <article class="h-entry">
                                    <h4>
                                        <a class="p-name title"
                                           href="{{entry['link']}}">
                                            {{entry['title']}}</a>
                                    </h4>
                                    <!-- TODO Edit to be possible if entry is present -->
                                    <!-- {% if jabber_id and entry['present'] %}{% endif %} -->
                                    {% if jabber_id %}
                                        {% if restore %}
                                            <a href="{{link_save}}">restore</a>
                                        {% elif delete %}
                                            <a href="/url/{{entry['url_hash']}}/delete"
                                               id="confirm">confirm deletion</a>
                                        {% elif jabber_id == jid or exist or path in ('private', 'read') %}
                                            <a href="/url/{{entry['url_hash']}}/edit">
                                                edit</a>
                                            /
                                            <a href="/url/{{entry['url_hash']}}/confirm">
                                                delete</a>
                                        {% else %}
                                            <a href="/url/{{entry['url_hash']}}/edit">
                                                add this</a>
                                        {% endif %}
                                    {% endif %}
                                    <p class="p-summary summary">{{entry['summary']}}</p>
                                    <div class="details">
                                        <span class="tags">
                                            {% if entry['tags'] | length > 0 %}
                                                to
                                                {% for tag in entry['tags'] %}
                                                    <a class="p-category"
                                                       href="{% if jid %}/jid/{{jid}}{% elif path in ('query', 'url') %}/{% endif %}?tags={{tag}}">
                                                        {{tag}}
                                                    </a>
                                                {% endfor %}
                                            {% endif %}
                                        </span>
                                        by
                                        {% if jid %}
                                            <a class="p-author" href="/jid/{{jid}}">{{jid}}</a>
                                        {% else %}
                                            <a class="p-author" href="/jid/{{entry['jid']}}">{{entry['name']}}</a>
                                        {% endif %}
                                        …
                                        <a class="u-uid u-url" href="/url/{{entry['url_hash']}}">
                                            {% if entry['instances'] and entry['instances'] != 1 %}
                                                {% if entry['instances'] > 5000 %}
                                                    <span class="instances-degree-fifth">
                                                {% elif entry['instances'] > 500 %}
                                                    <span class="instances-degree-fourth">
                                                {% elif entry['instances'] > 50 %}
                                                    <span class="instances-degree-third">
                                                {% elif entry['instances'] > 5 %}
                                                    <span class="instances-degree-second">
                                                {% else %}
                                                    <span class="instances-degree-first">
                                                {% endif %}
                                                {% if entry['instances'] == 2 %}
                                                    and another one
                                                {% else %}
                                                    and {{entry['instances']}} others
                                                {% endif %}</span>
                                            {% else %}
                                                <span>details</span>
                                            {% endif %}
                                        </a>
                                        at
                                        <span class="dt-published date"
                                              datetime="{{entry['published']}}">
                                            {{entry['published_mod']}}
                                        </span>
                                    </div>
                                </article>
                            </dd>
                        {% endfor %}
                    </dl>
                {% endif %}
            </div>
            <div id="related-tags">
                <h3>
                    {% if path == 'url' %}
                        Tags
                    {% else %}
                        Related tags
                    {% endif %}
                </h3>
                <dl>
                    {% for tag in tags %}
                        <dd>
                            <a href="{% if jid %}/jid/{{jid}}{% elif path in ('query', 'url') %}/{% endif %}?tags={{tag}}">
                                {{tag}}
                            </a>
                            {% if tags[tag] %}
                                ({{tags[tag]}})
                            {% endif %}
                        </dd>
                    {% endfor %}
                    <dd>
                        »
                        <a href="/tag/{% if jid %}{{jid}}{% endif %}">see more tags</a>
                    </dd>
                </dl>
            </div>
        </div>
        {% if pager %}
            {% if page_next or page_prev %}
                <div id="navigate-bottom" class="row">
                    {% if page_prev %}
                        « <a href="?page={{page_prev}}{% if param_tags %}&amp;tags={{param_tags}}{% endif %}{% if param_query %}&amp;q={{param_query}}{% endif %}"><b>retract</b></a>
                    {% else %}
                    <span class="inactive">« retract</span>
                    {% endif %}
                    or
                    {% if page_next %}
                        <a href="?page={{page_next}}{% if param_tags %}&amp;tags={{param_tags}}{% endif %}{% if param_query %}&amp;q={{param_query}}{% endif %}"><b>proceed</b></a> »
                    {% else %}
                        <span class="inactive">proceed »</span>
                    {% endif %}
                </div>
            {% endif %}
        {% endif %}
        <div id="subscribe" class="row">
            <p>
                <img alt="💡" src="/graphic/xmpp.svg" width="16" height="16"/>
                <a href="xmpp:{{pubsub_jid}}?pubsub;action=subscribe;node={{node_id}}">
                    PubSub
                </a>
                and
                <img alt="âš›" class="enlarge" src="/graphic/syndicate.svg" width="16" height="16"/>
                <a href="/{% if jid %}jid/{% endif %}{{syndicate}}?mode=feed{% if param_tags %}&amp;tags={{param_tags}}{% endif %}{% if param_url %}&amp;url={{param_url}}{% endif %}{% if param_hash %}&amp;hash={{param_hash}}{% endif %}">
                    RSS
                    <!-- img src="/graphic/atom.svg" width="36" height="14" alt="Atom"/ -->
                </a>
                syndication feeds for this page are available.
            </p>
        </div>
        <div id="footer" class="row">
            <dl>
                <dd>
                    <img src="/graphic/blasta.svg" alt="logo"/>
                    <a href="/">blasta</a>
                </dd>
                <dd>
                    <a href="/help/about">about</a>
                </dd>
                <dd>
                    <a href="/help/about/xmpp">xmpp</a>
                </dd>
                <dd>
                    <a href="/help/about/xmpp/pubsub">pubsub</a>
                </dd>
                <dd>
                    <a href="{{journal}}">journal</a>
                </dd>
                <dd>
                    <a href="/help">help</a>
                </dd>
                <dd>
                    <a href="/help/policy">policy</a>
                </dd>
                <dd>
                    <a href="/help/feeds">rss</a>
                </dd>
                <dd>
                    <a href="/contact">contact</a>
                </dd>
            </dl>
        </div>
    </div>
</body>
</html>