From b2f13c600f1369bbe82f869d8149b277dc90bde1 Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Tue, 18 Jun 2024 07:34:57 -0500 Subject: [PATCH] Bolding and Italics on highlights --- constants.json | 5 +++++ pageUpdater.js | 15 ++++++++++++++- static/style.css | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/constants.json b/constants.json index 1fe2312..3370540 100644 --- a/constants.json +++ b/constants.json @@ -168,6 +168,11 @@ "Teto": { "color": "rgb(255, 100, 100)", "caseInsensitive": true + }, + "Ryouiki Tenkai": { + "bold": true, + "italicized": true, + "caseInsensitive": true } } } \ No newline at end of file diff --git a/pageUpdater.js b/pageUpdater.js index ac1604f..754967a 100644 --- a/pageUpdater.js +++ b/pageUpdater.js @@ -175,16 +175,29 @@ function converter(html) { var startContent = element.content.substring(spanStart - 1, termIndex) var style = termProps.style || "" + var classes = termProps.classes || "" if (termProps.color) { style += `color: ${termProps.color};` } + if (termProps.italicized) { + style += "font-style: italic;" + } + + if (termProps.bold) { + classes += "bold" + } + if (style.length > 2) { style = `style="${style}"` } - var replacement = `${startContent + highTable[index] + endContent}` + if (classes.length > 2) { + classes = `class="${classes}"` + } + + var replacement = `${startContent + highTable[index] + endContent}` element.content = element.content.substring(0, spanStart) + replacement + element.content.substring(spanEnd) } diff --git a/static/style.css b/static/style.css index b56c785..ddc5f4e 100644 --- a/static/style.css +++ b/static/style.css @@ -328,7 +328,7 @@ em, b, s { color: inherit; } -b, b > *, .activityTitle, .activityTitle > * { +b, b > *, .activityTitle, .activityTitle > *, .bold { font-family: "RubikBold", Verdana, Geneva, Tahoma, sans-serif; }