17 lines
618 B
JavaScript
17 lines
618 B
JavaScript
(function(){
|
|
function applyFilter() {
|
|
var active = {};
|
|
document.querySelectorAll('.email-filter input[type="checkbox"]').forEach(function(chk) {
|
|
active[chk.getAttribute('data-stato')] = chk.checked;
|
|
});
|
|
document.querySelectorAll('tbody tr[data-stato]').forEach(function(tr) {
|
|
var stato = tr.getAttribute('data-stato');
|
|
var show = (stato in active) ? active[stato] : true;
|
|
tr.style.display = show ? '' : 'none';
|
|
});
|
|
}
|
|
document.querySelectorAll('.email-filter input[type="checkbox"]').forEach(function(chk) {
|
|
chk.addEventListener('change', applyFilter);
|
|
});
|
|
})();
|