-
Notifications
You must be signed in to change notification settings - Fork 0
/
myscript-common.js
542 lines (460 loc) · 35.9 KB
/
myscript-common.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
///////////////////////////////////
function r12345_showChar__src(s) {
const id = encodeURIComponent(s).replace(/%/g,'')
return 'http://www.r12345.com/datafile/zy/'+id.substr(5)+'/'+id+'.png'
}
const r12345_chars = '一丁七万丈三上下不与丐丑专且丕世丘丙业丛东丝丞丢两严丧个丫中丰串临丸丹为主丽举乃久么义之乌乍乎乏乐乒乓乔乖乘乙乜九乞也习乡书买乱乳乾了予争事二于亏云互五井亘亚些亟亡亢交亥亦产亨亩享京亭亮亲亵人亿什仁仃仄仅仆仇今介仍从仑仓仔仕他仗付仙仞仟代令以仪们仰仲件价任份仿企伉伊伍伎伏伐休众优伙会伞伟传伢伤伥伦伧伪伫伯估伲伴伶伸伺似佃但位低住佐佑体何佗余佛作佝佞你佣佤佩佬佯佰佳佶佻佼使侃侄侈例侍侏侔侗供依侠侣侥侦侧侨侩侪侬侮侯侵便促俄俊俎俏俐俑俗俘俚保俞信俨俩俪俭修俯俱俳俸俺倌倍倏倒倔倘候倚倜借倡倦倨倩倪倬倭债值倾偃假偈偎偏偕停健偬偶偷偻偿傀傅傣傥储傩催傲傻像僚僧僮僵僻儆儒儡儿兀允元兄充兆先光克免兑兔兕党兜兢入全八公六兮兰共关兴兵其具典兹养兼兽冀内冈冉册再冒冕冗写军农冠冢冤冥冬冯冰冲决况冶冷冻冽净凄准凉凋凌减凑凛凝几凡凤凫凭凯凰凳凶凸凹出击函凿刀刁刃分切刈刊刍刎刑划刖列刘则刚创初删判刨利别刮到刳制刷券刹刺刻刽剁剂剃削前剐剑剔剖剜剥剧剩剪副割剽剿劓力劝办功加务劣动助努劫劬励劲劳劾势勃勇勉勋勒勘募勤勺勾勿匀包匆匈匍匐匕化北匙匝匠匡匣匪匮匹区医匾匿十千卅升午卉半华协卑卒卓单卖南博卜占卡卢卤卦卧卫卯印危即却卵卷卸卿厂厄厅历厉压厌厕厘厚厝原厢厥厦厨厩厮去县叁参又叉及友双反发叔取受变叙叛叟叠口古句另叨叩只叫召叭叮可台叱史右叵叶号司叹叼叽吁吃各吆合吉吊同名后吏吐向吒吓吕吗君吝吞吟吠否吧吨吩含听吭吮启吱吴吵吸吹吻吼吾呀呃呆呈告呐呓呔呕呖呗员呛呜呢呦周呱味呵呷呸呻呼命咀咂咄咆咋和咎咏咐咒咕咖咙咚咛咝咤咦咧咨咩咪咫咬咯咱咳咴咸咻咽咿哀品哄哆哇哈哉响哎哏哐哑哒哕哗哝哞哟哥哦哧哨哩哪哭哮哲哳哺哼哽唁唆唇唉唏唐唠唢唤唧唬售唯唰唱唳唷唾唿啁啃啄商啊啐啕啖啜啡啤啥啦啧啪啬啭啮啰啸啻啼啾喀喂喃善喇喈喉喊喋喏喑喔喘喙喜喝喟喧喱喳喵喷喻喽嗅嗑嗒嗓嗖嗜嗝嗡嗣嗤嗥嗦嗨嗬嗯嗵嗷嗽嘀嘁嘈嘉嘎嘘嘛嘟嘣嘤嘱嘲嘴嘶嘹嘻嘿噍噎噔噗噙噜噢噤器噩噪噬噱嚎嚏嚓嚣嚷嚼囊囚四囝回囟因囡团囤囫园困囱围囵囹固国图囿圃圄圆圈圉土圣在圭圮地圹场圾址均坊坍坎坏坐坑块坚坛坝坞坟坠坡坤坦坩坪坯坳坷坼垂垃垄型垒垛垠垡垢垣垦垫垮埂埃埋城埔埙埚域埠埤培基堂堆堑堕堡堤堪堰堵塌塑塔塘塞填塾境墅墉墓墙增墟墨墩壁壑壕壤士壬壮声壳壶壹处备复夏夕外夙多夜够夥大天太夫夭央夯失头夷夸夹夺奄奇奈奉奋奎奏契奔奕奖套奚奠奢奥女奴奶奸她好如妃妄妆妇妈妊妍妒妓妖妗妙妞妣妥妨妩妪妮妯妹妻妾姆姊始姐姑姒姓委姗姘姚姜姣姥姨姬姹姻姿威娃娄娅娇娉娌娑娓娘娜娟娠娣娥娩娱娲娴娶娼婀婆婉婊婚婢婪婴婵婶婷婿媒媚媛媪媲媳媸媾嫁嫂嫉嫌嫒嫔嫖嫘嫡嫣嫦嫩嫱嬉嬗嬷孀子孑孓孔孕字存孙孚孛孜孝孟季孤学孩孪孬孰孱孳孵孺孽宁它宅宇守安宋完宏宕宗官宙定宛宜宝实宠审客宣室宦宪宫宰害宴宵家容宽宾宿寂寄寅密寇富寐寒寓寝寞察寡寤寥寨寮寰寸对寺寻导寿封射将尉尊小少尔尖尘尚尜尝尤尧尬就尴尸尹尺尼尽尾尿局屁层居屈屉届屋屎屏屐屑展屙属屠屡屣履屦屯山屹屿岁岂岔岖岗岚岛岩岫岭岳岸峋峙峡峥峦峨峪峭峰峻崇崎崔崖崛崩崭崴崽嵇嵌嵘嵩嵯嶂嶙巅巍川州巡巢工左巧巨巩巫差己已巳巴巷巽巾币市布帅帆师希帐帕帖帘帚帛帜帝带帧席帮帷常帼帽幂幄幅幌幔幕幢干平年并幸幺幻幼幽广庄庆庇床序庐庑库应底庖店庙庚府庞废庠度座庭庵庶康庸廉廊廓廪延廷建廿开弁异弃弄弈弊弋式弓引弗弘弟张弥弦弧弩弭弯弱弹强弼归当录彗彘彝形彤彦彩彪彬彭彰影彷役彻彼往征径待很徉徊律後徐徒徕得徘徙徜御徨循徭微德徼徽心必忆忌忍忏忐忑忖志忘忙忠忡忤忧忪快忮忱念忸忽忾忿怀态怂怄怅怆怍怎怏怒怔怕怖怙怛怜思怠怡急怦性怨怩怪怯怵总恁恃恋恍恐恒恕恙恚恢恣恤恨恩恪恫恬恭息恰恳恶恸恺恻恼恿悄悉悍悔悖悚悟悠患悦您悬悭悯悲悴悸悻悼情惆惊惋惑惕惘惚惜惟惠惦惧惨惩惫惬惭惮惯惰想惴惶惹惺愀愁愈愉愎意愕愚感愠愣愤愦愧愫愿慈慊慌慎慑慕慢慧慨慰慵慷憋憎憔憧憨憩憬憷憾懂懈懊懑懒懔懦懵懿戈戊戌戍戎戏成我戒戕或战戚戛戟戡戢戥截戮戳戴户戾房所扁扇扈扉手才扎扑扒打扔托扛扣执扩扪扫扬扭扮扯扰扳扶批扼找承技抄把抑抒抓投抖抗折抚抛抠抡抢护报抨披抬抱抵抹押抽抿拂拄担拆拇拈拉拌拍拎拐拒拓拔拖拗拘拙拚招拜拟拢拣拥拦拧拨择括拭拮拯拱拳拴拶拷拼拽拾拿持挂指挈按挎挑挖挚挛挞挟挠挡挣挤挥挨挪挫振挲挺挽捂捅捆捉捌捎捏捐捕捞损捡换捣捧捩据捶捷捺捻掀掂授掉掌掏掐排掖掘掠探掣接控推掩措掬掮掰掳掴掷掸掺掾揄揆揉揍描提插揖揠握揣揩揪揭援揶揽揿搀搁搂搅搏搓搔搜搞搪搬搭携搽摁摄摆摇摈摊摒摔摘摞摧摩摸摹撂撇撑撒撕撞撤撩撬播撮撰撵撺撼擀擂擅操擎擒擘擞擢擤擦攀攒攘攥攫支收攸改攻放政故效敌敏救敕敖教敛敝敞敢散敦敬数敲整敷文斋斌斐斑斗料斜斟斡斤斥斧斩断斯新方於施旁旅旋旌旎族旖旗无既日旦旧旨早旬旭旱时旷旺昂昃昆昊昌明昏易昔昙星映春昧昨昭是昱昵昶昼显晃晋晌晏晒晓晕晚晤晦晨普景晰晴晶晷智晾暂暄暇暑暖暗暨暮暴曙曛曝曦曰曲曳更曹曼曾替最月有朊朋服朔朕朗望朝期朦木未末本札术朱朴朵机朽杀杂权杆杈杉李杏材村杖杜杞束杠条来杨杪杭杯杰杲杳杵杷松板极构枇枉析枕林枚果枝枢枣枥枪枫枭枯枰枳架枷枸柄柏某柑柒染柔柚柜柞柠柢查柩柬柯柰柱柳柴柿栅标栈栊栋栎栏树栓栖栗校栩株样核根格栽桁桂桃桅框案桉桌桎桐桑桔桕档桥桦桧桨桩桶梁梅梆梏梓梗梢梦梧梨梭梯械梳梵检棂棉棋棍棒棕棘棚棠森棰棱棵棹棺棼椁椅植椎椒椟椭椰椴椹椽椿楂楔楗楚楞楠楣楫楷楼概榄榆榉榔榕榛榜榨榫榭榴榷榻槌槐槔槛槟槽樊樘樟模横樯樱樵樽橄橇橘橙橛橡橱橹檀檄檐檑檠檩檬欠次欢欣欧欲欷欺款歇歉歌歙止正此步武歧歪歹死歼殁殃殄殆殉殊残殒殓殖殚殡殳殴段殷殿毁毅毋母每毒毓比毕毖毗毙毛毡毫毯毳毽氏氐民氓气氛氢氤氧氨氮氯氲水永氽汀汁求汇汉汊汐汔汕汗汛汝汞江池污汤汩汪汰汴汶汹汽汾沁沃沆沈沉沌沏沐沓沙沛沟没沤沥沦沧沪沫沮沱河沸油治沼沽沾沿泄泅泉泊泌泓法泛泞泡波泣泥注泪泯泰泳泵泻泼泽泾洁洄洋洌洒洗洛洞津洪洲活洼洽派流浃浅浆浇浊测济浑浒浓浙浜浦浩浪浮浴海浸涂消涉涌涎涓涔涕涛涝涟涡涣涤润涧涨涩涮涯液涵涸涿淀淆淇淋淌淑淖淘淙淞淡淤淫淬淮深淳混淹添清渊渍渎渐渔渗渝渠渡渣渤温渭港渲渴游渺湃湍湖湘湛湫湮湾湿溃溅溉源溘溜溟溢溪溯溴溶溺滂滇滋滑滓滔滚滞满滢滤滥滨滩滴漂漆漏漓演漠漩漪漫漱漶漾潇潋潘潜潦潭潮潺澄澈澌澎澜澡澳激濒濡瀑瀚瀛瀣灌火灭灯灰灵灶灸灼灾灿炀炅炉炊炎炒炕炖炙炜炫炬炭炮炯炳炷炸点炼炽烁烂烈烊烘烙烛烟烤烦烧烨烩烫热烯烷烹烽焉焊焐焕焖焙焚焦焯焰然煌煎煜煞煤煦照煨煮煲煽熄熊熏熔熘熙熟熠熨熬熹燃燎燕燥燧燮爆爪爬爰爱爵父爷爸爹爻爽片版牌牍牒牖牙牛牝牟牡牢牦牧物牯牲牵特牺犀犁犄犊犍犏犒犟犬犯犴状犷犸犹狂狄狈狍狎狐狒狗狙狞狠狡狩独狭狮狯狰狱狲狷狸狺狼猁猎猕猖猗猜猝猞猡猢猥猩猪猫猬献猱猴猾猿獐獗獭獾玄率玉王玎玑玖玛玩玫玮环现玲玷玺玻珀珂珊珍珏珐珑珠珥班球琅理琉琐琢琥琦琪琮琳琴琵琶琼瑕瑗瑙瑚瑛瑜瑞瑟瑰瑶瑾璀璃璇璋璐璜璞瓜瓢瓣瓤瓦瓮瓴瓶瓷甄甘甚甜生甥用甩甫甬甭田由甲申电男甸画畅界畏畔留畚畜略畦番畴畸疆疏疑疖疗疙疚疝疟疠疡疤疥疫疮疯疱疲疳疴疵疸疹疼疽疾痂病症痈痉痊痍痒痔痕痘痛痞痢痣痦痧痨痪痫痰痱痴痹痼瘁瘅瘌瘘瘟瘤瘦瘩瘪瘫瘳瘴瘸瘾癃癌癍癖癞癣癫癸登白百皂的皆皇皈皎皑皓皖皙皮皱皲皴皿盂盅盆盈益盍盎盏盐监盒盔盖盗盘盛盟盥目盯盲直相盹盼盾省眈眉看眍真眠眢眦眨眩眯眶眷眸眺眼着睁睛睡督睥睦睨睫睬睹睽睾睿瞄瞅瞌瞎瞑瞒瞟瞠瞥瞧瞩瞪瞬瞭瞰瞳瞻瞿矗矛矜矢矣知矩矫短矮石矽矾矿码砂砌砍砒研砖砚砝砣砧砭砰破砸砻砾础硅硕硝硫硬确硼碇碉碌碍碎碑碗碘碟碣碧碰碱碳碴碾磁磅磊磋磐磔磕磨磬磷磺礁礴示礼社祀祈祉祖祗祛祝神祠祥票祭祷祸祺禀禁禄禅福禧禹禺离禽禾秀私秃秆秉秋种科秒秕秘租秣秤秦秧秩秫积称秸移秽稀稃程稍税稔稗稚稞稠稳稷稻稼稽稿穆穑穗穴究穷穹空穿突窃窄窈窍窑窒窕窖窗窘窜窝窟窠窥窿立竖站竞竟章竣童竦竭端竹竿笃笆笈笋笑笔笙笛笞笠笤符笨第笳笺笼等筋筌筏筐筑筒答策筚筛筝筮筵筷筹签简箍箔箕算管箧箩箪箫箭箱箴箸篁篆篇篑篓篙篝篡篦篮篱篷篾簇簋簌簧簪簸簿籀籁籍米类籼籽粉粒粕粗粘粝粞粟粤粥粪粮粲粳粹粼粽精糅糈糌糍糕糖糙糟糠糯系紊素索紧紫累絮絷繁纂纠红纤约级纨纪纫纬纭纯纰纱纲纳纵纶纷纸纹纺纽纾线练组绅细织终绊绌绍绎经绑绒结绕绘给绚绛络绝绞统绡绢绣绥继绩绪绫续绮绯绰绳维绵绶绷绸绻综绽绾绿缀缅缆缈缉缎缓缔缕编缘缚缛缜缝缠缢缣缤缥缩缪缭缮缰缱缴缶缸缺罄罐网罔罕罗罚罢罩罪置署罴罹羁羊羌美羔羚羞羡群羯羲羹羽羿翁翅翌翎翔翕翘翟翠翡翥翦翩翮翰翱翻翼耀老考耄者耆耋而耍耐耒耕耗耙耜耳耶耷耸耻耽耿聂聆聊聋职聒联聘聚聩聪聿肃肄肆肇肉肋肌肓肖肘肚肛肝肠股肢肤肥肩肪肫肮肯肱育肴肺肽肾肿胀胁胃胄胆背胎胖胚胛胜胝胞胡胤胥胧胭胯胰胱胳胴胶胸胺胼能脂脆脉脍脏脐脑脓脖脚脬脯脱脶脸脾腆腊腋腌腐腑腔腕腚腠腥腩腭腮腰腴腹腺腻腼腾腿膀膈膊膏膘膛膜膝膨膳膺膻臀臂臃臆臊臣臧自臬臭至致臻臼臾舀舂舅舆舌舍舐舒舔舜舞舟舢舨航般舰舱舵舶舷舸船舾艄艇艘艮良艰色艳艺艾艿节芋芍芒芙芜芝芡芥芦芪芬芭芯花芳芷芸芹芽芾苇苋苍苎苏苑苒苔苗苛苞苟苣若苦苫苯英苴苹茁茂范茄茅茉茎茏茔茗茜茧茨茫茬茱茴茵茶茸茹荃荆荇草荏荐荒荔荚荞荟荠荡荣荤荦荧荪荫药荷荸荻荼莅莉莎莓莘莜莠莫莱莲莳莴获莹莺莼莽菇菊菌菜菠菩菱菲菽萃萄萌萍萎萝萤营萦萧萨萱萸萼落葆著葚葛葡董葩葫葬葱葵葸葺蒂蒋蒙蒜蒲蒸蒿蓄蓉蓑蓓蓖蓝蓦蓬蔑蔓蔗蔚蔡蔫蔬蔷蔸蔻蔼蔽蕃蕉蕊蕙蕞蕴蕾薄薇薏薛薨薪薯薰藏藐藓藕藤藩藻蘑蘸虎虏虐虑虔虚虞虫虬虱虹虻虽虾蚀蚁蚂蚊蚌蚍蚓蚕蚜蚣蚤蚧蚩蚪蚯蚱蛀蛆蛇蛉蛊蛋蛐蛔蛙蛛蛟蛤蛭蛮蛰蛱蛲蛸蛹蛾蜀蜂蜇蜈蜉蜍蜒蜓蜕蜗蜘蜚蜜蜡蜢蜩蜮蜱蜴蜷蜻蜾蜿蝇蝈蝉蝌蝎蝗蝙蝠蝮蝰蝴蝶蝻蝾螂螃融螟螨螭螯螳螵螺螽蟀蟆蟋蟑蟒蟥蟮蟹蟾蠊蠓蠕蠢蠲蠹血衅行衍衔街衙衡衢衣补表衩衫衬衰衲衷衽袁袂袄袅袈袋袍袒袖袜袤被袭袱袼裁裂装裆裉裔裕裘裙裟裢裣裤裥裨裰裱裳裴裸裹裾褂褊褐褒褓褚褛褡褥褪褫褴褶襁襟襻西要覆见观规觅视览觉觑角觞解触言詹誉誊誓警譬计订讣认讥讦讧讨让讪讫训议讯记讲讳讴讵讶讷许讹论讼讽设访诀证诂评诅识诈诉诊诋诌词诎诏译试诗诘诙诚诛话诞诟诠诡询诣诤该详诧诩诫诬语诮误诰诱诲说诵请诸诺读诽课诿谀谁调谄谅谆谇谈谊谋谍谎谏谐谑谒谓谕谗谘谙谚谛谜谢谣谤谦谧谨谩谪谬谭谮谰谱谴谷豁豆豉豌豕豚象豢豪豫豸豹豺貂貉貌贝贞负贡财责贤败账货质贩贪贫贬购贮贯贰贱贲贴贵贷贸费贺贻贼贽贾贿赁赂赃资赅赇赈赊赋赌赎赏赐赔赖赘赙赚赛赞赠赡赢赣赤赦赫赭走赳赴赵赶起趁趄超越趋趔趟趣足趴趼趾跃跄跋跌跎跑跚跛距跟跣跤跨跪跬路跳践跷跺跽踉踊踌踏踔踝踞踟踢踩踪踮踱踵踹蹂蹄蹇蹈蹉蹊蹋蹑蹒蹙蹦蹩蹬蹭蹲蹴蹶蹼蹿躁躇躏躜身躬躯躲躺车轧轨轩转轮软轰轱轲轳轴轶轻轼载轾轿辁较辄辅辆辇辈辉辊辍辎辏辐辑输辔辕辖辗辘辙辛辜辞辟辣辨辩辫辰辱边辽达迁迂迄迅过迈迎运近返迕还这进远违连迟迢迤迥迦迨迩迪迫迭述迷迸迹追退送适逃逅逆选逊逋逍透逐递途逗通逛逝逞速造逡逢逦逮逵逶逸逻逼逾遁遂遇遍遏遐遑遒道遗遘遢遣遥遨遭遮遴遵遽避邀邂邃邈邋邑邓邕邢那邦邪邮邱邵邸邻郁郊郎郑郝郡部郭都鄂鄙酉酊酋酌配酒酗酚酝酞酣酤酥酩酪酬酱酵酶酷酸酽酿醇醉醋醍醐醒醮醴醺采釉释里重野量金釜鉴銮鋈鎏鏖鑫针钉钊钋钍钎钐钒钓钗钙钚钛钝钞钟钠钢钤钥钦钧钨钩钮钱钳钴钵钷钹钺钻钼钾钿铀铁铂铃铄铅铆铍铎铐铗铛铜铝铠铡铢铣铤铨铩铬铭铮铱铲铳银铸铺链铿销锁锂锄锅锇锈锉锋锌锏锐错锚锛锡锢锣锤锥锦锨锭键锯锰锱锲锴锵锹锻镀镁镂镇镉镊镌镍镏镐镑镖镗镜镝镞镣镪镫镬镭镯镰镳镶长门闩闪闭问闯闰闱闲间闷闸闹闺闻闽闾阀阁阂阃阅阉阋阎阐阑阔阕阖阙阜队阡阮阱防阳阴阵阶阻阿陀陂附际陆陇陈陉陋陌降限陕陛陟陡院除陨险陪陲陵陶陷隅隆隋随隐隔隘隙障隧隶隹隼隽难雀雁雄雅集雇雉雌雍雏雕雠雨雩雪雯雳零雷雹雾需霁霄霆震霉霍霎霏霓霖霜霞霪霭露霸霹霾青靓靖静靛非靠靡面靥革靴靶鞅鞋鞍鞘鞠鞭韦韧韩韫韬韭音韵韶页顶顷项顺须顽顾顿颁颂颃预颅领颇颈颉颊颌颏颐频颓颔颖颗题颚颛颜额颟颠颡颤颦颧风飑飒飓飕飘飙飞食飨餍餐餮饕饥饨饪饬饭饮饯饰饱饲饴饵饶饷饺饼饿馁馄馅馆馈馊馋馍馏馐馒馕首香馥馨马驭驮驯驰驱驳驴驶驷驸驹驻驼驽驾驿骀骁骂骄骅骆骇骈骊骋验骏骐骑骒骓骖骗骚骛骜骝骞骠骡骤骥骧骨骷骸髅髓高髡髦髭髯髻鬃鬓鬯鬲鬻鬼魁魂魄魅魇魈魉魍魏魑魔鱼鱿鲁鲇鲈鲍鲑鲜鲟鲠鲢鲤鲥鲧鲨鲫鲮鲲鲳鲸鲻鳃鳄鳅鳊鳍鳎鳏鳔鳕鳖鳗鳜鳝鳞鸟鸠鸡鸢鸣鸥鸦鸨鸬鸭鸯鸱鸳鸵鸶鸽鸾鸿鹂鹃鹄鹅鹇鹉鹊鹌鹏鹑鹘鹚鹛鹜鹞鹤鹦鹫鹭鹰鹳鹾鹿麇麈麋麒麓麝麟麦麸麻麽黄黉黍黎黏黑黔默黛黜黝黠黥黩黯黾鼎鼓鼠鼬鼯鼹鼻鼾齐齿龀龃龄龆龇龈龉龊龌龙龚龛龟'.split('')
/////////////////////
const unknownHanzi = new Set([])
var isBrowser = (function() {
try {
return this === window;
} catch (e) {
return false;
}
})();
// google-chrome-beta --user-data-dir="/tmp/tmp-chrome-user-data-dir" --allow-file-access-from-files file:///home/srghma/projects/srghma-chinese/elon-musk/unknown-hanzi.html --disable-web-security
const isFileSystem = isBrowser && window.location.protocol === "file:"
const mychineseSitePrefix__root = isFileSystem ? "file:///home/srghma/projects/srghma-chinese" : ""
const mychineseSitePrefix__elon_musk = isFileSystem ? "file:///home/srghma/projects/srghma-chinese/elon-musk/" : "/elon-musk/"
const isGithubPage = isBrowser && /srghma-chinese\d*\.github\.io/.test(window.location.host)
const rootUrl__srghmaChineseFiles__collectionMedia = isFileSystem ? `file:///home/srghma/projects/srghma-chinese-files/collection.media` : `https://srghma-chinese-files.github.io/collection.media`
const {
ruPinyinTextPromise__file_url,
hanziAnkiInfoPromise__file_url,
allHanziAnkiInfoPromise__file_url
} = (function() {
if (isFileSystem) {
return {
ruPinyinTextPromise__file_url: () => `${mychineseSitePrefix__root}/ru-pinyin.txt`,
hanziAnkiInfoPromise__file_url: (hanzi) => `${mychineseSitePrefix__root}/files-split/${hanzi}.json`,
allHanziAnkiInfoPromise__file_url: () => `${mychineseSitePrefix__root}/files/anki.json`
}
} else if (isGithubPage) {
// https://github.com/USER/PROJECT/blob/gh-pages/PATH_TO_FILE?raw=true
// return `https://github.com/${window.location.host.replace('.github.io', '')}/${window.location.host}/blob/master/ru-pinyin.txt?raw=true`
// https://github.com/${window.location.host.replace('.github.io', '')}/${window.location.host}/raw/master/ru-pinyin.txt
const mychineseSitePrefix__root = `https://raw.githubusercontent.com/${window.location.host.replace('.github.io', '')}/${window.location.host}/main/`
return {
ruPinyinTextPromise__file_url: () => `${mychineseSitePrefix__root}/ru-pinyin.txt`,
hanziAnkiInfoPromise__file_url: (hanzi) => `${mychineseSitePrefix__root}/files-split/${hanzi}.json`,
allHanziAnkiInfoPromise__file_url: () => `${mychineseSitePrefix__root}/files/anki.json`
}
} else {
// serve .
// localhost:5000
return {
ruPinyinTextPromise__file_url: () => `${mychineseSitePrefix__root}/ru-pinyin.txt`,
hanziAnkiInfoPromise__file_url: (hanzi) => `${mychineseSitePrefix__root}/files-split/${hanzi}.json`,
allHanziAnkiInfoPromise__file_url: () => `${mychineseSitePrefix__root}/files/anki.json`
}
}
})();
const isCurrentPageAHPage = (function() {
if (!isBrowser) { return false }
let x = window.location.pathname.split('/')
x = x[x.length - 1]
x = x.replace('.html', '')
return x === "h"
})();
//////////////////////////////////////////
function sortBy(fn, list) {
return Array.prototype.slice.call(list, 0).sort(function(a, b) {
var aa = fn(a);
var bb = fn(b);
return aa < bb ? -1 : aa > bb ? 1 : 0;
});
}
//////////////////////////////////////////
// Object -> Set
function mk_ruPinyinObject_small(ruPinyinObject) {
const buffer = new Set()
for (const [key, value] of Object.entries(ruPinyinObject)) {
if (value.length < 30 || value.includes("TODOFINISH")) {
buffer.add(key)
}
}
return buffer
}
//////////////////////////////////////////
function ruPinyinTextToArray(text) {
return text.split(/―{4,}|-{4,}/).map(x => x.trim())
}
const removeLinks = x => x.replace(/<link>[^<]*<\/link>/g, '')
const ruPinyinTextPromise = () => fetch(ruPinyinTextPromise__file_url()).then(x => x.text())
const hanziAnkiInfoPromise = (hanzi) => fetch(hanziAnkiInfoPromise__file_url(hanzi)).then(x => x.json())
const allHanziAnkiInfoPromise = () => fetch(allHanziAnkiInfoPromise__file_url()).then(x => x.json())
const asyncLoadAllAnkiInfoAndText = async (hanzi) => {
const [allHanziAnkiInfo, ruPinyinText] = await Promise.all([
allHanziAnkiInfoPromise(),
ruPinyinTextPromise(),
])
return { allHanziAnkiInfo, ruPinyinText }
}
const asyncLoadHanziAnkiInfoAndText = async (hanzi) => {
const [hanziAnkiInfo, ruPinyinText] = await Promise.all([
hanziAnkiInfoPromise(hanzi),
ruPinyinTextPromise(),
])
return { hanziAnkiInfo, ruPinyinText }
}
const asyncLoadHanziAnkiInfoAndAllAnkiInfoAndText = async (hanzi) => {
let allHanziAnkiInfo
let hanziAnkiInfo
let ruPinyinText
if (isGithubPage) {
const result = await asyncLoadHanziAnkiInfoAndText(hanzi)
hanziAnkiInfo = result.hanziAnkiInfo
ruPinyinText = result.ruPinyinText
allHanziAnkiInfo = { [hanzi]: hanziAnkiInfo }
} else {
const result = await asyncLoadAllAnkiInfoAndText()
allHanziAnkiInfo = result.allHanziAnkiInfo
ruPinyinText = result.ruPinyinText
hanziAnkiInfo = allHanziAnkiInfo[hanzi]
}
return { allHanziAnkiInfo, hanziAnkiInfo, ruPinyinText }
}
function recomputeCacheAndThrowIfDuplicate(ruPinyinArray) {
const arrayOfValuesToObject = ({ arrayOfKeysField, valueField, array }) => {
const buffer = {}
const duplicateKeys = {}
function duplicateKeys_add(hanziThatIsDuplicated, duplicatedWhere) {
if (duplicateKeys.hasOwnProperty(hanziThatIsDuplicated)) {
duplicateKeys[hanziThatIsDuplicated].push(duplicatedWhere)
} else {
duplicateKeys[hanziThatIsDuplicated] = [duplicatedWhere]
}
}
array.forEach(arrayElement => {
arrayElement[arrayOfKeysField].forEach(key => {
if (buffer.hasOwnProperty(key)) { duplicateKeys_add(key, arrayElement[valueField]) }
buffer[key] = arrayElement[valueField]
})
})
if (Object.keys(duplicateKeys).length > 0) { throw new Error(`duplicateKeys: ${JSON.stringify(duplicateKeys, undefined, 2)}`) }
return buffer
}
ruPinyinArray = ruPinyinArray.map(text => {
const hanzi = uniq([...(removeLinks(text))].filter(isHanzi))
return {
text,
hanzi,
}
})
// console.log(ruPinyinArray)
return arrayOfValuesToObject({
arrayOfKeysField: "hanzi",
valueField: "text",
array: ruPinyinArray,
})
}
/////////////////////////////////
const REGEX_JAPANESE = /[\u3040-\u309f]|[\u30a0-\u30ff]|[\u4e00-\u9faf]|[\u3400-\u4dbf]/
const REGEX_CHINESE = /[\u4E00-\u9FCC\u3400-\u4DB5\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\ud840-\ud868][\udc00-\udfff]|\ud869[\udc00-\uded6\udf00-\udfff]|[\ud86a-\ud86c][\udc00-\udfff]|\ud86d[\udc00-\udf34\udf40-\udfff]|\ud86e[\udc00-\udc1d]/;
const specialChar = "。?!,"
// Hiragana: [\u3040-\u309f]
// Katakana: [\u30a0-\u30ff]
// Roman characters + half-width katakana: [\uff00-\uff9f]
// Roman characters + half-width katakana (more): [\uff00-\uffef]
// Kanji: [\u4e00-\u9faf]|[\u3400-\u4dbf]
function isHanzi(ch) {
if ([...ch].length !== 1) { throw new Error(`'${ch}' is not length 1`) }
const isSpecialChar = specialChar.includes(ch)
const isJapanese = REGEX_JAPANESE.test(ch)
const isChinese = REGEX_CHINESE.test(ch)
const isHanzi = !isSpecialChar && (isJapanese || isChinese)
return isHanzi
}
/////////////////////////////////
const uniq = array => [...new Set(array)]
function showText(hanzi, containerElement, text) {
// console.log(text)
const linkTranchinese = x => `<a target="_blank" href="https://www.trainchinese.com/v2/search.php?searchWord=${encodeURIComponent(x)}&tcLanguage=ru">${x}</a>`
const other_links = [
`<a target="_blank" href="https://zi.tools/zi/$1">zitools</a>`,
`<a target="_blank" href="https://bkrs.info/slovo.php?ch=$1">bkrs</a>`,
linkTranchinese(`${hanzi}*`),
linkTranchinese(`*${hanzi}`),
].join(` | `)
text = text.replace(/(.)">yw11<\/a>/g, `$1">yw11</a> | ${other_links}`)
if (isFileSystem) {
text = text.replace(/<img src=("|')(?!https?\:\/\/)/g, '<img src=$1file:///home/srghma/projects/srghma-chinese-files/collection.media/')
text = text.replace(/href="([^\.]+)\.mp3"/g, 'href="file:///home/srghma/projects/srghma-chinese-files/collection.media/$1.mp3"')
text = text.replace(/<object data="[^"]+" type="image\/png">/g, '')
text = text.replace(/<\/object>/g, '')
text = text.replace('<a href="https://images.yw11.com/zixing/', '<a href="https://lens.google.com/uploadbyurl?url=https://images.yw11.com/zixing/')
} else if (isGithubPage) {
// <img src="https://www.unicode.org/cgi-bin/refglyph?24-5DE5"
// <img src="asdfasdf.png"
// <img src="hanziyan-J11022.png"/>
// <img src='lf_24037.gif">
// https://github.com/srghma-chinese-files/srghma-chinese-files.github.io/blob/master/PATH_TO_FILE?raw=true
text = text.replace(/<img src=("|')(?!https?\:\/\/)/g, '<img src=$1https://srghma-chinese-files.github.io/collection.media/')
// href="allsetlearning-gong1.mp3"
text = text.replace(/href="([^\.]+)\.mp3"/g, 'href="https://srghma-chinese-files.github.io/collection.media/$1.mp3"')
} else {
text = text.replace(/<img src=("|')(?!https?\:\/\/)/g, '<img src=$1srghma-chinese-files/collection.media/')
text = text.replace(/href="([^\.]+)\.mp3"/g, 'href="srghma-chinese-files/collection.media/$1.mp3"')
}
// bc it's the same
if (r12345_chars.includes(hanzi)) {
const src = r12345_showChar__src(hanzi)
text = text + `<img src="${src}" height="500">`
}
containerElement.innerHTML = text
function enhanceWithLinkToH(containerElement) {
// const colorizer = (ch, colorIndex) => `<a target="_blank" href="plecoapi://x-callback-url/s?q=${ch}">${ch}</a>`
const colorizer = (ch, colorIndex) => `<a target="_blank" href="h.html#${ch}">${ch}</a>`
// const colorizer = (ch, colorIndex) => `<div onclick="window.copyToClipboard('${ch}')">${ch}</div>`
const ruby_chars = [...containerElement.innerHTML]
containerElement.innerHTML = ruby_chars.map(ch => isHanzi(ch) ? colorizer(ch) : ch).join('')
}
Array.from(document.querySelectorAll('[data-enhance-with-pleco]')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#chinese_opposite')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#ch_with_same_pronounciation')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#Ru_trainchinese')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#origin_of_ch_char_book')).forEach(enhanceWithLinkToH)
// Array.from(document.querySelectorAll('#rtega_mnemonic')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#purpleculture_info')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#purpleculture_tree')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#purpleculture_examples')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#myStory')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#heisig_constituent')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#humanum_small_description')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#humanum_small_description_en')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#humanum_full_description')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#humanum_full_description_en')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#baidu_chinese')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#baidu_chinese_en')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#hanziyuan')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#yw11')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#yw11_en_transl')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#yw11_image_chinese')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#yw11_image_ru_transl')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#bkrs_pinyin')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('#bkrs_transl')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('.my-pinyin-english')).forEach(enhanceWithLinkToH)
Array.from(document.querySelectorAll('.my-pinyin-ru')).forEach(enhanceWithLinkToH)
// Array.from(document.querySelectorAll('.dictips')).forEach(enhanceWithLinkToH)
// Array.from(document.querySelectorAll('.yw11_image__container')).forEach(enhanceWithLinkToH)
// Array.from(document.querySelectorAll('.trainchinese-transl')).forEach(enhanceWithLinkToH)
///////////////////////////////////
const elementsToAddTranslLinks = [
document.getElementById("yw11"),
document.getElementById("yw11_image_chinese"),
document.getElementById("baidu_chinese"),
document.getElementById("humanum_full_description"),
document.getElementById("humanum_small_description"),
]
// console.log('doing', elementsToAddTranslLinks)
elementsToAddTranslLinks.filter(x => x).forEach(element => {
const text = element.innerText.replace(/\n\n+/g, '\n\n').trim()
// console.log(element, text)
if (!text) { return }
const encoded = encodeURIComponent(text)
const baidu_url = `https://fanyi.baidu.com/#zh/en/` + encoded
const deepl_url = `https://www.deepl.com/translator#zh/ru/` + encoded
const link = (text, url) => `<a href="${url}" target="_blank">${text}</a>`
const linksElement = document.createElement('div')
linksElement.innerHTML = `${link('baidu', baidu_url)}, ${link('deepl', deepl_url)}`
element.appendChild(linksElement)
})
}
function strip(html) {
let returnText = html
//-- remove BR tags and replace them with line break
returnText=returnText.replace(/<br>/gi, "\n");
returnText=returnText.replace(/<br\s\/>/gi, "\n");
returnText=returnText.replace(/<br\/>/gi, "\n");
//-- remove P and A tags but preserve what's inside of them
returnText=returnText.replace(/<p.*>/gi, "\n");
returnText=returnText.replace(/<a.*href="(.*?)".*>(.*?)<\/a>/gi, " $2 ($1)");
//-- remove all inside SCRIPT and STYLE tags
returnText=returnText.replace(/<script.*>[\w\W]{1,}(.*?)[\w\W]{1,}<\/script>/gi, "");
returnText=returnText.replace(/<style.*>[\w\W]{1,}(.*?)[\w\W]{1,}<\/style>/gi, "");
//-- remove all else
returnText=returnText.replace(/<(?:.|\s)*?>/g, "");
//-- get rid of more than 2 multiple line breaks:
returnText=returnText.replace(/(?:(?:\r\n|\r|\n)\s*){2,}/gim, "\n\n");
//-- get rid of more than 2 spaces:
returnText = returnText.replace(/ +(?= )/g,'');
//-- get rid of html-encoded characters:
returnText=returnText.replace(/ /gi," ");
returnText=returnText.replace(/&/gi,"&");
returnText=returnText.replace(/"/gi,'"');
returnText=returnText.replace(/</gi,'<');
returnText=returnText.replace(/>/gi,'>');
returnText=returnText.replace(/^\s+/gm,'');
return returnText
}
function showDummyAnkiInfo__getOtherKanjiFromRendered(rendered) {
// ... -> Array String
function matchAllFirstMatch(input, regex) {
return Array.from(input.matchAll(regex)).map(x => x[1])
}
function parseHtmlEntities(str) {
var txt = document.createElement("textarea");
txt.innerHTML = str;
return txt.value;
}
rendered = parseHtmlEntities(rendered)
let otherKanji = [
matchAllFirstMatch(rendered, /Traditional in your browser[^:]+:<\/b><span class="text-lg">(.+?)<\/span>/g),
matchAllFirstMatch(rendered, /Older traditional characters[^:]+:<\/b><span class="text-lg">(.+?)<\/span>/g),
matchAllFirstMatch(rendered, /Variant rule[^:]+:(.+?)<\/p>/g),
].flat().join('')
otherKanji = [...otherKanji].filter(isHanzi)
otherKanji = uniq(otherKanji)
return otherKanji
}
function showDummyAnkiInfo({ allHanziAnkiInfo, hanzi }) {
const hanziAnkiInfo = allHanziAnkiInfo[hanzi]
if (!hanziAnkiInfo) { return hanzi }
const otherKanji = showDummyAnkiInfo__getOtherKanjiFromRendered(hanziAnkiInfo.rendered).filter(x => x !== hanziAnkiInfo.kanji)
let mainAndOtherKanji_kanji_and_glyphPronunciations = [hanzi, ...otherKanji].map(hanzi => {
const hanziAnkiInfo = allHanziAnkiInfo[hanzi]
if (!hanziAnkiInfo) { return hanzi }
let glyphs = (hanziAnkiInfo.glyphs || []).map(x => (x.pinyins || [])[0]).filter(x => x).join(' + ')
return [hanziAnkiInfo.kanji, glyphs].filter(x => x).join(' ')
}).filter(x => x).join('\n')
let Ru_trainchinese = hanziAnkiInfo.Ru_trainchinese || ""
// console.log(Ru_trainchinese)
Ru_trainchinese = strip(Ru_trainchinese)
// console.log(Ru_trainchinese)
Ru_trainchinese = Ru_trainchinese.replace(/^(.+?): \(.+?\)/gm, '$1')
Ru_trainchinese = Ru_trainchinese.replace(/\(диал\.\)/g, '')
Ru_trainchinese = Ru_trainchinese.replace(/\(книжн\.\)/g, '')
// console.log(Ru_trainchinese)
// console.log(strip(Ru_trainchinese))
return [mainAndOtherKanji_kanji_and_glyphPronunciations, Ru_trainchinese].filter(x => x).join('\n') + '\n'
}
if (!isBrowser) {
exports.ruPinyinTextToArray = ruPinyinTextToArray
exports.recomputeCacheAndThrowIfDuplicate = recomputeCacheAndThrowIfDuplicate
exports.mk_ruPinyinObject_small = mk_ruPinyinObject_small
exports.r12345_showChar__src = r12345_showChar__src
exports.r12345_chars = r12345_chars
}
///////////////////////////////////
// Copyright (c) 2020, Pepe Becker
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/**
* Create a unicode character from the codepoint of a Chinese character
* @param codepoint codepoint of Chinese character as number or string type
* @example
* ```
* codepointToUnicode(0x6211) // 我
* codepointToUnicode('0x6211') // 我
* codepointToUnicode('U+6211') // 我
* codepointToUnicode('6211') // 我
* ```
*/
const codepointToUnicode = (codepoint) => {
if (typeof codepoint === 'string') {
let codepointStr = codepoint.replace('U+', '');
if (!/^0x/.test(codepointStr)) {
codepointStr = '0x' + codepointStr;
}
return String.fromCodePoint(parseInt(codepointStr));
}
return String.fromCodePoint(codepoint);
};
/**
* Four tones: ` ̄` ` ́` ` ̌` ` ̀`
*/
const toneMarks = ['\u0304', '\u0301', '\u030c', '\u0300'];
/**
* Returns the tone number of a Pinyin syllable
* @param text Pinyin syllable to get the tone number from
* @example
* ```
* getToneNumber('shì') // 4
* getToneNumber('shi4') // 4
* ```
*/
const getToneNumber = (text) => {
// Check for tone number
const matches = text.match(/[a-zü](\d)/i);
if (matches)
return +matches[1];
// Check for tone mark
for (let i = 0; i < toneMarks.length; i++) {
if (text.normalize('NFD').match(toneMarks[i]))
return i + 1;
}
// Return 5th tone as default
return 5;
};
/**
* Removes the tone mark/number from a Pinyin syllable
* @param text Pinyin syllable to remove the tone mark/number from
* @example
* ```
* removeTone('wǒ') // wo
* removeTone('wo3') // wo
* ```
*/
const removeTone = (text) => {
text = text.normalize('NFD').replace(/\u0304|\u0301|\u030c|\u0300/g, '');
return text.normalize('NFC').replace(/(\w|ü)[1-5]/gi, '$1');
};
function markToNumber(data, fithTone = true) {
const process = (text) => {
if (text.trim().length === 0)
return text;
if (fithTone) {
return removeTone(text) + getToneNumber(text);
}
else {
const tone = getToneNumber(text);
return tone === 5 ? removeTone(text) : removeTone(text) + tone;
}
};
if (Array.isArray(data)) {
return data.map(process);
}
else {
return process(data);
}
}
function numberToMark(data) {
const process = (text) => {
if (text.trim().length === 0)
return text;
const tone = getToneNumber(text);
text = removeTone(text);
if (tone !== 5) {
if (text === 'm' || text === 'n' || text === 'M' || text === 'N') {
return (text + toneMarks[tone - 1]).normalize('NFC');
}
const matchedVovels = text.match(/[aeiouü]/gi);
if (matchedVovels) {
let vovel = matchedVovels[matchedVovels.length - 1];
if (text.match('ou'))
vovel = 'o';
if (text.match('a'))
vovel = 'a';
if (text.match('e'))
vovel = 'e';
return text.replace(vovel, vovel + toneMarks[tone - 1]).normalize('NFC');
}
}
return text;
};
if (Array.isArray(data)) {
return data.map(process);
}
else {
return process(data);
}
}