-
Notifications
You must be signed in to change notification settings - Fork 0
/
mixercodelog.html
75 lines (74 loc) · 3.85 KB
/
mixercodelog.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
72
73
74
75
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SMITE Mixer Stream Chest Code Chat Tracker</title>
<style>
html {color:#333;}
body {margin:0;padding:0;}
main {margin:1em;}
aside {font-style: italic;}
.new {color:#338833; font-weight:bold;}
#relatedpages {background-color:#eeeeff;line-height:2em;padding:0.4em;font-style:normal;}
#relatedpages a {margin:0 0.4em;padding:0.2em;background-color:#ccccff;border-radius:6px;border:1px solid #ccccff;text-decoration:none;}
#relatedpages a:hover {background-color:#aaaaff;border-color:#aaaaff;color:#000;}
</style>
</head>
<body>
<aside id="relatedpages">See also: <a href="smitegods.html">SMITE Gods Overview</a><a href="god-skins.html">SMITE God Skins</a><a href="godstats.html">SMITE God Stats</a></aside>
<main>
<h1>SMITE Mixer Stream Chest Code Chat Tracker</h1>
<p style="color:red;"><b>Note:</b> Functionality currently broken. Microsoft technically restricted API data access. Adjusting is not trivial. I am looking into it.</p>
<p>The official <a href="https://mixer.com/SmiteGame">SMITE Mixer Stream @SmiteGame</a> regulary streams esport matches.</p>
<p>
During these streams chest codes are dropped from time to time.
The `!lastdrop` command triggers a message from `Scottybot` to everyone saying if there is an active code, and what it is.
</p>
<p>What this website does: Every 5 minutes the most recent chat history is checked for messages from Scottybot. These messages are displayed here.</p>
<p>You can then check these for changes and codes.</p>
<p>The list only shows the last 10 entries, and marks new messages in green and bold. Most recent is at the bottom.</p>
<aside><p>Note: This may not include all codes posted. Please enjoy the stream if you’re interested in it. ;)</p></aside>
<ul id="msgs">
</ul>
</main>
<script>
let url = 'https://mixer.com/api/v1/chats/19088261/history'
// Scottybot has user id 2685
let trackedUserId = 2685
let checkIntervalMin = 5
let maxElCount = 10
let loop = setInterval(update, checkIntervalMin * 60 * 1000)
update()
function update(){
let req = new XMLHttpRequest(); req.open('GET', url)
req.responseType = 'json'
req.send()
req.onload = function(event){
let req = event.target
let resp = req.response
resp.forEach(msg => {
if (msg.user_id === trackedUserId) {
append(msg.message.message[0].text)
}
})
append('^ results from checked at ' + (new Date()).toLocaleTimeString() + ' (of ' + resp.length + ' last msgs)')
window.scrollTo({'top': window.scrollMaxY})
}
function append(text){
let trg = document.getElementById('msgs')
let el = document.createElement('li')
let isNew = true
el.textContent = text
trg.childNodes.forEach(node => {if (isNew) {isNew = node.textContent != text;}})
if (isNew) {
el.classList.add('new')
}
trg.appendChild(el)
if (trg.childNodes.length > maxElCount) {
trg.childNodes[0].remove()
}
}
}
</script>
</body>
</html>