<commit_before>{% extends "base.html" %}

{% block header %}
  {% if topic %}
    <link rel="alternate" type="application/rss+xml" title="{{ topic.name|escape }} (RSS)" href="http://e-drop.appspot.com{{ request_path}}.rss"/>

    <script type="text/javascript">
      $.tpl("tweet", [
        '<div class="tweet">',
          '<img src="{pic_url}" alt="Picture of {author}"',
               'height="48" width="48"/>',
          '<span class="content">{content}</span>',
          '<div class="meta">',
            '<span class="author">{author}</span>',
            '<abbr class="timeago" title="{created_at}">{created_at}</abbr>',
            '<a href="{source_url}">View original</a>',
          '</div>',
        '</div>',
        ]);

      $(function() {
        $("abbr[class*=timeago]").timeago();
        timeAlive = $.timeago($("#topic-created-at")).slice(0, -3)
        $("#topic-created-at").before("for " + timeAlive)

        window.setInterval(function() {
          $.getJSON(document.location.href + ".json",
            function(data) {
              first = $.filename($("#tweets .meta a").eq(0).attr("href"))
              if (data.length > 0 && data[0].source_id == first) return;
              $.each(data.reverse(), function(i, item) {
                tweetHTML = $.tpl("tweet", item, true);
                el = $(tweetHTML)
                el.prependTo("#tweets");
                el.find("abbr[class*=timeago]").timeago()
              });
            });
        }, 20000);
      });
    </script>
  {% endif %}
{% endblock header %}

{% block content %}
  {% if topic %}
    {% if tweets %}

      <span class="left">Sort tweets by:</span><ul id="sort-menu">
        <li><a href="{{ request_path }}">Most recent</a></li>
        <li><a href="{{ request_path }}?order=-influence"
          >Most influential</a></li>
      </ul>
    {% endif %}

    <div id="tweets">

    {% if tweets %}

      {% for tweet in tweets %}
        <div class="tweet">
          <img src="{{ tweet.pic_url }}" alt="Picture of {{ tweet.author }}"
          height="48" width="48"/>
          <span class="content">{{ tweet.content|urlize }}</span>
          <div class="meta">
            <span class="author">{{ tweet.author }}</span>
            <abbr class="timeago"
                  title="{{ tweet.created_at|date:"Y-m-d\TH:i:s\Z" }}"
              >{{ tweet.created_at|date:"Y-m-d H:i:s" }}</abbr>
            <a href="{{ tweet.source_url }}">View original</a>
          </div>
        </div>
      {% endfor %}

      <p>{{ topic.name }} has remained interesting <span id="topic-created-at"
        title="{{ topic.created_at|date:"Y-m-d\TH:i:s\Z" }}"
        >since {{ topic.created_at|date:"M d Y, g:iA" }}</span>.</p>

    {% else %}

      <p>Nobody has talked about <strong>{{ topic.name|escape }}</strong> since
      we started eavesdropping <abbr class="timeago"
        title="{{ topic.created_at|date:"Y-m-d\TH:i:s\Z" }}"
        > on {{ topic.created_at|date:"M d Y, g:iA" }}</abbr>.</p>

    {% endif %}

    </div>

  {% else %}

    <h2>Nobody knows about {{ topic_name|escape }} yet. You're
      the first person to eavesdrop on it!</h2>
    <form method="POST" action="/topics/">
      <input type="hidden" name="name" value="{{ topic_name|escape }}"/>
      <div class="dialog-buttons">
        <input type="submit" value="Eavesdrop"/>
        <a href="/">Actually, I've changed my mind</a>
      </div>
    </form>

  {% endif %}
{% endblock content %}
<commit_msg>Fixing bugs in the ajax. Added some fade effects too.<commit_after>{% extends "base.html" %}

