Skip to content

Instantly share code, notes, and snippets.

@uggedal
Created March 5, 2013 17:44
Show Gist options
  • Save uggedal/5092283 to your computer and use it in GitHub Desktop.
Save uggedal/5092283 to your computer and use it in GitHub Desktop.
<style>
h1 {
font-size: 55em;
line-height: 1.25;
text-align: center;
}
</style>
<h1 id=time></h1>
<script>
var t = document.getElementById("time"),
end = /#(\d{2}):(\d{2})/.exec(window.location.hash),
endHour = parseInt(end[1], 10),
endMinute = parseInt(end[2], 10);
var poll = function() {
var d = new Date,
remaining = d.getHours() == endHour ? 0 : 60;
setTimeout(function() {
t.textContent = remaining - (d.getMinutes() - endMinute);
poll();
}, 1000);
}
poll();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment