From c4328afa302c657e796e2889d8cdd06a29e35903 Mon Sep 17 00:00:00 2001 From: Elbert Alias Date: Sat, 5 Aug 2017 15:26:26 +1000 Subject: [PATCH] Fix icon not displaying and popup not expanding --- src/drivers/npm/README.md | 2 +- src/drivers/webextension/js/driver.js | 10 +++++----- src/drivers/webextension/js/iframe.js | 2 +- src/drivers/webextension/js/popup.js | 12 ++++++++++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/drivers/npm/README.md b/src/drivers/npm/README.md index e8b5e1323..afa90ec84 100644 --- a/src/drivers/npm/README.md +++ b/src/drivers/npm/README.md @@ -30,7 +30,7 @@ $ node index.js https://wappalyzer.com ```javascript const wappalyzer = require('wappalyzer'); -wappalyzer('https://wappalyzer.com') +wappalyzer.analyze('https://wappalyzer.com') .then(json => { console.log(JSON.stringify(json, null, 2)); }) diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index bcf4ce75b..79b547100 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -230,13 +230,13 @@ wappalyzer.driver.displayApps = (detected, context) => { var app = detected[appName]; app.props.cats.forEach(category => { - var icon = app.icon || 'default.svg'; + if ( category === match && !found ) { + var icon = app.props.icon || 'default.svg'; - if ( !dynamicIcon ) { - icon = 'default.svg'; - } + if ( !dynamicIcon ) { + icon = 'default.svg'; + } - if ( category === match && !found ) { if ( /\.svg$/i.test(icon) ) { icon = 'converted/' + icon.replace(/\.svg$/, '.png'); } diff --git a/src/drivers/webextension/js/iframe.js b/src/drivers/webextension/js/iframe.js index 156dae30b..ea3e2a990 100644 --- a/src/drivers/webextension/js/iframe.js +++ b/src/drivers/webextension/js/iframe.js @@ -138,7 +138,7 @@ var exports = {}; '', 'tracking_enabled_response', function(message) { - if ( message.tracking_enabled ) { + if ( message && message.tracking_enabled ) { callback(); } else { diff --git a/src/drivers/webextension/js/popup.js b/src/drivers/webextension/js/popup.js index 34f55c0a2..94be5f258 100644 --- a/src/drivers/webextension/js/popup.js +++ b/src/drivers/webextension/js/popup.js @@ -1,8 +1,6 @@ /** global: chrome */ /** global: browser */ -replaceDomWhenReady([ 'p', {}, ' ' ], document, {}); - var func = tabs => { ( chrome || browser ).runtime.sendMessage({ id: 'get_apps', @@ -44,6 +42,16 @@ function replaceDom(domTemplate) { var nodes = document.querySelectorAll('[data-i18n]'); + for ( let ms = 200; ms < 500; ms += 50 ) { + setTimeout(() => { + let div = document.createElement('div'); + + div.style.display = 'none'; + + body.appendChild(div); + }, ms); + }; + Array.prototype.forEach.call(nodes, node => { node.childNodes[0].nodeValue = browser.i18n.getMessage(node.dataset.i18n); });