2012-03-04 15:58:16 -05:00
|
|
|
//= require vendor/jquery
|
2012-03-29 16:57:32 -04:00
|
|
|
//= require vendor/jquery.timeago
|
2012-03-04 15:58:16 -05:00
|
|
|
//= require bootstrap
|
|
|
|
//= require_tree .
|
2012-03-29 16:57:32 -04:00
|
|
|
|
2012-05-11 19:48:03 -04:00
|
|
|
$(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');
|
|
|
|
}
|
|
|
|
});
|
2012-03-29 16:57:32 -04:00
|
|
|
});
|
2012-07-26 19:08:15 -04:00
|
|
|
|
|
|
|
$(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'));
|
|
|
|
})
|
|
|
|
});
|