diff options
Diffstat (limited to 'anki-card-template')
-rw-r--r-- | anki-card-template/card.css | 19 | ||||
-rw-r--r-- | anki-card-template/card.js | 6 |
2 files changed, 14 insertions, 11 deletions
diff --git a/anki-card-template/card.css b/anki-card-template/card.css index 0f76b82..35c99ec 100644 --- a/anki-card-template/card.css +++ b/anki-card-template/card.css @@ -184,17 +184,20 @@ body { .mobile #card.vertical-layout #back #target-word-reading .reading .syllable { white-space: nowrap; } /* word note style */ -#card #target-word-reading { - display: inline-block; - position: relative; -} -.mobile #card #target-word-reading .note { left: 0.5em; } +#card #target-word-reading .kanji { position: relative; } #card #target-word-reading .note { position: absolute; - left: 1em; - top: 50%; - transform: translate(-100%, -50%); font-style: italic; opacity: 50%; font-size: 0.75em; } +#card #target-word-reading .note { + left: -0.25em; + top: 50%; + transform: translate(-100%, -50%); +} +.mobile #card.vertical-layout #target-word-reading .note { + top: -0.25em; + left: 50%; + transform: translate(-50%, -100%); +} diff --git a/anki-card-template/card.js b/anki-card-template/card.js index 7e44b2e..18c8cb9 100644 --- a/anki-card-template/card.js +++ b/anki-card-template/card.js @@ -55,6 +55,9 @@ HTMLElement.prototype.parse = function() { if (this.classList.contains("parse-brackets")) { if (i == 0) { + // start kanji reading + out += `<span class="kanji">`; + var match = input.match(/\((.+?)\)/); // display "(note)" before kanji if (match) { @@ -62,9 +65,6 @@ HTMLElement.prototype.parse = function() { note_head = match.index; note_tail = note_head + match[0].length; } - // start kanji reading - out += `<span class="kanji">`; - continue; } // ignore note if parsed if (i == note_head) { i += note_tail - 1; continue; } |