forked from mumuy/relationship
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
216 lines (214 loc) · 7.72 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
<title>中国亲戚关系计算器</title>
<meta name="keywords" content="家庭称谓,亲戚关系计算器,称呼计算器,关系算法,親戚關係稱呼">
<meta name="description" content="一款最全面的中国亲戚关系计算器,走亲访友,逢年过节必备神器。它避免了叫错、不会叫亲戚的尴尬,人人必备亲戚关系工具。">
<link rel="stylesheet" href="style/index.css">
<script type="text/javascript">
setTimeout(function(){
if(location.hostname.indexOf('passer-by.com')<0){
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="mod-head">
<a href="/">返回首页 >></a>
</div>
</div>
<div class="container">
<div class="content">
<div class="mod-panel">
<div class="hd">
<h1>中国亲戚关系计算器</h1>
<p>逢年过节遇到三姑六婆,拒绝叫不出口的尴尬!轻松搞定亲戚关系~</p>
</div>
<div class="bd">
<div class="row">
<div class="field">
计算类型:
<label for="default">
<input id="default" type="radio" name="type" value="default" checked>
<span>找称呼</span>
</label>
<label for="chain">
<input id="chain" type="radio" name="type" value="chain">
<span>找关系</span>
</label>
</div>
</div>
<div class="row group">
<div class="field">
我的性别:
<label for="male">
<input id="male" type="radio" name="sex" value="1" checked>
<span>男</span>
</label>
<label for="female">
<input id="female" type="radio" name="sex" value="0">
<span>女</span>
</label>
</div>
<div class="field">
称呼方式:
<label for="call">
<input id="call" type="radio" name="reverse" value="0" checked>
<span>我称呼对方</span>
</label>
<label for="called">
<input id="called" type="radio" name="reverse" value="1">
<span>对方称呼我</span>
</label>
</div>
</div>
<div class="row">
<textarea id="input" placeholder="称谓间用'的'字分开…"></textarea>
</div>
<p>
<label>快速选择:</label><br/>
<span>
<button class="btn" data-value="爸爸">父</button>
<button class="btn" data-value="妈妈">母</button>
</span>
<span>
<button class="btn" data-value="老公">夫</button>
<button class="btn" data-value="老婆">妻</button>
</span>
<span>
<button class="btn" data-value="儿子">子</button>
<button class="btn" data-value="女儿">女</button>
</span>
<span>
<button class="btn" data-value="哥哥">兄</button>
<button class="btn" data-value="弟弟">弟</button>
</span>
<span>
<button class="btn" data-value="姐姐">姐</button>
<button class="btn" data-value="妹妹">妹</button>
</span>
</p>
<p>
<button class="input-button">回退</button>
<button class="input-button">清空</button>
<button class="input-button">计算</button>
</p>
<p>计算结果:</p>
<p>
<textarea id="reslut" readonly></textarea>
</p>
</div>
<div class="ft">
<div class="copy">
<p><a class="github-button" href="https://github.com/mumuy" data-style="mega" data-count-href="/mumuy/followers" data-count-api="/users/mumuy#followers" data-count-aria-label="# followers on GitHub" aria-label="Follow @mumuy on GitHub" rel="nofollow">Follow @mumuy</a>
<a class="github-button" href="https://github.com/mumuy/relationship" data-style="mega" data-count-href="/mumuy/relationship/stargazers" data-count-api="/repos/mumuy/relationship#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star mumuy/relationship on GitHub" rel="nofollow">Star</a></p>
<p>android版下载:<a href="http://passer-by.com/relationship/app.html" target="_blank">三姑六婆计算器</a></p>
<p>© <a href="http://passer-by.com">passer-by.com</a></p>
</div>
</div>
</div>
<div class="mod-qrcode">
<div class="box"><img src="image/qrcode.jpg" width="150" alt="亲戚关系微信小程序"/></div>
<p>微信扫一扫,使用小程序</p>
</div>
<div class="mod-my">
<div class="box"><img src="image/my.png" width="189" alt="我的活动二维码"/></div>
<p>一起玩起来吧</p>
</div>
</div>
</div>
</div>
<script src="script/common.js"></script>
<script src="script/relationship.js"></script>
<script>
(function(){
var $type = document.getElementsByName('type');
var $sex = document.getElementsByName('sex');
var $reverse = document.getElementsByName('reverse');
var $radio = document.getElementsByTagName('INPUT');
var $textarea = document.getElementsByTagName('TEXTAREA');
var $group = DOMUtil.getElementsByClassName('group')[0];
var $btns = DOMUtil.getElementsByClassName('btn');
var $buttons = DOMUtil.getElementsByClassName('input-button');
var toggle = function(sex){
if(sex){ //男女判断
$btns[2].disabled=true;
$btns[3].disabled=false;
}else{
$btns[2].disabled=false;
$btns[3].disabled=true;
}
}
var count = function(){
var value = $textarea[0].value.trim();
if(value){
var sex = $sex[0].checked?1:0;
var type = $type[0].checked?'default':'chain';
var reverse = !$reverse[0].checked;
var result = relationship({text:value,sex:sex,reverse:reverse,type:type});
$textarea[1].value = '';
if(result.length){
$textarea[1].value = result.join('\n');
}else{
$textarea[1].value = '貌似他/她跟你不是很熟哦!';
}
}else{
$textarea[1].value = '';
}
}
for(var i=0;i<$btns.length;i++){
$btns[i].onclick = function(){
var value = $textarea[0].value.trim();
var name = this.getAttribute('data-value');
if(value){
$textarea[0].value= value+'的'+name;
}else{
$textarea[0].value= name;
}
toggle('爸爸,老公,儿子,哥哥,弟弟'.indexOf(name)>-1);
}
}
for(var i=0;i<$radio.length;i++){
$radio[i].onchange=function(){
toggle($sex[0].checked);
$group.style.display = $type[0].checked?'block':'none';
if($textarea[1].value){
count();
}
}
}
$buttons[0].onclick = function(){
var value = $textarea[0].value.trim();
var index = value.lastIndexOf('的');
index = Math.max(0,index);
var search = value.substr(0,index);
$textarea[0].value = search;
$textarea[1].value = '';
var name = search.split('的').pop();
if(!name){
toggle($sex[0].checked);
}else{
toggle('爸爸,老公,儿子,哥哥,弟弟'.indexOf(name)>-1);
}
}
$buttons[1].onclick = function(){
$textarea[1].value = $textarea[0].value = '';
toggle($sex[0].checked);
}
$buttons[2].onclick = count;
toggle($sex[0].checked);
})();
</script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
<div style="display: none;">
<script src="https://s95.cnzz.com/z_stat.php?id=1258310068&web_id=1258310068"></script>
</div>
</body>
</html>