Skip to content

Instantly share code, notes, and snippets.

@objarni
Last active December 3, 2015 18:22
Show Gist options
  • Save objarni/9863471 to your computer and use it in GitHub Desktop.
Save objarni/9863471 to your computer and use it in GitHub Desktop.
Poor mans digital sign
<html>
<head>
<title>Poor mans digital sign</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<script>
var urls = [
'http://www.bloggar.se',
'http://www.knuff.se',
'http://objarni.wordpress.com',
];
var switchEvery = 10;
</script>
</head>
<body onload="countDown()">
<center>
<iframe id='frame' frameBorder='0' width='100%' height='95%'>
</iframe>
<div style='padding:5px; background-color:#ddddff;'>
<span id='infoRow'></span>
<span><a href="https://gist.github.com/objarni/9863471">Make your own</a><span>
</div>
</center>
<script>
var currentIndex = urls.length-1;
var secondsLeft = 0;
function $(id) { return document.getElementById(id); }
function currentUrl() {
return urls[currentIndex];
}
function buildStatusMessage() {
return currentUrl() + ' (' + secondsLeft + ')';
}
function countDown() {
secondsLeft--;
if(secondsLeft < 0) {
secondsLeft = switchEvery;
skipToNext();
}
$('infoRow').innerHTML = buildStatusMessage();
setTimeout(countDown, 1000);
}
function skipToNext() {
currentIndex = (currentIndex + 1) % urls.length;
$('frame').src = currentUrl();
}
</script>
</body>
</html>
@objarni
Copy link
Author

objarni commented Apr 1, 2014

I'd like to be able to edit the URL list and switch parameters in realtime, so that I don't have to fiddle with files at all...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment