From 74fd48a0f2b3ac81207a39606e9db9500caae8dc Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 4 Jan 2024 14:07:52 +0000 Subject: [PATCH] [theme] add data-userclass to body tag --- core/basepage.php | 8 +++++++- themes/default/style.css | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/basepage.php b/core/basepage.php index e991a6ff..a4d57157 100644 --- a/core/basepage.php +++ b/core/basepage.php @@ -532,15 +532,21 @@ class BasePage */ public function render() { + global $config, $user; + $head = $this->head_html(); $body = $this->body_html(); + $body_attrs = [ + "data-userclass" => $user->class->name, + ]; + print emptyHTML( rawHTML(""), HTML( ["lang" => "en"], HEAD(rawHTML($head)), - BODY(rawHTML($body)) + BODY($body_attrs, rawHTML($body)) ) ); } diff --git a/themes/default/style.css b/themes/default/style.css index 6df2cdd5..25e0ceb1 100644 --- a/themes/default/style.css +++ b/themes/default/style.css @@ -217,3 +217,10 @@ ARTICLE TABLE { border-radius: 12px; box-shadow: 2px 2px 6px rgba(0,0,0,0.6); } + +// example of how to apply specific styles to specific thumbs for specific userclasses +/* +BODY[data-userclass="anonymous"] .thumb[data-rating="e"] IMG { + filter: blur(5px); +} +*/