Sha256: 2b098894b4170ced84f8402a6d2a841f1e70fd344bb97dee712f8e3fa54728d5

Contents?: true

Size: 1.49 KB

Versions: 5

Compression:

Stored size: 1.49 KB

Contents

//= require vendor/jquery
//= require vendor/jquery.timeago
//= require bootstrap
//= require_tree .

$(function() {
  $.timeago.settings.allowFuture = true
  $("time").timeago();
});

$(function() {
  $('.check_all').live('click', function() {
    var checked = $(this).attr('checked');
    if (checked == 'checked') {
      $('input[type=checkbox]', $(this).closest('table')).attr('checked', checked);
    } else {
      $('input[type=checkbox]', $(this).closest('table')).removeAttr('checked');
    }
  });
});

$(function() {
  $('a[name=poll]').data('polling', false);

  $('a[name=poll]').on('click', function(e) {
    e.preventDefault();
    var pollLink = $(this);
    if (pollLink.data('polling')) {
      clearInterval(pollLink.data('interval'));
      pollLink.text('Live Poll');
      $('.poll-status').text('');
    }
    else {
      var href = pollLink.attr('href');
      pollLink.data('interval', setInterval(function() {
        $.get(href, function(data) {
          var responseHtml = $(data);
          $('.hero-unit').replaceWith(responseHtml.find('.hero-unit'));
          $('.workers').replaceWith(responseHtml.find('.workers'));
        });
        var currentTime = new Date();
        $('.poll-status').text('Last polled at: ' + currentTime.getHours() + ':' + currentTime.getMinutes() + ':' + currentTime.getSeconds());
      }, 2000));
      $('.poll-status').text('Starting to poll...');
      pollLink.text('Stop Polling');
    }
    pollLink.data('polling', !pollLink.data('polling'));
  })
});

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
sidekiq-2.2.0 web/assets/javascripts/application.js
creeper-2.0.2 web/assets/javascripts/application.js
creeper-2.0.1 web/assets/javascripts/application.js
creeper-2.0.0 web/assets/javascripts/application.js
sidekiq-2.1.1 web/assets/javascripts/application.js