Compare commits
7 Commits
ae9280af68
...
f9190a8773
Author | SHA1 | Date |
---|---|---|
|
f9190a8773 | |
|
46964b5c2b | |
|
ddb1ceb146 | |
|
6fa4283e85 | |
|
ef2516fd4d | |
|
0551fe3ff5 | |
|
22636ebbd5 |
|
@ -2,4 +2,4 @@
|
|||
|
||||
this is the code for [blackout.tilde.town](https://blackout.tilde.town).
|
||||
|
||||
the database that powers this was made using [gutchunk](https://git.tilde.town/~vilmibm/gutchunk).
|
||||
the database that powers this was made using [gutchunk](https://git.tilde.town/vilmibm/gutchunk).
|
||||
|
|
4
main.go
4
main.go
|
@ -50,6 +50,9 @@ func main() {
|
|||
randMax := big.NewInt(maxID)
|
||||
|
||||
spaceRE := regexp.MustCompile(`[\t\v\f\r ]+`)
|
||||
r.HEAD("/", func(c *gin.Context) {
|
||||
c.String(http.StatusOK, "")
|
||||
})
|
||||
|
||||
r.GET("/", func(c *gin.Context) {
|
||||
db, err := connectDB()
|
||||
|
@ -58,6 +61,7 @@ func main() {
|
|||
c.String(http.StatusInternalServerError, "oh no.")
|
||||
return
|
||||
}
|
||||
defer db.Close()
|
||||
|
||||
id, err := rand.Int(rand.Reader, randMax)
|
||||
if err != nil {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<style>
|
||||
body {
|
||||
background-color: black;
|
||||
color: black;
|
||||
}
|
||||
.rainbow {
|
||||
animation-name: rainbow;
|
||||
|
@ -63,6 +64,10 @@
|
|||
background-color: white;
|
||||
}
|
||||
|
||||
#paper span.black:hover {
|
||||
background-color: grey;
|
||||
}
|
||||
|
||||
#aboutToggle {
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
|
@ -97,7 +102,7 @@
|
|||
-->
|
||||
<center>
|
||||
<p>
|
||||
<button id="copy">copy to clipboard</button>
|
||||
<button id="copy">copy text to clipboard</button>
|
||||
</p>
|
||||
<p>
|
||||
<a id="aboutToggle" href="">ABOUT</a>
|
||||
|
@ -112,6 +117,9 @@
|
|||
<p>
|
||||
IT IS <strong>#{{.ID}}</strong> OUT OF <strong>{{.MaxID}}</strong> POSSIBLE TEXT CHUNKS. RELOAD FOR ANOTHER.
|
||||
</p>
|
||||
<p>
|
||||
THIS IS A <a href="https://tilde.town/~vilmibm/blog/#blackout">BLOG POST</a>. THIS IS <a href="https://git.tilde.town/vilmibm/gutchunk">SOURCE</a> <a href="https://git.tilde.town/vilmibm/blackout">CODE</a>.
|
||||
</p>
|
||||
<p>
|
||||
THIS IS A PROJECT BY <a href="https://tilde.town/~vilmibm">~VILMIBM</a>.
|
||||
</p>
|
||||
|
@ -130,6 +138,18 @@
|
|||
let toCopy = "";
|
||||
document.querySelectorAll("#paper span").forEach(span => {
|
||||
let guts = span.innerHTML;
|
||||
if (!span.classList.contains("black")) {
|
||||
toCopy += guts.trim()+" ";
|
||||
}
|
||||
if (guts.includes("\n") && toCopy[toCopy.length-1] != "\n") {
|
||||
toCopy += "\n"
|
||||
}
|
||||
|
||||
/*
|
||||
// I think this method of converting to plaintext is interesting but
|
||||
// it's not very practical--it's way too many characters to
|
||||
// realistically put in a toot or alt text or similar. I may add a
|
||||
// "copy wide text" button that re-introduces this behavior.
|
||||
let out = "";
|
||||
if (span.classList.contains("black")) {
|
||||
for (let i = 0; i < guts.length; i++) {
|
||||
|
@ -142,8 +162,8 @@
|
|||
} else {
|
||||
out = guts;
|
||||
}
|
||||
|
||||
toCopy += out;
|
||||
toCopy += out
|
||||
*/
|
||||
});
|
||||
|
||||
navigator.clipboard.writeText(toCopy).then(() => {
|
||||
|
|
Loading…
Reference in New Issue