Initial commit

This commit is contained in:
octycs 2020-12-22 18:54:35 +01:00
commit 11f9e725da
2 changed files with 148 additions and 0 deletions

71
index.css Normal file
View File

@ -0,0 +1,71 @@
body {
background: #000;
color: #FFF;
font-family: sans-serif;
}
#bottom-bar {
position: fixed;
bottom: 0;
/*left: 0;*/
margin-bottom: 20px;
font-size: 14px;
overflow: hidden;
/*padding-left: 100%;
box-sizing: content-box;*/
}
* { box-sizing: border-box; }
/* OUTER CONTAINER */
#bottom-bar {
width: 100%;
overflow: hidden; /* Hide scroll bar */
}
/* MIDDLE CONTAINER */
#ticker-wrap {
width: 100%;
padding-left: 100%; /* Push contents to right side of screen */
}
/* INNER CONTAINER */
@keyframes ticker {
0% { transform: translate3d(-20%, 0, 0); }
100% { transform: translate3d(-100%, 0, 0); }
}
#ticker {
/* Basically move items from right side of screen to left in infinite loop */
display: inline-block;
white-space: nowrap;
padding-right: 100%;
animation-iteration-count: infinite;
animation-timing-function: linear;
animation-name: ticker;
animation-duration: 120s;
}
/* ITEMS */
.item{
display: inline-block; /* Lay items in a horizontal line */
padding: 10px 36px;
font-size: 22px;
}
.item > img {
height: 32px;
vertical-align: middle;
}
.item > span.user {
color: #fff;
margin: 0 20px;
vertical-align: middle;
}
.item > span.content {
color: #fff;
vertical-align: middle;
}

77
index.html Normal file
View File

@ -0,0 +1,77 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="favicon.ico">
<link rel="stylesheet" href="index.css">
<!--<script src="recent.js"></script>-->
<title>rC3 Stream Overlay</title>
</head>
<body style="background:#000">
<main>
<div id="bottom-bar" class="visible">
<div id="ticker-wrap">
<div id="ticker">
<div class="item">Helo 1 sadfsa df sa df as df as dfas d f as df as df sa df a sdf asdf as fd sad f sa df sa fd sa fd sa fd sa df sa df asdf sa df sa df s af</div>
<div class="item">Helo 2 s adf safd sad fs df sa f sa f sa df sa df sa df a sd f asd f safd sad f safd asfd sadf a sfd sadf asdf a sdf a sdf sa fd</div>
</div>
</div>
</div>
</main>
<script>
var tweets = {};
function update_tweets() {
var request = new XMLHttpRequest();
request.open('GET', 'https://api.octycs.eu/tweets-rc3.json', true);
request.onload = function() {
if (this.status >= 200 && this.status < 400) {
tweets = JSON.parse(this.response);
update_tweet_ticker();
} else {
// We reached our target server, but it returned an error
console.log(this);
}
};
request.onerror = function(e) {
console.log(e);
};
request.send();
}
function update_tweet_ticker() {
var ticker = document.getElementById("ticker");
ticker.innerHTML = "";
for (var i in tweets.data) {
//console.log(tweets.data[i].text);
var item = document.createElement("div");
item.className = "item";
var img = document.createElement("img");
img.src = tweets.includes.users[i].profile_image_url;
item.appendChild(img);
var user = document.createElement("span");
user.className = "user";
var uname = tweets.includes.users[i].username;
user.innerText = "@" + uname;
item.appendChild(user);
var content = document.createElement("span");
content.className = "content";
var text = tweets.data[i].text;
text = text.replace(/\n/g, "↲");
content.innerText = text;
item.appendChild(content);
ticker.appendChild(item);
}
}
update_tweets();
</script>
</body>
</html>