add random quote

This commit is contained in:
dongdigua 2022-10-29 13:26:19 +08:00
parent 44f49f2afa
commit fdcd5c7efa
3 changed files with 22 additions and 8 deletions

View File

@ -25,19 +25,21 @@
<div class="home p-contact contact h-card vcard"> <div class="home p-contact contact h-card vcard">
<pre> <pre>
(let ((name "dongdigua") (let ((name "dongdigua")
(blog "<a href=posts>posts/</a>") (blog "<a href=https://dongdigua.github.io/posts>posts/</a>")
(feed "<a href=feed.xml>feed.xml</a>") (feed "<a href=https://dongdigua.github.io/feed.xml>feed.xml</a>")
(github "<a href=https://github.com/dongdigua>@dongdigua</a>") (github "<a href=https://github.com/dongdigua>@dongdigua</a>")
(payment "<a href=xmr.txt>monero</a>") (payment "<a href=https://dongdigua.github.io/xmr.txt>monero</a>")
(pgp "<a href=pgpkey.txt>0x56CEE157C9F5334F</a>") (pgp "<a href=https://dongdigua.github.io/pgpkey.txt>0x56CEE157C9F5334F</a>")
(interests (interests
'("computer science" '("computer science"
"cyber security" "cyber security"
"GeoGebra" "GeoGebra"
"Minecraft redstone survival" "Minecraft redstone survival"
"anime" "anime"
(Lost (In (Superfluous (Parentheses)))))))) (Lost (In (Superfluous (Parentheses)))))))
(random-quote
"<span id="quote"></span>"))
</pre> </pre>
</div> </div>
</body> </body>
<script src="./js/random-quote.js"></script>

12
js/random-quote.js Normal file
View File

@ -0,0 +1,12 @@
var data = [
"富强民主闻名和谐, 自由平等公正法治, 爱国敬业诚信友善",
"解放思想, 实事求是, 与时俱进",
"You are not alone",
"The internet is FULL, go away!",
"May the --force be with you",
"Software that sucks less",
];
var index = Math.floor((Math.random() * data.length));
window.document.getElementById("quote").innerHTML = data[index];

View File

@ -279,7 +279,7 @@ defmodule Server do
case find_peer(user_data) do case find_peer(user_data) do
nil -> add_peer(user_data) nil -> add_peer(user_data)
{{peer0, msg0}, {peer1, msg1}} -> { {peer0, msg0}, {peer1, msg1} } ->
:gen_udp.send(socket, peer0, msg0) :gen_udp.send(socket, peer0, msg0)
:gen_udp.send(socket, peer1, msg1) :gen_udp.send(socket, peer1, msg1)
end end