From 087fc5ed2bc5e8e1fda5cb0422c67ead8ce20a4e Mon Sep 17 00:00:00 2001 From: Elbert Alias Date: Mon, 12 Jun 2017 10:13:34 +1000 Subject: [PATCH] Fixes for MS Edge --- src/drivers/npm/package.json | 2 +- src/drivers/webextension/js/driver.js | 12 ++++++++++-- src/drivers/webextension/js/i18n.js | 2 +- src/drivers/webextension/js/popup.js | 10 +++++----- src/drivers/webextension/manifest.edge.json | 2 +- src/drivers/webextension/manifest.json | 2 +- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/drivers/npm/package.json b/src/drivers/npm/package.json index e18f57dd7..7e36ff01e 100644 --- a/src/drivers/npm/package.json +++ b/src/drivers/npm/package.json @@ -2,7 +2,7 @@ "name": "Wappalyzer", "description": "Uncovers the technologies used on websites", "homepage": "https://github.com/AliasIO/Wappalyzer", - "version": "4.1.3", + "version": "4.1.4", "author": "Elbert Alias", "license": "GPL-3.0", "repository": { diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index 8cf460772..ab2ceda7c 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -33,9 +33,17 @@ * Get a value from localStorage */ getOption: function(name, defaultValue, callback) { - browser.storage.local.get(name).then(function(item) { + var func = function(item) { callback(item.hasOwnProperty(name) ? item[name] : defaultValue); - }); + }; + + try { + // Chrome, Firefox + browser.storage.local.get(name).then(func); + } catch ( e ) { + // Edge + browser.storage.local.get(name, func); + } }, /** diff --git a/src/drivers/webextension/js/i18n.js b/src/drivers/webextension/js/i18n.js index 6921c0f0f..aa62fcee2 100644 --- a/src/drivers/webextension/js/i18n.js +++ b/src/drivers/webextension/js/i18n.js @@ -3,7 +3,7 @@ document.addEventListener('DOMContentLoaded', function() { var nodes = document.querySelectorAll('[data-i18n]'); - nodes.forEach(function(node) { + Array.prototype.forEach.call(nodes, function (node) { node.childNodes[0].nodeValue = browser.i18n.getMessage(node.dataset.i18n); }); }); diff --git a/src/drivers/webextension/js/popup.js b/src/drivers/webextension/js/popup.js index 37f642e62..578670f54 100644 --- a/src/drivers/webextension/js/popup.js +++ b/src/drivers/webextension/js/popup.js @@ -6,7 +6,7 @@ init: function() { popup.update([ 'p', {}, ' ' ], document, {}); - var callback = function(tabs) { + var func = function(tabs) { ( chrome || browser ).runtime.sendMessage({ id: 'get_apps', tab: tabs[0], source: 'popup.js' }, function(response) { popup.update(popup.appsToDomTemplate(response)); }); @@ -14,15 +14,15 @@ try { // Chrome, Firefox - browser.tabs.query({ active: true, currentWindow: true }).then(callback); + browser.tabs.query({ active: true, currentWindow: true }).then(func); } catch ( e ) { // Edge - browser.tabs.query({ active: true, currentWindow: true }, callback); + browser.tabs.query({ active: true, currentWindow: true }, func); } }, update: function(dom) { - if ( /complete|interacrive|loaded/.test(document.readyState) ) { + if ( /complete|interactive|loaded/.test(document.readyState) ) { popup.replaceDom(dom); } else { document.addEventListener('DOMContentLoaded', function() { @@ -38,7 +38,7 @@ body.removeChild(body.firstChild); } - body.append(jsonToDOM(domTemplate, document, {})); + body.appendChild(jsonToDOM(domTemplate, document, {})); }, appsToDomTemplate: function(response) { diff --git a/src/drivers/webextension/manifest.edge.json b/src/drivers/webextension/manifest.edge.json index 8c0b80db3..bc71f3b2d 100644 --- a/src/drivers/webextension/manifest.edge.json +++ b/src/drivers/webextension/manifest.edge.json @@ -4,7 +4,7 @@ "author": "Elbert Alias", "homepage_url": "https://wappalyzer.com/", "description": "Identify web technologies", - "version": "4.1.3", + "version": "4.1.4", "default_locale": "en", "manifest_version": 2, "icons": { diff --git a/src/drivers/webextension/manifest.json b/src/drivers/webextension/manifest.json index a2cdd6479..7e140bcda 100644 --- a/src/drivers/webextension/manifest.json +++ b/src/drivers/webextension/manifest.json @@ -4,7 +4,7 @@ "author": "Elbert Alias", "homepage_url": "https://wappalyzer.com/", "description": "Identify web technologies", - "version": "4.1.3", + "version": "4.1.4", "default_locale": "en", "manifest_version": 2, "icons": {