From f4931b474cbdbe8a2e1c0bad3df0e1b90510e8d4 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sat, 1 Jun 2024 22:58:11 +1200 Subject: [PATCH] smaller images on mobile, using srcset --- app/templates/post/_post_full.html | 184 +++++++++++++++-------------- 1 file changed, 95 insertions(+), 89 deletions(-) diff --git a/app/templates/post/_post_full.html b/app/templates/post/_post_full.html index ea5bf961..d2e3baf3 100644 --- a/app/templates/post/_post_full.html +++ b/app/templates/post/_post_full.html @@ -1,207 +1,213 @@
- {% if post.type == POST_TYPE_IMAGE %} + {% if post.type == POST_TYPE_IMAGE -%}
- {% include "post/_post_voting_buttons.html" %} + {% include "post/_post_voting_buttons.html" -%}

{{ post.title }} - {% if current_user.is_authenticated %} - {% include 'post/_post_notification_toggle.html' %} - {% endif %} - {% if post.nsfw %}nsfw{% endif %} - {% if post.nsfl %}nsfl{% endif %} + {% if current_user.is_authenticated -%} + {% include 'post/_post_notification_toggle.html' -%} + {% endif -%} + {% if post.nsfw -%}nsfw{% endif -%} + {% if post.nsfl -%}nsfl{% endif -%}

- {% if post.url %} + {% if post.url -%}

{{ post.url|shorten_url }}

- {% endif %} -

{% if post.reports > 0 and current_user.is_authenticated and post.community.is_moderator(current_user) %} + {% endif -%} +

{% if post.reports > 0 and current_user.is_authenticated and post.community.is_moderator(current_user) -%} - {% endif %}submitted {{ moment(post.posted_at).fromNow() }} by {{ render_username(post.author) }} - {% if post.edited_at %} edited {{ moment(post.edited_at).fromNow() }}{% endif %} + {% endif -%}submitted {{ moment(post.posted_at).fromNow() }} by {{ render_username(post.author) }} + {% if post.edited_at -%} edited {{ moment(post.edited_at).fromNow() }}{% endif -%}

- {% if post.image_id %} - {% if low_bandwidth %} - {{ post.image.alt_text if post.image.alt_text else post.title }}{{ post.image.alt_text if post.image.alt_text else post.title }} - {% else %} - {{ post.image.alt_text if post.image.alt_text else post.title }} - {% endif %} - {% else %} + {% else -%} + + {{ post.image.alt_text if post.image.alt_text else post.title }} + + {% endif -%} + {% else -%} - {% endif %} + {% endif -%}
{{ post.body_html|community_links|safe if post.body_html else '' }}
- {% else %} + {% else -%}
- {% include "post/_post_voting_buttons.html" %} + {% include "post/_post_voting_buttons.html" -%}

{{ post.title }} - {% if current_user.is_authenticated %} - {% include 'post/_post_notification_toggle.html' %} - {% endif %} - {% if post.nsfw %}nsfw{% endif %} - {% if post.nsfl %}nsfl{% endif %} + {% if current_user.is_authenticated -%} + {% include 'post/_post_notification_toggle.html' -%} + {% endif -%} + {% if post.nsfw -%}nsfw{% endif -%} + {% if post.nsfl -%}nsfl{% endif -%}

- {% if post.type == POST_TYPE_LINK and post.image_id and not (post.url and 'youtube.com' in post.url) %} + {% if post.type == POST_TYPE_LINK and post.image_id and not (post.url and 'youtube.com' in post.url) -%}
{{ post.image.alt_text if post.image.alt_text else '' }}
- {% endif %} -

{% if post.reports > 0 and current_user.is_authenticated and post.community.is_moderator(current_user) %} + {% endif -%} +

{% if post.reports > 0 and current_user.is_authenticated and post.community.is_moderator(current_user) -%} - {% endif %}submitted {{ moment(post.posted_at).fromNow() }} by + {% endif -%}submitted {{ moment(post.posted_at).fromNow() }} by {{ render_username(post.author) }} - {% if post.edited_at %} edited {{ moment(post.edited_at).fromNow() }}{% endif %} + {% if post.edited_at -%} edited {{ moment(post.edited_at).fromNow() }}{% endif -%}

