Skip to content

Instantly share code, notes, and snippets.

@v2keener
Last active December 17, 2015 23:39
Show Gist options
  • Save v2keener/5690829 to your computer and use it in GitHub Desktop.
Save v2keener/5690829 to your computer and use it in GitHub Desktop.
<h1>This page is meant to redirect you to Gustavo Keener's new site,</h1>
<h1 style="padding-left: 25%;"><a href="http://www.keenerweb.com">KeenerWeb™</a></h1>
<h1>in <span id="number">8</span> seconds<span id="wait">...</span></h1>
<script type="text/javascript">
var span = document.getElementById('wait'), number = document.getElementById('number');
var waitStates = ['....', '..', '...'], first = true;
var count = 0, intervalSeconds = 0.5, maxSeconds = 8, intervalsPerSecond = (1 / intervalSeconds), maxCount = (maxSeconds * intervalsPerSecond);
var interval = window.setInterval(function () {
if (count >= maxCount) {
window.clearInterval(interval);
try {
window.location = "http://www.keenerweb.com";
}
catch (e) {
alert('There was an error sending you to "http://www.keenerweb.com". This could be due to a network error or any number of horrible things. Sorry.');
}
}
else {
span.innerHTML = waitStates[(count % waitStates.length)];
if ((count % parseInt(intervalsPerSecond)) === 0) {
if (first) { first = false; }
else {
var val = parseInt(number.innerHTML);
number.innerHTML = (val - 1);
}
}
}
count++;
}, (intervalSeconds * 1000));
try {
window.location = "http://www.keenerweb.com";
} catch (e) {
// Ignore... We'll be trying again in 8 seconds anyway...
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment