Replace DisplayGenerator._isCharacterKanji with jp.isCodePointKanji
This commit is contained in:
parent
77a2cc60e9
commit
70284c62ee
@ -43,6 +43,7 @@
|
|||||||
<script src="/mixed/js/core.js"></script>
|
<script src="/mixed/js/core.js"></script>
|
||||||
<script src="/mixed/js/dom.js"></script>
|
<script src="/mixed/js/dom.js"></script>
|
||||||
<script src="/mixed/js/api.js"></script>
|
<script src="/mixed/js/api.js"></script>
|
||||||
|
<script src="/mixed/js/japanese.js"></script>
|
||||||
|
|
||||||
<script src="/fg/js/document.js"></script>
|
<script src="/fg/js/document.js"></script>
|
||||||
<script src="/fg/js/source.js"></script>
|
<script src="/fg/js/source.js"></script>
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
/* global
|
/* global
|
||||||
* TemplateHandler
|
* TemplateHandler
|
||||||
* apiGetDisplayTemplatesHtml
|
* apiGetDisplayTemplatesHtml
|
||||||
|
* jp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class DisplayGenerator {
|
class DisplayGenerator {
|
||||||
@ -283,7 +284,7 @@ class DisplayGenerator {
|
|||||||
_appendKanjiLinks(container, text) {
|
_appendKanjiLinks(container, text) {
|
||||||
let part = '';
|
let part = '';
|
||||||
for (const c of text) {
|
for (const c of text) {
|
||||||
if (DisplayGenerator._isCharacterKanji(c)) {
|
if (jp.isCodePointKanji(c.codePointAt(0))) {
|
||||||
if (part.length > 0) {
|
if (part.length > 0) {
|
||||||
container.appendChild(document.createTextNode(part));
|
container.appendChild(document.createTextNode(part));
|
||||||
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=[]) {
|
static _appendMultiple(container, createItem, detailsArray, fallback=[]) {
|
||||||
if (container === null) { return 0; }
|
if (container === null) { return 0; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user