diff options
author | siikamiika <siikamiika@users.noreply.github.com> | 2017-10-19 19:27:28 +0300 |
---|---|---|
committer | siikamiika <siikamiika@users.noreply.github.com> | 2017-10-19 19:27:28 +0300 |
commit | bc92327d86201b0c36cf910052ab82da7c47ff9f (patch) | |
tree | 4de0271f8fbd2d8573975a8ff243026f7df48ec5 /ext/bg/js/handlebars.js | |
parent | f54f909701453bac563c9cb5ec75fde23e087e8e (diff) |
Anki: term frequency colors in merged mode
Diffstat (limited to 'ext/bg/js/handlebars.js')
-rw-r--r-- | ext/bg/js/handlebars.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/bg/js/handlebars.js b/ext/bg/js/handlebars.js index 66d5fa2b..72908cab 100644 --- a/ext/bg/js/handlebars.js +++ b/ext/bg/js/handlebars.js @@ -75,6 +75,18 @@ function handlebarsMultiLine(options) { return options.fn(this).split('\n').join('<br>'); } +function handlebarsTermFrequencyColor(options) { + const termFrequency = options.fn(this); + + if (termFrequency === 'popular') { + return '#0275d8'; + } else if (termFrequency === 'rare') { + return '#999'; + } else { + return 'inherit'; + } +} + function handlebarsRegisterHelpers() { if (Handlebars.partials !== Handlebars.templates) { Handlebars.partials = Handlebars.templates; @@ -83,6 +95,7 @@ function handlebarsRegisterHelpers() { Handlebars.registerHelper('furiganaPlain', handlebarsFuriganaPlain); Handlebars.registerHelper('kanjiLinks', handlebarsKanjiLinks); Handlebars.registerHelper('multiLine', handlebarsMultiLine); + Handlebars.registerHelper('termFrequencyColor', handlebarsTermFrequencyColor); } } |