Last active
December 3, 2015 18:22
-
-
Save objarni/9863471 to your computer and use it in GitHub Desktop.
Poor mans digital sign
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
I'd like to have "nice title" for the URL, which can look really ugly. It should be a link, which opens in separate window. Would be cheap alternative to play/pause...
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
I'd like to have a pause button!