move style out of root to minimize html redrawing and improve maintainability

pull/29/head
justcool393 2022-11-28 10:55:16 -06:00
parent fc7069ca57
commit a2477864a3
2 changed files with 14 additions and 15 deletions

View File

@ -23,20 +23,5 @@
</head>
<body {% block body_attributes %}id="{%block pagetype %}{% endblock %}"{% endblock %}>
{% block body required %}{% endblock %}
<style>
body {
{% if SITE_NAME == 'rDrama' and (not v or v.is_banned or v.agendaposter) %}
background:url(/assets/images/backgrounds/glitter/1.webp?v=3) center center fixed;
background-color: var(--background);
background-size: cover;
{% elif v and v.background %}
background:url(/assets/images/backgrounds/{{v.background}}?v=3) center center fixed;
background-color: var(--background);
{% if 'anime' not in v.background %}
background-size: cover;
{% endif %}
{% endif %}
}
</style>
</body>
</html>

View File

@ -107,6 +107,20 @@
{% macro stylesheets(include_user_css) %}
<link rel="stylesheet" href="{{'css/main.css' | asset}}">
<link id="favicon" rel="icon" type="image/webp" href="{{'icon.webp' | asset_siteimg}}">
{% if SITE_NAME == 'rDrama' and (not v or v.is_banned or v.agendaposter) %}
{% set background = '/assets/images/backgrounds/glitter/1.webp?v=3' %}
{% elif v and v.background %}
{% set background = v.background %}
{% endif %}
<style>
body {
background:url({{background}}) center center fixed;
background-color: var(--background);
{% if 'anime' not in background %}background-size: cover;{% endif %}
}
</style>
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
{% if v.agendaposter %}