]> git.gir.st - subscriptionfeed.git/blob - app/reddit/templates/reddit.html.j2
reddit: textarea hack does't escape quotes
[subscriptionfeed.git] / app / reddit / templates / reddit.html.j2
1 {% extends "base.html.j2" %}
2 {% import 'macros.imp.j2' as macros %}
3
4 {% block title %}{{ title | e }}{% endblock %}
5 {% block favicon %}
6 <link rel="shortcut icon" href='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300" fill="%23fff"><circle r="150" cx="150" cy="150" fill="%23f40"/><path d="m150 80l80 80h-40v40h-80v-40h-40l80-80"/></svg>'>
7 {% endblock %}
8
9 {% block content %}
10 {{ super() }}
11 <details style="margin:1em"><summary>Sort</summary><div id="container">
12 <a href="?s=hot">hot</a> |
13 <a href="?s=new">new</a> |
14 <a href="?s=rising">rising</a> |
15 <a href="?s=controversial">controversial</a> |
16 top (
17 <a href="?s=top&t=hour">hour</a>
18 <a href="?s=top&t=day">day</a>
19 <a href="?s=top&t=week">week</a>
20 <a href="?s=top&t=month">month</a>
21 <a href="?s=top&t=year">year</a>
22 <a href="?s=top&t=all">all</a>
23 )
24 </div></details>
25
26 <div class="cards" id="cards">
27 {% if client_side_client %}
28 <noscript><ul class=flashes><li class="error">The reddit module requires javascript (sorry).</li></ul></noscript>
29 {% else %}
30 {% for row in rows %}
31 {% set karma = '&#x2191;' ~ row.n_karma|trim3 %}
32 {% set alt = row.n_karma~' karma, '~row.n_comments~' comments' %}
33 {% call macros.card(row.video_id, row.title, karma, row.pinned, alt, row.url, badge=row.length,ts=row.timestamp) %}
34 <a href="{{ url_for('reddit.reddit', subreddit=row.subreddit) }}">
35 /r/{{ row.subreddit | lower | e }}
36 </a>
37 {% endcall %}
38 {% endfor %}
39 {{ macros.dummycard() }}
40 {% endif %}
41 </div>
42
43 <div class="pagination-container">
44 {{ macros.more({'after':next_page}) if next_page }}
45 </div>
46
47 {% if client_side_client %}
48 <script src="/static/rd/client.js"></script>
49 <script>
50 let options = new URLSearchParams(document.location.search);
51 document.addEventListener("DOMContentLoaded", (event) => {
52 load_page({{ subreddit|tojson }}, {
53 "sorted_by": options.get('s') || "hot",
54 "time": options.get('t') || "day",
55 "after": options.get('after') || "",
56 })
57 });
58 </script>
59
60 <template id=card>
61 {% call macros.card('{{videoid}}', '{{title}}', '&#x2191;{{karma}}', False, '{{karma}} karma, {{comments}} comments', '{{url}}', badge='{{length}}',ts='{{timestamp}}') %}
62 {%raw%}<a href="{{subreddit}}">/r/{{subreddit}}</a>{%endraw%}
63 {% endcall %}
64 </template>
65 <template id=dummycards>
66 {{ macros.dummycard() }}
67 </template>
68 <template id=pagination>
69 {{ macros.more({'after':'{{after}}'}) }}
70 </template>
71 {% endif %}
72
73 {% endblock %}
74
75 {% block footer %}
76 <hr>
77 <a href="/manage/subreddits">Manage Subreddits</a>
78 {% for subreddit in subreddits %}
79 {{ "||" if loop.first else "|"}}
80 <a href="/r/{{ subreddit }}">/r/{{ subreddit }}</a>
81 {% endfor %}
82 {% endblock %}
Imprint / Impressum