Added an option to disable javascript

This commit is contained in:
Éloi Rivard 2023-07-03 23:26:39 +02:00
parent 7efcf32ade
commit 10a0ecc090
6 changed files with 31 additions and 12 deletions

View file

@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_,
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.
Added
*****
- Configuration option to disable javascript :pr:`141`
[0.0.29] - 2023-06-30
=====================

View file

@ -32,6 +32,9 @@ SECRET_KEY = "change me before you go in production"
# If you have a sentry instance, you can set its dsn here:
# SENTRY_DSN = "https://examplePublicKey@o0.ingest.sentry.io/0"
# Enables javascript to smooth the user experience
# JAVASCRIPT = true
# Accelerates webpages with async requests
# HTMX = true

View file

@ -86,19 +86,21 @@
<footer>
<a href="{{ url_for('account.about') }}">{{ _("About Canaille") }}</a>
</footer>
{% if not is_boosted %}
<script src="/static/jquery/jquery.min.js" defer></script>
<script src="/static/fomanticui/semantic.min.js" defer></script>
{% if config.get("HTMX", true) %}
<script src="/static/htmx/htmx.min.js" defer></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
htmx.config.requestClass = "loading"
})
</script>
{% if config.get("JAVASCRIPT", true) %}
{% if not is_boosted %}
<script src="/static/jquery/jquery.min.js" defer></script>
<script src="/static/fomanticui/semantic.min.js" defer></script>
{% if config.get("HTMX", true) %}
<script src="/static/htmx/htmx.min.js" defer></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
htmx.config.requestClass = "loading"
})
</script>
{% endif %}
<script src="/static/js/base.js" defer></script>
{% endif %}
<script src="/static/js/base.js" defer></script>
{% block script %}{% endblock %}
{% endif %}
{% block script %}{% endblock %}
</body>
</html>

View file

@ -32,6 +32,9 @@ FAVICON = "/static/img/canaille-c.png"
# If you have a sentry instance, you can set its dsn here:
# SENTRY_DSN = "https://examplePublicKey@o0.ingest.sentry.io/0"
# Enables javascript to smooth the user experience
# JAVASCRIPT = true
# Accelerates webpages with async requests
# HTMX = true

View file

@ -32,6 +32,9 @@ FAVICON = "/static/img/canaille-c.png"
# If you have a sentry instance, you can set its dsn here:
# SENTRY_DSN = "https://examplePublicKey@o0.ingest.sentry.io/0"
# Enables javascript to smooth the user experience
# JAVASCRIPT = true
# Accelerates webpages with async requests
# HTMX = true

View file

@ -46,6 +46,9 @@ Canaille is based on Flask, so any `flask configuration <https://flask.palletspr
:TIMEZONE:
*Optional.* The timezone in which datetimes will be displayed to the users. If unset, the server timezone will be used.
:JAVASCRIPT:
*Optional.* Wether javascript is used to smooth the user experience.
:HTMX:
*Optional.* Wether `HTMX <https://htmx.org>`_ will be used to accelerate webpages. Defaults to true.