// $Id$
(function ($) {
/**
* Attaches the tablefilter behavior to tables with the 'tablefilter' class.
*/
Drupal.behaviors.batch = {
attach: function (context, settings) {
$('table.tablefilter', context).once(function() {
var filter_obj = $('');
var table_obj = $(this).before($('').text(Drupal.t('Filter')));
var filter_value, str_exists;
filter_obj.keyup(function() {
filter_value = $(this).val().toLowerCase();
table_obj.find('tbody tr').each(function() {
str_exists = false;
$(this).find('td').each(function() {
if ($(this).text().toLowerCase().indexOf(filter_value) > -1) {
str_exists = true;
};
});
if (!str_exists) {
$(this).hide();
}
else {
$(this).show();
};
});
}).prependTo(table_obj.parent());
});
}
};
})(jQuery);