|
|
|
@ -7,16 +7,18 @@
|
|
|
|
|
|
|
|
|
|
var w = wappalyzer;
|
|
|
|
|
|
|
|
|
|
var $, strings;
|
|
|
|
|
var $, prefs, strings;
|
|
|
|
|
|
|
|
|
|
w.adapter = {
|
|
|
|
|
/**
|
|
|
|
|
* Log messages to console
|
|
|
|
|
*/
|
|
|
|
|
log: function(args) {
|
|
|
|
|
var consoleService = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
|
|
|
|
|
if ( prefs != null && prefs.getBoolPref('debug') ) {
|
|
|
|
|
var consoleService = Components.classes['@mozilla.org/consoleservice;1'].getService(Components.interfaces.nsIConsoleService);
|
|
|
|
|
|
|
|
|
|
consoleService.logStringMessage(args.message);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -31,8 +33,6 @@
|
|
|
|
|
strings = document.getElementById('wappalyzer-strings');
|
|
|
|
|
|
|
|
|
|
AddonManager.getAddonByID('wappalyzer@crunchlabz.com', function(addon) {
|
|
|
|
|
addon.version = addon.version;
|
|
|
|
|
|
|
|
|
|
// Load jQuery
|
|
|
|
|
(function () {
|
|
|
|
|
var window;
|
|
|
|
@ -42,6 +42,22 @@
|
|
|
|
|
$ = jQuery.noConflict(true);
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
// Preferences
|
|
|
|
|
prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefService).getBranch('extensions.wappalyzer.');
|
|
|
|
|
|
|
|
|
|
container();
|
|
|
|
|
|
|
|
|
|
// Version check
|
|
|
|
|
addon.version = addon.version;
|
|
|
|
|
|
|
|
|
|
if ( !prefs.getCharPref('version') ) {
|
|
|
|
|
w.config.firstRun = true;
|
|
|
|
|
} else if ( prefs.getCharPref('version') != addon.version ) {
|
|
|
|
|
w.config.upgraded = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prefs.setCharPref('version', addon.version);
|
|
|
|
|
|
|
|
|
|
// Listen for messages from content script
|
|
|
|
|
messageManager.addMessageListener('wappalyzer', content);
|
|
|
|
|
|
|
|
|
@ -56,7 +72,7 @@
|
|
|
|
|
|
|
|
|
|
// Get response headers
|
|
|
|
|
onStateChange: function(progress, request, flags, status) {
|
|
|
|
|
if ( flags & Components.interfaces.nsIWebProgressListener.STATE_STOP ) {
|
|
|
|
|
if ( request.nsIHttpChannel != null && flags & Components.interfaces.nsIWebProgressListener.STATE_STOP ) {
|
|
|
|
|
var headers = new Object();
|
|
|
|
|
|
|
|
|
|
request.nsIHttpChannel.visitResponseHeaders(function(header, value) {
|
|
|
|
@ -83,12 +99,37 @@
|
|
|
|
|
displayApps: function() {
|
|
|
|
|
var url = gBrowser.currentURI.spec;
|
|
|
|
|
|
|
|
|
|
$('#wappalyzer-menu > menuitem, #wappalyzer-menu > menuseparator').remove();
|
|
|
|
|
$('#wappalyzer-container > image, #wappalyzer-menu > menuitem, #wappalyzer-menu > menuseparator').remove();
|
|
|
|
|
|
|
|
|
|
if ( w.detected[url] != null && w.detected[url].length ) {
|
|
|
|
|
$('#wappalyzer-icon').attr('src', 'chrome://wappalyzer/skin/images/icon16x16_hot.ico');
|
|
|
|
|
if ( !prefs.getBoolPref('showIcons') ) {
|
|
|
|
|
var image = $('<image/>')
|
|
|
|
|
.attr('src', 'chrome://wappalyzer/skin/images/icon16x16_hot.ico')
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
$('#wappalyzer-container').prepend(image);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
w.detected[url].map(function(app, i) {
|
|
|
|
|
var display = false;
|
|
|
|
|
|
|
|
|
|
for ( cat in w.apps[app].cats ) {
|
|
|
|
|
if ( prefs.getBoolPref('cat' + w.apps[app].cats[cat]) ) {
|
|
|
|
|
display = true;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( display ) {
|
|
|
|
|
if ( prefs.getBoolPref('showIcons') ) {
|
|
|
|
|
var image = $('<image/>')
|
|
|
|
|
.attr('src', 'chrome://wappalyzer/skin/images/icons/' + app + '.ico')
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
$('#wappalyzer-container').prepend(image);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var menuSeparator = $('<menuseparator/>');
|
|
|
|
|
|
|
|
|
|
$('#wappalyzer-menu').append(menuSeparator);
|
|
|
|
@ -107,14 +148,19 @@
|
|
|
|
|
for ( cat in w.apps[app].cats ) {
|
|
|
|
|
var menuItem = $('<menuitem/>')
|
|
|
|
|
.attr('disabled', 'true')
|
|
|
|
|
.attr('label', w.categories[cat].name)
|
|
|
|
|
.attr('label', w.categories[w.apps[app].cats[cat]].name)
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
$('#wappalyzer-menu').append(menuItem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
$('#wappalyzer-icon').attr('src', 'chrome://wappalyzer/skin/images/icon16x16.ico');
|
|
|
|
|
var image = $('<image/>')
|
|
|
|
|
.attr('src', 'chrome://wappalyzer/skin/images/icon16x16.ico')
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
$('#wappalyzer-container').prepend(image);
|
|
|
|
|
|
|
|
|
|
var menuSeparator = $('<menuseparator/>');
|
|
|
|
|
|
|
|
|
@ -133,7 +179,7 @@
|
|
|
|
|
* Go to URL
|
|
|
|
|
*/
|
|
|
|
|
goToURL: function(args) {
|
|
|
|
|
gBrowser.addTab(args.url);
|
|
|
|
|
gBrowser.selectedTab = gBrowser.addTab(args.url);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -148,5 +194,80 @@
|
|
|
|
|
delete msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Move container to address or addon bar
|
|
|
|
|
*/
|
|
|
|
|
function container() {
|
|
|
|
|
$('#wappalyzer-container')
|
|
|
|
|
.remove()
|
|
|
|
|
.prependTo(prefs.getBoolPref('addonBar') ? $('#wappalyzer-addonbar') : $('#urlbar-icons'));
|
|
|
|
|
|
|
|
|
|
// 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.adapter.displayApps();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(prefix + 'tracking' )
|
|
|
|
|
.attr('checked', prefs.getBoolPref('tracking') ? 'true' : 'false')
|
|
|
|
|
.bind('command', function() {
|
|
|
|
|
prefs.setBoolPref('tracking', !prefs.getBoolPref('tracking'));
|
|
|
|
|
|
|
|
|
|
$(this).attr('checked', prefs.getBoolPref('tracking') ? 'true' : 'false');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(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();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(prefix + 'categories')
|
|
|
|
|
.bind('command', function() {
|
|
|
|
|
w.adapter.goToURL({ url: 'chrome://wappalyzer/content/xul/categories.xul' })
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(prefix + 'donate')
|
|
|
|
|
.bind('command', function() {
|
|
|
|
|
w.adapter.goToURL({ url: w.config.websiteURL + 'donate/' })
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(prefix + 'feedback')
|
|
|
|
|
.bind('command', function() {
|
|
|
|
|
w.adapter.goToURL({ url: w.config.websiteURL + '?redirect=feedback' })
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(prefix + 'website')
|
|
|
|
|
.bind('command', function() {
|
|
|
|
|
w.adapter.goToURL({ url: w.config.websiteURL })
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(prefix + 'github' )
|
|
|
|
|
.bind('command', function() {
|
|
|
|
|
w.adapter.goToURL({ url: w.config.githubURL })
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(prefix + 'twitter')
|
|
|
|
|
.bind('command', function() {
|
|
|
|
|
w.adapter.goToURL({ url: w.config.twitterURL})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(prefix + 'gplus')
|
|
|
|
|
.bind('command', function() {
|
|
|
|
|
w.adapter.goToURL({ url: w.config.gplusURL })
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
w.init();
|
|
|
|
|
})();
|
|
|
|
|