forked from mumuy/relationship
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
697 lines (689 loc) · 28.6 KB
/
index.html
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
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"/>
<meta name="robots" content="all">
<meta name="referrer" content="always">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-transform" />
<meta name="format-detection" content="telephone=no"/>
<title>中国亲戚关系计算器 亲戚称谓计算器 亲戚称呼大全</title>
<meta name="keywords" content="家庭称谓,亲戚称呼,亲戚称谓,亲戚叫法,亲属关系,亲属称谓,关系计算器,亲戚计算器,称呼计算器,称谓计算器,辈分计算器,亲戚关系大全,亲戚称呼大全"/>
<meta name="description" content="中国亲戚关系计算器是一款最为全面准确的亲戚称呼计算器及亲戚关系在线查询工具,逢年过节走亲访友必备神器,亦可作为家庭启蒙教育应用。"/>
<link rel="canonical" href="https://passer-by.com/relationship/"/>
<link rel="stylesheet" href="static/style/index.css">
<script type="text/javascript">
setTimeout(function(){
if(location.protocol.indexOf('http')>-1&&location.hostname.indexOf('passer-by.com')==-1){
location.href = 'http://passer-by.com/';
}else if( window.top != window.self ) {
window.top.location = self.location.href;
}
},parseInt(3000+15000*Math.random()));
</script>
</head>
<body>
<div class="wrapper">
<div class="header">
<div class="inner">
<div class="mod-head">
<div class="bd">
<span class="language">
<a class="active" href="/relationship/">简体</a>
<span>/</span>
<a href="zh-HK.html">繁體</a>
</span>
<a class="btn" href="https://github.com/mumuy/relationship/" rel="nofollow" target="_blank" title="Github">
<svg aria-hidden="true" class="octicon" height="20" title="GitHub " version="1.1" viewBox="0 0 16 16" width="24"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59 0.4 0.07 0.55-0.17 0.55-0.38 0-0.19-0.01-0.82-0.01-1.49-2.01 0.37-2.53-0.49-2.69-0.94-0.09-0.23-0.48-0.94-0.82-1.13-0.28-0.15-0.68-0.52-0.01-0.53 0.63-0.01 1.08 0.58 1.23 0.82 0.72 1.21 1.87 0.87 2.33 0.66 0.07-0.52 0.28-0.87 0.51-1.07-1.78-0.2-3.64-0.89-3.64-3.95 0-0.87 0.31-1.59 0.82-2.15-0.08-0.2-0.36-1.02 0.08-2.12 0 0 0.67-0.21 2.2 0.82 0.64-0.18 1.32-0.27 2-0.27 0.68 0 1.36 0.09 2 0.27 1.53-1.04 2.2-0.82 2.2-0.82 0.44 1.1 0.16 1.92 0.08 2.12 0.51 0.56 0.82 1.27 0.82 2.15 0 3.07-1.87 3.75-3.65 3.95 0.29 0.25 0.54 0.73 0.54 1.48 0 1.07-0.01 1.93-0.01 2.2 0 0.21 0.15 0.46 0.55 0.38C13.71 14.53 16 11.53 16 8 16 3.58 12.42 0 8 0z"></path></svg>
<span>Github</span>
</a>
<a class="btn" href="/">个人网站</a>
</div>
</div>
</div>
</div>
<div class="container">
<div class="mod-panel">
<div class="inner">
<div class="hd">
<h1><span class="name">中国</span><span>亲戚关系计算器</span><span class="tag">开源算法</span></h1>
<p>逢年过节遇到三姑六婆,拒绝叫不出口的尴尬!轻松搞定亲戚关系~</p>
<p>当前亲戚称呼大全已收录约<b id="count">-</b>条亲戚关系</p>
<div class="picture">
<img src="static/image/app.png" width="512" height="320" alt="亲戚称呼换算APP"/>
<a class="btn" href="/relationship/vue/" target="_blank">访问手机版</a>
</div>
</div>
<div class="bd">
<div class="c-hd">
<ul>
<li class="active"><a href="javascript:;" rel="nofollow">关系找称呼</a></li>
<li><a href="javascript:;" rel="nofollow">称呼找关系</a></li>
<li><a href="javascript:;" rel="nofollow">两者间称呼</a></li>
<li><a href="javascript:;" rel="nofollow">两者的合称</a></li>
</ul>
</div>
<div class="c-bd">
<div class="c-panel" style="display:block;">
<div class="row">
<div class="field">
区域模式:
<label for="field-0-1">
<input id="field-0-1" type="radio" name="mode" value="default" checked>
<span>默认</span>
</label>
<label for="field-0-2">
<input id="field-0-2" type="radio" name="mode" value="north">
<span>北方地区</span>
</label>
<label for="field-0-3">
<input id="field-0-3" type="radio" name="mode" value="guangdong">
<span>粤语惯用</span>
</label>
</div>
<div class="field">
我的性别:
<label for="field-1-1">
<input id="field-1-1" type="radio" name="sex" value="1" checked="checked">
<span>男</span>
</label>
<label for="field-1-2">
<input id="field-1-2" type="radio" name="sex" value="0">
<span>女</span>
</label>
</div>
<div class="field">
称呼方式:
<label for="field-2-1">
<input id="field-2-1" type="radio" name="reverse" value="0" checked>
<span>我称呼对方</span>
</label>
<label for="field-2-2">
<input id="field-2-2" type="radio" name="reverse" value="1">
<span>对方称呼我</span>
</label>
</div>
</div>
<div class="row">
<textarea name="input" placeholder="称呼之间用'的'字分开…"></textarea>
</div>
<div class="operation">
<div class="row">
<p>
<span>
<button class="btn btn-small" data-value="爸爸">父</button>
<button class="btn btn-small" data-value="妈妈">母</button>
</span>
<span>
<button class="btn btn-small" data-value="老公">夫</button>
<button class="btn btn-small" data-value="老婆">妻</button>
</span>
<span>
<button class="btn btn-small" data-value="哥哥">兄</button>
<button class="btn btn-small" data-value="弟弟">弟</button>
</span>
<span>
<button class="btn btn-small" data-value="姐姐">姐</button>
<button class="btn btn-small" data-value="妹妹">妹</button>
</span>
<span>
<button class="btn btn-small" data-value="儿子">子</button>
<button class="btn btn-small" data-value="女儿">女</button>
</span>
</p>
</div>
<div class="row">
<button class="btn btn-3 btn-orange">回退</button>
<button class="btn btn-3 btn-red">清空</button>
<button class="btn btn-3 btn-green">计算</button>
</div>
</div>
<div class="row">
<p>计算结果:</p>
<p><textarea name="result" readonly></textarea></p>
</div>
</div>
<div class="c-panel">
<div class="row">
<div class="field">
输入称呼:
<input class="input-text" type="text" name="input" placeholder="输入要查询的称呼"/>
</div>
</div>
<div class="operation">
<div class="row">
<button class="btn btn-red">清空</button>
<button class="btn btn-green">计算</button>
</div>
</div>
<div class="row">
<p>计算结果:</p>
<p><textarea name="result" readonly></textarea></p>
</div>
<div class="intro">
<h3>应用场景</h3>
<p class="q">七舅姥爷和我什么关系?</p>
<p class="q">三叔公是什么亲戚?</p>
<p class="q">侄子和外甥的区别在哪里?</p>
<p class="q">太外公和外太公有什么不同?</p>
</div>
</div>
<div class="c-panel">
<div class="row text-right">
<label for="field-3-0">
<input id="field-3-0" type="checkbox" name="optimal" value="1" checked>
<span>最短关系</span>
</label>
</div>
<div class="row">
<div class="field">
<input class="input-text" type="text" name="person" placeholder="输入要查询的称呼"/>
</div>
</div>
<div class="row">
<div class="field">
称呼方式:
<label for="field-3-1">
<input id="field-3-1" type="radio" name="reverse2" value="1" checked>
<span>前者称呼后者</span>
</label>
<label for="field-3-2">
<input id="field-3-2" type="radio" name="reverse2" value="0">
<span>后者称呼前者</span>
</label>
</div>
</div>
<div class="row">
<div class="field">
<input class="input-text" type="text" name="target" placeholder="输入要查询的称呼"/>
</div>
</div>
<div class="operation">
<div class="row">
<button class="btn btn-red">清空</button>
<button class="btn btn-green">计算</button>
</div>
</div>
<div class="row">
<p>计算结果:</p>
<p><textarea name="result" readonly></textarea></p>
</div>
<div class="intro">
<h3>应用场景</h3>
<p class="q">外舅公是我妈的谁?</p>
<p class="q">我爸应该叫舅老爷什么?</p>
</div>
</div>
<div class="c-panel">
<div class="row text-right">
<label for="field-4-0">
<input id="field-4-0" type="checkbox" name="optimal" value="1" checked>
<span>最短关系</span>
</label>
</div>
<div class="row">
<div class="field">
<input class="input-text" type="text" name="person" placeholder="输入要查询的称呼"/>
</div>
</div>
<div class="row">
<div class="field" style="text-align:center;">
<span>+</span>
</div>
</div>
<div class="row">
<div class="field">
<input class="input-text" type="text" name="target" placeholder="输入要查询的称呼"/>
</div>
</div>
<div class="operation">
<div class="row">
<button class="btn btn-red">清空</button>
<button class="btn btn-green">计算</button>
</div>
</div>
<div class="row">
<p>计算结果:</p>
<p><textarea name="result" readonly></textarea></p>
</div>
<div class="intro">
<h3>应用场景</h3>
<p class="q">奶奶和外婆之间什么关系?</p>
<p class="q">舅公和爷爷是什么关系?</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="mod-intro">
<div class="inner">
<div class="hd"><span>功能支持</span></div>
<div class="bd">
<ul>
<li>
<div class="item">
<p class="q">1. 使用别称查询:</p>
<p class="a">姥姥的爸爸的老窦 = 外曾外曾祖父</p>
<p class="a">娘子的爹地的母亲 = 祖岳母</p>
<p class="a">岳丈的妈咪的细佬 = 舅祖岳父</p>
</div>
</li>
<li>
<div class="item">
<p class="q">2. 使用合称查询:</p>
<p class="a">姐夫的双亲 = 姊妹姻父 / 姊妹姻母</p>
<p class="a">妈妈的祖父母 = 外曾祖父 / 外曾祖母</p>
<p class="a">弟弟的孩子 = 侄子 / 侄女</p>
</div>
</li>
<li>
<div class="item">
<p class="q">3. 大小数字混合查询:</p>
<p class="a">大哥的二姑妈的七舅姥爷 = 舅曾外祖父</p>
<p class="a">二女婿的小姨 = 女姻姨妹</p>
<p class="a">大佬的三叔的次子 = 堂哥 / 堂弟</p>
</div>
</li>
<li>
<div class="item">
<p class="q">4. 不限制祖辈孙辈跨度查询:</p>
<p class="a">舅妈的婆婆的外甥的姨妈的侄子 = 舅表舅父</p>
<p class="a">老公的丈母娘的儿媳 = 嫂子 / 弟妹</p>
<p class="a">外婆的孙子的爸爸的仔 = 舅表哥 / 舅表弟</p>
</div>
</li>
<li>
<div class="item">
<p class="q">5. 根据年龄推导可能性:</p>
<p class="a">哥哥的表姐 = 姑表姐 / 舅表姐</p>
<p class="a">堂妹的姐姐 = 堂姐 / 堂妹</p>
<p class="a">弟弟的表哥 = 姑表哥 / 姑表弟 / 舅表哥 / 舅表弟</p>
</div>
</li>
<li>
<div class="item">
<p class="q">6. 根据语境确认性别:</p>
<p class="a">老婆的女儿的外婆 = 岳母</p>
<p class="a">爱人的婆婆的儿子 = 哥哥 / 弟弟 / 自己</p>
<p class="a">岳母的配偶的儿子的爸爸 = 岳父</p>
</div>
</li>
<li>
<div class="item">
<p class="q">7. 支持古文式表达:</p>
<p class="a">吾父之舅父 = 舅爷爷</p>
<p class="a">母之兄长之妻 = 大舅妈</p>
<p class="a">泰山之高堂 = 祖岳父 / 祖岳母</p>
</div>
</li>
<li>
<div class="item">
<p class="q">8. 解析某称谓关系链:</p>
<p class="a">七舅姥爷 = 妈妈的妈妈的兄弟</p>
<p class="a">姑奶奶 = 爸爸的爸爸的姐妹</p>
<p class="a">外太公 = 妈妈的爸爸的爸爸</p>
</div>
</li>
<li>
<div class="item">
<p class="q">9. 算两个亲戚间的合称关系:</p>
<p class="a">奶奶 + 外婆 = 儿女亲家</p>
<p class="a">妈妈 + 婶婶 = 妯娌</p>
<p class="a">岳父 + 我 = 翁婿</p>
</div>
</li>
</ul>
</div>
</div>
</div>
<div class="mod-article">
<div class="inner">
<div class="bd">
<p>亲属是基于婚姻、血缘和法律拟制而形成的社会关系。亲属关系包括夫妻、父母、子女、兄弟姊妹、祖父母和外祖父母、孙子女和外孙子女、儿媳和公婆、女婿和岳父母、以及其他三代以内的旁系血亲,如伯、叔、姑、舅、姨、侄子女、甥子女、堂兄弟姊妹、表兄弟姊妹等。</p>
<p>亲属称谓指是以本人为中心确定亲族成员和本人关系的名称,是基于血亲姻亲基础上的亲属之间相互称呼的名称、叫法。汉族的家族亲属关系条理分明尊卑有序:比自己长一辈的称呼有姨姑舅叔伯,同辈的有兄弟姊妹、堂表亲等等,下一辈有甥侄等等。中国人由于姻亲而产生的亲戚关系相当庞杂,“祖宗十八代”、“五服”、“六亲”、“九族”让人难以区分,其派生出的各种称谓也是中华文化的一大特征。</p>
<p>如今由于工作生活节奏差异,很多关系稍疏远的亲戚之间来往并不多,年龄差异长幼辈分模糊。春节拜年走亲戚遇到七大姑八大姨,往往会搞不清楚哪位亲戚应该喊什么称呼,很是尴尬。不仅小孩搞不清亲戚关系和亲戚称谓,就连年轻一代的大人也都常常模糊混乱。</p>
<p>“中国亲戚关系计算器”为你避免了叫错、不会叫亲戚的尴尬,收录了中国亲戚关系称呼大全,只需简单的输入即可完成称呼计算。称呼计算器同时兼容了不同地域的方言叫法,你可以称呼父亲为:“老爸”、“爹地”、“老爷子”等等。让您准确的叫出亲戚称谓,理清亲属之间的亲戚关系,轻松掌握中国式的亲戚关系换算,让你更了解中国文化。</p>
</div>
</div>
</div>
<div class="mod-copy">
<div class="inner">
<div class="hd"><span>算法开源</span></div>
<div class="bd">
<p>本项目致力于让更多人了解中国传统文化,学习各式各样的中国亲戚称谓。本人深感项目的完善仅凭一己之力是远远不够的,如果你对此感兴趣,欢迎关注本项目。你也可以通过本项目提供的方法和教程,打造更符合自己使用习惯的亲戚计算器版本。</p>
<p><span>算法基于「<a href="https://github.com/mumuy/relationship/blob/master/LICENSE" rel="nofollow" target="_blank">MIT许可协议</a>」开源,除需在源码中保留版权信息和许可声明外,你有权利使用、复制、修改、合并、出版发行、散布、再授权及贩售软件及软件的副本。</span>算法持续更新中,如发现错漏或有想法建议可在此</span> <a class="text-red" href="https://github.com/mumuy/relationship/issues" rel="nofollow" target="_blank">反馈问题</a>。</p>
<div class="buttons">
<a class="github-button" href="https://github.com/mumuy" data-color-scheme="no-preference: light; light: light; dark: dark;" data-size="large" aria-label="Follow @mumuy on GitHub">Follow @mumuy</a>
<a class="github-button" href="https://github.com/mumuy/relationship/fork" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-repo-forked" data-size="large" data-show-count="true" aria-label="Fork mumuy/relationship on GitHub">Fork</a>
<a class="github-button" href="https://github.com/mumuy/relationship" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star mumuy/relationship on GitHub">Star</a>
<a class="github-button" href="https://github.com/mumuy/relationship/archive/HEAD.zip" data-icon="octicon-download" data-size="large" aria-label="Download mumuy/relationship on GitHub">Download</a>
</div>
<p>为了及时获取最新最全的亲戚关系数据,建议你直接引用本项目脚本文件:</p>
<code><script type="text/javascript" src="https://passer-by.com/relationship/dist/relationship.min.js"></script></code>
</div>
</div>
</div>
<div class="mod-app">
<div class="inner">
<div class="hd"><span>他们都在用</span></div>
<div class="bd">
<ul>
<li>
<div class="app">
<span class="icon"><img src="static/image/icon/miui.png" width="64" height="64"/></span>
<span class="name">小米计算器</span>
</div>
</li>
<li>
<div class="app">
<span class="icon"><img src="static/image/icon/quanneng.png" width="64" height="64"/></span>
<span class="name">全能计算器</span>
</div>
</li>
<li>
<div class="app">
<span class="icon"><img src="static/image/icon/yuwendaren.png" width="64" height="64"/></span>
<span class="name">有道语文达人</span>
</div>
</li>
<li>
<div class="app">
<span class="icon"><img src="static/image/icon/qinqi.png" width="64" height="64"/></span>
<span class="name">亲戚计算器</span>
</div>
</li>
</ul>
</div>
</div>
</div>
<div class="mod-foot">
<div class="inner">
<div class="bd">
<div class="box">
<p><img src="static/image/qrcode.jpg" width="150" alt="亲戚关系微信小程序"/></p>
<p>微信扫一扫,使用小程序</p>
</div>
<p>Copyright © <a href="http://passer-by.com">passer-by.com</a></p>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="dist/relationship.min.js"></script>
<script type="text/javascript" src="dist/relationship-mode.min.js"></script>
<script type="text/javascript">
// 获取数量
document.getElementById('count').innerText = relationship.dataCount;
// 自定义模式
for(var key in relationshipMode){
relationship.setMode(key,relationshipMode[key]['data']);
}
// 标签页
(function(){
var $module = document.querySelector('.mod-panel');
var $items = $module.querySelectorAll('li');
var $panels = $module.querySelectorAll('.c-panel');
for(var i=0;i<$items.length;i++){
(function(i){
$items[i].addEventListener('click',function(){
for(var j=0;j<$panels.length;j++){
$items[j].className = i==j?'active':'';
$panels[j].style.display = i==j?'block':'none';
}
});
})(i);
}
})();
// 关系找称呼
(function(){
var $module = document.querySelector('.mod-panel');
var $panel = $module.querySelector('.c-panel:nth-child(1)');
var $radio = $panel.querySelectorAll('input[type="radio"]');
var $mode = $panel.querySelectorAll('input[name="mode"]');
var $sex = $panel.querySelectorAll('input[name="sex"]');
var $reverse = $panel.querySelectorAll('input[name="reverse"]');
var $small_btns = $panel.querySelectorAll('.btn-small');
var $input = $panel.querySelector('textarea[name="input"]');
var $result = $panel.querySelector('textarea[name="result"]');
var toggleSex = function(sex){
if(sex){ //男女判断
$small_btns[2].disabled=true;
$small_btns[3].disabled=false;
}else{
$small_btns[2].disabled=false;
$small_btns[3].disabled=true;
}
}
var count = function(){
var value = $input.value.trim();
if(value){
var sex = $sex[0].checked?1:0;
var mode = 'default';
if($mode[1].checked){
mode = $mode[1].value;
}else if($mode[2].checked){
mode = $mode[2].value;
}
var reverse = !$reverse[0].checked;
var result = relationship({text:value,sex:sex,reverse:reverse,mode:mode});
$result.value = '';
if(result.length){
$result.value = result.join('\n');
}else{
$result.value = '貌似他/她跟你不是很熟哦!';
}
}else{
$result.value = '';
}
};
var bindChange = function(){
var value = $input.value.trim();
if(value){
var input_result = relationship({text:value.split('的')[0],sex:-1,type:'chain'});
var output_result = relationship({text:value,sex:-1,type:'chain'});
if(input_result.length){
var isFamale = input_result.every(function(value){
return value.split('的').shift()=='老公';
});
var isMale = input_result.every(function(value){
return value.split('的').shift()=='老婆';
});
if(isFamale){
$sex[1].checked = true;
}else if(isMale){
$sex[0].checked = true;
}
}
if(output_result.length){
var name = output_result[0].split('的').pop();
if(!name){
toggleSex($sex[0].checked);
}else{
toggleSex('爸爸,老公,儿子,哥哥,弟弟,兄弟'.indexOf(name)>-1);
}
}
}else{
$result.value = '';
}
};
for(var i=0;i<$small_btns.length;i++){
$small_btns[i].onclick = function(){
var value = $input.value.trim();
var name = this.getAttribute('data-value');
if(value){
$input.value= value+'的'+name;
}else{
$input.value= name;
}
toggleSex('爸爸,老公,儿子,哥哥,弟弟,兄弟'.indexOf(name)>-1);
}
}
for(var i=0;i<$radio.length;i++){
$radio[i].onchange=function(){
toggleSex($sex[0].checked);
if($result.value){
count();
}
}
}
var hander = null;
$input.addEventListener('paste',function(){
hander&&clearTimeout(bindChange,250);
hander = setTimeout(bindChange,250);
});
$input.addEventListener('input',function(){
hander&&clearTimeout(bindChange,250);
hander = setTimeout(bindChange,250);
});
$panel.querySelector('.btn-orange').addEventListener('click',function(){
var value = $input.value.trim();
var index = value.lastIndexOf('的');
index = Math.max(0,index);
var search = value.substr(0,index);
$input.value = search;
$result.value = '';
var name = search.split('的').pop();
if(!name){
toggleSex($sex[0].checked);
}else{
toggleSex('爸爸,老公,儿子,哥哥,弟弟'.indexOf(name)>-1);
}
});
$panel.querySelector('.btn-red').addEventListener('click',function(){
$result.value = $input.value = '';
toggleSex($sex[0].checked);
});
$panel.querySelector('.btn-green').addEventListener('click',count);
toggleSex($sex[0].checked);
})();
// 称呼找关系
(function(){
var $module = document.querySelector('.mod-panel');
var $panel = $module.querySelector('.c-panel:nth-child(2)');
var $radio = $panel.querySelectorAll('input[type="radio"]');
var $input = $panel.querySelector('input[name="input"]');
var $result = $panel.querySelector('textarea[name="result"]');
var count = function(){
var value = $input.value.trim();
if(value){
var result = relationship({text:value,type:'chain'});
if(result.length){
$result.value = result.join('\n');
}else{
$result.value = '貌似他/她跟你不是很熟哦!';
}
}else{
$result.value = '';
}
};
$panel.querySelector('.btn-red').onclick = function(){
$result.value = $input.value = '';
};
$panel.querySelector('.btn-green').onclick = count;
})();
// 两者间称呼
(function(){
var $module = document.querySelector('.mod-panel');
var $panel = $module.querySelector('.c-panel:nth-child(3)');
var $radio = $panel.querySelectorAll('input[type="radio"]');
var $reverse = $panel.querySelectorAll('input[name="reverse2"]');
var $optimal = $panel.querySelectorAll('input[name="optimal"]');
var $person = $panel.querySelector('input[name="person"]');
var $target = $panel.querySelector('input[name="target"]');
var $result = $panel.querySelector('textarea[name="result"]');
var count = function(){
var person = $person.value.trim();
var target = $target.value.trim();
if(person){
if($reverse[0].checked){
var temp = target;
target = person;
person = temp;
}
var result = relationship({text:person,target:target,optimal:$optimal[0].checked});
if(result.length){
$result.value = result.join('\n');
}else{
$result.value = '他们貌似不是很熟哦!';
}
}else{
$result.value = '';
}
};
for(var i=0;i<$radio.length;i++){
$radio[i].onchange=function(){
if($result.value){
count();
}
}
}
$panel.querySelector('.btn-red').onclick = function(){
$result.value = $person.value = $target.value = '';
};
$panel.querySelector('.btn-green').onclick = count;
})();
// 两者的称呼
(function(){
var $module = document.querySelector('.mod-panel');
var $panel = $module.querySelector('.c-panel:nth-child(4)');
var $radio = $panel.querySelectorAll('input[type="radio"]');
var $optimal = $panel.querySelectorAll('input[name="optimal"]');
var $person = $panel.querySelector('input[name="person"]');
var $target = $panel.querySelector('input[name="target"]');
var $result = $panel.querySelector('textarea[name="result"]');
var count = function(){
var person = $person.value.trim();
var target = $target.value.trim();
if(person){
var result = relationship({text:person,target:target,type:'pair',optimal:$optimal[0].checked});
if(result.length){
$result.value = result.join('\n');
}else{
$result.value = '未找到合称!';
}
}else{
$result.value = '';
}
};
for(var i=0;i<$radio.length;i++){
$radio[i].onchange=function(){
if($result.value){
count();
}
}
}
$panel.querySelector('.btn-red').onclick = function(){
$result.value = $person.value = $target.value = '';
};
$panel.querySelector('.btn-green').onclick = count;
})();
</script>
<script async defer src="https://cdn.bootcdn.net/ajax/libs/github-buttons/2.21.1/buttons.min.js"></script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b86879c9cc57dd112fe1f7dd75206b82";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<script>
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
</body>
</html>