Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Generated by CoffeeScript 1.8.0
- (function() {
- var after, countdown, diff, end, item, rex, src, time, x, _i, _len;
- 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';
- rex = /&(month|day|year|offset|hour|minute)=\d+/gi;
- countdown = src.match(rex);
- time = {};
- for (_i = 0, _len = countdown.length; _i < _len; _i++) {
- item = countdown[_i];
- x = item.split('=');
- time[x[0].slice(1)] = x[1];
- }
- end = new Date(Date.UTC(time.year, time.month, time.day, time.hour, time.minute));
- if (time.offset != null) {
- time.offset = -1 * time.offset;
- end.setHours(end.getHours() + time.offset);
- }
- console.log("current time is " + (new Date()));
- console.log("countdown ends at " + end);
- after = function(ms, cb) {
- return setTimeout(cb, ms);
- };
- diff = function(end) {
- var rem;
- rem = (end - new Date()) / 1000;
- if ((rem != null) && rem > 0) {
- console.log(rem);
- return after(1000, function() {
- return diff(end);
- });
- } else {
- return console.log("countdown over");
- }
- };
- diff(end);
- }).call(this);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement