feat: allow disabling redirect on js-only pages

This commit is contained in:
Bobby 2022-06-28 11:47:28 +07:00
parent 2b195652a5
commit ed06b4bcb1
No known key found for this signature in database
GPG Key ID: 941839794CBF5A09
4 changed files with 10 additions and 8 deletions

View File

@ -5,6 +5,8 @@
#}
<noscript>
<style>body > section:not(#noscript) { display: none !important; }</style>
{% if noscriptRefreshUrl !== null -%}
<!-- Redirect after 3 seconds -->
<meta http-equiv="refresh" content="3;url={{ noscriptRefreshUrl or 'nojs' }}">
{%- endif %}
</noscript>

View File

@ -5,13 +5,11 @@
<p>
This page requires JavaScript to function.
</p>
<p>
{%- if noscriptMessage -%}
{{ noscriptMessage | safe }}
{%- else -%}
If you are not automatically redirected to our No-JS uploader, <a href="nojs">click here</a>.
{%- endif -%}
</p>
{% if noscriptMessage or (noscriptMessage === null) -%}
{{ noscriptMessage | safe }}
{%- else -%}
<p>If you are not automatically redirected to our No-JS uploader, <a href="nojs">click here</a>.</p>
{%- endif %}
</div>
</div>
</section>

View File

@ -147,7 +147,7 @@
{% set floatingHomeHref = '..' %}
{% include "_partial/floating-home.njk" %}
{% if not nojs -%}
{% set noscriptMessage = 'If you are not automatically redirected to its No-JS version, <a href="' + noJsUrl + '">click here</a>.' %}
{% set noscriptMessage = '<p>If you are not automatically redirected to its No-JS version, <a href="' + noJsUrl + '">click here</a>.</p>' %}
{% include "_partial/noscript.njk" %}
{%- endif %}
{% endblock %}

View File

@ -34,6 +34,7 @@
<script src="../js/misc/utils.js{{ versions[1] }}"></script>
{% endblock %}
{% set noscriptRefreshUrl = null %}
{% block endmeta %}
{% include "_partial/noscript-refresh.njk" %}
{% endblock %}
@ -92,5 +93,6 @@
{% set floatingHomeHref = '..' %}
{% include "_partial/floating-home.njk" %}
{% set noscriptMessage = null %}
{% include "_partial/noscript.njk" %}
{% endblock %}