From 0fd14132fff1f611933db9d27e60ff80051e1458 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Sat, 24 Dec 2022 19:49:23 -0800 Subject: [PATCH] Format challenge #91 --- content/challenges/91.md | 12 ++++++++++++ .../tegakituesday.com/layouts/challenges/single.html | 9 +++++++++ themes/tegakituesday.com/static/js/toggle.js | 8 +++++--- 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 content/challenges/91.md diff --git a/content/challenges/91.md b/content/challenges/91.md new file mode 100644 index 0000000..b43bc98 --- /dev/null +++ b/content/challenges/91.md @@ -0,0 +1,12 @@ +--- +override: "(せん)" +date: 2022-12-24 +--- + +

:snowflake: Special Christmas challenge! :snowflake:

+ +2022 Kanji of the Year is [戦]{せん}. Write it in any style you like. + +{{< youtube b3qVwsfOEMc >}} + +*This challenge was suggested by **zoop** using the `-h suggest` command.* diff --git a/themes/tegakituesday.com/layouts/challenges/single.html b/themes/tegakituesday.com/layouts/challenges/single.html index 21752e0..fb4fb63 100644 --- a/themes/tegakituesday.com/layouts/challenges/single.html +++ b/themes/tegakituesday.com/layouts/challenges/single.html @@ -11,8 +11,10 @@ {{- partial "nav.html" . -}}
+{{ if not .Params.override }} +{{ end }} {{ if .Params.english }} @@ -22,6 +24,12 @@

Tegaki Tuesday #{{- $current -}}

()()きの()(よう)()#{{- $current -}}・ +{{ if .Params.override }} +
+ {{ .Params.override | safeHTML }} +
+{{ else }} + {{ if .Params.english }} +{{ end }}
diff --git a/themes/tegakituesday.com/static/js/toggle.js b/themes/tegakituesday.com/static/js/toggle.js index a988f02..5cbdfbf 100644 --- a/themes/tegakituesday.com/static/js/toggle.js +++ b/themes/tegakituesday.com/static/js/toggle.js @@ -7,9 +7,11 @@ const defaultHeight = challenge.scrollHeight + "px"; let verticalHeight; challenge.style.height = defaultHeight; +let texts = []; const vocab = document.getElementById("challenge-vocab"); +if (vocab) texts.push(vocab); const kanji = document.getElementById("challenge-kanji"); -const texts = [vocab, kanji]; +if (kanji) texts.push(kanji); const rubies = document.getElementsByTagName("ruby"); let kyujitaiConvertable = []; @@ -24,8 +26,8 @@ for (let i = 0; i < rubies.length; i++) { } ruby.shinjitai = pair[0]; ruby.kyujitai = pair[1]; - const encodedURIComponent = encodeURIComponent(pair[0]).toLowerCase(); - if (ruby.parentNode.nodeName === "A" && ruby.parentNode.href.includes(encodedURIComponent) && ruby.parentNode.href.endsWith("%23kanji")) { + const encodedURIComponent = encodeURIComponent(pair[0]); + if (ruby.parentNode.nodeName === "A" && ruby.parentNode.href.toUpperCase().includes(encodedURIComponent) && ruby.parentNode.href.endsWith("%23kanji")) { ruby.parentNode.shinjitaiHref = ruby.parentNode.href; ruby.parentNode.kyujitaiHref = ruby.parentNode.href.replace(encodedURIComponent, encodeURIComponent(pair[1])); kyujitaiConvertableLinks.push(ruby.parentNode);