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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

82 lines
2.4 KiB

var wappalyzer = {};
(function() {
var popup = {
pollHeaders: null,
init: function() {
$('#options').click(function() {
window.open(chrome.extension.getURL('options.html'));
});
$('#analyze-headers').text(chrome.i18n.getMessage('analyzeHeaders')).removeAttr('disabled');
chrome.tabs.getSelected(null, function(tab) {
if ( tab.url.match(/https?:\/\//) ) {
13 years ago
$('#detected-apps').html('<div class="empty">' + chrome.i18n.getMessage('noAppsDetected') + '</div>');
$('#analyze-headers').click(function() {
$(this).attr('disabled', 'disabled');
13 years ago
chrome.extension.sendRequest({ id: 'fetch_headers', tab: tab });
13 years ago
popup.pollHeaders = setInterval(popup.displayApps, 100);
});
if ( parseInt(localStorage['autoAnalyzeHeaders']) ) {
$('#analyze-headers').click();
}
} else {
13 years ago
$('#detected-apps').html('<div class="empty">' + chrome.i18n.getMessage('nothingToDo') + '</div>');
$('#analyze-headers').attr('disabled', 'disabled');
}
});
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 ) {
if ( popup.pollHeaders != null ) {
clearTimeout(popup.pollHeaders);
$('#analyze-headers').text(chrome.i18n.getMessage('analyzeHeadersDone'));
}
}
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/' + appName.toLowerCase().replace(/ /g, '-').replace(/[^\w-]/g, '') + '">' +
'<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] + '">' +
13 years ago
'<span class="category">' + chrome.i18n.getMessage('categoryName' + cat) + '</span>' +
'</a>';
});
html +=
'</a>' +
'</div>';
$('#detected-apps').append(html);
});
}
});
});
}
}
$(function() { popup.init(); });
})();