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).
|
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)
|
randMax := big.NewInt(maxID)
|
||||||
|
|
||||||
spaceRE := regexp.MustCompile(`[\t\v\f\r ]+`)
|
spaceRE := regexp.MustCompile(`[\t\v\f\r ]+`)
|
||||||
|
r.HEAD("/", func(c *gin.Context) {
|
||||||
|
c.String(http.StatusOK, "")
|
||||||
|
})
|
||||||
|
|
||||||
r.GET("/", func(c *gin.Context) {
|
r.GET("/", func(c *gin.Context) {
|
||||||
db, err := connectDB()
|
db, err := connectDB()
|
||||||
|
@ -58,6 +61,7 @@ func main() {
|
||||||
c.String(http.StatusInternalServerError, "oh no.")
|
c.String(http.StatusInternalServerError, "oh no.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
defer db.Close()
|
||||||
|
|
||||||
id, err := rand.Int(rand.Reader, randMax)
|
id, err := rand.Int(rand.Reader, randMax)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
background-color: black;
|
background-color: black;
|
||||||
|
color: black;
|
||||||
}
|
}
|
||||||
.rainbow {
|
.rainbow {
|
||||||
animation-name: rainbow;
|
animation-name: rainbow;
|
||||||
|
@ -63,6 +64,10 @@
|
||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#paper span.black:hover {
|
||||||
|
background-color: grey;
|
||||||
|
}
|
||||||
|
|
||||||
#aboutToggle {
|
#aboutToggle {
|
||||||
color: white;
|
color: white;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -97,7 +102,7 @@
|
||||||
-->
|
-->
|
||||||
<center>
|
<center>
|
||||||
<p>
|
<p>
|
||||||
<button id="copy">copy to clipboard</button>
|
<button id="copy">copy text to clipboard</button>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a id="aboutToggle" href="">ABOUT</a>
|
<a id="aboutToggle" href="">ABOUT</a>
|
||||||
|
@ -112,6 +117,9 @@
|
||||||
<p>
|
<p>
|
||||||
IT IS <strong>#{{.ID}}</strong> OUT OF <strong>{{.MaxID}}</strong> POSSIBLE TEXT CHUNKS. RELOAD FOR ANOTHER.
|
IT IS <strong>#{{.ID}}</strong> OUT OF <strong>{{.MaxID}}</strong> POSSIBLE TEXT CHUNKS. RELOAD FOR ANOTHER.
|
||||||
</p>
|
</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>
|
<p>
|
||||||
THIS IS A PROJECT BY <a href="https://tilde.town/~vilmibm">~VILMIBM</a>.
|
THIS IS A PROJECT BY <a href="https://tilde.town/~vilmibm">~VILMIBM</a>.
|
||||||
</p>
|
</p>
|
||||||
|
@ -130,6 +138,18 @@
|
||||||
let toCopy = "";
|
let toCopy = "";
|
||||||
document.querySelectorAll("#paper span").forEach(span => {
|
document.querySelectorAll("#paper span").forEach(span => {
|
||||||
let guts = span.innerHTML;
|
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 = "";
|
let out = "";
|
||||||
if (span.classList.contains("black")) {
|
if (span.classList.contains("black")) {
|
||||||
for (let i = 0; i < guts.length; i++) {
|
for (let i = 0; i < guts.length; i++) {
|
||||||
|
@ -142,8 +162,8 @@
|
||||||
} else {
|
} else {
|
||||||
out = guts;
|
out = guts;
|
||||||
}
|
}
|
||||||
|
toCopy += out
|
||||||
toCopy += out;
|
*/
|
||||||
});
|
});
|
||||||
|
|
||||||
navigator.clipboard.writeText(toCopy).then(() => {
|
navigator.clipboard.writeText(toCopy).then(() => {
|
||||||
|
|
Loading…
Reference in New Issue