diff --git a/club/templates/club/club_members.jinja b/club/templates/club/club_members.jinja
index 3aa43d56..7e37b04e 100644
--- a/club/templates/club/club_members.jinja
+++ b/club/templates/club/club_members.jinja
@@ -1,11 +1,7 @@
{% extends "core/base.jinja" %}
{% from 'core/macros.jinja' import user_profile_link, select_all_checkbox %}
-{% block additional_js %}
-
-{% endblock %}
{% block additional_css %}
-
{% endblock %}
diff --git a/core/static/bundled/core/components/include-index.ts b/core/static/bundled/core/components/include-index.ts
index c1989f4b..b50cdbc2 100644
--- a/core/static/bundled/core/components/include-index.ts
+++ b/core/static/bundled/core/components/include-index.ts
@@ -6,14 +6,36 @@ import { inheritHtmlElement, registerComponent } from "#core:utils/web-component
**/
@registerComponent("link-once")
export class LinkOnce extends inheritHtmlElement("link") {
- connectedCallback() {
- super.connectedCallback(false);
+ refresh() {
+ this.clearNode();
+
// We get href from node.attributes instead of node.href to avoid getting the domain part
const href = this.node.attributes.getNamedItem("href").nodeValue;
if (document.querySelectorAll(`link[href='${href}']`).length === 0) {
this.appendChild(this.node);
}
}
+
+ clearNode() {
+ while (this.firstChild) {
+ this.removeChild(this.lastChild);
+ }
+ }
+
+ connectedCallback() {
+ super.connectedCallback(false);
+ this.refresh();
+ }
+
+ disconnectedCallback() {
+ this.clearNode();
+
+ // This re-triggers link-once elements that still exists and suppressed
+ // themeselves once it gets removed from the page
+ for (const link of document.getElementsByTagName("link-once")) {
+ (link as LinkOnce).refresh();
+ }
+ }
}
/**
@@ -22,12 +44,34 @@ export class LinkOnce extends inheritHtmlElement("link") {
**/
@registerComponent("script-once")
export class ScriptOnce extends inheritHtmlElement("script") {
- connectedCallback() {
- super.connectedCallback(false);
+ refresh() {
+ this.clearNode();
+
// We get src from node.attributes instead of node.src to avoid getting the domain part
const src = this.node.attributes.getNamedItem("src").nodeValue;
if (document.querySelectorAll(`script[src='${src}']`).length === 0) {
this.appendChild(this.node);
}
}
+
+ clearNode() {
+ while (this.firstChild) {
+ this.removeChild(this.lastChild);
+ }
+ }
+
+ connectedCallback() {
+ super.connectedCallback(false);
+ this.refresh();
+ }
+
+ disconnectedCallback() {
+ this.clearNode();
+
+ // This re-triggers script-once elements that still exists and suppressed
+ // themeselves once it gets removed from the page
+ for (const link of document.getElementsByTagName("script-once")) {
+ (link as LinkOnce).refresh();
+ }
+ }
}
diff --git a/core/templates/core/user_preferences.jinja b/core/templates/core/user_preferences.jinja
index 1aed4d94..f3694ff0 100644
--- a/core/templates/core/user_preferences.jinja
+++ b/core/templates/core/user_preferences.jinja
@@ -1,14 +1,7 @@
{% extends "core/base.jinja" %}
-{%- block additional_js -%}
-
-{%- endblock -%}
-
{%- block additional_css -%}
- {# importing ajax-select-index is necessary for it to be applied after HTMX reload #}
-
-
{%- endblock -%}
{% block title %}
diff --git a/subscription/templates/subscription/subscription.jinja b/subscription/templates/subscription/subscription.jinja
index 9046c296..45e88e18 100644
--- a/subscription/templates/subscription/subscription.jinja
+++ b/subscription/templates/subscription/subscription.jinja
@@ -6,14 +6,8 @@
{% trans %}New subscription{% endtrans %}
{% endblock %}
-{# The following statics are bundled with our autocomplete select.
- However, if one tries to swap a form by another, then the urls in script-once
- and link-once disappear.
- So we give them here.
- If the aforementioned bug is resolved, you can remove this. #}
{% block additional_js %}
-