From 0c0cad0723d94ae1b65050be2ede2e80b9848e27 Mon Sep 17 00:00:00 2001 From: TLSM Date: Wed, 16 Nov 2022 12:03:14 -0500 Subject: [PATCH] banners: use a class, only style correct elements. Selecting on the alt attribute is unstable and creates a non-obvious coupling to maintain. Also it inadvertently affected the shop banners and some elements in settings. --- files/assets/css/main.css | 5 +++-- files/templates/default.html | 3 ++- files/templates/errors/PCM/502.html | 2 +- files/templates/errors/WPD/502.html | 2 +- files/templates/errors/rDrama/502.html | 2 +- files/templates/util/macros.html | 4 ++-- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/files/assets/css/main.css b/files/assets/css/main.css index 485611548..2fb8dff40 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -6358,10 +6358,11 @@ div.markdown { -o-object-fit: contain; } -img[alt*="banner"] { +.site-banner { width: 100%; } -img[alt*="banner"][alt^="/h/"]{ +.site-banner-hole { + width: 100%; object-fit: cover; max-height: min(42vh,30vw) !important; } diff --git a/files/templates/default.html b/files/templates/default.html index 35bf6baa3..3f17cfea0 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -34,12 +34,13 @@ {% if sub and SITE_NAME != WPD %} {% set src = sub.banner_url %} {% set alt = ['/h/', sub, 'banner']|join %} + {% set class = 'site-banner-hole' %} {% elif SITE_NAME == "rDrama" %} {% set href = "https://secure.transequality.org/site/Donation2?df_id=1480" %} {% set expand = false %} {% endif %} - {{ macros.banner(src, href, alt, expand) }} + {{ macros.banner(src, href, alt, expand, class) }} {% endif %} {% endblock %} diff --git a/files/templates/errors/PCM/502.html b/files/templates/errors/PCM/502.html index d07126730..7074699cf 100644 --- a/files/templates/errors/PCM/502.html +++ b/files/templates/errors/PCM/502.html @@ -88,7 +88,7 @@ - site banner + site banner