summaryrefslogtreecommitdiff
path: root/ext/bg/js/yomichan.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-04-17 19:06:57 -0700
committerAlex Yatskov <alex@foosoft.net>2016-04-17 19:06:57 -0700
commitd5170414af9287143a9906fd81fde49318be4617 (patch)
tree27764bde977e1e17c36543f3f53d1b29b0584f74 /ext/bg/js/yomichan.js
parentde268e73a613b963ea982f34ca7439d57694facd (diff)
Adding kanji links
Diffstat (limited to 'ext/bg/js/yomichan.js')
-rw-r--r--ext/bg/js/yomichan.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js
index a66c1244..11d71ae1 100644
--- a/ext/bg/js/yomichan.js
+++ b/ext/bg/js/yomichan.js
@@ -20,6 +20,18 @@
class Yomichan {
constructor() {
Handlebars.partials = Handlebars.templates;
+ Handlebars.registerHelper('kanjiLinks', function(options) {
+ let result = '';
+ for (const c of options.fn(this)) {
+ if (Translator.isKanji(c)) {
+ result += `<a href="#">${c}</a>`;
+ } else {
+ result += c;
+ }
+ }
+
+ return result;
+ });
this.translator = new Translator();
this.updateState('disabled');