aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/templates/comments.html
diff options
context:
space:
mode:
Diffstat (limited to 'youtube/templates/comments.html')
-rw-r--r--youtube/templates/comments.html77
1 files changed, 37 insertions, 40 deletions
diff --git a/youtube/templates/comments.html b/youtube/templates/comments.html
index 20cde4e..7bd75e5 100644
--- a/youtube/templates/comments.html
+++ b/youtube/templates/comments.html
@@ -1,30 +1,43 @@
{% import "common_elements.html" as common_elements %}
-{% macro render_comment(comment, include_avatar) %}
+{% macro render_comment(comment, include_avatar, timestamp_links=False) %}
<div class="comment-container">
<div class="comment">
<a class="author-avatar" href="{{ comment['author_url'] }}" title="{{ comment['author'] }}">
{% if include_avatar %}
- <img class="author-avatar-img" src="{{ comment['author_avatar'] }}">
+ <img class="author-avatar-img" alt="{{ comment['author'] }}" src="{{ comment['author_avatar'] }}">
{% endif %}
</a>
- <address>
+ <address class="author-name">
<a class="author" href="{{ comment['author_url'] }}" title="{{ comment['author'] }}">{{ comment['author'] }}</a>
</address>
<a class="permalink" href="{{ comment['permalink'] }}" title="permalink">
- <time datetime="">{{ comment['published'] }}</time>
+ <span>{{ comment['time_published'] }}</span>
</a>
- <span class="text">{{ common_elements.text_runs(comment['text']) }}</span>
- <span class="likes">{{ comment['likes_text'] if comment['likes'] else ''}}</span>
- <div class="bottom-row">
- <a href="{{ comment['replies_url'] }}" class="replies">{{ comment['view_replies_text'] }}</a>
- {% if 'delete_url' is in comment %}
- <a href="{{ comment['delete_url'] }}" target="_blank">Delete</a>
+ {% if timestamp_links %}
+ <span class="comment-text">{{ common_elements.text_runs(comment['text'])|timestamps|safe }}</span>
+ {% else %}
+ <span class="comment-text">{{ common_elements.text_runs(comment['text']) }}</span>
+ {% endif %}
+
+ <span class="comment-likes">{{ comment['likes_text'] if comment['approx_like_count'] else ''}}</span>
+ <div class="button-row">
+ {% if comment['reply_count'] %}
+ {% if settings.use_comments_js and comment['replies_url'] %}
+ <details class="replies" data-src="{{ comment['replies_url'] }}">
+ <summary>{{ comment['view_replies_text'] }}</summary>
+ <a href="{{ comment['replies_url'] }}" class="replies-open-new-tab" target="_blank">Open in new tab</a>
+ <div class="comment_page">loading...</div>
+ </details>
+ {% elif comment['replies_url'] %}
+ <a href="{{ comment['replies_url'] }}" class="replies">{{ comment['view_replies_text'] }}</a>
+ {% else %}
+ <a class="replies">{{ comment['view_replies_text'] }} (error constructing url)</a>
+ {% endif %}
{% endif %}
</div>
</div>
-
</div>
{% endmacro %}
@@ -34,35 +47,19 @@
<a class="sort-button" href="{{ link_url }}">{{ link_text }}</a>
{% endfor %}
</div>
- <div class="comments">
- {% for comment in comments_info['comments'] %}
- {{ render_comment(comment, comments_info['include_avatars']) }}
- {% endfor %}
- </div>
- {% if 'more_comments_url' is in comments_info %}
- <a class="page-button more-comments" href="{{ comments_info['more_comments_url'] }}">More comments</a>
- {% endif %}
-{% endmacro %}
-
-{% macro comment_posting_box(info) %}
- <form action="{{ info['form_action'] }}" method="post" class="comment-form">
- <div id="comment-account-options">
- <label for="account-selection">Account:</label>
- <select id="account-selection" name="channel_id">
- {% for account in info['accounts'] %}
- <option value="{{ account[0] }}">{{ account[1] }}</option>
- {% endfor %}
- </select>
- <a href="/https://youtube.com/login" target="_blank">Add account</a>
+ {% if comments_info['error'] %}
+ <div class="comments">
+ <div class="code-box"><code>{{ comments_info['error'] }}</code></div>
</div>
- <textarea name="comment_text"></textarea>
- {% if info['include_video_id_input'] %}
- <input type="hidden" name="video_id" value="{{ info['video_id'] }}">
+ {% else %}
+ <div class="comments">
+ {% for comment in comments_info['comments'] %}
+ {{ render_comment(comment, comments_info['include_avatars'], True) }}
+ {% endfor %}
+ </div>
+ {% if 'more_comments_url' is in comments_info %}
+ <a class="page-button more-comments" href="{{ comments_info['more_comments_url'] }}">More comments</a>
{% endif %}
- <button type="submit" class="post-comment-button">{{ 'Post reply' if info['replying'] else 'Post comment' }}</button>
- </form>
-{% endmacro %}
-
-
-
+ {% endif %}
+{% endmacro %}