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.
remotes/1693176582716663532/tmp_refs/heads/watchparty
Snakes 2022-11-16 12:03:14 -05:00
parent 7feddc42f0
commit 0c0cad0723
6 changed files with 10 additions and 8 deletions

View File

@ -6358,10 +6358,11 @@ div.markdown {
-o-object-fit: contain; -o-object-fit: contain;
} }
img[alt*="banner"] { .site-banner {
width: 100%; width: 100%;
} }
img[alt*="banner"][alt^="/h/"]{ .site-banner-hole {
width: 100%;
object-fit: cover; object-fit: cover;
max-height: min(42vh,30vw) !important; max-height: min(42vh,30vw) !important;
} }

View File

@ -34,12 +34,13 @@
{% if sub and SITE_NAME != WPD %} {% if sub and SITE_NAME != WPD %}
{% set src = sub.banner_url %} {% set src = sub.banner_url %}
{% set alt = ['/h/', sub, 'banner']|join %} {% set alt = ['/h/', sub, 'banner']|join %}
{% set class = 'site-banner-hole' %}
{% elif SITE_NAME == "rDrama" %} {% elif SITE_NAME == "rDrama" %}
{% set href = "https://secure.transequality.org/site/Donation2?df_id=1480" %} {% set href = "https://secure.transequality.org/site/Donation2?df_id=1480" %}
{% set expand = false %} {% set expand = false %}
{% endif %} {% endif %}
{{ macros.banner(src, href, alt, expand) }} {{ macros.banner(src, href, alt, expand, class) }}
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

@ -88,7 +88,7 @@
<body id="error-502"> <body id="error-502">
<a href="/i/PCM/cached.webp?v=3009"> <a href="/i/PCM/cached.webp?v=3009">
<img alt="site banner" src="/i/PCM/cached.webp?v=3009" width="100%"> <img class="site-banner" alt="site banner" src="/i/PCM/cached.webp?v=3009" width="100%">
</a> </a>
<nav class="shadow-md fixed-top"> <nav class="shadow-md fixed-top">

View File

@ -88,7 +88,7 @@
<body id="error-502"> <body id="error-502">
<a href="/i/WPD/cached.webp?v=3009"> <a href="/i/WPD/cached.webp?v=3009">
<img alt="site banner" src="/i/WPD/cached.webp?v=3009" width="100%"> <img class="site-banner" alt="site banner" src="/i/WPD/cached.webp?v=3009" width="100%">
</a> </a>
<nav class="shadow-md fixed-top"> <nav class="shadow-md fixed-top">

View File

@ -88,7 +88,7 @@
<body id="error-502"> <body id="error-502">
<a rel="nofollow noopener" href="https://secure.transequality.org/site/Donation2?df_id=1480"> <a rel="nofollow noopener" href="https://secure.transequality.org/site/Donation2?df_id=1480">
<img alt="site banner" src="/i/rDrama/cached.webp?v=3009" width="100%"> <img class="site-banner" alt="site banner" src="/i/rDrama/cached.webp?v=3009" width="100%">
</a> </a>
<nav class="shadow-md fixed-top"> <nav class="shadow-md fixed-top">

View File

@ -4,9 +4,9 @@
{%- endif -%} {%- endif -%}
{%- endmacro -%} {%- endmacro -%}
{%- macro banner(src, href, alt, expand) %} {%- macro banner(src, href, alt, expand, class) %}
<a href="{{href|default(src)}}" rel="nofollow noopener"> <a href="{{href|default(src)}}" rel="nofollow noopener">
<img onclick="{{expand|default('expandDesktopImage()')}}" alt="{{alt|default('site banner')}}" src="{{src|default(live_banner())}}"> <img onclick="{{expand|default('expandDesktopImage()')}}" class="{{class|default('site-banner')}}" alt="{{alt|default('site banner')}}" src="{{src|default(live_banner())}}">
</a> </a>
{% endmacro -%} {% endmacro -%}