-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground.js
104 lines (96 loc) · 1.65 KB
/
background.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Wait until the comments have been loaded
setTimeout(function(){
// Enable brutal mode to completely hide the comment
var brutal = false;
// Actual comments found on www.dribbble.com
// Keep these or roll your own
var crap = [
// Star ratings
'★★★★★',
// Hearts
'<3',
// Emoticons
':)',
':-)',
';)',
';-)',
':p',
// A
'Absolutely stunning! Amazing job!',
'Awesome!',
'Amazing!',
'Awesome.',
// B
'Brilliant. That is all.',
// C
'Cool!',
'Clever.',
// D
'Damn!',
'Damn, excellent!',
// E
// F
'Fantastic idea!',
// G
'Good idea!',
'Great idea!',
'Great stuff.',
'Great stuff per usual.',
'genius',
// H
// I
// J
// K
// L
'Love it!',
'Looks great man.',
// M
'Mind blown',
// N
'Nice.',
'Nice!',
// O
'Oh mah gawd',
// P
// Q
// R
// S
// T
'This is perfect!',
// U
// V
'Very nice!',
'Very nice',
'very nice',
'Very cool!',
'Very cool',
'very cool',
'Very sharp and smart!',
// W
'wow, wonderful!',
// X
// Y
'yessss'
// Z
];
// Loop though all the comments and add class to fade out the comment if crap
var comments = document.getElementById("comments").querySelectorAll(".comment-body p"),
i,
x,
el;
for(i=0; i < comments.length; ++i) {
el = comments[i];
// Not sure if this is the best way to do this (loop within a loop, if this is even the best way to loop through them...)
for(x=0; x < crap.length; ++x) {
if( el.textContent.indexOf(crap[x]) != -1 ) {
if (brutal == false) {
el.parentNode.parentNode.classList.add("comment--crap");
break;
} else{
el.parentNode.parentNode.classList.add("comment--hide");
break;
};
}
}
}
}, 2000);