Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <HTA:APPLICATION ID="oHTA"
- APPLICATIONAME="myApp"
- MAXIMIZEBUTTON="no"
- SINGLEINSTANCE="yes"
- BORDER="thin"
- INNERBORDER="no">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Countdown</title>
- <script type="text/javascript">
- //<![CDATA[
- function e(id){return document.getElementById(id);}
- function addZeros(a,b){a=String(a);while(a.length<b)a='0'+a;return a;}
- var Countdown={
- element: null,
- intervalID: null,
- utc: 0,
- now: 0,
- fps: 1,
- init: function(el){
- this.element = el;
- this.utc = Math.floor(Date.UTC(2012, 11, 21, 11, 12, 0) / 1000);
- this.now = dt2ts(new Date());
- this.start();
- },
- update: function(){
- this.now = dt2ts(new Date());
- var sec = this.utc - this.now;
- this.element.innerHTML = Math.abs(sec) == sec ? formatTime(sec) : 'World didn\'t end, too bad.';
- },
- start: function(){
- if(!this.intervalID)this.intervalID = window.setInterval((function(self){
- return function(){self.update();};
- })(this), 1000 / this.fps);
- this.update();
- },
- stop: function(){if(this.intervalID)window.clearInterval(this.intervalID);}
- };
- function dt2ts(dt){return Math.floor(dt.getTime()/1000);}
- function formatTime(s){
- return addZeros(Math.floor(s / 3600), 2)+':'+
- addZeros(Math.floor((s / 60) % 60), 2)+':'+
- addZeros(Math.floor(s % 60), 2);
- }
- window.onload=function(){
- var w=240,h=160;
- window.resizeTo(w,h);
- window.moveTo((screen.availWidth/2)-(w/2),(screen.availHeight/2)-(h/2));
- document.oncontextmenu=function(){return false;};
- document.body.onselectstart=function(){return false;};
- Countdown.init(e('countdown'));
- };
- //]]>
- </script>
- <style type="text/css">
- /*<![CDATA[*/
- *{cursor:default;}
- body{overflow:auto;font:13px Tahoma;background-color:ButtonFace;}
- #page{margin-top:55px;text-align:center;}
- /*]]>*/
- </style>
- </head>
- <body>
- <div id="page">
- <div id="countdown"> </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement