-
Notifications
You must be signed in to change notification settings - Fork 0
/
wisdom.html
71 lines (63 loc) · 2.08 KB
/
wisdom.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE HTML>
<html>
<head>
<meta property="og:image" content="https://effortlogger.com/bw.png" />
<meta property="og:title" content="Gain wisdom" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://effortlogger.com/wisdom.html" />
<meta name="twitter:card" content="summary_large_image">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<p>This website is NOT affiliated with ASU or Lynn Robert Carter</p>
<h1>Gain Wisdom</h1>
<img src="/bw.png" width=300 height=300>
<br>
<button onclick="wisdom()">Gain Wisdom</button>
<br>
<p id="lore"></p>
<p>Have wisdom to share from the <b>Great Carter</b>? <a href="https://forms.gle/gDXp2MRxVNHKQmdw7">Share it here</a></p>
</body>
<script>
let all_lore = []
let less_random_lore = []
fetch(
"https://sheets.googleapis.com/v4/spreadsheets/1LFj-olH2e_Ju5KK2IvNZ6cP7p2ygUIX0xD_qpe8bsUA/values/B2:B10000?key=AIzaSyAae6-k0pmXQK5XdJpuwRnCFhUBJ3qU_t4"
).then((response) => response.json()
).then((cells) => cells.values.map((v) => v[0])
).then(lore => {
//clone the array so it is less random. This prevents people from seeing the same
//lore more than once while cycling through.
all_lore = lore;
less_random_lore = Array.from(lore);
});
function reduce(index) {
less_random_lore.splice(index, 1);
if(less_random_lore.length === 0) {
less_random_lore = Array.from(all_lore);
}
}
function wisdom() {
const random_element = Math.floor(Math.random() * less_random_lore.length);
document.getElementById("lore").innerText = `"${less_random_lore[random_element]}" - Professor Lynn Robert Carter`;
reduce(random_element);
}
</script>
<style>
/*i forgot if its # or . for id*/
#lore {
max-width: 35%;
}
.lore {
max-width: 35%;
}
@media screen and (max-width:1000px){
#lore {
max-width: 90%;
}
.lore {
max-width: 90%;
}
}
</style>
</html>