Skip to content

Commit

Permalink
Merge remote-tracking branch 'samyoul/issue/138'
Browse files Browse the repository at this point in the history
* samyoul/issue/138:
  updated version number to 1.9.1 in manifest
  Fix for bug 138
  • Loading branch information
409H committed Nov 8, 2017
2 parents 4bf2b92 + b682dcd commit ff548f3
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
46 changes: 46 additions & 0 deletions js/DomManipulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ class EtherAddressLookup {
var objNodes = document.getElementsByTagName(arrWhitelistedTags[i]);
//Loop through the whitelisted content
for(var x=0; x<objNodes.length; x++) {

if(this.hasIgnoreAttributes(objNodes[x])){
continue;
}

this.convertAddresses(objNodes[x]);
}
}
Expand Down Expand Up @@ -197,6 +202,47 @@ class EtherAddressLookup {
return content;
}

/**
* @name Has Ignore Attributes
* @desc Checks if a node contains any attribute that we want to avoid manipulating
* @param {Element} node
* @returns {boolean}
*/
hasIgnoreAttributes(node)
{
var ignoreAttributes = {
"class": ["ng-binding"]
};

// Loop through all attributes we want to test for ignoring
for(var attributeName in ignoreAttributes){
// Filter out the object's default properties
if (ignoreAttributes.hasOwnProperty(attributeName)) {

// Check this node has the attribute we are currently checking for
if(node.hasAttribute(attributeName)){

// This node's value for the attribute we are checking
var nodeAttributeValue = node.getAttribute(attributeName);
// The values we want to ignore for this attribute
var badAttributeValueList = ignoreAttributes[attributeName];

// Loop through the attribute values we want to ignore
for(var i=0; i < badAttributeValueList.length; i++){
// If we find an indexOf, this value is present in the attribute
if(nodeAttributeValue.indexOf(badAttributeValueList[i]) !== -1){
return true;
}
}

}

}
}

return false;
}

/**
* @name Is Pattern Matched
* @desc Checks content matches any of the object's matchPatterns
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.9.0",
"version": "1.9.1",

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

0 comments on commit ff548f3

Please sign in to comment.