From 06544a33ca839162529c37339cb5a899ba4f82db Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Wed, 10 Jun 2020 09:54:49 +1000 Subject: [PATCH] Fix terms display in popup, fix regex --- src/apps.json | 4 ++-- src/drivers/npm/package.json | 2 +- src/drivers/webextension/css/styles.css | 4 ++-- src/drivers/webextension/html/popup.html | 8 ++++---- src/drivers/webextension/js/driver.js | 12 ++++++++++++ src/drivers/webextension/js/popup.js | 22 +++++++++++++++++++--- src/drivers/webextension/manifest.json | 2 +- 7 files changed, 41 insertions(+), 13 deletions(-) diff --git a/src/apps.json b/src/apps.json index 42232232b..204058f54 100644 --- a/src/apps.json +++ b/src/apps.json @@ -1901,7 +1901,7 @@ "js": { "_carbonads": "" }, - "script": "^(?:https?:)?\\/\\/(?:[^\\/]+\\.)*carbonads\\.com\\/", + "script": "carbonads\\.com", "website": "http://carbonads.net" }, "Cargo": { @@ -11640,7 +11640,7 @@ }, "script": [ "zencdn\\.net/c/video\\.js", - "^(?:https?:)?\\/\\/(?:[^\\/]+\\.)*cdnjs\\.cloudflare\\.com\\/ajax\\/libs\\/video\\.js\\/([\\d\\.]+)\\/\\;version:\\1" + "cdnjs\\.cloudflare\\.com\\/ajax\\/libs\\/video\\.js\\/([\\d\\.]+)\\/\\;version:\\1" ], "website": "http://videojs.com" }, diff --git a/src/drivers/npm/package.json b/src/drivers/npm/package.json index c016d3fb0..4767f7f1e 100644 --- a/src/drivers/npm/package.json +++ b/src/drivers/npm/package.json @@ -13,7 +13,7 @@ "software" ], "homepage": "https://www.wappalyzer.com", - "version": "6.0.3", + "version": "6.0.4", "author": "Wappalyzer", "license": "MIT", "repository": { diff --git a/src/drivers/webextension/css/styles.css b/src/drivers/webextension/css/styles.css index d4a45aaa3..9a0dac141 100644 --- a/src/drivers/webextension/css/styles.css +++ b/src/drivers/webextension/css/styles.css @@ -167,10 +167,10 @@ a:hover { .terms { align-items: center; - display: flex; + display: none; flex-direction: column; justify-content: center; - margin-bottom: 1rem; + padding: 1.5rem 1.5rem 1rem 1.5rem; height: 12rem; width: 36rem; } diff --git a/src/drivers/webextension/html/popup.html b/src/drivers/webextension/html/popup.html index 593fc255b..4e9798d19 100644 --- a/src/drivers/webextension/html/popup.html +++ b/src/drivers/webextension/html/popup.html @@ -19,6 +19,10 @@ +
+ +
+
@@ -27,10 +31,6 @@
-
- -
-
diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index d83d12b94..ab45bcc9a 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -61,6 +61,18 @@ const Driver = { ['responseHeaders'] ) chrome.tabs.onRemoved.addListener((id) => (Driver.cache.tabs[id] = null)) + + const { version } = chrome.runtime.getManifest() + const previous = await getOption('version') + const upgradeMessage = await getOption('upgradeMessage', true) + + if (previous === null) { + Driver.open('https://www.wappalyzer.com/installed') + } else if (version !== previous && upgradeMessage) { + Driver.open(`https://www.wappalyzer.com/upgraded?v${version}`, false) + } + + await setOption('version', version) }, log(message, source = 'driver', type = 'log') { diff --git a/src/drivers/webextension/js/popup.js b/src/drivers/webextension/js/popup.js index 5852af745..f0bad8266 100644 --- a/src/drivers/webextension/js/popup.js +++ b/src/drivers/webextension/js/popup.js @@ -31,11 +31,21 @@ const Popup = { agent === 'chrome' || (await getOption('termsAccepted', false)) if (termsAccepted) { - document.querySelector('.terms').style.display = 'none' - Popup.driver('getDetections') } else { + document.querySelector('.terms').style.display = 'flex' document.querySelector('.detections').style.display = 'none' + document.querySelector('.empty').style.display = 'none' + + document.querySelector('.terms').addEventListener('click', async () => { + await setOption('termsAccepted', true) + + document.querySelector('.terms').remove() + document.querySelector('.detections').style.display = 'block' + document.querySelector('.empty').style.display = 'block' + + Popup.driver('getDetections') + }) i18n() } @@ -166,7 +176,13 @@ const Popup = { ) Array.from(document.querySelectorAll('a')).forEach((a) => - a.addEventListener('click', () => Popup.driver('open', a.href)) + a.addEventListener('click', (event) => { + event.preventDefault() + + Popup.driver('open', a.href) + + return false + }) ) i18n() diff --git a/src/drivers/webextension/manifest.json b/src/drivers/webextension/manifest.json index e00572b6b..534a9bc54 100644 --- a/src/drivers/webextension/manifest.json +++ b/src/drivers/webextension/manifest.json @@ -4,7 +4,7 @@ "author": "Wappalyzer", "homepage_url": "https://www.wappalyzer.com", "description": "Identify web technologies", - "version": "5.10.3", + "version": "6.0.4", "default_locale": "en", "manifest_version": 2, "icons": {