You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.8 KiB
70 lines
1.8 KiB
12 years ago
|
var wappalyzer = {};
|
||
|
|
||
|
(function() {
|
||
|
var popup = {
|
||
|
pollHeaders: null,
|
||
|
|
||
|
init: function() {
|
||
|
chrome.tabs.getSelected(null, function(tab) {
|
||
|
if ( tab.url.match(/https?:\/\//) ) {
|
||
|
$('#detected-apps').html('<div class="empty">No applications detected.</div>');
|
||
|
|
||
|
$('#analyze-headers').show().click(function() {
|
||
|
$(this).addClass('pending');
|
||
|
|
||
|
chrome.extension.sendRequest({ id: 'fetch_headers', tab: tab });
|
||
|
|
||
|
popup.pollHeaders = setInterval(popup.displayApps, 100);
|
||
|
});
|
||
|
} else {
|
||
|
$('#detected-apps').html('<div class="empty">Nothing to do here.</div>');
|
||
|
|
||
|
$('#analyze-headers').hide();
|
||
|
}
|
||
|
});
|
||
|
|
||
|
popup.displayApps();
|
||
|
},
|
||
|
|
||
|
displayApps: function() {
|
||
|
chrome.tabs.getSelected(null, function(tab) {
|
||
|
chrome.extension.sendRequest({ id: 'get_apps', tab: tab }, function(response) {
|
||
|
if ( response.tabCache.analyzed.indexOf('headers') > 0 ) {
|
||
|
clearTimeout(popup.pollHeaders);
|
||
|
|
||
|
$('#analyze-headers').removeClass('pending');
|
||
|
}
|
||
|
|
||
|
if ( response.tabCache.count > 0 ) {
|
||
|
$('#detected-apps').html('');
|
||
|
|
||
|
response.tabCache.appsDetected.map(function(appName) {
|
||
|
html =
|
||
|
'<div class="detected-app">' +
|
||
|
'<a target="_blank" href="http://wappalyzer.com/applications/' + encodeURIComponent(appName) + '">' +
|
||
|
'<img src="images/icons/' + appName + '.png"/>' +
|
||
|
'<span class="label">' + appName + '</span>' +
|
||
|
'</a>';
|
||
|
|
||
|
wappalyzer.apps[appName].cats.map(function(cat) {
|
||
|
html +=
|
||
|
'<a target="_blank" href="http://wappalyzer.com/categories/' + wappalyzer.categories[cat] + '">' +
|
||
|
'<span class="category">' + categoryNames[cat] + '</span>' +
|
||
|
'</a>';
|
||
|
});
|
||
|
|
||
|
html +=
|
||
|
'</a>' +
|
||
|
'</div>';
|
||
|
|
||
|
$('#detected-apps').append(html);
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
popup.init();
|
||
|
})();
|