MarseyWorld/files/templates/post_listing.html

273 lines
13 KiB
HTML
Raw Normal View History

{%- import 'util/macros.html' as macros with context -%}
2022-10-04 15:24:58 +00:00
{% if v %}
{% include "modals/award.html" %}
2022-10-04 15:24:58 +00:00
{% endif %}
{% if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
2023-03-17 14:22:29 +00:00
<script defer src="{{'js/admin/pinpost.js' | asset}}"></script>
2022-10-04 15:24:58 +00:00
{% endif %}
{% include "popover.html" %}
{% set disable_votes = request.path.startswith('/@') and v and v.admin_level < PERMS['ENABLE_VOTE_BUTTONS_ON_USER_PAGE'] %}
2024-01-31 18:54:38 +00:00
{% set post_permalinks = [] %}
2023-10-05 10:09:58 +00:00
{% for p in listing if can_see(v, p) %}
2024-01-31 18:54:38 +00:00
<div class="d-none">
{{post_permalinks.append(p.permalink)}}
</div>
2024-02-23 21:16:30 +00:00
<input hidden id="twoattrs-{{p.id}}" class="twoattrs" value="{{p.id}},{{p.comment_count}}">
2022-10-04 15:24:58 +00:00
2023-10-29 12:51:00 +00:00
{% set ups=p.upvotes %}
{% set downs=p.downvotes %}
{% set score=ups-downs %}
2023-10-29 12:51:00 +00:00
{% if v %}
{% set voted= p.voted %}
{% else %}
{% set voted=-2 %}
{% endif %}
2022-10-04 15:24:58 +00:00
2023-10-29 12:51:00 +00:00
{% set v_forbid_deleted = (p.deleted_utc != 0 or p.is_banned) and not (v and v.admin_level >= PERMS['POST_COMMENT_MODERATION']) and not (v and v.id == p.author_id) %}
2022-10-04 15:24:58 +00:00
{{macros.reports(p, 'post')}}
2024-02-18 15:29:53 +00:00
<div id="post-{{p.id}}" class="actual-post card {% if u and p.profile_pinned %}pinned-to-profile{% endif %} {% if p.ghost %}ghost-post{% endif %} {% if p.unread %}unread{% endif %} {% if p.is_banned %} banned{% endif %}{% if p.deleted_utc %} deleted{% endif %}{% if p.pinned %} pinned{% endif %}{% if voted == 1 %} upvoted{% elif voted==-1 %} downvoted{% endif %}{% if p.nsfw %} nsfw{% endif %}">
2023-10-29 12:51:00 +00:00
<div class="d-flex flex-row-reverse flex-md-row flex-nowrap" style="align-items:flex-start">
<div class="voting my-2 d-none d-md-flex pr-2">
{% if v %}
2023-10-29 14:27:55 +00:00
<div tabindex="0" data-nonce="{{g.nonce}}" data-onclick="vote('post', '{{p.id}}', '1')" class="post-{{p.id}}-up mx-auto arrow-up upvote-button post-{{p.id}}-up {% if voted == 1 %}active{% endif %} {% if disable_votes and voted != 1 %}disabled {% endif %}"></div>
2022-10-04 15:24:58 +00:00
2023-10-29 14:27:55 +00:00
<span class="post-score-{{p.id}} score post-score-{{p.id}} {% if voted == 1 %}score-up{% elif voted==-1 %}score-down{% endif %}{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="right" title="+{{ups}} | -{{downs}}"{% endif %}style="cursor: default">{{score}}</span>
2022-10-04 15:24:58 +00:00
2023-12-01 14:43:03 +00:00
<div {% if DISABLE_DOWNVOTES %}style="display:none!important"{% endif %} tabindex="0" data-nonce="{{g.nonce}}" data-onclick="vote('post', '{{p.id}}', '-1')" class="post-{{p.id}}-down text-muted mx-auto arrow-down downvote-button post-{{p.id}}-down {% if voted==-1 %}active{% endif %} {% if disable_votes and voted != -1 %}disabled {% endif %}"></div>
2023-10-29 12:51:00 +00:00
{% else %}
<a tabindex="0" data-nonce="{{g.nonce}}" class="post-{{p.id}}-up mx-auto arrow-up" href="/login?redirect={{request.full_path | urlencode}}"></a>
2022-10-04 15:24:58 +00:00
2023-10-29 12:51:00 +00:00
<span class="post-{{p.id}}-score-none score{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="right" title="+{{ups}} | -{{downs}}"{% endif %}style="cursor: default">{{score}}</span>
2022-10-04 15:24:58 +00:00
2023-12-01 14:43:03 +00:00
<a {% if DISABLE_DOWNVOTES %}style="display:none!important"{% endif %} tabindex="0" data-nonce="{{g.nonce}}" data-onclick="vote('post', '{{p.id}}', '-1')" class="post-{{p.id}}-down text-muted mx-auto arrow-down" href="/login?redirect={{request.full_path | urlencode}}"></a>
2023-10-29 12:51:00 +00:00
{% endif %}
2022-10-04 15:24:58 +00:00
2023-10-29 12:51:00 +00:00
</div>
2022-10-04 15:24:58 +00:00
2023-10-29 12:51:00 +00:00
<div class="card-header bg-transparent border-0 d-flex flex-row flex-nowrap pl-2 pl-md-0 p-0 mr-md-2">
{% if not v_forbid_deleted %}
<div class="card-thumbnail mt-3">
{% if not p.url %}
<a {% if v and v.newtab %}data-target="t" target="_blank"{% endif %} href="{{p.permalink}}">
<img alt="post thumbnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
</a>
{% elif p.is_image %}
<a href="{{p.realurl(v)}}" rel="noopener">
2023-10-29 12:51:00 +00:00
<img data-nonce="{{g.nonce}}" data-onclick="expandImage('{{p.realurl(v)}}')" alt="post thumbnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
</a>
{% elif p.is_video or p.is_audio %}
<a href="{{p.realurl(v)}}" rel="noopener">
2023-10-29 12:51:00 +00:00
<img data-nonce="{{g.nonce}}" data-onclick="togglevideo('{{p.id}}')" alt="post thumbnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
{% if p.is_video %}
<i class="video-play fas fa-play"></i>
{% endif %}
</a>
{% elif p.is_youtube %}
<a href="{{p.realurl(v)}}" rel="noopener">
2023-10-29 12:51:00 +00:00
<img data-nonce="{{g.nonce}}" data-onclick="toggleyoutube('{{p.id}}')" alt="post thumbnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
<i class="video-play fas fa-play"></i>
</a>
{% else %}
<a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="noopener" href="{{p.realurl(v)}}">
2023-10-29 12:51:00 +00:00
<img alt="post thumbnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
<i class="ext-link fas fa-external-link"></i>
</a>
{% endif %}
</div>
{% endif %}
</div>
<div class="card-block text-left x-scroll-parent w-100">
<div class="post-meta text-left x-scroll hide-scrollbar mb-md-2">
{{macros.post_meta(p)}}
</div>
<h5 class="card-title post-title text-left w-lg-95 pb-0 pb-md-1" style="margin-top:6px">
2024-02-12 18:56:36 +00:00
{% if p.cw %}
<span class="post-flair bg-danger font-weight-bolder mr-1">CHILD WARNING</span>
{% endif %}
{% if p.effortpost %}
<a href="/?effortposts_only=True" class="post-flair effortpost-flair font-weight-bolder mr-1">EFFORTPOST</a>
{% endif %}
2024-02-08 05:25:01 +00:00
<a id="{{p.id}}-title" {% if v and v.newtab %}data-target="t" target="_blank"{% endif %} href="{{p.permalink}}" class="{% if p.hole %}sub{% endif %} stretched-link {% if p.chudded %}text-uppercase{% endif %}">
{% if p.flair %}<span class="post-flair font-weight-bolder mr-1">{{p.flair | safe}}</span>{% endif %}
{{p.realtitle(v) | safe}}
</a>
</h5>
2023-10-29 12:51:00 +00:00
</div>
2022-10-18 11:17:54 +00:00
</div>
2022-10-04 15:24:58 +00:00
2023-10-29 12:51:00 +00:00
<div class="post-actions d-mob-none">
<div class="d-flex" style="flex-basis:146px"></div>
<ul class="list-inline text-right d-flex">
2024-03-03 00:38:57 +00:00
{% if p.realbody(v) or (p.embed and p.domain == "twitter.com") %}
2023-10-29 12:51:00 +00:00
<button type="button" class="list-inline-item ml-2" data-nonce="{{g.nonce}}" data-onclick="expandText('{{p.id}}')"><i class="fas fa-expand-alt mx-0 text-expand-icon-{{p.fullname}}"></i></button>
{% endif %}
<a class="list-inline-item" {% if v and v.newtab %}data-target="t" target="_blank"{% endif %} href="{{p.permalink}}">
<i class="fas fa-comment-dots mr-2"></i>{{p.comment_count}}
<span class="text-info d-none {{p.id}}-new-comments"></span>
</a>
{% include 'post_actions.html' %}
</ul>
</div>
2022-10-04 15:24:58 +00:00
2023-10-29 12:51:00 +00:00
<div class="d-md-none mt-2">
<div class="post-actions">
<ul class="list-inline text-right d-flex">
<li class="list-inline-item mr-auto">
2023-10-29 00:07:53 +00:00
<a {% if v and v.newtab %}data-target="t" target="_blank"{% endif %} href="{{p.permalink}}">
2023-10-29 12:51:00 +00:00
<i class="fas fa-comment-dots ml-0 mr-2"></i>{{p.comment_count}}
<span class="text-info d-none {{p.id}}-new-comments"></span>
2023-10-29 00:07:53 +00:00
</a>
2023-10-29 12:51:00 +00:00
{% if v and v.admin_level >= PERMS['ADMIN_HOME_VISIBLE'] %}
<button type="button" class="ml-2" data-bs-toggle="modal" data-bs-target="#adminModal-{{p.id}}">
<i class="fas fa-broom"></i>
</button>
{% endif %}
</li>
2024-03-03 00:38:57 +00:00
{% if p.realbody(v) or (p.embed and p.domain == "twitter.com") %}
2023-10-29 12:51:00 +00:00
<button type="button" class="list-inline-item ml-2" data-nonce="{{g.nonce}}" data-onclick="expandText('{{p.id}}')"><i class="fas fa-expand-alt mx-0 text-expand-icon-{{p.fullname}}"></i></button>
{% endif %}
{% if v %}
<li class="list-inline-item">
<button type="button" data-bs-toggle="modal" data-bs-target="#actionsModal-{{p.id}}">
<i class="fas fa-ellipsis-h"></i>
</button>
</li>
{% endif %}
{% if v %}
<li id="voting-{{p.id}}-mobile" class="voting list-inline-item d-md-none">
2023-10-29 14:27:55 +00:00
<span tabindex="0" data-nonce="{{g.nonce}}" data-onclick="vote('post-mobile', '{{p.id}}', '1')" class="post-mobile-{{p.id}}-up mx-0 pr-1 arrow-up upvote-button post-{{p.id}}-up {% if voted == 1 %}active{% endif %} {% if disable_votes and voted != 1 %}disabled {% endif %}"></span>
2023-10-29 12:51:00 +00:00
2023-10-29 14:27:55 +00:00
<span class="post-mobile-score-{{p.id}} score post-score-{{p.id}} {% if voted == 1 %}score-up{% elif voted==-1 %}score-down{% endif %}{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="top" title="+{{ups}} | -{{downs}}"{% endif %}style="cursor: default">{{score}}</span>
2023-10-29 12:51:00 +00:00
2023-12-01 14:43:03 +00:00
<span {% if DISABLE_DOWNVOTES %}style="display:none!important"{% endif %} tabindex="0" data-nonce="{{g.nonce}}" data-onclick="vote('post-mobile', '{{p.id}}', '-1')" class="post-mobile-{{p.id}}-down mx-0 pl-1 my-0 arrow-down downvote-button post-{{p.id}}-down {% if voted==-1 %}active{% endif %} {% if disable_votes and voted != -1 %}disabled {% endif %}"></span>
2023-10-29 12:51:00 +00:00
</li>
2023-10-29 00:07:53 +00:00
{% else %}
2023-10-29 12:51:00 +00:00
<li id="voting-{{p.id}}-mobile" class="voting list-inline-item d-md-none">
<a tabindex="0" class="arrow-{{p.id}}-mobile-up mx-0 pr-1 arrow-mobile-up" href="/login?redirect={{request.full_path | urlencode}}">
<i class="fas fa-arrow-alt-up mx-0"></i>
</a>
<span class="post-mobile-score-{{p.id}} score{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="top" title="+{{ups}} | -{{downs}}"{% endif %}style="cursor: default">{{score}}</span>
<a tabindex="0" class="arrow-{{p.id}}-mobile-down arrow-mobile-down mx-0 pl-1 my-0" href="/login?redirect={{request.full_path | urlencode}}">
<i class="fas fa-arrow-alt-down mx-0"></i>
</a>
</li>
2023-10-29 00:07:53 +00:00
{% endif %}
2023-10-29 12:51:00 +00:00
</ul>
2022-10-04 15:24:58 +00:00
</div>
2023-10-29 12:51:00 +00:00
</div>
2022-10-04 15:24:58 +00:00
2023-10-29 12:51:00 +00:00
{% if v %}
<div class="modal fade d-md-none" id="actionsModal-{{p.id}}" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header p-3">
<h6 class="col modal-title text-center">More options</h6>
<button type="button" class="close position-absolute py-3" style="right: 1rem" data-bs-dismiss="modal">
<span><i class="fas fa-times-circle text-gray-500"></i></span>
</button>
</div>
<div class="modal-body">
<ul class="list-group post-actions">
{% include "post_actions_mobile.html" %}
</ul>
</div>
</div>
</div>
</div>
2022-11-10 05:56:50 +00:00
{% endif %}
2022-10-04 15:24:58 +00:00
2023-10-29 12:51:00 +00:00
{% if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
{% include "post_admin_actions_mobile.html" %}
{% endif %}
2023-01-01 11:36:20 +00:00
2023-10-29 12:51:00 +00:00
{% if not v_forbid_deleted %}
2024-03-03 00:38:57 +00:00
{% if p.realbody(v) or (p.embed and p.domain == "twitter.com") %}
2023-10-29 12:51:00 +00:00
<div class="{% if p.chudded %}text-uppercase chud-img chud-{{p.id_last_num}}{% endif %} d-none card rounded border post-preview" id="post-text-{{p.id}}">
{% if p.domain == "twitter.com" %}
{{p.embed | safe}}
{% endif %}
2023-10-29 12:51:00 +00:00
{{p.realbody(v) | safe}}
</div>
2022-10-04 15:24:58 +00:00
{% endif %}
2023-10-29 12:51:00 +00:00
{% if p.is_video %}
<div id="video-{{p.id}}" class="d-none ml-md-5 mt-md-4 mt-2 mx-sm-auto">
<p class="resizable">
<video {% if p.poster_url %}poster="{{p.poster_url}}"{% endif %} id="video2-{{p.id}}" controls preload="none" src="{{p.realurl(v)}}"></video>
</p>
2022-10-04 15:24:58 +00:00
</div>
2023-10-29 12:51:00 +00:00
{% elif p.is_audio %}
<div id="video-{{p.id}}" class="d-none ml-md-5 mt-md-4 mt-2 mx-sm-auto">
<audio id="video2-{{p.id}}" controls preload="none" src="{{p.realurl(v)}}"></audio>
2022-10-04 15:24:58 +00:00
</div>
2023-10-29 12:51:00 +00:00
{% elif p.is_youtube %}
<div id="video-{{p.id}}" class="d-none ml-md-5 mt-md-4 mt-2 resizable">
{{p.embed | safe}}
</div>
{% endif %}
{% endif %}
2022-10-04 15:24:58 +00:00
</div>
{% else %}
2023-09-29 03:43:25 +00:00
<div class="row no-gutters">
<div class="col">
<div class="text-center px-3 my-3">
{% if u %}
{% if "/saved/" in request.path %}
{% set text = "You haven't saved any posts yet!" %}
{% elif "/subscribed/" in request.path %}
{% set text = "You haven't subscribed to any posts yet!" %}
{% elif v and v.id == u.id %}
{% set text = "You haven't made any posts yet!" %}
{% else %}
{% set text = "@" ~ u.username ~ " hasn't made any posts yet!" %}
{% endif %}
{% else %}
2024-02-14 08:36:55 +00:00
{% set text = "No posts found!" if request.path.startswith('/search') else "There are no posts here (yet)." %}
2023-09-29 03:43:25 +00:00
{% endif %}
{{macros.ghost_box(text, '', 1)}}
</div>
2023-01-01 11:36:20 +00:00
</div>
</div>
2022-10-04 15:24:58 +00:00
{% endfor %}
<script src="{{'js/new_comments.js' | asset}}"></script>
2022-10-04 15:24:58 +00:00
{% if v %}
{% include "modals/delete_post.html" %}
{% include "modals/report_post.html" %}
2024-02-14 12:49:29 +00:00
{% include "modals/change_hole.html" %}
{% if v.admin_level >= PERMS['USER_BAN'] %}
{% include "modals/punish.html" %}
2022-10-04 15:24:58 +00:00
{% endif %}
{% include "modals/emoji.html" %}
{% include "modals/gif.html" %}
2022-10-04 15:24:58 +00:00
{% endif %}
<script defer src="{{'js/vendor/clipboard.js' | asset}}"></script>
2023-06-07 23:26:32 +00:00
<script defer src="{{'js/comments+post_listing.js' | asset}}"></script>
<script defer src="{{'js/post_listing.js' | asset}}"></script>
2023-08-15 20:19:57 +00:00
{% if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
2023-06-07 23:26:32 +00:00
<script defer src="{{'js/admin/post.js' | asset}}"></script>
2022-10-23 16:24:17 +00:00
{% endif %}
<input hidden id="post_permalinks" value="{{post_permalinks}}">
2024-01-31 18:56:00 +00:00
<script defer src="{{'js/post_permalinks.js' | asset}}"></script>