forked from mudit2103/piazza-booster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.js
35 lines (30 loc) · 961 Bytes
/
utils.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
34
35
function filter(e, target) {
if (e.classname != null && e.classname.includes("user_name") && e.innerText == target) {
return true;
}
var replies;
if (e.children == null || e.children.length == 0)
return false;
var i = 0;
allnames = e.querySelectorAll(".user_name");
for (i=0;i<allnames.length;i++) {
if (allnames[i].innerText == target)
return true;
}
return false;
}
function filterAll(target) {
var arr = document.querySelectorAll("div.clarifying_discussion.clearFix[data-pats=followup]");
console.log(arr);
for (var i = 0; i < arr.length; i++) {
if (arr[i] != null && !filter(arr[i], target))
arr[i].style.display="none";
}
}
function resetAll() {
arr = document.querySelectorAll("div.clarifying_discussion.clearFix[data-pats=followup]");
for (i = 0; i < arr.length; i++) {
arr[i].style.display="block";
}
}
// filterAll("Eric");