diff --git a/drivers/chrome/js/driver.js b/drivers/chrome/js/driver.js
index 668489833..2c67b5c41 100644
--- a/drivers/chrome/js/driver.js
+++ b/drivers/chrome/js/driver.js
@@ -96,7 +96,7 @@
},
goToURL: function(args) {
- window.open(args.url);
+ window.open(args.url + '?utm_source=firefox&utm_medium=extension&utm_campaign=extensions');
},
/**
diff --git a/drivers/firefox/content/js/content.js b/drivers/firefox/content/js/content.js
index 7f8bc44dc..60927bb97 100644
--- a/drivers/firefox/content/js/content.js
+++ b/drivers/firefox/content/js/content.js
@@ -1,28 +1,40 @@
"use strict";
(function() {
- var lastEnv = null;
+ var
+ lastEnv = null,
+ prefs = {}
+ ;
addEventListener('DOMContentLoaded', function() {
removeEventListener('DOMContentLoaded', onLoad, false);
+ prefs = sendSyncMessage('wappalyzer', { action: 'get prefs' })[0];
+
onLoad();
}, false);
function onLoad() {
if ( content.document.contentType != 'text/html' ) { return; }
- content.document.documentElement.addEventListener('load', function() {
- var env = Object.keys(content.wrappedJSObject);
+ if ( prefs.analyzeOnLoad ) {
+ content.document.documentElement.addEventListener('load', function() {
+ var env = Object.keys(content.wrappedJSObject);
- if ( env.join() !== lastEnv ) {
- lastEnv = env.join();
+ if ( env.join() !== lastEnv ) {
+ lastEnv = env.join();
- sendAsyncMessage('wappalyzer', { env: Object.keys(content.wrappedJSObject) });
- }
+ sendAsyncMessage('wappalyzer', {
+ action: 'analyze',
+ analyze: {
+ env: Object.keys(content.wrappedJSObject)
+ }
+ });
+ }
- removeEventListener('load', onLoad, true);
- }, true);
+ removeEventListener('load', onLoad, true);
+ }, true);
+ }
// HTML
var html = content.document.documentElement.outerHTML;
@@ -37,9 +49,13 @@
}
sendAsyncMessage('wappalyzer', {
+ action: 'analyze',
hostname: content.location.hostname,
- html: html,
- url: content.location.href
+ url: content.location.href,
+ analyze: {
+ html: html,
+ env: prefs.analyzeJavaScript ? Object.keys(content.wrappedJSObject) : []
+ }
});
}
})();
diff --git a/drivers/firefox/content/js/driver.js b/drivers/firefox/content/js/driver.js
index 7df97e7cd..d67d232c9 100644
--- a/drivers/firefox/content/js/driver.js
+++ b/drivers/firefox/content/js/driver.js
@@ -39,13 +39,13 @@
AddonManager.getAddonByID('wappalyzer@crunchlabz.com', function(addon) {
// Load jQuery
- (function () {
- Cc['@mozilla.org/moz/jssubscript-loader;1'].getService(Ci.mozIJSSubScriptLoader).loadSubScript('chrome://wappalyzer/content/js/lib/jquery.min.js');
- })();
+ Cc['@mozilla.org/moz/jssubscript-loader;1'].getService(Ci.mozIJSSubScriptLoader).loadSubScript('chrome://wappalyzer/content/js/lib/jquery.min.js');
// Preferences
prefs = Cc['@mozilla.org/preferences-service;1'].getService(Ci.nsIPrefService).getBranch('extensions.wappalyzer.');
+ prefs.addObserver('', w.driver, false);
+
container();
bindings();
@@ -75,6 +75,8 @@
// Get response headers
onStateChange: function(progress, request, flags, status) {
+ if ( !prefs.getBoolPref('analyzeHeaders') ) { return; }
+
if ( request != null && flags & Ci.nsIWebProgressListener.STATE_STOP ) {
if ( request.nsIHttpChannel && request.contentType == 'text/html' ) {
if ( progress.currentURI && request.name == progress.currentURI.spec ) {
@@ -101,6 +103,20 @@
window.addEventListener('unload', w.driver.track, false);
},
+ // Observe preference changes
+ observe: function(subject, topic, data) {
+ if ( topic != 'nsPref:changed' ) { return; }
+
+ switch(data) {
+ case 'addonBar':
+ container();
+
+ break;
+ }
+
+ w.driver.displayApps();
+ },
+
/**
* Display apps
*/
@@ -203,7 +219,7 @@
* Go to URL
*/
goToURL: function(args) {
- gBrowser.selectedTab = gBrowser.addTab(args.url);
+ gBrowser.selectedTab = gBrowser.addTab(args.url + '?utm_source=firefox&utm_medium=extension&utm_campaign=extensions');
},
/**
@@ -237,7 +253,19 @@
function content(msg) {
w.log('content.js');
- w.analyze(msg.json.hostname, msg.json.url, { html: msg.json.html, env: msg.json.env });
+ switch ( msg.json.action ) {
+ case 'analyze':
+ w.analyze(msg.json.hostname, msg.json.url, msg.json.analyze);
+
+ break;
+ case 'get prefs':
+ return {
+ analyzeJavaScript: prefs.getBoolPref('analyzeJavaScript'),
+ analyzeOnLoad: prefs.getBoolPref('analyzeOnLoad')
+ };
+
+ break;
+ }
msg = null;
}
@@ -249,11 +277,11 @@
if ( prefs.getBoolPref('addonBar') ) {
$('#wappalyzer-container').prependTo($('#wappalyzer-addonbar'));
- $('#wappalyzer-addonbar').show();
+ $('#wappalyzer-addonbar').attr('collapsed', 'false');
} else {
$('#wappalyzer-container').prependTo($('#urlbar-icons'));
- $('#wappalyzer-addonbar').hide();
+ $('#wappalyzer-addonbar').attr('collapsed', 'true');
}
}
@@ -264,35 +292,11 @@
// Menu items
var prefix = '#wappalyzer-menu-';
- $(prefix + 'icons')
- .attr('checked', prefs.getBoolPref('showIcons') ? 'true' : 'false')
- .bind('command', function() {
- prefs.setBoolPref('showIcons', !prefs.getBoolPref('showIcons'));
-
- $(this).attr('checked', prefs.getBoolPref('showIcons') ? 'true' : 'false');
-
- w.driver.displayApps();
- });
-
$(prefix + 'preferences' )
.bind('command', function() {
w.driver.goToURL({ url: 'chrome://wappalyzer/content/xul/preferences.xul' })
});
- $(prefix + 'addonbar' )
- .attr('checked', prefs.getBoolPref('addonBar') ? 'true' : 'false')
- .bind('command', function() {
- prefs.setBoolPref('addonBar', !prefs.getBoolPref('addonBar'));
-
- $(this).attr('checked', prefs.getBoolPref('addonBar') ? 'true' : 'false');
-
- container();
-
- if ( prefs.getBoolPref('addonBar') ) {
- alert(strings.getString('wappalyzer.addonBar'));
- }
- });
-
$(prefix + 'feedback')
.bind('command', function() {
w.driver.goToURL({ url: w.config.websiteURL + 'contact' })
diff --git a/drivers/firefox/content/xul/preferences.xul b/drivers/firefox/content/xul/preferences.xul
index 3ae791df0..e1d3aee1c 100755
--- a/drivers/firefox/content/xul/preferences.xul
+++ b/drivers/firefox/content/xul/preferences.xul
@@ -6,8 +6,15 @@
-
+
+
+
+
+
+
+
+
@@ -37,153 +44,114 @@
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/drivers/firefox/content/xul/wappalyzer.xul b/drivers/firefox/content/xul/wappalyzer.xul
index aa398aafc..cad1a1a3d 100755
--- a/drivers/firefox/content/xul/wappalyzer.xul
+++ b/drivers/firefox/content/xul/wappalyzer.xul
@@ -18,8 +18,6 @@