2021-01-01 12:54:13 +13:00
|
|
|
{% macro options(current, values, default) -%}
|
|
|
|
{% for value in values %}
|
|
|
|
<option value="{{ value }}" {% if current == value || (current == "" && value == default) %}selected{% endif %}>
|
2021-02-21 09:14:32 +13:00
|
|
|
{{ format!("{}{}", value.get(0..1).unwrap_or_default().to_uppercase(), value.get(1..).unwrap_or_default()) }}
|
2021-01-01 12:54:13 +13:00
|
|
|
</option>
|
|
|
|
{% endfor %}
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
|
|
{% macro sort(root, methods, selected) -%}
|
|
|
|
{% for method in methods %}
|
|
|
|
<a {% if method == selected %}class="selected"{% endif %} href="{{ root }}/{{ method }}">
|
2021-02-21 09:14:32 +13:00
|
|
|
{{ format!("{}{}", method.get(0..1).unwrap_or_default().to_uppercase(), method.get(1..).unwrap_or_default()) }}
|
2021-01-01 12:54:13 +13:00
|
|
|
</a>
|
|
|
|
{% endfor %}
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
|
|
{% macro search(root, search) -%}
|
2021-03-18 13:28:05 +13:00
|
|
|
<form action="{% if root != "/r/" && !root.is_empty() %}{{ root }}{% endif %}/search" id="searchbox">
|
2021-01-18 11:49:36 +13:00
|
|
|
<input id="search" type="text" name="q" placeholder="Search" title="Search libreddit" value="{{ search }}">
|
2021-01-01 17:21:56 +13:00
|
|
|
{% if root != "/r/" && !root.is_empty() %}
|
2021-01-01 12:54:13 +13:00
|
|
|
<div id="inside">
|
2021-01-03 17:50:23 +13:00
|
|
|
<input type="checkbox" name="restrict_sr" id="restrict_sr">
|
2021-02-13 17:53:33 +13:00
|
|
|
<label for="restrict_sr" class="search_label" title="Restrict search to this subreddit">in {{ root }}</label>
|
2021-01-01 12:54:13 +13:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
2021-01-18 12:51:03 +13:00
|
|
|
<button class="submit">
|
|
|
|
<svg width="15" viewBox="0 0 110 100" fill="none" stroke-width="10" stroke-linecap="round">
|
|
|
|
<path d="M20 50 H100" />
|
|
|
|
<path d="M75 15 L100 50 L75 85" />
|
|
|
|
→
|
|
|
|
</svg>
|
|
|
|
</button>
|
2021-01-01 12:54:13 +13:00
|
|
|
</form>
|
2021-01-13 10:43:03 +13:00
|
|
|
{%- endmacro %}
|
|
|
|
|
2021-02-21 10:59:16 +13:00
|
|
|
{% macro render_flair(flair_parts) -%}
|
2021-02-22 17:28:04 +13:00
|
|
|
{% for flair_part in flair_parts %}{% if flair_part.flair_part_type == "emoji" %}<span class="emoji" style="background-image:url('{{ flair_part.value }}');"></span>{% else if flair_part.flair_part_type == "text" && !flair_part.value.is_empty() %}<span>{{ flair_part.value }}</span>{% endif %}{% endfor %}
|
2021-01-13 10:43:03 +13:00
|
|
|
{%- endmacro %}
|
2021-01-30 18:00:55 +13:00
|
|
|
|
2021-01-31 11:52:18 +13:00
|
|
|
{% macro sub_list(current) -%}
|
2021-02-14 09:55:23 +13:00
|
|
|
{% if prefs.subscriptions.len() > 0 %}
|
2021-02-02 14:50:00 +13:00
|
|
|
<details id="feeds">
|
|
|
|
<summary>Feeds</summary>
|
|
|
|
<div id="feed_list">
|
|
|
|
<p>MAIN FEEDS</p>
|
|
|
|
<a href="/">Home</a>
|
|
|
|
<a href="/r/popular">Popular</a>
|
|
|
|
<a href="/r/all">All</a>
|
|
|
|
<p>REDDIT FEEDS</p>
|
2021-02-14 09:55:23 +13:00
|
|
|
{% for sub in prefs.subscriptions %}
|
2021-01-31 15:16:42 +13:00
|
|
|
<a href="/r/{{ sub }}" {% if sub == current %}class="selected"{% endif %}>{{ sub }}</a>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</details>
|
2021-01-30 18:00:55 +13:00
|
|
|
{% endif %}
|
|
|
|
{%- endmacro %}
|
2021-02-04 08:11:04 +13:00
|
|
|
|
|
|
|
{% macro post_in_list(post) -%}
|
|
|
|
<div class="post {% if post.flags.stickied %}stickied{% endif %}">
|
|
|
|
<p class="post_header">
|
|
|
|
<a class="post_subreddit" href="/r/{{ post.community }}">r/{{ post.community }}</a>
|
|
|
|
<span class="dot">•</span>
|
|
|
|
<a class="post_author" href="/u/{{ post.author.name }}">u/{{ post.author.name }}</a>
|
|
|
|
<span class="dot">•</span>
|
|
|
|
<span class="created" title="{{ post.created }}">{{ post.rel_time }}</span>
|
|
|
|
</p>
|
|
|
|
<p class="post_title">
|
|
|
|
{% if post.flair.flair_parts.len() > 0 %}
|
2021-03-18 13:28:05 +13:00
|
|
|
<a href="/r/{{ post.community }}/search?q=flair_name%3A%22{{ post.flair.text }}%22&restrict_sr=on"
|
2021-02-22 17:28:04 +13:00
|
|
|
class="post_flair"
|
|
|
|
style="color:{{ post.flair.foreground_color }}; background:{{ post.flair.background_color }};">{% call render_flair(post.flair.flair_parts) %}</a>
|
2021-02-04 08:11:04 +13:00
|
|
|
{% endif %}
|
|
|
|
<a href="{{ post.permalink }}">{{ post.title }}</a>{% if post.flags.nsfw %} <small class="nsfw">NSFW</small>{% endif %}
|
|
|
|
</p>
|
|
|
|
<!-- POST MEDIA/THUMBNAIL -->
|
|
|
|
{% if (prefs.layout.is_empty() || prefs.layout == "card") && post.post_type == "image" %}
|
|
|
|
<a href="{{ post.media.url }}" class="post_media_image {% if post.media.height / post.media.width < 2 %}short{% endif %}" >
|
|
|
|
<svg
|
|
|
|
width="{{ post.media.width }}px"
|
|
|
|
height="{{ post.media.height }}px"
|
|
|
|
xmlns="http://www.w3.org/2000/svg">
|
|
|
|
<image width="100%" height="100%" href="{{ post.media.url }}"/>
|
|
|
|
<desc>
|
|
|
|
<img alt="Post image" src="{{ post.media.url }}"/>
|
|
|
|
</desc>
|
|
|
|
</svg>
|
|
|
|
</a>
|
2021-02-08 13:22:14 +13:00
|
|
|
{% else if (prefs.layout.is_empty() || prefs.layout == "card") && post.post_type == "gif" %}
|
2021-03-11 07:49:18 +13:00
|
|
|
<video class="post_media_video short" src="{{ post.media.url }}" width="{{ post.media.width }}" height="{{ post.media.height }}" controls loop autoplay><a href={{ post.media.url }}>Video</a></video>
|
2021-02-08 13:22:14 +13:00
|
|
|
{% else if (prefs.layout.is_empty() || prefs.layout == "card") && post.post_type == "video" %}
|
2021-03-11 07:49:18 +13:00
|
|
|
<video class="post_media_video short" src="{{ post.media.url }}" width="{{ post.media.width }}" height="{{ post.media.height }}" poster="{{ post.media.poster }}" preload="none" controls autoplay><a href={{ post.media.url }}>Video</a></video>
|
2021-02-04 08:11:04 +13:00
|
|
|
{% else if post.post_type != "self" %}
|
|
|
|
<a class="post_thumbnail {% if post.thumbnail.url.is_empty() %}no_thumbnail{% endif %}" href="{% if post.post_type == "link" %}{{ post.media.url }}{% else %}{{ post.permalink }}{% endif %}">
|
|
|
|
{% if post.thumbnail.url.is_empty() %}
|
|
|
|
<svg viewBox="0 0 100 106" width="140" height="53" xmlns="http://www.w3.org/2000/svg">
|
|
|
|
<title>Thumbnail</title>
|
|
|
|
<path d="M35,15h-15a10,10 0,0,0 0,20h25a10,10 0,0,0 10,-10m-12.5,0a10, 10 0,0,1 10, -10h25a10,10 0,0,1 0,20h-15" fill="none" stroke-width="5" stroke-linecap="round"/>
|
|
|
|
</svg>
|
|
|
|
{% else %}
|
|
|
|
<svg width="{{ post.thumbnail.width }}px" height="{{ post.thumbnail.height }}px" xmlns="http://www.w3.org/2000/svg">
|
|
|
|
<image width="100%" height="100%" href="{{ post.thumbnail.url }}"/>
|
|
|
|
<desc>
|
|
|
|
<img alt="Thumbnail" src="{{ post.thumbnail.url }}"/>
|
|
|
|
</desc>
|
|
|
|
</svg>
|
|
|
|
{% endif %}
|
|
|
|
<span>{% if post.post_type == "link" %}{{ post.domain }}{% else %}{{ post.post_type }}{% endif %}</span>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<div class="post_score">{{ post.score }}<span class="label"> Upvotes</span></div>
|
|
|
|
<div class="post_footer">
|
|
|
|
<a href="{{ post.permalink }}" class="post_comments">{{ post.comments }} comments</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{%- endmacro %}
|