Skip to content

Commit

Permalink
Merge branch 'en-49'
Browse files Browse the repository at this point in the history
* en-49:
  Increased version number
  Issue #49 - Makes the 0x mandatory for matching the hex string. Also added small to the whitelisted tags to iterate through to match strings (fixes the myetherwallet donation link that was annoying me :P)
  • Loading branch information
409H committed Aug 14, 2017
2 parents c7a828d + adbe8ad commit cc8cf4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions js/DomManipulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ class EtherAddressLookup {
//Finds Ethereum addresses and converts to a link to a block explorer
convertAddressToLink()
{
var arrWhitelistedTags = new Array("code", "span", "p", "td", "li", "em", "i", "b", "strong");
var strRegex = /(^|\s|:|-)((?:0x)?[0-9a-fA-F]{40})(?:\s|$)/gi;
var arrWhitelistedTags = new Array("code", "span", "p", "td", "li", "em", "i", "b", "strong", "small");
var strRegex = /(^|\s|:|-)((?:0x)[0-9a-fA-F]{40})(?:\s|$)/gi;

//Get the whitelisted nodes
for(var i=0; i<arrWhitelistedTags.length; i++) {
var objNodes = document.getElementsByTagName(arrWhitelistedTags[i]);
//Loop through the whitelisted content
for(var x=0; x<objNodes.length; x++) {
var strContent = objNodes[x].innerHTML;
if( /((?:0x)?[0-9a-fA-F]{40})/gi.exec(strContent) !== null) {
if( /((?:0x)[0-9a-fA-F]{40})/gi.exec(strContent) !== null) {
objNodes[x].innerHTML = strContent.replace(
new RegExp(strRegex, "gi"),
'$1<a title="See this address on the blockchain explorer" href="'+ this.strBlockchainExplorer +'/$2" class="ext-etheraddresslookup-link" target="_blank">$2</a>'
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.5.1",
"version": "1.5.2",

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

0 comments on commit cc8cf4e

Please sign in to comment.