diff options
Diffstat (limited to 'ext/bg/js/util.js')
-rw-r--r-- | ext/bg/js/util.js | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index 0a4592ea..6e86c2a6 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -98,44 +98,3 @@ function jsonRequest(url, action, params) { } }); } - -/* - * Helpers - */ - -function handlebarsEscape(text) { - return Handlebars.Utils.escapeExpression(text); -} - -function handlebarsDumpObject(options) { - const dump = JSON.stringify(options.fn(this), null, 4); - return handlebarsEscape(dump); -} - -function handlebarsKanjiLinks(options) { - let result = ''; - for (const c of options.fn(this)) { - if (jpIsKanji(c)) { - result += `<a href="#" class="kanji-link">${c}</a>`; - } else { - result += c; - } - } - - return result; -} - -function handlebarsMultiLine(options) { - return options.fn(this).split('\n').join('<br>'); -} - -function handlebarsRegister() { - Handlebars.partials = Handlebars.templates; - Handlebars.registerHelper('dumpObject', handlebarsDumpObject); - Handlebars.registerHelper('kanjiLinks', handlebarsKanjiLinks); - Handlebars.registerHelper('multiLine', handlebarsMultiLine); -} - -function handlebarsRender(template, data) { - return Handlebars.templates[template](data); -} |