{% block header %}
  {% if topic %}
    <link rel="alternate" type="application/rss+xml" title="{{ topic.name|escape }} (RSS)" href="http://e-drop.appspot.com{{ request_path}}.rss"/>

    <script type="text/javascript">
      $.tpl("tweet", [
        '<div class="tweet">',
          '<img src="{pic_url}" alt="Picture of {author}"',
               'height="48" width="48"/>',
          '<span class="content">{content}</span>',
          '<div class="meta">',
            '<span class="author">{author}</span>',
            '<abbr class="timeago" title="{created_at}">{created_at}</abbr>',
            '<a href="{source_url}">View original</a>',
          '</div>',
        '</div>',
        ]);

      $(function() {
        $("abbr[class*=timeago]").timeago();
        var timeAlive = $.timeago($("#topic-created-at")).slice(0, -3)
        $("#topic-created-at").before("for " + timeAlive)

        var display = function(items) {
          var item = items.pop();
          if (item == null) return;

          var tweetHTML = $.tpl("tweet", item, true);
          var el = $(tweetHTML).css( { display:"none", opacity:0 } ).prependTo("#tweets");
          el.find("abbr[class*=timeago]").timeago();
          el.slideDown("slow", function() {
              $(this).animate( { opacity: 1 }, "slow",
                    function() { display(items); });
              });
        };

        window.setInterval(function() {
          $.getJSON(document.location.href + ".json", function(data) {
              if (data.length < 1) return;
              var href = $("#tweets .meta a").eq(0).attr("href");
              var head = (href == null) ? null : $.filename(href);
              var index = data.length - 1;
              while (index >= 0) {
                if (data[index].source_id == head) break;
                index--;
              }
              if (head == null) $("#tweets p:last").fadeOut();
              display(data.slice(0, (index == -1 ? data.length : index)));
            });
        }, 60000);
      });
    </script>
  {% endif %}
{% endblock header %}

{% block content %}
  {% if topic %}
    {% if tweets %}

      <span class="left">Sort tweets by:</span><ul id="sort-menu">
        <li><a href="{{ request_path }}">Most recent</a></li>
        <li><a href="{{ request_path }}?order=-influence"
          >Most influential</a></li>
      </ul>
    {% endif %}

    <div id="tweets">

    {% if tweets %}

      {% for tweet in tweets %}
        <div class="tweet">
          <img src="{{ tweet.pic_url }}" alt="Picture of {{ tweet.author }}"
          height="48" width="48"/>
          <span class="content">{{ tweet.content|urlize }}</span>
          <div class="meta">
            <span class="author">{{ tweet.author }}</span>
            <abbr class="timeago"
                  title="{{ tweet.created_at|date:"Y-m-d\TH:i:s\Z" }}"
              >{{ tweet.created_at|date:"Y-m-d H:i:s" }}</abbr>
            <a href="{{ tweet.source_url }}">View original</a>
          </div>
        </div>
      {% endfor %}

      <p>{{ topic.name }} has remained interesting <span id="topic-created-at"
        title="{{ topic.created_at|date:"Y-m-d\TH:i:s\Z" }}"
        >since {{ topic.created_at|date:"M d Y, g:iA" }}</span>.</p>

    {% else %}

      <p>Nobody has talked about <strong>{{ topic.name|escape }}</strong> since
      we started eavesdropping <abbr class="timeago"
        title="{{ topic.created_at|date:"Y-m-d\TH:i:s\Z" }}"
        > on {{ topic.created_at|date:"M d Y, g:iA" }}</abbr>.</p>

    {% endif %}

    </div>

  {% else %}

    <h2>Nobody knows about {{ topic_name|escape }} yet. You're
      the first person to eavesdrop on it!</h2>
    <form method="POST" action="/topics/">
      <input type="hidden" name="name" value="{{ topic_name|escape }}"/>
      <div class="dialog-buttons">
        <input type="submit" value="Eavesdrop"/>
        <a href="/">Actually, I've changed my mind</a>
      </div>
    </form>

  {% endif %}
{% endblock content %}

{'fraction_non_alphanumeric': 0.21181423496908303, 'fraction_numerical': 0.005920273648204183, 'mean_word_length': 2.1834170854271355, 'pattern_counts': {'":': 0, '<': 130, '<?xml version=': 0, '>': 131, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3700000', 'n_tokens_mistral': 2572, 'n_tokens_neox': 2400, 'n_words': 500}