This commit is contained in:
Alex Yatskov 2016-09-12 22:14:58 -07:00
parent 4241b4f859
commit 540d0e239c
2 changed files with 14 additions and 12 deletions

View File

@ -17,6 +17,19 @@
*/
function kanjiLinks(options) {
let result = '';
for (const c of options.fn(this)) {
if (isKanji(c)) {
result += Handlebars.templates['kanji-link.html']({kanji: c}).trim();
} else {
result += c;
}
}
return result;
}
function loadJson(url) {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();

View File

@ -20,18 +20,7 @@
class Yomichan {
constructor() {
Handlebars.partials = Handlebars.templates;
Handlebars.registerHelper('kanjiLinks', function(options) {
let result = '';
for (const c of options.fn(this)) {
if (isKanji(c)) {
result += Handlebars.templates['kanji-link.html']({kanji: c}).trim();
} else {
result += c;
}
}
return result;
});
Handlebars.registerHelper('kanjiLinks', kanjiLinks);
this.translator = new Translator();
this.asyncPools = {};