summaryrefslogtreecommitdiff
path: root/ext/bg/js/util.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-07-19 09:24:38 -0700
committerAlex Yatskov <alex@foosoft.net>2017-07-19 09:24:38 -0700
commit62db3d74b8042dd3185a7a552920a2ce7a4bd4ab (patch)
tree4af9f620908f679d1c75695a80a256f22a85b22d /ext/bg/js/util.js
parent26e1cc517f6100fe665d8d066729a11fde2cdc26 (diff)
factor out handlebars from util
Diffstat (limited to 'ext/bg/js/util.js')
-rw-r--r--ext/bg/js/util.js41
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);
-}