Skip to content

Commit

Permalink
Merge branch 'ft-firefox_support'
Browse files Browse the repository at this point in the history
* ft-firefox_support:
  Removed debug
  Increased version number
  Changed default bookmark to mycrypto
  Increased version for Firefox support
  Modified console.log message
  Changed the repo destination for EAL blacklists to the infura cdn one
  Added logic for Firefox support
  Added logic for Firefox support
  Added logic to add error text to the red icon
  Added styling to allow an error message
  Converted logic to add support for FireFox
  Converted logic to add support for FireFox
  • Loading branch information
409H committed Apr 26, 2018
2 parents af507e6 + 6382c50 commit cdc3aba
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 45 deletions.
7 changes: 5 additions & 2 deletions css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,16 @@
.ext-etheraddresslookup-address_stats_hover_node_error {
all: initial;
background: #d02626;
border-radius: 50%;
border-radius: 5em;
height: 10px;
width: 10px;
width: auto;
position: absolute;
right: 5%;
display: none;
z-index: 2;
color: #fff;
padding: 3px;
font-size: 8pt;
}
.ext-etheraddresslookup-address_stats_hover_node_ok {
all: initial;
Expand Down
7 changes: 5 additions & 2 deletions js/DomManipulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class EtherAddressLookup {
*/
convertAddressToLink()
{
var arrWhitelistedTags = ["code", "span", "p", "td", "li", "em", "i", "b", "strong", "small"];
var arrWhitelistedTags = ["div", "code", "span", "p", "td", "li", "em", "i", "b", "strong", "small"];

//Get the whitelisted nodes
for(var i=0; i<arrWhitelistedTags.length; i++) {
Expand Down Expand Up @@ -398,6 +398,7 @@ class EtherAddressLookup {
if(error) {
intTransactionCount = -1;
objHoverNodeContent.querySelector("#ext-etheraddresslookup-address_stats_hover_node_error_"+intUniqueId).style.display = "inline";
objHoverNodeContent.querySelector("#ext-etheraddresslookup-address_stats_hover_node_error_"+intUniqueId).innerText = "There were RPC errors";
} else {
objHoverNodeContent.querySelector("#ext-etheraddresslookup-address_stats_hover_node_ok_"+intUniqueId).style.display = "inline";
intTransactionCount = parseInt(result).toLocaleString();
Expand All @@ -417,6 +418,7 @@ class EtherAddressLookup {
if(error) {
flEthBalance = -1;
objHoverNodeContent.querySelector("#ext-etheraddresslookup-address_stats_hover_node_error_"+intUniqueId).style.display = "inline";
objHoverNodeContent.querySelector("#ext-etheraddresslookup-address_stats_hover_node_error_"+intUniqueId).innerText = "There were RPC errors";
} else {
objHoverNodeContent.querySelector("#ext-etheraddresslookup-address_stats_hover_node_ok_"+intUniqueId).style.display = "inline";
flEthBalance = web3.fromWei(result.toString(10), "ether").toLocaleString("en-US", {maximumSignificantDigits: 9});
Expand All @@ -437,6 +439,7 @@ class EtherAddressLookup {
if(error) {
objContractAddress.innerHTML += "<small>Unable to determine if contract</small>";
objHoverNodeContent.querySelector("#ext-etheraddresslookup-address_stats_hover_node_error_"+intUniqueId).style.display = "inline";
objHoverNodeContent.querySelector("#ext-etheraddresslookup-address_stats_hover_node_error_"+intUniqueId).innerText = "There were RPC errors";
} else {
objHoverNodeContent.querySelector("#ext-etheraddresslookup-address_stats_hover_node_ok_"+intUniqueId).style.display = "inline";
var blIsContractAddress = result == "0x" ? false : true;
Expand All @@ -447,7 +450,7 @@ class EtherAddressLookup {
});

if(objResponse.resp.includes("quiknode.io")) {
objHoverNodeContent.innerHTML += "<a href='https://quiknode.io/?ref=EtherAddressLookup' target='_blank' title='RPC node managed by Quiknode.io'><img src='" + chrome.runtime.getURL("/images/powered-by-quiknode.png") + "' /></a>";
objHoverNodeContent.innerHTML += "<a href='https://quiknode.io/?ref=EtherAddressLookup' target='_blank' title='RPC node managed by Quiknode.io'><img src='" + objBrowser.runtime.getURL("/images/powered-by-quiknode.png") + "' /></a>";
}

return false;
Expand Down
13 changes: 9 additions & 4 deletions js/app/chooseBlockchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ function refreshBlockchainExplorer() {

//Notify the tab to do a class method
var strMethod = "changeBlockchainExplorer";
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {
var objBrowser = chrome ? chrome : browser;
objBrowser.tabs.query({active: true, currentWindow: true}, function(tabs) {
objBrowser.tabs.sendMessage(tabs[0].id, {
"func":strMethod
}, function(response) {
console.log(response);
}, function(objResponse) {
if(objResponse.status) {
console.log("Response from tab: " + objResponse.status);
} else {
console.log("Cannot "+ strMethod +" on tab.");
}
});
});
}
50 changes: 26 additions & 24 deletions js/app/historyInspector.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
(function () {
var objHistoryInspector = document.getElementById("ext-etheraddresslookup-history_inspect");

//Perform the history inspection
objHistoryInspector.addEventListener("click", function (objEvent) {
//See if we need to request permission
chrome.permissions.contains({
permissions: ['history']
}, function (blResult) {
//No permission to history, ask for it.
if (blResult === false) {
chrome.permissions.request({
permissions: ['history']
}, function (blGranted) {
if (blGranted) {
console.log("Granted history permission");
doHistoryInspection();
} else {
exitNoPermission();
}
});
} else {
doHistoryInspection();
}
if(typeof chrome !== 'undefined') {
objHistoryInspector.addEventListener('click', event => {
chrome.permissions.request({permissions: ['history']}, function(blGranted) {
if (blGranted) {
console.log("Granted history permission");
doHistoryInspection();
} else {
exitNoPermission();
}
});
});
});
} else {
objHistoryInspector.addEventListener('click', event => {
browser.permissions.request({permissions: ['history']}).then((blGranted) => {
if (blGranted) {
console.log("Granted history permission");
doHistoryInspection();
} else {
exitNoPermission();
}
});
});
}
})();

function doHistoryInspection() {
chrome.history.search({text: "", maxResults: 500}, function (objHistoryItems) {
var objBrowser = chrome ? chrome : browser;
objBrowser.history.search({text: "", maxResults: 500}, function (objHistoryItems) {
var blRedirected = false;
var intTotalWarnings = 0;
var strReportText = "";
Expand Down Expand Up @@ -88,7 +89,8 @@ function exitNoPermission()

function removePermission()
{
chrome.permissions.remove({
var objBrowser = chrome ? chrome : browser;
objBrowser.permissions.remove({
permissions: ['history']
}, function(removed) {
if (removed) {
Expand Down
5 changes: 3 additions & 2 deletions js/app/toggleBlacklistDomains.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ function toggle3rdPartyBlacklistDomains()

function refreshBlacklistDomains()
{
chrome.runtime.sendMessage({func: "blacklist_domain_list"}, function(objResponse) {
console.log("BDL-001");
var objBrowser = chrome ? chrome : browser;
objBrowser.runtime.sendMessage({func: "blacklist_domain_list"}, function(objResponse) {
console.log("BDL-001 - Fetched blacklisted domains");
});

var intBlacklistDomains = localStorage.getItem("ext-etheraddresslookup-blacklist_domains");
Expand Down
4 changes: 2 additions & 2 deletions js/app/toggleBookmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ function getBookmarks()
if(strBookmarks === null) {
var arrBookmarks = new Array();
arrBookmarks.push({
"icon": "images/bookmarks/myetherwallet.png",
"url": "https://myetherwallet.com"
"icon": "https://www.google.com/s2/favicons?domain=https://mycrypto.com",
"url": "https://mycrypto.com"
});
arrBookmarks.push({
"icon": "images/bookmarks/etherscan.png",
Expand Down
19 changes: 13 additions & 6 deletions js/app/toggleMatchHighlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,31 @@
})();

//Sets the local storage to remember their match highlight settings
function toggleMatchHighlight() {
function toggleMatchHighlight()
{
var objShowHighlight = document.getElementById("ext-etheraddresslookup-show_style");
var intShowHighlight = objShowHighlight.checked ? 1 : 0;
localStorage.setItem("ext-etheraddresslookup-show_style", intShowHighlight);

refreshHighlightOption();
}

function refreshHighlightOption() {
function refreshHighlightOption()
{
var objBrowser = chrome ? chrome : browser;
var intShowHighlight = localStorage.getItem("ext-etheraddresslookup-show_style");
document.getElementById("ext-etheraddresslookup-show_style").checked = (intShowHighlight == 1 ? true : false);
//Notify the tab to do a class method
var strMethod = (intShowHighlight == 1 ? "addHighlightStyle" : "removeHighlightStyle");
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {
objBrowser.tabs.query({active: true, currentWindow: true}, function(tabs) {
objBrowser.tabs.sendMessage(tabs[0].id, {
"func":strMethod
}, function(response) {
console.log(response);
}, function(objResponse) {
if(objResponse.status) {
console.log("Response from tab: " + objResponse.status);
} else {
console.log("Cannot "+ strMethod +" on tab.");
}
});
});
}
2 changes: 1 addition & 1 deletion js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function getBlacklistedDomains(strType)
"timestamp": 0,
"domains": [],
"format": "plain",
"repo": "https://raw.githubusercontent.com/409H/EtherAddressLookup/master/blacklists/domains.json",
"repo": "http://api.infura.io/v1/blacklist",
"identifer": "eal"
},
"third_party": {
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.14.3",
"version": "1.15.1",

"browser_action": {
"default_icon": "images/icon.png",
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.11.0",
"version": "1.15.1",
"description": "A web extension for blocking ethereum phishing websites.",
"main": "blacklists/domains.json",
"scripts": {
Expand Down

0 comments on commit cdc3aba

Please sign in to comment.