Last active
August 29, 2015 14:21
-
-
Save perguth/241d46b48d062d158a81 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
function startTime() { | |
var today=new Date(); | |
var alarm=new Date(today.getFullYear(),today.getMonth(),today.getDate(),11,00,00,0); | |
show(today,'current'); | |
show(alarm,'alarm'); | |
if(!checkAlarm(alarm, today)) { | |
timed=setTimeout(function(){startTime()},1000); | |
} | |
} | |
function show(date, div) { | |
var h=date.getHours(); | |
var m=date.getMinutes(); | |
var s=date.getSeconds(); | |
// leading zero | |
m= m < 10 ? "0" + m : m; | |
s= s < 10 ? "0" + s : s; | |
document.getElementById(div).innerHTML=h+":"+m+":"+s; | |
} | |
function checkAlarm(alarm, clock) { | |
if (alarm.getTime() < clock.getTime() ) { | |
window.location = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'; //https://www.youtube.com/watch?v=vUi1PdYn5nk | |
return true; | |
} | |
return false; | |
} | |
</script> | |
<style type="text/css"> | |
body { | |
background: #000; | |
} | |
div { | |
font-size: 300px; | |
text-align: center; | |
} | |
div#current { | |
color: #CEFC26; | |
} | |
div#alarm { | |
color: #8C2951; | |
} | |
</style> | |
</head> | |
<body onload="startTime()"> | |
<div id="current"></div> | |
<div id="alarm"></div> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment