From 49da04ef4b3031458fae86a87a26d45da9bc1a6a Mon Sep 17 00:00:00 2001 From: suchmememanyskill <38142618+suchmememanyskill@users.noreply.github.com> Date: Tue, 19 Mar 2024 17:45:25 +0100 Subject: [PATCH] Also convert [class] in css --- css_inject.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/css_inject.py b/css_inject.py index 6d0b27a..61a9846 100644 --- a/css_inject.py +++ b/css_inject.py @@ -64,6 +64,14 @@ async def load(self) -> Result: if split_css[x].startswith(".") and split_css[x][1:] in CLASS_MAPPINGS: split_css[x] = "." + CLASS_MAPPINGS[split_css[x][1:]] + self.css = ("".join(split_css)).replace("\\", "\\\\").replace("`", "\\`") + + split_css = re.split(r"(\[class[*^|~]=\"[_a-zA-Z0-9-]*\"\])", self.css) + + for x in range(len(split_css)): + if split_css[x].startswith("[class") and split_css[x].endswith("\"]") and split_css[x][9:-2] in CLASS_MAPPINGS: + split_css[x] = split_css[x][0:9] + CLASS_MAPPINGS[split_css[x][9:-2]] + split_css[x][-2:] + self.css = ("".join(split_css)).replace("\\", "\\\\").replace("`", "\\`") Log(f"Loaded css at {self.cssPath}")