summaryrefslogtreecommitdiff
path: root/ext/util.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-03-27 18:24:04 -0700
committerAlex Yatskov <alex@foosoft.net>2016-03-27 18:24:04 -0700
commit2bdb5763780e68889b355200a60844da83d3ede7 (patch)
tree11138675c85db464b91446a3e5e1f2b74e9d9153 /ext/util.js
parent70faa9e87f742b5a883762c8f40b3e4a5a3f3609 (diff)
Better output
Diffstat (limited to 'ext/util.js')
-rw-r--r--ext/util.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/util.js b/ext/util.js
index 76579cac..cd71e873 100644
--- a/ext/util.js
+++ b/ext/util.js
@@ -68,3 +68,23 @@ function getPopupPositionForRange(popup, range, offset) {
return {x: posX, y: posY};
}
+
+function renderDefs(terms) {
+ const outputs = [];
+ for (let term of terms) {
+ outputs.push(renderDef(term));
+ }
+
+ return outputs.join('');
+}
+
+function renderDef(term) {
+ return `
+<div class="yomichan-def">
+ <span class="yomichan-def-expression">${term.expression}</span>
+ <span class="yomichan-def-rules">${term.rules.join('&nbsp;&lt;&nbsp;')}</span>
+ <span class="yomichan-def-reading">${term.reading}</span>
+ <span class="yomichan-def-glossary">${term.glossary}</span>
+</div>
+`;
+}