Skip to content

Commit 9bb4f55

Browse files
committed
Add discord hidden ping generator
TODO: add disabled button styles
1 parent 0209c52 commit 9bb4f55

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta name="nav-title" content="Discord hidden ping generator" />
7+
<title>Discord hidden ping generator</title>
8+
<link rel="stylesheet" href="css/global.css" />
9+
</head>
10+
<body>
11+
<a href="nav.html"><button>&lt; back</button></a>
12+
13+
<style>
14+
body > div {
15+
display: flex;
16+
flex-direction: column;
17+
padding-top: 8px;
18+
gap: 8px;
19+
}
20+
textarea {
21+
width: fit-content;
22+
}
23+
.chars span {
24+
color: #f00;
25+
font-weight: bold;
26+
}
27+
</style>
28+
<button
29+
onclick="navigator.clipboard.writeText(document.getElementById('result').value).then(()=>alert('Copied')).catch(()=>alert('Copy failed'))"
30+
id="copy"
31+
disabled
32+
>
33+
Copy result
34+
</button>
35+
<span id="chars">0/1000 characters</span>
36+
<div>
37+
<textarea
38+
rows="9"
39+
cols="40"
40+
id="message"
41+
placeholder="Visible message"
42+
oninput="update()"
43+
></textarea>
44+
<textarea
45+
rows="9"
46+
cols="40"
47+
id="hidden"
48+
placeholder="Hidden message"
49+
oninput="update()"
50+
></textarea>
51+
<textarea
52+
rows="9"
53+
cols="40"
54+
id="result"
55+
placeholder="Result (updates live)"
56+
disabled
57+
></textarea>
58+
</div>
59+
<script>
60+
function update() {}
61+
Array.from(document.getElementsByTagName("textarea")).forEach(
62+
(e) => (e.value = ""),
63+
);
64+
65+
function update() {
66+
let message = document.getElementById("message").value,
67+
hidden = document.getElementById("hidden").value;
68+
document.getElementById("result").value =
69+
`${message}${decodeURIComponent("||\u200b||").repeat(200)}${hidden}`;
70+
71+
document.getElementById("copy").disabled = false;
72+
73+
document.getElementById("chars").innerText =
74+
`${message.length + hidden.length}/1000 characters`;
75+
if (message.length + hidden.length > 1000)
76+
document.body.classList.add("chars");
77+
else document.body.classList.remove("chars");
78+
}
79+
</script>
80+
</body>
81+
</html>

0 commit comments

Comments
 (0)