- {% if post.type == POST_TYPE_LINK %} + {% if post.type == POST_TYPE_LINK -%}

{{ post.url|shorten_url }}

- {% if post.url.endswith('.mp3') %} + {% if post.url.endswith('.mp3') -%}

- {% elif post.url.endswith('.mp4') or post.url.endswith('.webm') %} + {% elif post.url.endswith('.mp4') or post.url.endswith('.webm') -%}

- {% elif post.url.startswith('https://streamable.com') %} + {% elif post.url.startswith('https://streamable.com') -%}
- {% elif post.url.startswith('https://www.redgifs.com/watch/') %} + {% elif post.url.startswith('https://www.redgifs.com/watch/') -%}
- {% endif %} - {% if 'youtube.com' in post.url %} + {% endif -%} + {% if 'youtube.com' in post.url -%}

{{ _('Watch on piped.video') }}

- {% endif %} - {% elif post.type == POST_TYPE_VIDEO %} + {% endif -%} + {% elif post.type == POST_TYPE_VIDEO -%}

{{ post.url|shorten_url }}

- {% if post.url.endswith('.mp4') or post.url.endswith('.webm') %} + {% if post.url.endswith('.mp4') or post.url.endswith('.webm') -%}

- {% elif post.url.startswith('https://streamable.com') %} + {% elif post.url.startswith('https://streamable.com') -%}
- {% elif post.url.startswith('https://www.redgifs.com/watch/') %} + {% elif post.url.startswith('https://www.redgifs.com/watch/') -%}
- {% endif %} - {% if 'youtube.com' in post.url %} + {% endif -%} + {% if 'youtube.com' in post.url -%}

{{ _('Watch on piped.video') }}

- {% endif %} - {% if 'videos/watch' in post.url %} + {% endif -%} + {% if 'videos/watch' in post.url -%}
- {% endif %} - {% elif post.type == POST_TYPE_IMAGE %} + {% endif -%} + {% elif post.type == POST_TYPE_IMAGE -%}
{{ post.image.alt_text if post.image.alt_text else post.title }}
- {% else %} - {% if post.image_id and not (post.url and 'youtube.com' in post.url) %} + {% else -%} + {% if post.image_id and not (post.url and 'youtube.com' in post.url) -%} {{ post.image.alt_text if post.image.alt_text else post.title }} - {% endif %} - {% endif %} + {% endif -%} + {% endif -%}
{{ post.body_html|community_links|safe if post.body_html else '' }}
- {% if post.type == POST_TYPE_POLL %} + {% if post.type == POST_TYPE_POLL -%}
- {% if poll_results and poll_total_votes == 0 %} + {% if poll_results and poll_total_votes == 0 -%}

{{ _('The poll has finished, yet no votes were cast.') }}

- {% elif poll_results and poll_total_votes %} + {% elif poll_results and poll_total_votes -%}
    - {% for choice in poll_choices %} + {% for choice in poll_choices -%}
  • {{ choice.choice_text }}

    {{ choice.percentage(poll_total_votes) }}%
  • - {% endfor %} + {% endfor -%}

{{ _('Total votes: %(total_votes)d.', total_votes=poll_total_votes) }}

{{ _('Poll closes') }} {{ moment(poll_data.end_poll).fromNow(refresh=True) }}.

- {% elif poll_form %} - {% if current_user.is_authenticated %} + {% elif poll_form -%} + {% if current_user.is_authenticated -%}
- {% else %} + {% else -%} - {% endif %} + {% endif -%}
    - {% for choice in poll_choices %} - {% if poll_data.mode == 'single' %} + {% for choice in poll_choices -%} + {% if poll_data.mode == 'single' -%}
  • - {% else %} + {% else -%}
  • - {% endif %} - {% endfor %} + {% endif -%} + {% endfor -%}
- {% endif %} + {% endif -%}
- {% endif %} + {% endif -%}
- {% endif %} + {% endif -%}
- {% if post.tags.count() > 0 %} + {% if post.tags.count() > 0 -%} - {% endif %} - {% if post.cross_posts %} + {% endif -%} + {% if post.cross_posts -%}
{{ len(post.cross_posts) }}
- {% endif %} + {% endif -%}