-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Paul Mizel
committed
Jul 9, 2018
1 parent
39d2352
commit ea1c093
Showing
11 changed files
with
9,582 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
$.getJSON("https://raw.githubusercontent.com/AsureFoundation/EthereumTwitterScamBotBlocker/master/twitter.json", function(response) { | ||
|
||
var json = response; | ||
this.json = json; | ||
|
||
function modify(){ | ||
chrome.storage.sync.get(['action'], function(result) { | ||
console.log('action currently is ' + result.action); | ||
var action = result.action || "red"; | ||
|
||
$('.tweet').each(function(index){ | ||
var t = $(this).html(); | ||
var jt=$(this); | ||
console.log(jt.attr("data-user-id") +" - "+jt.attr("data-screen-name")); | ||
var blacklist=json.blacklist; | ||
if(blacklist[jt.attr("data-user-id")]!==undefined){ | ||
if(action==="hide") | ||
{jt.hide();} | ||
else | ||
{jt.css("background-color","red");} | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
function DOMModificationHandler(){ | ||
$(this).unbind('DOMSubtreeModified.event1'); | ||
setTimeout(function(){ | ||
modify(); | ||
$('#timeline').bind('DOMSubtreeModified.event1',DOMModificationHandler); | ||
},10); | ||
} | ||
|
||
$('#timeline').bind('DOMSubtreeModified.event1',DOMModificationHandler); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "EthereumTwitterScamBotBlocker Extensions", | ||
"description" : "Ethereum Twitter ScamBot Blocker Extension", | ||
"author": "Paul Mizel", | ||
"version": "1.0", | ||
"icons": { | ||
"16": "extension-16x16.png", | ||
"48": "extension-48x48.png", | ||
"128": "extension-128x128.png" }, | ||
"permissions": [ | ||
"http://twitter.com/","https://twitter.com/","https://github.com/","tabs","activeTab","storage", | ||
"http://*/", | ||
"https://*/" | ||
], | ||
"content_security_policy":"script-src 'self' https://apis.google.com; object-src 'self'", | ||
"browser_action": { | ||
"default_popup": "options.html", | ||
"default_icon": "extension-16x16.png" | ||
}, | ||
"manifest_version": 2, | ||
"web_accessible_resources": [ | ||
"twitter.json" | ||
], | ||
"content_scripts": [ | ||
{ | ||
"matches": ["http://www.twitter.com/*", | ||
"https://twitter.com/*"], | ||
"js": ["jquery.js", "contentScript.js"], | ||
"run_at": "document_end" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Options for Ethereum Twitter ScamBot Blocker Extension</title> | ||
<script type="text/javascript" src="jquery.js"></script> | ||
<script type="text/javascript" src="options.js"></script> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | ||
<style> | ||
html, | ||
body { | ||
margin: 10px; | ||
height: 380px; | ||
min-height: 380px; | ||
max-height: 380px; | ||
padding: 10px; | ||
width: 600px; | ||
} | ||
.hidden{ | ||
display:none; | ||
} | ||
.footer{ | ||
position: fixed; | ||
bottom: 10px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<img src="extension-48x48.png"/> | ||
<h4>Ethereum Twitter ScamBot Blocker Extension</h4> | ||
<br/> | ||
<b>Want to add a scam user? </b> | ||
<br/> | ||
Go to <a href="https://github.com/AsureFoundation/EthereumTwitterScamBotBlocker" target="_blank">github</a> and change twitter.json file. | ||
<br/> | ||
|
||
<h5>Action:</h5> | ||
<select id="action" class="form-control"> | ||
<option value="red">Mark scam tweets red</option> | ||
<option value="hide">Hide scam tweets</option> | ||
</select> | ||
<br /> | ||
<div class="alert alert-success saved hidden" id="saved" role="alert"> | ||
Options are saved! | ||
</div> | ||
<span class="footer"> | ||
Powered by <a href="https://www.asure.io?s=ce" target="_blank">https://www.asure.io</a> | ||
</span> | ||
|
||
<!--<br /> | ||
<button onclick="saveOptions()" class="btn btn-primary btn-block">Save</button> | ||
<br /> | ||
<button onclick="eraseOptions()" class="btn">Restore default</button> | ||
--> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
var defaultAction = "red"; | ||
$(()=>{ | ||
var favAction = localStorage["action"]; | ||
|
||
// valid colors are red, blue, green and yellow | ||
if (favAction == undefined || (favAction != "red" && favAction != "hide")) { | ||
favAction = defaultAction; | ||
} | ||
|
||
var select = document.getElementById("action"); | ||
for (var i = 0; i < select.children.length; i++) { | ||
var child = select.children[i]; | ||
if (child.value == favAction) { | ||
child.selected = "true"; | ||
break; | ||
} | ||
} | ||
|
||
$("#action").change(()=>{ | ||
saveOptions(); | ||
}); | ||
}); | ||
|
||
|
||
|
||
|
||
function saveOptions() { | ||
var select = document.getElementById("action"); | ||
var action = select.children[select.selectedIndex].value; | ||
localStorage["action"] = action; | ||
chrome.storage.sync.set({"action": action}, function() { | ||
console.log('Saved', "action", action); | ||
$(".saved").show().delay(2000).hide(100); | ||
}); | ||
} | ||
|
||
function eraseOptions() { | ||
localStorage.removeItem("action"); | ||
location.reload(); | ||
} |
Oops, something went wrong.