Add Thedish alphabet
authorLanius Trolling <lanius@laniustrolling.dev>
Thu, 15 Jun 2023 15:35:57 +0000 (11:35 -0400)
committerLanius Trolling <lanius@laniustrolling.dev>
Thu, 15 Jun 2023 15:35:57 +0000 (11:35 -0400)
src/main/kotlin/info/mechyrdia/data/views_comment.kt
src/main/kotlin/info/mechyrdia/lore/parser_tags.kt
src/main/resources/static/font/thedish-language-alphabet.woff [new file with mode: 0644]
src/main/resources/static/init.js
src/main/resources/static/style.css

index 904123f35fa44e4e7afadf66ab48240f74880555..5c6573ca179ebb3bd5c0429a6aebc1dcbc67605e 100644 (file)
@@ -482,7 +482,16 @@ suspend fun ApplicationCall.commentHelpPage(): HTML.() -> Unit = page("Commentin
                                        }
                                }
                                tr {
-                                       td { +"[lang=gothic]Gutiska Razda[/lang]" }
+                                       td { +"[lang=thedish]Theodisc Rasda[/lang]" }
+                                       td {
+                                               +"Writes text in the Thedish alphabet: "
+                                               span(classes = "lang-thedish") {
+                                                       +"Theodisc Rasda"
+                                               }
+                                       }
+                               }
+                               tr {
+                                       td { +"[lang=gothic]\uD800\uDF32\uD800\uDF3F\uD800\uDF44\uD800\uDF39\uD800\uDF43\uD800\uDF3A\uD800\uDF30 \uD800\uDF42\uD800\uDF30\uD800\uDF36\uD800\uDF33\uD800\uDF30[/lang]" }
                                        td {
                                                +"Writes text in the Gothic alphabet: "
                                                span(classes = "lang-gothic") {
index ac9e1391bbb31999456d0edcdae412f2fb713976..8aaef54badfe525897b74054378e1f9e39cca20a 100644 (file)
@@ -273,8 +273,10 @@ enum class TextParserFormattingTag(val type: TextParserTagType<Unit>) {
                                val tylan = TylanAlphabet.tylanToFontAlphabet(uncensored)
                                val recensored = TextParserState.censorText(tylan)
                                "<span class=\"lang-tylan\">$recensored</span>"
-                       } else if (tagParam != null)
-                               "<span class=\"lang-${sanitizeLink(tagParam)}\">$content</span>"
+                       } else if (tagParam?.equals("thedish", ignoreCase = true) == true)
+                               "<span class=\"lang-thedish\">$content</span>"
+                       else if (tagParam?.equals("gothic", ignoreCase = true) == true)
+                               "<span class=\"lang-gothic\">$content</span>"
                        else content
                }
        ),
@@ -288,7 +290,16 @@ enum class TextParserFormattingTag(val type: TextParserTagType<Unit>) {
                                        |<p>Tylan Alphabet:</p>
                                        |<textarea class="output-box lang-tylan" readonly></textarea>
                                        |</div>
-                                       """.trimMargin()
+                               """.trimMargin()
+                       } else if (content.equals("thedish", ignoreCase = true)) {
+                               """
+                                       |<div class="thedish-alphabet-box">
+                                       |<p>Latin Alphabet:</p>
+                                       |<textarea class="input-box" spellcheck="false"></textarea>
+                                       |<p>Thedish Alphabet:</p>
+                                       |<textarea class="output-box lang-thedish" readonly></textarea>
+                                       |</div>
+                               """.trimMargin()
                        } else content
                }
        ),
diff --git a/src/main/resources/static/font/thedish-language-alphabet.woff b/src/main/resources/static/font/thedish-language-alphabet.woff
new file mode 100644 (file)
index 0000000..c1100f0
Binary files /dev/null and b/src/main/resources/static/font/thedish-language-alphabet.woff differ
index 0e5707b13b33948908f07e42353ae48a6bcfce25..1f4890bda2e9ee92dd5a95986ee1aeba201c8a10 100644 (file)
                }
        });
 
+       window.addEventListener("load", function () {
+               // Thedish alphabet
+               const thedishAlphabetBoxes = document.getElementsByClassName("thedish-alphabet-box");
+               for (const thedishAlphabetBox of thedishAlphabetBoxes) {
+                       const inputBox = thedishAlphabetBox.getElementsByClassName("input-box")[0];
+                       const outputBox = thedishAlphabetBox.getElementsByClassName("output-box")[0];
+
+                       inputBox.addEventListener("input", () => {
+                               outputBox.value = inputBox.value;
+                       });
+               }
+       });
+
        window.addEventListener("load", function () {
                // Preview themes
                const themeChoices = document.getElementsByName("theme");
index b2d1d207f26806c225ad70e0ef1d8ddfa2046a91..7452f27639881222aeb466e99c73d075e37f76a0 100644 (file)
@@ -864,6 +864,10 @@ iframe {
        text-align: center;
 }
 
+.lang-gothic {
+       font-family: 'Noto Sans Gothic', sans-serif;
+}
+
 @font-face {
        font-family: 'Tulasra';
        src: url(/static/font/tylan-language-alphabet-3.woff) format('woff');
@@ -882,8 +886,22 @@ textarea.lang-tylan {
        line-height: 1.0;
 }
 
-.lang-gothic {
-       font-family: 'Noto Sans Gothic', sans-serif;
+@font-face {
+       font-family: 'Theodisc';
+       src: url(/static/font/thedish-language-alphabet.woff) format('woff');
+}
+
+.lang-thedish {
+       font-family: Theodisc, monospace;
+       font-size: 1.25em;
+       line-height: 1.0;
+       font-variant: normal !important;
+}
+
+textarea.lang-thedish {
+       font-family: Theodisc, monospace;
+       font-size: 2.5em;
+       line-height: 1.0;
 }
 
 #thumb-view {