Skip to content

Commit

Permalink
v1.10 - pr 146 and 160 - blockies and bug138 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
409H committed Nov 8, 2017
2 parents ff548f3 + 7b9e20c commit 1d1c137
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
11 changes: 11 additions & 0 deletions css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,15 @@
margin-top: 5%;
padding: 15px 5%;
background: #e4e4e4;
}

.ext-etheraddresslookup-blockie {
width: 1em;
height: 1em;
background-size: cover;
background-repeat: no-repeat;
border-radius: 50%;
box-shadow: inset rgba(255, 255, 255, 0.6) 0 2px 2px, inset rgba(0, 0, 0, 0.3) 0 -2px 6px;
display: inline-block;
margin-bottom: -0.2em;
}
19 changes: 18 additions & 1 deletion js/DomManipulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ class EtherAddressLookup {
'$1<a title="See this address on the blockchain explorer" ' +
'href="' + this.strBlockchainExplorer + '/$2" ' +
'class="ext-etheraddresslookup-link" ' +
'target="'+ this.target +'">$2</a>$3',
'target="'+ this.target +'">' +
'<div class="ext-etheraddresslookup-blockie" data-ether-address="$2" ></div> $2' +
'</a>$3',

// ENS Address Replace
'<a title="See this address on the blockchain explorer" ' +
Expand Down Expand Up @@ -153,6 +155,7 @@ class EtherAddressLookup {
}

this.tidyUpSlots();
this.addBlockies();

if(this.blHighlight) {
this.addHighlightStyle();
Expand Down Expand Up @@ -286,6 +289,20 @@ class EtherAddressLookup {
}
}

addBlockies()
{
var blockieDivs = document.querySelectorAll("div.ext-etheraddresslookup-blockie");
for(var i = 0; i < blockieDivs.length; i++){

blockieDivs[i].style.backgroundImage = 'url(' + blockies.create({
// toLowerCase is used because standard blockies are based on none-checksum Ethereum addresses
seed:blockieDivs[i].getAttribute('data-ether-address').toLowerCase(),
size: 8,
scale: 16
}).toDataURL() +')';
}
}

//Removes the highlight style from Ethereum addresses
removeHighlightStyle()
{
Expand Down
1 change: 1 addition & 0 deletions js/app/lib/blockies.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions 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.9.1",
"version": "1.10.0",

"browser_action": {
"default_icon": "images/icon.png",
Expand All @@ -23,7 +23,11 @@
"content_scripts":[{
"run_at": "document_start",
"matches": ["http://*/*", "https://*/*"],
"js": ["js/app/lib/punycode.min.js", "js/DomainBlacklist.js"]
"js": [
"js/app/lib/punycode.min.js",
"js/app/lib/blockies.min.js",
"js/DomainBlacklist.js"
]
},{
"run_at": "document_end",
"matches": ["http://*/*", "https://*/*"],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "etheraddresslookup",
"version": "1.0.0",
"version": "1.10.0",
"description": "A web extension for blocking ethereum phishing websites.",
"main": "blacklists/domains.json",
"scripts": {
Expand Down

0 comments on commit 1d1c137

Please sign in to comment.