Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Shows days to christmas

  • Loading branch information...
commit e4e298ad10089c31b2facdfd6e5b0518e71efaf2 1 parent 51a4cad
@TShadwell authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 js/domtree.js
View
18 js/domtree.js
@@ -130,5 +130,23 @@
}
resize();
+
+ (function(){
+ var today = new Date(),
+ christmas = new Date(today.getFullYear(), 11, 26),
+ setMessage = function(x){
+ document.getElementById("christmasMessage").innerHTML = x;
+ };
+ today.setHours(0);
+ today.setMinutes(0);
+ today.setSeconds(0);
+ today.setMilliseconds(0);
+ var howLong = Math.round( (christmas-today) / 1000 / 60 /60 /24 );
+ if (howLong > 0) {
+ setMessage("There are " + howLong + " days until Christmas!");
+ } else {
+ setMessage("You'll have to wait until next year!");
+ }
+ })();
})()
Please sign in to comment.
Something went wrong with that request. Please try again.