Skip to content

Commit 31fe997

Browse files
committed
特殊常见标点区显示code
1 parent 62ef5a8 commit 31fe997

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

checkessay.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ function show_check_results(only_unusual = false)
5959
<rt></rt>
6060
</ruby>
6161
`);
62+
63+
var div_comments_above_char = div_essayChar.q(".div_comments_above_char");
64+
if ( charObj.cInfo.showCode == true )
65+
{
66+
var codeDiv = htmlStr2dom(`
67+
<div class="a_comment_above_char" >
68+
<span class="span_a_comment_above_char" id="code" ">${charObj.cInfo.hex}</span>
69+
</div>
70+
`);
71+
div_comments_above_char.insertBefore(codeDiv, div_comments_above_char.firstChild);
72+
}
73+
6274
var div_origChar_n_aboveText = div_essayChar.q(".div_origChar_n_aboveText");
6375
var div_origChar = div_essayChar.q(".div_orig_char");
6476
var ruby_rt = div_essayChar.q("rt");
@@ -275,10 +287,12 @@ function getCInfo(c)
275287
hex: c2utf16(c).hex,
276288
blk: undefined,
277289
unusuals: undefined,
290+
showCode: undefined,
278291
}
279292
cInfo.blk = getCpBlock(cInfo.hex);
280293
cInfo.unusuals = getCharUnusuals(c, cInfo);
281-
294+
cInfo.showCode = getIfShowCode(c, cInfo);
295+
282296
charsCInfoCache [c] = cInfo;
283297
}
284298
return charsCInfoCache [c];

unusual_conditions.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,16 @@ function getCharUnusuals(c, cInfo)
145145

146146
return result;
147147
}
148-
148+
function getIfShowCode(c, cInfo)
149+
{
150+
const blks = [
151+
"General Punctuation",
152+
"Halfwidth and Fullwidth Forms",
153+
"Latin-1 Supplement",
154+
];
155+
if ( blks.includes(cInfo.blk) )
156+
return true;
157+
}
149158

150159
unusual_cond['is_jp'].func = function(c, mapObj, cInfo) {
151160
return ( mapObj !== undefined

0 commit comments

Comments
 (0)