-
Notifications
You must be signed in to change notification settings - Fork 0
/
crazy.html
176 lines (169 loc) · 6.11 KB
/
crazy.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
<!DOCTYPE html>
<html lang="cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>疯狂星期X-要钱神器</title>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2597042766299857"
crossorigin="anonymous"></script>
<script defer src="https://umami.jerryz.com.cn/script.js" data-website-id="319efe93-a9d5-4f43-bfad-7bb27b46f56c"></script>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
<style>
:root {
--primary-color: #6750A4;
--on-primary-color: #FFFFFF;
--surface-color: #FFFBFE;
--on-surface-color: #1C1B1F;
--secondary-color: #E8DEF8;
--error-color: #B00020;
--border-radius: 16px;
}
body {
font-family: 'Roboto', sans-serif;
margin: 0;
padding: 20px;
background-color: var(--surface-color);
color: var(--on-surface-color);
transition: all 0.3s ease;
display: flex;
flex-direction: column;
align-items: center;
min-height: 100vh;
}
.container {
max-width: 600px;
width: 100%;
background-color: #FFFFFF;
border-radius: var(--border-radius);
box-shadow: 0 8px 16px rgba(0,0,0,0.15);
overflow: hidden;
transition: box-shadow 0.3s ease;
}
.container:hover {
box-shadow: 0 12px 24px rgba(0,0,0,0.2);
}
.app-bar {
background-color: var(--primary-color);
color: var(--on-primary-color);
padding: 20px;
font-size: 24px;
font-weight: 500;
text-align: center;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.content {
padding: 24px;
display: flex;
flex-direction: column;
align-items: center;
}
#number {
width: 100%;
padding: 12px;
font-size: 18px;
border: 2px solid var(--secondary-color);
border-radius: var(--border-radius);
margin-bottom: 20px;
}
.button {
background-color: var(--primary-color);
color: var(--on-primary-color);
border: none;
padding: 12px 24px;
border-radius: 16px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
margin-bottom: 20px;
width: 100%;
}
.button:hover {
background-color: var(--primary-color);
transform: translateY(-2px);
box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}
.button:active {
transform: translateY(0);
box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}
#result {
font-size: 24px;
font-weight: 500;
margin-top: 20px;
text-align: center;
min-height: 36px;
}
#copyButton {
display: none;
}
.instructions {
background-color: var(--secondary-color);
padding: 20px;
border-radius: var(--border-radius);
margin-top: 20px;
}
.instructions ul {
list-style-type: none;
padding: 0;
}
.instructions li {
margin-bottom: 10px;
}
</style>
</head>
<body>
<div class="container">
<div class="app-bar">疯狂星期X</div>
<div class="content">
<input type="text" id="number" placeholder="请输入金额">
<button class="button" onclick="calculate()">计算</button>
<div id="result"></div>
<button id="copyButton" class="button" onclick="copyResult()">复制结果</button>
<div class="instructions">
<strong>使用说明:</strong>
<ul>
<li>向朋友开口要钱时是否会感到尴尬?你可以试试这款神器!</li>
<li>点击 "计算",将会计算出金额对应的"疯狂星期几"。(以"今天是疯狂星期四,v我50"为基准进行计算)</li>
<li>点击 "复制结果"按钮,可以将结果复制到粘贴板。把它直接发给朋友吧!</li>
</ul>
</div>
</div>
</div>
<script>
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
function convertToChinese(num) {
const chineseNum = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十'];
if(Number.isInteger(num) && num >= 1 && num <= 10) {
return chineseNum[num - 1];
} else {
return num.toFixed(2);
}
}
function calculate() {
const number = document.getElementById('number').value;
if (!isNumber(number) || number <= 0) {
document.getElementById('result').textContent = "输入错误";
document.getElementById('copyButton').style.display = 'none';
return;
}
let result = (4 * number) / 50;
result = `今天是疯狂星期${convertToChinese(result)},v我${number}`;
document.getElementById('result').textContent = result;
document.getElementById('copyButton').style.display = 'block';
}
function copyResult() {
var copyText = document.getElementById("result");
var textArea = document.createElement("textarea");
textArea.value = copyText.textContent;
document.body.appendChild(textArea);
textArea.select();
document.execCommand("Copy");
textArea.remove();
alert("结果已复制到剪贴板!");
}
</script>
</body>
</html>