From 8d458f776548ec2c766d02a6cebba8f379411db1 Mon Sep 17 00:00:00 2001 From: DaAwesomeP Date: Mon, 10 Apr 2017 22:00:34 -0500 Subject: [PATCH] add option to keep icon static --- src/drivers/webextension/_locales/en/messages.json | 1 + src/drivers/webextension/js/defaults.js | 1 + src/drivers/webextension/js/driver.js | 4 +++- src/drivers/webextension/js/options.js | 5 +++++ src/drivers/webextension/options.html | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/drivers/webextension/_locales/en/messages.json b/src/drivers/webextension/_locales/en/messages.json index 7a5ebe100..624d02221 100644 --- a/src/drivers/webextension/_locales/en/messages.json +++ b/src/drivers/webextension/_locales/en/messages.json @@ -6,6 +6,7 @@ "optionsSave": { "message": "Save options" }, "optionsSaved": { "message": "Saved" }, "optionUpgradeMessage": { "message": "Tell me about upgrades" }, + "optionChangeIcon": { "message": "Change the icon in the toolbar to the first detected application instead of the Wappalyzer logo" }, "optionTracking": { "message": "Anonymously send reports on detected applications to wappalyzer.com for research" }, "nothingToDo": { "message": "Nothing to do here." }, "noAppsDetected": { "message": "No applications detected." }, diff --git a/src/drivers/webextension/js/defaults.js b/src/drivers/webextension/js/defaults.js index 3ec2d3e09..296cb0323 100644 --- a/src/drivers/webextension/js/defaults.js +++ b/src/drivers/webextension/js/defaults.js @@ -1,5 +1,6 @@ var defaults = { autoAnalyzeHeaders: 0, upgradeMessage: 1, + changeIcon: 1, tracking: 1 }; diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index cf4ae7b9f..5fb6b5f01 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -215,7 +215,9 @@ icon = 'converted/' + icon + '.png'; } - browser.pageAction.setIcon({ tabId: tab.id, path: 'images/icons/' + icon }); + if (parseInt(localStorage['changeIcon'], 10)) { + browser.pageAction.setIcon({ tabId: tab.id, path: 'images/icons/' + icon }); + } found = true; } diff --git a/src/drivers/webextension/js/options.js b/src/drivers/webextension/js/options.js index 71974de97..2f812224f 100644 --- a/src/drivers/webextension/js/options.js +++ b/src/drivers/webextension/js/options.js @@ -27,6 +27,10 @@ document.addEventListener('DOMContentLoaded', function() { d.getElementById('option-upgrade-message').setAttribute('checked', 'checked'); } + if ( parseInt(options.opts.changeIcon) ) { + d.getElementById('option-change-icon').setAttribute('checked', 'checked'); + } + if ( parseInt(options.opts.tracking) ) { d.getElementById('option-tracking').setAttribute('checked', 'checked'); } @@ -36,6 +40,7 @@ document.addEventListener('DOMContentLoaded', function() { var option; options.opts.upgradeMessage = d.getElementById('option-upgrade-message').checked ? 1 : 0; + options.opts.changeIcon = d.getElementById('option-change-icon' ).checked ? 1 : 0; options.opts.tracking = d.getElementById('option-tracking' ).checked ? 1 : 0; for ( option in options.opts ) { diff --git a/src/drivers/webextension/options.html b/src/drivers/webextension/options.html index 4b6817ce7..4834595b2 100644 --- a/src/drivers/webextension/options.html +++ b/src/drivers/webextension/options.html @@ -29,6 +29,7 @@

+