{"size": 1084, "ext": "js", "max_stars_repo_path": "cidonkey/static/js/page.js", "max_stars_repo_name": "samuelcolvin/ci-donkey", "max_stars_repo_stars_event_min_datetime": "2015-04-27T13:31:43.000Z", "max_stars_repo_stars_event_max_datetime": "2015-04-27T13:31:43.000Z", "max_issues_repo_path": "kushillu/static/js/page.js", "max_issues_repo_name": "codeadict/kushillu", "max_issues_repo_issues_event_min_datetime": "2015-01-08T11:00:16.000Z", "max_issues_repo_issues_event_max_datetime": "2015-03-04T12:25:56.000Z", "max_forks_repo_path": "kushillu/static/js/page.js", "max_forks_repo_name": "codeadict/kushillu", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 9, "max_forks_count": null, "avg_line_length": 22.1224489796, "max_line_length": 65, "alphanum_fraction": 0.63099631}
var fast_update = 10000;
var slow_update = 30000;
var live_time_clear = null;
$(document).ready(function(){
  delay_update(fast_update);
  start_live_times();
});

function delay_update(timeout){
    setTimeout(update, timeout);
}

function update(){
  var el = $('[load-from]');
  if (document.URL.indexOf('?') != -1){
    return;
  }
  el.load(el.attr('load-from'), function(response, status, xhr){
    var code = xhr.status;
    if (code == 200) {
      delay_update(fast_update);
      start_live_times();
    }
    else if (code == 201){
      delay_update(slow_update);
    }
  });
}

function start_live_times(){
  clearInterval(live_time_clear);
  live_time_clear = setInterval(live_times, 250);
  live_times()
}

function live_times(){
  var live_times = $('.live-time');
  if (live_times.length == 0){
    clearInterval(live_time_clear);
    return;
  }
  $('.live-time').each(function(){
    var start = new Date(Date.parse($(this).attr('data-start')));
    var now = new Date();
    var diff = Math.round((now - start.getTime())/1000);
    $(this).text(diff + 's')
  })
}
