make banners not retarded + increase future scalability
|
@ -6357,3 +6357,11 @@ div.markdown {
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
-o-object-fit: contain;
|
-o-object-fit: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img[alt*="banner"] {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
img[alt*="banner"][alt^="/h/"]{
|
||||||
|
object-fit: cover;
|
||||||
|
max-height: min(42vh,30vw) !important;
|
||||||
|
}
|
||||||
|
|
Before Width: | Height: | Size: 246 KiB After Width: | Height: | Size: 246 KiB |
Before Width: | Height: | Size: 218 KiB After Width: | Height: | Size: 218 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 194 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 186 KiB |
Before Width: | Height: | Size: 209 KiB After Width: | Height: | Size: 209 KiB |
Before Width: | Height: | Size: 216 KiB After Width: | Height: | Size: 216 KiB |
Before Width: | Height: | Size: 203 KiB After Width: | Height: | Size: 203 KiB |
Before Width: | Height: | Size: 296 KiB After Width: | Height: | Size: 296 KiB |
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 242 KiB |
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 186 KiB |
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 194 KiB |
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 162 KiB |
Before Width: | Height: | Size: 171 KiB After Width: | Height: | Size: 171 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 179 KiB After Width: | Height: | Size: 179 KiB |
|
@ -1,6 +1,6 @@
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from os import environ, listdir
|
from os import environ, listdir, path
|
||||||
|
|
||||||
from jinja2 import pass_context
|
from jinja2 import pass_context
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ def timestamp(timestamp):
|
||||||
def inject_constants():
|
def inject_constants():
|
||||||
return {"environ":environ, "SITE":SITE, "SITE_NAME":SITE_NAME, "SITE_FULL":SITE_FULL,
|
return {"environ":environ, "SITE":SITE, "SITE_NAME":SITE_NAME, "SITE_FULL":SITE_FULL,
|
||||||
"AUTOJANNY_ID":AUTOJANNY_ID, "PUSHER_ID":PUSHER_ID,
|
"AUTOJANNY_ID":AUTOJANNY_ID, "PUSHER_ID":PUSHER_ID,
|
||||||
"CC":CC, "CC_TITLE":CC_TITLE, "listdir":listdir, "AEVANN_ID":AEVANN_ID,
|
"CC":CC, "CC_TITLE":CC_TITLE, "listdir":listdir, "os_path":path, "AEVANN_ID":AEVANN_ID,
|
||||||
"PIZZASHILL_ID":PIZZASHILL_ID, "DEFAULT_COLOR":DEFAULT_COLOR,
|
"PIZZASHILL_ID":PIZZASHILL_ID, "DEFAULT_COLOR":DEFAULT_COLOR,
|
||||||
"COLORS":COLORS, "time":time, "PERMS":PERMS, "FEATURES":FEATURES,
|
"COLORS":COLORS, "time":time, "PERMS":PERMS, "FEATURES":FEATURES,
|
||||||
"HOLE_NAME":HOLE_NAME, "HOLE_STYLE_FLAIR":HOLE_STYLE_FLAIR, "HOLE_REQUIRED":HOLE_REQUIRED,
|
"HOLE_NAME":HOLE_NAME, "HOLE_STYLE_FLAIR":HOLE_STYLE_FLAIR, "HOLE_REQUIRED":HOLE_REQUIRED,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{%- import 'util/helpers.html' as help -%}
|
{%- import 'util/helpers.html' as help -%}
|
||||||
{%- import 'html_head.html' as html_head with context -%}
|
{%- import 'html_head.html' as html_head with context -%}
|
||||||
|
{%- import 'util/macros.html' as macros with context -%}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
{% if request.path == '/' %}
|
{% if request.path == '/' %}
|
||||||
|
@ -30,44 +31,15 @@
|
||||||
{% include "modals/expanded_image.html" %}
|
{% include "modals/expanded_image.html" %}
|
||||||
|
|
||||||
{% if '@' not in request.path %}
|
{% if '@' not in request.path %}
|
||||||
{% if sub and SITE_NAME != 'WPD' %}
|
|
||||||
<a href="{{sub.banner_url}}">
|
{% if sub and SITE_NAME != WPD %}
|
||||||
<img alt="/h/{{sub}} banner" onclick="expandDesktopImage()" src="{{sub.banner_url}}" width=100% style="object-fit:cover;max-height:min(42vh,30vw)!important">
|
{% set src = sub.banner_url %}
|
||||||
</a>
|
{% set alt = ['/h/', sub, 'banner']|join %}
|
||||||
{% elif SITE_NAME == 'rDrama' %}
|
{% elif SITE_NAME == "rDrama" %}
|
||||||
<a rel="nofollow noopener" href="https://secure.transequality.org/site/Donation2?df_id=1480">
|
{% set href = "https://secure.transequality.org/site/Donation2?df_id=1480" %}
|
||||||
{% if v and (v.is_banned or v.agendaposter) %}
|
|
||||||
<img alt="site banner" src="/i/{{SITE_NAME}}/banner2.webp?v=2000" width="100%">
|
|
||||||
{% else %}
|
|
||||||
{% set path = "assets/images/" + SITE_NAME + "/banners" %}
|
|
||||||
{% set image = "/" + path + "/" + listdir('files/' + path)|random() + '?v=25' %}
|
|
||||||
<img alt="site banner" src="{% if v %}{{image}}{% else %}{{'cached.webp' | asset_siteimg}}{% endif %}" width="100%">
|
|
||||||
{% endif %}
|
|
||||||
</a>
|
|
||||||
{% elif SITE_NAME == 'WPD' %}
|
|
||||||
{% if v %}
|
|
||||||
{% set path = "assets/images/" + SITE_NAME + "/banners" %}
|
|
||||||
{% set banner = "/" + path + "/" + listdir('files/' + path)|random() + '?v=1' %}
|
|
||||||
{% else %}
|
|
||||||
{% set banner = 'cached.webp' | asset_siteimg %}
|
|
||||||
{% endif %}
|
|
||||||
<a href="{{banner}}">
|
|
||||||
<img alt="site banner" onclick="expandDesktopImage()" src="{{banner}}" width="100%">
|
|
||||||
</a>
|
|
||||||
{% else %}
|
|
||||||
{% if SITE_NAME == 'PCM' %}
|
|
||||||
{# set path = "assets/images/" + SITE_NAME + "/banners" #}
|
|
||||||
{# set banner = "/" + path + "/" + listdir('files/' + path)|max + '?v=1' #}
|
|
||||||
{% set path = "assets/images/" + SITE_NAME + "/banner_rotation" %}
|
|
||||||
{% set banner = "/" + path + "/" + listdir('files/' + path)|random() + '?v=1' %}
|
|
||||||
{% else %}
|
|
||||||
{% set banner = 'banner.webp' | asset_siteimg %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<a href="{{banner}}">
|
{{ macros.banner(src, href, alt) }}
|
||||||
<img alt="site banner" onclick="expandDesktopImage()" src="{{banner}}" width="100%">
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<div class="col sidebar text-left {% if '/sidebar' not in request.path %}d-none d-lg-block{% endif %} pt-3" {% if request.path != '/sidebar' %}id="sidebar-content"{% endif %}>
|
<div class="col sidebar text-left {% if '/sidebar' not in request.path %}d-none d-lg-block{% endif %} pt-3" {% if request.path != '/sidebar' %}id="sidebar-content"{% endif %}>
|
||||||
|
|
||||||
{%- if v -%}
|
{%- if v -%}
|
||||||
{%- set art_path = 'assets/images/WPD/sidebar' -%}
|
{%- set art_image = macros.random_image("sidebar") -%}
|
||||||
{%- set art_image = '/' + art_path + '/' + listdir('files/' + art_path)|random() + '?v=45' -%}
|
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{%- set art_image = '/i/' + SITE_NAME + '/sidebar.webp?v=3000' -%}
|
{%- set art_image = '/i/' + SITE_NAME + '/sidebar.webp?v=3000' -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
{% if sub %}
|
{% if sub %}
|
||||||
{% set image=sub.sidebar_url %}
|
{% set image=sub.sidebar_url %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set path = "assets/images/" + SITE_NAME + "/sidebar" %}
|
{% set image = macros.random_image("sidebar") %}
|
||||||
{% set image = "/" + path + "/" + listdir('files/' + path)|random() + '?v=45' %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if request.path != '/sidebar' %}
|
{% if request.path != '/sidebar' %}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
{% macro banner(src, href, alt) %}
|
||||||
|
<a href="{{href|default(src)}}">
|
||||||
|
<img onclick = "expandDesktopImage()" alt="{{alt|default('site banner')}}" src="{{src|default(live_banner())}}">
|
||||||
|
</a>
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro live_banner() %}
|
||||||
|
{% set path = "files/assets/images/" + SITE_NAME %}
|
||||||
|
{% if not v and os_path.exists(path + "/cached.webp") %}
|
||||||
|
{{ 'cached.webp' | asset_siteimg }}
|
||||||
|
{% elif os_path.exists(path + "/banners") %}
|
||||||
|
{{ random_image("banners") }}
|
||||||
|
{% else %}
|
||||||
|
{{ 'banner.webp' | asset_siteimg }}
|
||||||
|
{% endif %}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro random_image(assetdir) %}
|
||||||
|
{% set path = "assets/images/" + SITE_NAME + "/" + assetdir %}
|
||||||
|
{{ "/" + path + "/" + listdir('files/' + path)|random() + '?v=45' }}
|
||||||
|
{% endmacro %}
|