Skip to content

Commit

Permalink
Merge branch 'hf-1.3.1'
Browse files Browse the repository at this point in the history
* hf-1.3.1:
  Fixed bug that caused on to be off and off to be on, on block malicious domains
  • Loading branch information
Harry Denley committed Jul 7, 2017
2 parents 03c08c3 + 4a1b9cb commit d16aeac
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 26 deletions.
47 changes: 22 additions & 25 deletions js/DomManipulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class EtherAddressLookup {
//Update the DOM once all settings have been received...
setTimeout(function() {
if(this.intSettingsCount === this.intSettingsTotalCount) {
if(this.blBlacklistDomains === false) {
if(this.blBlacklistDomains) {
this.blacklistedDomainCheck();
}
this.convertAddressToLink();
Expand All @@ -55,7 +55,6 @@ class EtherAddressLookup {
//Finds Ethereum addresses and converts to a link to a block explorer
convertAddressToLink()
{
console.log("converting");
var arrWhitelistedTags = new Array("code", "span", "p", "td", "li");
var strRegex = /(^|\s|:|-)((?:0x)?[0-9a-fA-F]{40})(?:\s|$)/gi;

Expand All @@ -65,7 +64,6 @@ class EtherAddressLookup {
//Loop through the whitelisted content
for(var x=0; x<objNodes.length; x++) {
var strContent = objNodes[x].innerText;
console.log(strContent);
if( /((?:0x)?[0-9a-fA-F]{40})/gi.exec(strContent) !== null) {
objNodes[x].innerHTML = strContent.replace(
new RegExp(strRegex, "gi"),
Expand Down Expand Up @@ -108,28 +106,27 @@ class EtherAddressLookup {
//@todo - check local storage and if within 5 minutes, don't send this request.
var objAjax = new XMLHttpRequest();
objAjax.open("GET", "https://raw.githubusercontent.com/409H/EtherAddressLookup/master/blacklists/domains.json", true);
if( objAjax.send() ) {
objAjax.onreadystatechange = function () {
if (objAjax.readyState === 4) {
var arrBlacklistedDomains = JSON.parse(objAjax.responseText);
var strCurrentTab = window.location.hostname;

if (arrBlacklistedDomains.includes(strCurrentTab)) {
var objBlacklistedDomain = document.createElement("div");
objBlacklistedDomain.style.cssText = "position:absolute;z-index:999999999;top:0%;left:0%;width:100%;height:100%;background:#fff;color:#000;text-align:center;"

var objBlacklistedDomainText = document.createElement("div");
objBlacklistedDomainText.style.cssText = "padding:5%;color:#57618F;";
objBlacklistedDomainText.innerHTML = "<img src='https://github.com/409H/EtherAddressLookup/raw/master/images/icon.png?raw=true' />" +
"<br /><h3>ATTENTION</h3>We have detected this domain to have malicious " +
"intent and have prevented you from interacting with it.<br /><br /><br /><small>This is " +
"because you have <br />enabled <em>'Warn of blacklisted domains'</em> setting <br />on EtherAddressLookup Chrome " +
"Extension. You <br />can turn this setting off to interact with this site <br />but it's advised not to." +
"<br /><br />We blacklisted it for a reason.</small>";

objBlacklistedDomain.appendChild(objBlacklistedDomainText);
document.body.appendChild(objBlacklistedDomain);
}
objAjax.send();
objAjax.onreadystatechange = function () {
if (objAjax.readyState === 4) {
var arrBlacklistedDomains = JSON.parse(objAjax.responseText);
var strCurrentTab = window.location.hostname;

if (arrBlacklistedDomains.includes(strCurrentTab)) {
var objBlacklistedDomain = document.createElement("div");
objBlacklistedDomain.style.cssText = "position:absolute;z-index:999999999;top:0%;left:0%;width:100%;height:100%;background:#fff;color:#000;text-align:center;"

var objBlacklistedDomainText = document.createElement("div");
objBlacklistedDomainText.style.cssText = "padding:5%;color:#57618F;";
objBlacklistedDomainText.innerHTML = "<img src='https://github.com/409H/EtherAddressLookup/raw/master/images/icon.png?raw=true' />" +
"<br /><h3>ATTENTION</h3>We have detected this domain to have malicious " +
"intent and have prevented you from interacting with it.<br /><br /><br /><small>This is " +
"because you have <br />enabled <em>'Warn of blacklisted domains'</em> setting <br />on EtherAddressLookup Chrome " +
"Extension. You <br />can turn this setting off to interact with this site <br />but it's advised not to." +
"<br /><br />We blacklisted it for a reason.</small>";

objBlacklistedDomain.appendChild(objBlacklistedDomainText);
document.body.appendChild(objBlacklistedDomain);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "EtherAddressLookup",
"short_name": "EtherAddressLookup",
"description": "Adds links to strings that look like Ethereum addresses to your favorite blockchain explorer.",
"version": "1.3",
"version": "1.3.1",

"browser_action": {
"default_icon": "images/icon.png",
Expand Down

0 comments on commit d16aeac

Please sign in to comment.