Skip to content

Commit 6e6eb6a

Browse files
committed
Initial revision
0 parents  commit 6e6eb6a

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

LICENSE

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2+
Version 2, December 2004
3+
4+
Copyright (C) 2016 Sean Cassidy
5+
6+
Everyone is permitted to copy and distribute verbatim or modified
7+
copies of this license document, and changing it is allowed as long
8+
as the name is changed.
9+
10+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12+
13+
0. You just DO WHAT THE FUCK YOU WANT TO.

genius-blocker.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var geniusBlockerObserver = new MutationObserver(function(mutations) {
2+
mutations.forEach(function(mutation) {
3+
if (mutation.addedNodes.length > 0) {
4+
for (var i = 0; i < mutation.addedNodes.length; i++) {
5+
var item = mutation.addedNodes[i];
6+
if (item.tagName !== undefined) {
7+
if (item.tagName === "SCRIPT") {
8+
var src = item.getAttribute("src");
9+
if (src !== undefined && (src.startsWith("http://genius.com/") || src.startsWith("https://genius.com/"))) {
10+
console.log("Removing ", item.tagName, src);
11+
document.body.removeChild(item);
12+
} else {
13+
console.log("Not removing ", item.tagName, src);
14+
}
15+
} else if (item.tagName.startsWith("GENIUS")) {
16+
console.log("Removing ", item.tagName);
17+
document.body.removeChild(item);
18+
} else {
19+
console.log("Not removing ", item.tagName);
20+
}
21+
}
22+
}
23+
}
24+
});
25+
});
26+
27+
geniusBlockerObserver.observe(document.body, {childList: true});
28+
29+

test.html

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
5+
<meta http-equiv="content-type" content="text/html; charset=utf-8">
6+
<title>GeniusBlocker Test Page</title>
7+
</head>
8+
9+
<body>
10+
<h1>Test page</h1>
11+
12+
<p>This is a test page for testing GeniusBlocker.</p>
13+
<p>This is a test page for testing GeniusBlocker.</p>
14+
<p>This is a test page for testing GeniusBlocker.</p>
15+
<p>This is a test page for testing GeniusBlocker.</p>
16+
<p>This is a test page for testing GeniusBlocker.</p>
17+
<p>This is a test page for testing GeniusBlocker.</p>
18+
19+
<script src="genius-blocker.js"></script>
20+
</body>
21+
</html>

0 commit comments

Comments
 (0)