-
Notifications
You must be signed in to change notification settings - Fork 1
/
hide.annoying.things.js
55 lines (52 loc) · 1.37 KB
/
hide.annoying.things.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
// ==UserScript==
// @name Hide annoying things form your FaceBook wall
// @namespace http://hide.annoying.things/
// @version 0.1
// @description Deleted DOM nodes from facebook containing the strings in the array
// @match https://www.facebook.com/
// @copyright 2014+, Tom Gould
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
// @grant GM_addStyle
// ==/UserScript==
var hideAnnoyingThingsStrings = [
"cameron",
"Boris",
"EU ",
"Europe",
"Brexit",
"referendum",
"xbox",
"playstation",
"football",
"poker",
"game",
"Apple",
"iPhone",
"iPad",
"iWatch",
];
var hideAnnoyingThings = function () {
$('._4ikz').each(function () {
var elements = $(this).find('div.mbm');
$.each(elements, function (key, value) {
var findings = hideAnnoyingThings_str_contains(
$(value).html(), hideAnnoyingThingsStrings, 0);
if (findings !== false) {
$(this).remove();
console.log('Found a ' + findings);
}
});
});
}
var hideAnnoyingThings_str_contains = function (haystack, needles, offset) {
for (i = 0; i < needles.length; i++) {
var str = needles[i].toLowerCase();
var n = (haystack.toLowerCase() + '')
.indexOf(str, (offset || 0));
if (n > -1) {
return str;
}
}
return false;
}
window.setInterval(hideAnnoyingThings, 1000);