move post teaser clickable div so voting buttons still work

This commit is contained in:
rimu 2024-11-24 09:19:58 +13:00
parent d3825b68b5
commit 3b462377ce
6 changed files with 13 additions and 6 deletions

View file

@ -39,7 +39,7 @@ document.addEventListener("DOMContentLoaded", function () {
function setupPostTeaserHandler() {
document.querySelectorAll('.post_teaser_clickable').forEach(div => {
div.onclick = function() {
const firstAnchor = this.querySelector('a');
const firstAnchor = this.parentElement.querySelector('a');
if (firstAnchor) {
window.location.href = firstAnchor.href;
}

View file

@ -867,6 +867,9 @@ div.navbar {
.post_list .post_teaser.blocked .voting_buttons .upvote_button, .post_list .post_teaser.blocked .voting_buttons .downvote_button {
font-size: 80%;
}
.post_list .post_teaser .post_teaser_clickable {
cursor: pointer;
}
.post_teaser_body {
position: relative;

View file

@ -460,6 +460,10 @@ div.navbar {
}
}
}
.post_teaser_clickable {
cursor: pointer;
}
}
}

View file

@ -1,4 +1,4 @@
<div class="col post_teaser_body post_teaser_clickable">
<div class="col post_teaser_body">
<h3>{% if post.sticky -%}<span class="fe fe-sticky-left"></span>{% endif -%}<a href="{{ url_for('activitypub.post_ap', post_id=post.id, sort='new' if sort == 'active' else None) }}" class="post_teaser_title_a">{{ post.title }}</a>
{% if post.nsfw -%}<span class="warning_badge nsfw" title="{{ _('Not safe for work') }}">nsfw</span>{% endif -%}
{% if post.nsfl -%}<span class="warning_badge nsfl" title="{{ _('Potentially emotionally scarring content') }}">nsfl</span>{% endif -%}
@ -13,7 +13,7 @@
c/{{ post.community.name }}</a>{% endif -%}
by {{ render_username(post.author) }} <time datetime="{{ post.last_active }}">{{ post.posted_at_localized(sort, locale) }}</time></span>
{% if post.body_html -%}
<div class="post_teaser_article_preview small">
<div class="post_teaser_article_preview small post_teaser_clickable">
{{ first_paragraph(post.body_html) | safe }}
</div>
{% endif -%}

View file

@ -1,4 +1,4 @@
<div class="col post_teaser_body post_teaser_clickable">
<div class="col post_teaser_body">
<h3>{% if post.sticky -%}<span class="fe fe-sticky-left"></span>{% endif -%}<a href="{{ url_for('activitypub.post_ap', post_id=post.id, sort='new' if sort == 'active' else None) }}" class="post_teaser_title_a">{{ post.title }}</a>
{% if post.domain_id -%}
{% if post.url.endswith('.mp3') -%}
@ -19,7 +19,7 @@
c/{{ post.community.name }}</a>{% endif -%}
by {{ render_username(post.author) }} <time datetime="{{ post.last_active }}">{{ post.posted_at_localized(sort, locale) }}</time></span>
{% if post.body_html -%}
<div class="post_teaser_link_preview small">
<div class="post_teaser_link_preview small post_teaser_clickable">
{{ first_paragraph(post.body_html) | safe }}
</div>
{% endif -%}

View file

@ -1,4 +1,4 @@
<div class="col post_teaser_body post_teaser_clickable">
<div class="col post_teaser_body">
<h3>{% if post.sticky -%}<span class="fe fe-sticky-left"></span>{% endif -%}<a href="{{ url_for('activitypub.post_ap', post_id=post.id, sort='new' if sort == 'active' else None) }}" class="post_teaser_title_a">{{ post.title }}</a>
<span class="fe fe-poll" aria-hidden="true"> </span>
{% if post.nsfw -%}<span class="warning_badge nsfw" title="{{ _('Not safe for work') }}">nsfw</span>{% endif -%}