dedup some event codde

pull/143/head
Aevann 2023-04-27 14:08:11 +02:00
parent c7b7b9514a
commit 3282e07422
29 changed files with 30 additions and 25 deletions

View File

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 262 KiB

After

Width:  |  Height:  |  Size: 262 KiB

View File

Before

Width:  |  Height:  |  Size: 645 KiB

After

Width:  |  Height:  |  Size: 645 KiB

View File

Before

Width:  |  Height:  |  Size: 599 KiB

After

Width:  |  Height:  |  Size: 599 KiB

View File

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -1094,12 +1094,25 @@ dkd_end = datetime.datetime.strptime(f'2/5/{t.year}', '%d/%m/%Y')
def IS_DKD():
return SITE_NAME == 'rDrama' and dkd_begin < datetime.datetime.now() < dkd_end
if SITE_NAME == 'rDrama':
birthgay_begin = datetime.datetime.strptime(f'20/5/{t.year}', '%d/%m/%Y')
birthgay_end = datetime.datetime.strptime(f'23/5/{t.year}', '%d/%m/%Y')
else:
birthgay_begin = datetime.datetime.strptime(f'26/4/{t.year}', '%d/%m/%Y')
birthgay_end = datetime.datetime.strptime(f'29/5/{t.year}', '%d/%m/%Y')
birthgay_begin = datetime.datetime.strptime(f'20/5/{t.year}', '%d/%m/%Y')
birthgay_end = datetime.datetime.strptime(f'23/5/{t.year}', '%d/%m/%Y')
def IS_BIRTHGAY():
return birthgay_begin < datetime.datetime.now() < birthgay_end
return SITE_NAME == 'rDrama' and birthgay_begin < datetime.datetime.now() < birthgay_end
birthdead_begin = datetime.datetime.strptime(f'26/4/{t.year}', '%d/%m/%Y')
birthdead_end = datetime.datetime.strptime(f'29/5/{t.year}', '%d/%m/%Y')
def IS_BIRTHDEAD():
return SITE_NAME == 'WPD' and birthdead_begin < datetime.datetime.now() < birthdead_end
def IS_EVENT():
if IS_FISTMAS():
return "fistmas"
elif IS_HOMOWEEN():
return "homoween"
elif IS_DKD():
return "DKD"
elif IS_BIRTHGAY():
return "birthgay"
elif IS_BIRTHDEAD():
return "birthdead"
return None

View File

@ -137,5 +137,5 @@ def inject_constants():
"git_head":git_head, "max_days":max_days, "EMOJI_KINDS":EMOJI_KINDS,
"BIO_FRIENDS_ENEMIES_LENGTH_LIMIT":BIO_FRIENDS_ENEMIES_LENGTH_LIMIT,
"IMMUNE_TO_AWARDS": IMMUNE_TO_AWARDS, "SITE_FULL_IMAGES": SITE_FULL_IMAGES,
"IS_FISTMAS":IS_FISTMAS, "IS_HOMOWEEN":IS_HOMOWEEN, "IS_DKD":IS_DKD, "IS_BIRTHGAY":IS_BIRTHGAY,
"IS_FISTMAS":IS_FISTMAS, "IS_HOMOWEEN":IS_HOMOWEEN, "IS_DKD":IS_DKD, "IS_EVENT":IS_EVENT,
}

View File

@ -88,7 +88,7 @@ def vote_post_comment(target_id, new, v, cls, vote_cls):
if SITE_NAME == 'WPD':
coin_mult *= 2
if IS_FISTMAS() or IS_HOMOWEEN() or IS_DKD() or IS_BIRTHGAY():
if IS_EVENT():
coin_mult *= 2
coin_value = coin_delta * coin_mult

View File

@ -7,16 +7,14 @@
{% if IS_FISTMAS() and not sub %}
{% include 'events/fistmas/banner.html' %}
{% else %}
{% if IS_BIRTHGAY() and not sub %}
{% set src = macros.random_image("assets/events/birthgay/images/banners/" ~ SITE_NAME) %}
{% elif IS_DKD() and not sub %}
{% set src = macros.random_image("assets/events/DKD/images/banners") %}
{% elif err and SITE_NAME == 'rDrama' %}
{% if err and SITE_NAME == 'rDrama' %}
{% set src = "banner_error.webp" | asset_siteimg %}
{% elif sub and sub.has_banners %}
{% set src = sub.random_banner() %}
{% set alt = ['/h/', sub, 'banner']|join %}
{% set class = 'site-banner-hole' %}
{% elif IS_EVENT() %}
{% set src = macros.random_image("assets/events/" ~ IS_EVENT() ~ "/images/banners") %}
{% elif SITE_NAME == "rDrama" %}
{% set href = "https://secure.transequality.org/site/Donation2?df_id=1480" %}
{% set expand = false %}

View File

@ -6,8 +6,8 @@
</h5>
</a>
{%- if IS_BIRTHGAY() -%}
{% set image = macros.random_image("assets/events/birthgay/images/sidebar/" ~ SITE_NAME) %}
{% if IS_EVENT() %}
{% set image = macros.random_image("assets/events/" ~ IS_EVENT() ~ "/images/sidebar") %}
{%- elif v -%}
{%- set image = macros.random_image("assets/images/" ~ SITE_NAME ~ "/sidebar") -%}
{%- else -%}

View File

@ -8,12 +8,8 @@
{% if sub %}
{% set image=sub.sidebar_url %}
{% elif IS_BIRTHGAY() %}
{% set image = macros.random_image("assets/events/birthgay/images/sidebar/" ~ SITE_NAME) %}
{% elif IS_DKD() %}
{% set image = macros.random_image("assets/events/DKD/images/sidebar") %}
{% elif IS_FISTMAS() %}
{% set image = macros.random_image("assets/events/fistmas/images/sidebar") %}
{% elif IS_EVENT() %}
{% set image = macros.random_image("assets/events/" ~ IS_EVENT() ~ "/images/sidebar") %}
{% else %}
{% set image = macros.random_image("assets/images/" ~ SITE_NAME ~ "/sidebar") %}
{% endif %}

View File

@ -64,8 +64,6 @@
{% if IS_DKD() %}
{% set favicon_url = macros.random_image('assets/events/DKD/images/favicon') %}
{% elif IS_FISTMAS() %}
{% set favicon_url = macros.random_image('assets/events/fistmas/images/favicon/' ~ SITE_NAME) %}
{% else %}
{% set favicon_url = '/icon.webp?x=2' %}
{% endif %}