diff options
author | cyfraeviolae <cyfraeviolae> | 2022-03-16 01:31:03 -0400 |
---|---|---|
committer | cyfraeviolae <cyfraeviolae> | 2022-03-16 01:31:08 -0400 |
commit | adeb3cf6b338d81e8ba4ca8b5ce8a444f5a7d997 (patch) | |
tree | 5712fec3a2b6cf6e377e65e8853fc5c8e15dcac4 /static/script.js | |
parent | 637416d88114ded93ba8403ac9537c61ac748065 (diff) |
more poems
Diffstat (limited to 'static/script.js')
-rw-r--r-- | static/script.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/static/script.js b/static/script.js index 0de93ad..70c17d1 100644 --- a/static/script.js +++ b/static/script.js @@ -34,7 +34,14 @@ function renderWord(word, wordIdx, guess, score, offset) { var typ = guess ? 'solbox' : 'entrybox' els.push(`<div data-word="${wordIdx}" data-word-offset="${c}" data-offset="${c+offset}" class="box ${typ} ${charclass}">${val}</div>`) } - var scansion = renderScansion(challenge.scansion[wordIdx]) + + if (typeof challenge.scansion === "string") { + var fullScansion = challenge.scansion.split(' ') + } else { + var fullScansion = challenge.scansion + } + + var scansion = renderScansion(fullScansion[wordIdx]) var scansionBox = guess ? '' : `<div class="scansion-box"><span class="scansion">${scansion}</span></div>` return `<div class="word">${scansionBox}${els.join('')}</div>` } |