-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhitokoto.html
42 lines (38 loc) · 894 Bytes
/
hitokoto.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
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<style>
#hitokoto {
font-size: 16px;
background-image: -webkit-linear-gradient(left, #6ad9c5, #72d39c, #bed851);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-family: "PingFang", sans-serif;
}
#output {
position: absolute;
top: 0;
left: 0;
opacity: 0;
z-index: -10;
}
</style>
<div class="result" onclick="copyText()">
<p id="hitokoto"></p>
</div>
<textarea id="output"></textarea>
<script>
function copyText() {
var text = document.getElementById("hitokoto").innerHTML;
var output = document.getElementById("output");
output.value = text;
output.select(); //选中文本
document.execCommand("copy");
window.alert("已复制");
}
</script>
<script src="https://v1.hitokoto.cn/?encode=js&select=%23hitokoto" defer></script>
</body>
</html>