Cleanup
This commit is contained in:
parent
4241b4f859
commit
540d0e239c
@ -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) {
|
function loadJson(url) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
|
@ -20,18 +20,7 @@
|
|||||||
class Yomichan {
|
class Yomichan {
|
||||||
constructor() {
|
constructor() {
|
||||||
Handlebars.partials = Handlebars.templates;
|
Handlebars.partials = Handlebars.templates;
|
||||||
Handlebars.registerHelper('kanjiLinks', function(options) {
|
Handlebars.registerHelper('kanjiLinks', kanjiLinks);
|
||||||
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;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.translator = new Translator();
|
this.translator = new Translator();
|
||||||
this.asyncPools = {};
|
this.asyncPools = {};
|
||||||
|
Loading…
Reference in New Issue
Block a user