forked from jgraglia/Trello-Points
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilter.js
33 lines (29 loc) · 820 Bytes
/
filter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function Filter(debug) {
var filteredState = false;
this.isCurrentlyFiltered= function() {
return filteredState;
};
var log = function(message) {
tp.utils.log("Filter", message);
};
var retrieveCurrentFilterStatus= function() {
return $('.js-filter-cards').hasClass('is-on');
};
var initialize= function() {
$('.content,.clearfix').on('DOMSubtreeModified',function(event){
var currentFilterState = retrieveCurrentFilterStatus();
if (currentFilterState != filteredState) {
if (debug) {
log("Filter state changed! was: "+filteredState+", now is: "+currentFilterState+". Event is: ");
log(event);
}
filteredState = currentFilterState;
}
});
if (debug) {
log("Filter state listener is now registered");
}
};
if (debug) log("Initializing...");
initialize();
}