Sha256: 2de0a1e9feee04ee1385cec292ac86a0c2c6ce065b69f99674f2dbae80c127f7

Contents?: true

Size: 1.69 KB

Versions: 4

Compression:

Stored size: 1.69 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() {
  function pad(n) { return ('0' + n).slice(-2); }

  $('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'));
          $('time').timeago();
        });
        var currentTime = new Date();
        $('.poll-status').text('Last polled at: ' + currentTime.getHours() + ':' + pad(currentTime.getMinutes()) + ':' + pad(currentTime.getSeconds()));
      }, 2000));
      $('.poll-status').text('Starting to poll...');
      pollLink.text('Stop Polling');
    }
    pollLink.data('polling', !pollLink.data('polling'));
  })
});

$(function() {
  $('[data-confirm]').click(function() {
    return confirm($(this).attr('data-confirm'));
  });
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sidekiq-2.3.3 web/assets/javascripts/application.js
sidekiq-2.3.2 web/assets/javascripts/application.js
sidekiq-2.3.1 web/assets/javascripts/application.js
sidekiq-2.3.0 web/assets/javascripts/application.js