Advertisement
Guest User

Untitled

a guest
Jan 6th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Generated by CoffeeScript 1.8.0
  2. (function() {
  3.   var after, countdown, diff, end, item, rex, src, time, x, _i, _len;
  4.  
  5.   src = 'http://e-hentai-countdown.darknessfall.com/EH-Cdwn.png?aucti' + 'onname=Remaining Time&month=12&day=31&year=2100&offset=3&hou' + 'r=09&minute=00&expire=Expired&template=default-transparent';
  6.  
  7.   rex = /&(month|day|year|offset|hour|minute)=\d+/gi;
  8.  
  9.   countdown = src.match(rex);
  10.  
  11.   time = {};
  12.  
  13.   for (_i = 0, _len = countdown.length; _i < _len; _i++) {
  14.     item = countdown[_i];
  15.     x = item.split('=');
  16.     time[x[0].slice(1)] = x[1];
  17.   }
  18.  
  19.   end = new Date(Date.UTC(time.year, time.month, time.day, time.hour, time.minute));
  20.  
  21.   if (time.offset != null) {
  22.     time.offset = -1 * time.offset;
  23.     end.setHours(end.getHours() + time.offset);
  24.   }
  25.  
  26.   console.log("current time is " + (new Date()));
  27.  
  28.   console.log("countdown ends at " + end);
  29.  
  30.   after = function(ms, cb) {
  31.     return setTimeout(cb, ms);
  32.   };
  33.  
  34.   diff = function(end) {
  35.     var rem;
  36.     rem = (end - new Date()) / 1000;
  37.     if ((rem != null) && rem > 0) {
  38.       console.log(rem);
  39.       return after(1000, function() {
  40.         return diff(end);
  41.       });
  42.     } else {
  43.       return console.log("countdown over");
  44.     }
  45.   };
  46.  
  47.   diff(end);
  48.  
  49. }).call(this);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement