Format challenge #91
This commit is contained in:
parent
969a506cf1
commit
0fd14132ff
3 changed files with 26 additions and 3 deletions
12
content/challenges/91.md
Normal file
12
content/challenges/91.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
override: "<span style=\"text-align: center; display: block; font-size: 3em;\"><a target=\"_blank\" href=\"https://jisho.org/search/%E6%88%A6%23kanji\"><ruby>戦<rp>(</rp><rt>せん</rt><rp>)</rp></ruby></a></span>"
|
||||
date: 2022-12-24
|
||||
---
|
||||
|
||||
<p style="text-align: center"><strong>:snowflake: Special Christmas challenge! :snowflake:</strong></p>
|
||||
|
||||
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.*
|
|
@ -11,8 +11,10 @@
|
|||
{{- partial "nav.html" . -}}
|
||||
<div id="challenge">
|
||||
<div>
|
||||
{{ if not .Params.override }}
|
||||
<button id="direction" title="Text direction">↕</button>
|
||||
<button lang="ja" id="highlight" title="Vocab/kanji links">漢字</button>
|
||||
{{ end }}
|
||||
<button lang="ja" id="kyujitai" title="Shinjitai/kyujitai">旧字体</button>
|
||||
{{ if .Params.english }}
|
||||
<button id="english" title="Show/hide translation">Show translation</button>
|
||||
|
@ -22,6 +24,12 @@
|
|||
<h3>Tegaki Tuesday #{{- $current -}}</h3>
|
||||
<small><ruby>手<rp>(</rp><rt>て</rt><rp>)</rp></ruby><ruby>書<rp>(</rp><rt>が</rt><rp>)</rp></ruby>きの<ruby>火<rp>(</rp><rt>か</rt><rp>)</rp></ruby><ruby>曜<rp>(</rp><rt>よう</rt><rp>)</rp></ruby><ruby>日<rp>(</rp><rt>び</rt><rp>)</rp></ruby>#{{- $current -}}・<time datetime="{{- .Date.Format " 2006-01-02T15:04:05Z07:00" -}}">{{- .Date.Format "2006年01月02日" -}}</time></small>
|
||||
</header>
|
||||
{{ if .Params.override }}
|
||||
<div>
|
||||
{{ .Params.override | safeHTML }}
|
||||
</div>
|
||||
{{ else }}
|
||||
|
||||
{{ if .Params.english }}
|
||||
<div id="challenge-english" style="display: none">
|
||||
<!-- English view -->
|
||||
|
@ -101,6 +109,7 @@
|
|||
{{- end -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
<script src="/js/toggle.js"></script>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue