From ad3676cae97b85372995220b15214348add468e9 Mon Sep 17 00:00:00 2001 From: ffont Date: Fri, 19 Jan 2024 13:25:58 +0100 Subject: [PATCH] Better dynamic adjustment of viewport width to avoid nasty zoomings https://github.com/MTG/freesound/issues/1735 --- templates/base.html | 65 ++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/templates/base.html b/templates/base.html index a33972c31..6d45c6de0 100644 --- a/templates/base.html +++ b/templates/base.html @@ -3,9 +3,23 @@ - + - + + Freesound{% if request.resolver_match.url_name != "front-page" %} - {% block title %}{% endblock %}{% endif %} @@ -24,16 +38,16 @@ {% elif request.user.profile.ui_theme_preference == 'd' %} {% else %} - {% if system_prefers_dark_theme %} - - {% else %} - - {% endif %} + {% if system_prefers_dark_theme %} + + {% else %} + + {% endif %} {% endif %} - - + + {% include 'accounts/modal_login.html' %} {% include 'accounts/modal_login_problems.html' %} @@ -43,22 +57,22 @@ {% include 'molecules/toast.html' %}
{% if messages %} - + {% endif %}
- {% block navbar %} + {% block navbar %} {% comment %}This block can be overriden by pages that use a different navbar{% endcomment %} {% include 'molecules/navbar.html' %} - {% endblock %} - {% block content %} - {% endblock %} - {% include 'molecules/footer.html' %} + {% endblock %} + {% block content %} + {% endblock %} + {% include 'molecules/footer.html' %}
{% bw_plausible_scripts %} {% bw_maps_js_scripts %} @@ -70,15 +84,10 @@ document.cookie = "preferSpectrogram=no;path=/"; document.cookie = "disallowSimultaneousAudioPlayback=no;path=/" {% endif %} - const siteWidth = 580; // Minimum expected width. If screen is smaller, scale website. - const scale = window.innerWidth / siteWidth; - if (scale < 1){ - document.querySelector('meta[name="viewport"]').setAttribute('content', 'width=' + siteWidth + ', initial-scale=' + scale); - } const userIsAuthenticated = {{ request.user.is_authenticated|yesno:'true,false' }}; {% block extrabody %} {% endblock %} - +