This commit is contained in:
Tyler Hallada 2018-07-04 19:24:29 -04:00
commit 0feaf568e9
3 changed files with 92 additions and 0 deletions

54
billboard.js Normal file
View File

@ -0,0 +1,54 @@
function genRandomText(length) {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 .?-!(),\"'";
for (var i = 0; i < length; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
function genRandomInt(min, max) {
// inclusive min & max
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function shiftArrayToRight(arr, places) {
for (var i = 0; i < places; i++) {
arr.unshift(arr.pop());
}
}
function textFillsScreen() {
var root = document.compatMode == 'BackCompat' ? document.body : document.documentElement;
return root.scrollHeight > root.clientHeight;
}
function fillScreenWithWhitespace() {
var text = document.getElementById("text");
var charArray = ["&nbsp"];
var whitespace = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
while(!textFillsScreen()) {
text.innerHTML += whitespace;
charArray.push.apply(charArray, ["&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;",
"&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;"]);
}
for (var i = 0; i < 26; i++) {
text.innerHTML += whitespace;
charArray.push.apply(charArray, ["&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;",
"&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;"]);
}
return charArray;
}
window.onload = function () {
var textElem = document.getElementById('text');
var charArray = fillScreenWithWhitespace();
window.setInterval(function () {
for (var i = 0; i < genRandomInt(1, 4); i++) {
charArray[genRandomInt(0, charArray.length - 1)] = genRandomText(1);
textElem.innerHTML = charArray.join("");
}
shiftArrayToRight(charArray, 1);
}, 25)
}

38
index.html Normal file
View File

@ -0,0 +1,38 @@
<html lang="en">
<head>
<title>Billboard</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- open graph tags -->
<meta property="og:title" content="Billboard" />
</head>
<body>
<style>
@font-face {
font-family: "LinearX";
src: url("linearx-20171201-180714-516307-740daec-24931da.ttf") format("truetype");
}
body {
font-family: "LinearX";
line-height: 13px;
font-size: 4pt;
color: LimeGreen;
background-color: black;
padding: 0;
word-break: break-all;
overflow: hidden;
}
</style>
<p id="text">&nbsp;</p>
</body>
<script async src="billboard.js"></script>
<!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-39880341-1', 'auto');
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<!-- End Google Analytics -->
</html>

Binary file not shown.