<!DOCTYPE html>
<html lang="en-us">
<head>
<title>Sleep Timer. DEV SITE.</title>
<meta charset="utf-8" />
<meta name="author" content="Jeff Martin, (970) 726-8326" />
<meta name="description" content="Sleep Timer DEV SITE." />
<meta name="keywords" content="sleep timer" />
<script src="class.Timer.js" type="text/javascript"></script>
<style media="screen" type="text/css">
div#configure {
float: left;
}
div#currentTime {
float: right;
font-size: 3em;
line-height: 3em;
}
div#timeContainer {
float: right;
}
div#timeLabel {
float: left;
font-size: 3em;
line-height: 3em;
padding-right: 40px;
}
iframe {
border-top: 5px solid #000000;
height: 700px;
width: 100%
}
</style>
<script type="text/javascript">
var
T = null,
newWindow = null;
function configure() {
var
time = document.getElementById('startTime').value,
timeComponents = time.split(':'),
i = 0,
startTime = 0;
timeComponents.reverse();
// Open the external website
if (document.getElementById('newTabBox').checked) {
newWindow = window.open(document.getElementById('externalSiteURL').value, '_blank');
} else {
// We are closing newWindow at the end, so if we do not open a new window, we want to close the current window
newWindow = window;
window.open(document.getElementById('externalSiteURL').value, 'externalSiteFrame');
}
// Parse the time string to get a total number of seconds to keep external site open
for (i = 0; i < timeComponents.length; i++) {
switch(i) {
case 0 : // seconds
startTime += timeComponents[i] * 1;
break;
case 1 : // minutes
startTime += timeComponents[i] * 60;
break;
case 2 : // hours
startTime += timeComponents[i] * 3600;
break;
case 3 : // days
startTime += timeComponents[i] * 3600 * 24;
break;
}
}
// Get rid of T if already has been configured
if (T) {
T.kill();
delete T;
}
T = new Timer(startTime, 1000, 'zero');
T.displayTimeId = 'currentTime';
T.updateDisplayFreq = 60;
T.subscribe(T.Events.TICK, T.displayTime);
T.subscribe(T.Events.END, function () { newWindow.close(); });
T.start();
// This is just here to prevent the form from being submitted
return false;
}
</script>
</head>
<body>
<header>
<section id="topDisplay">
<div id="configure">
<form onsubmit="return configure()">
<label>Start time (dd:hh:mm:ss):</label><input type="text" id="startTime" name="startTime" value="00:02:00:00" /><br />
<label>External website to show:</label><input type="text" id="externalSiteURL" name="externalSiteURL" value="http://iheartradio.com" /><br />
<label>Show website in new tab (check here if website refuses to show up in the iframe below):</label><input type="checkbox" id="newTabBox" name="newTabBox" /><br />
<button type="submit" id="configureButton">Go</button>
</form>
</div>
<div id="timeContainer">
<div id="timeLabel">Time til self destruct:</div>
<div id="currentTime">Not Configured</div>
</div>
</section>
</header>
<section id="wrapper">
<section id="subContent">
<iframe id="externalSiteFrame" name="externalSiteFrame">
</iframe>
</section> <!-- End content -->
<footer>
<hr />
<p>
<a href="http://www.dogsledrides.com/winterpark">Home</a>
</p>
</footer> <!-- End footer div -->
</section> <!-- End wrapper div -->
</body>
</html>
|