Don't do fancy javascript clicks on the notification page

This commit is contained in:
Mouse Reeve 2021-12-30 19:48:47 -08:00
parent d60684e08e
commit 8d72169bbd
3 changed files with 7 additions and 28 deletions

View file

@ -1,21 +0,0 @@
/* exported BlockHref */
let BlockHref = new (class {
constructor() {
document
.querySelectorAll("[data-href]")
.forEach((t) => t.addEventListener("click", this.followLink.bind(this)));
}
/**
* Follow a fake link
*
* @param {Event} event
* @return {undefined}
*/
followLink(event) {
const url = event.currentTarget.dataset.href;
window.location.href = url;
}
})();

View file

@ -1,12 +1,15 @@
{% load bookwyrm_tags %} {% load bookwyrm_tags %}
{% related_status notification as related_status %} {% related_status notification as related_status %}
<div class="notification is-clickable {% if notification.id in unread %} is-primary{% endif %}" data-href="{% block primary_link %}{% endblock %}"> <div class="box is-shadowless has-background-white-ter {% if notification.id in unread %} is-primary{% endif %}">
<div class="columns is-mobile"> <div class="columns is-mobile">
<div class="column is-narrow is-size-3 {% if notification.id in unread%}has-text-white{% else %}has-text-grey{% endif %}"> <div class="column is-narrow is-size-3 {% if notification.id in unread%}has-text-white{% else %}has-text-grey{% endif %}">
<a class="has-text-dark" href="{% block primary_link %}{% endblock %}">
{% block icon %}{% endblock %} {% block icon %}{% endblock %}
</a>
</div> </div>
<div class="column is-clipped"> <div class="column is-clipped">
<div class="block"> <div class="block content">
<p> <p>
{% if notification.related_user %} {% if notification.related_user %}
<a href="{{ notification.related_user.local_path }}">{% include 'snippets/avatar.html' with user=notification.related_user %} <a href="{{ notification.related_user.local_path }}">{% include 'snippets/avatar.html' with user=notification.related_user %}
@ -15,6 +18,7 @@
{% block description %}{% endblock %} {% block description %}{% endblock %}
</p> </p>
</div> </div>
{% if related_status %} {% if related_status %}
<div class="block"> <div class="block">
{% block preview %}{% endblock %} {% block preview %}{% endblock %}

View file

@ -46,7 +46,3 @@
{% endif %} {% endif %}
</div> </div>
{% endblock %} {% endblock %}
{% block scripts %}
<script src="{% static "js/block_href.js" %}?v={{ js_cache }}"></script>
{% endblock %}