-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnope.js
64 lines (57 loc) · 1.83 KB
/
nope.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
var blocked_feeds = [];
function nope(){
console.log("Entered Nope function");
//news feeds.
stories = document.getElementsByClassName("_5uch");
for(var i=0; i < stories.length; i++){
console.log("Story #"+i);
var story = stories[i];
remove_feeds(story, "feed");
}
//walls.
wall_posts = document.getElementsByClassName("timeline");
for(var i=0; i < wall_posts.length; i++){
console.log("Wall post #"+i);
var post = wall_posts[i];
remove_feeds(post, "wall");
}
}
function remove_feeds(item, pageType){
console.log("Entered remove_feeds");
var links = item.getElementsByTagName("a");
for(var k=0; k < links.length; k++){
var link = links[k];
var href = link.href.toLowerCase();
console.log("Processing links");
// decide which type of link it is
var linkType = null;
// if (href.indexOf("facebook.com/the_page_name") !== -1 ){
// linkType = "page link";
// }
// if (href.indexOf("shrt.lnk") !== -1 ){
// linkType = "shortened link";
// }
if (href.indexOf("yourstory.com") !== -1 ){
console.log("regular link found")
linkType = "regular link";
}
// hide it.
if(linkType !== null){
hideItem(item, linkType, pageType);
}
}
}
function hideItem(item, linkType, pageType){
// set the story to be invisible
item.style.opacity = "0.0";
item.style.display = "None";
console.log("Hiding item : "+item)
// add this story to the list of killed stories
if (blocked_feeds.indexOf(item) == -1){
console.log("Saide nope to " + item + " on your " + pageType);
blocked_feeds.push(item);
}
}
console.log("Entered nope.js");
nope();
document.addEventListener("scroll", nope);