aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed/js/util.js')
-rw-r--r--ext/mixed/js/util.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/ext/mixed/js/util.js b/ext/mixed/js/util.js
index edd49873..62838674 100644
--- a/ext/mixed/js/util.js
+++ b/ext/mixed/js/util.js
@@ -18,6 +18,25 @@
/*
+ * Cloze
+ */
+
+function clozeBuild(sentence, source) {
+ const result = {
+ sentence: sentence.text.trim()
+ };
+
+ if (source) {
+ result.prefix = sentence.text.substring(0, sentence.offset).trim();
+ result.body = source.trim();
+ result.suffix = sentence.text.substring(sentence.offset + source.length).trim();
+ }
+
+ return result;
+}
+
+
+/*
* Audio
*/
@@ -103,6 +122,10 @@ function audioBuildFilename(definition) {
}
function audioInject(definition, fields, mode) {
+ if (mode === 'disabled') {
+ return Promise.resolve(true);
+ }
+
const filename = audioBuildFilename(definition);
if (!filename) {
return Promise.resolve(true);