summaryrefslogtreecommitdiff
path: root/static/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/script.js')
-rw-r--r--static/script.js9
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>`
}