summaryrefslogtreecommitdiff
path: root/ext/mixed/js/display-generator.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-03-27 22:53:45 -0400
committerGitHub <noreply@github.com>2020-03-27 22:53:45 -0400
commita0c4ce779d35cab39c62ca42ad3fe58a82faa1bb (patch)
treecd5cdae9d1a7aa48c11668a30758c72e4decedc7 /ext/mixed/js/display-generator.js
parent08d38d8db2c97ff9f016a6de640f645b609088d1 (diff)
parent780d23b749325da0a95aa9cc7898df19f2ac1b31 (diff)
Merge pull request #413 from toasted-nutbread/japanese-utility
Convert Japanese utilities to a module-like style
Diffstat (limited to 'ext/mixed/js/display-generator.js')
-rw-r--r--ext/mixed/js/display-generator.js11
1 files changed, 2 insertions, 9 deletions
diff --git a/ext/mixed/js/display-generator.js b/ext/mixed/js/display-generator.js
index 49afc44b..41f7315a 100644
--- a/ext/mixed/js/display-generator.js
+++ b/ext/mixed/js/display-generator.js
@@ -19,6 +19,7 @@
/* global
* TemplateHandler
* apiGetDisplayTemplatesHtml
+ * jp
*/
class DisplayGenerator {
@@ -283,7 +284,7 @@ class DisplayGenerator {
_appendKanjiLinks(container, text) {
let part = '';
for (const c of text) {
- if (DisplayGenerator._isCharacterKanji(c)) {
+ if (jp.isCodePointKanji(c.codePointAt(0))) {
if (part.length > 0) {
container.appendChild(document.createTextNode(part));
part = '';
@@ -300,14 +301,6 @@ class DisplayGenerator {
}
}
- static _isCharacterKanji(c) {
- const code = c.codePointAt(0);
- return (
- code >= 0x4e00 && code < 0x9fb0 ||
- code >= 0x3400 && code < 0x4dc0
- );
- }
-
static _appendMultiple(container, createItem, detailsArray, fallback=[]) {
if (container === null) { return 0; }