diff --git a/ext/bg/background.html b/ext/bg/background.html index 4410c249..4a2d8c8d 100644 --- a/ext/bg/background.html +++ b/ext/bg/background.html @@ -8,7 +8,7 @@ - + diff --git a/ext/bg/search.html b/ext/bg/search.html index 4c07ee61..0fc3caf7 100644 --- a/ext/bg/search.html +++ b/ext/bg/search.html @@ -34,7 +34,7 @@ - + diff --git a/ext/fg/frame.html b/ext/fg/frame.html index c20745af..ecaee323 100644 --- a/ext/fg/frame.html +++ b/ext/fg/frame.html @@ -33,7 +33,7 @@ - + diff --git a/ext/mixed/js/util.js b/ext/mixed/js/audio.js similarity index 92% rename from ext/mixed/js/util.js rename to ext/mixed/js/audio.js index 0a8c914d..451fe1d9 100644 --- a/ext/mixed/js/util.js +++ b/ext/mixed/js/audio.js @@ -17,25 +17,6 @@ */ -/* - * 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 */ diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index da0cd351..e54bc0f9 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -80,7 +80,7 @@ class Display { if (context) { for (const definition of definitions) { if (context.sentence) { - definition.cloze = clozeBuild(context.sentence, definition.source); + definition.cloze = Display.clozeBuild(context.sentence, definition.source); } definition.url = context.url; @@ -119,7 +119,7 @@ class Display { if (context) { for (const definition of definitions) { if (context.sentence) { - definition.cloze = clozeBuild(context.sentence); + definition.cloze = Display.clozeBuild(context.sentence); } definition.url = context.url; @@ -394,6 +394,20 @@ class Display { }).catch(this.handleError.bind(this)).then(() => this.spinner.hide()); } + static 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; + } + static entryIndexFind(element) { return $('.entry').index(element.closest('.entry')); }