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;
}
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;
}

View File

@ -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 %}

View File

@ -88,7 +88,7 @@
<body id="error-502">
<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>
<nav class="shadow-md fixed-top">

View File

@ -88,7 +88,7 @@
<body id="error-502">
<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>
<nav class="shadow-md fixed-top">

View File

@ -88,7 +88,7 @@
<body id="error-502">
<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>
<nav class="shadow-md fixed-top">

View File

@ -4,9 +4,9 @@
{%- endif -%}
{%- endmacro -%}
{%- macro banner(src, href, alt, expand) %}
{%- macro banner(src, href, alt, expand, class) %}
<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>
{% endmacro -%}