Removed jQuery dependency from Chrome driver

main
Elbert Alias 12 years ago
parent 4fbcf1c5ab
commit 2fac8bb5b5

@ -1,5 +1,13 @@
$(function() {
$('[data-i18n]').each(function() {
$(this).html(chrome.i18n.getMessage($(this).attr('data-i18n')));
});
document.addEventListener('DOMContentLoaded', function() {
var
i, value,
d = document
nodes = d.getElementsByTagName('*')
;
for ( i = 0; i < nodes.length; i ++ ) {
if ( attr = nodes[i].dataset.i18n ) {
nodes[i].innerHTML = chrome.i18n.getMessage(attr);
}
}
});

@ -1,15 +1,17 @@
$(function() {
document.addEventListener('DOMContentLoaded', function() {
var d = document;
var options = {
opts: defaults,
init: function() {
options.load();
$('#github' ).click(function() { window.open(wappalyzer.config.githubURL); });
$('#twitter' ).click(function() { window.open(wappalyzer.config.twitterURL); });
$('#wappalyzer').click(function() { window.open(wappalyzer.config.websiteURL + '?utm_source=chrome&utm_medium=extension&utm_campaign=extensions'); });
d.getElementById('github' ).addEventListener('click', function() { window.open(wappalyzer.config.githubURL); });
d.getElementById('twitter' ).addEventListener('click', function() { window.open(wappalyzer.config.twitterURL); });
d.getElementById('wappalyzer').addEventListener('click', function() { window.open(wappalyzer.config.websiteURL + '?utm_source=chrome&utm_medium=extension&utm_campaign=extensions'); });
$('#options-save').click(options.save);
d.getElementById('options-save').addEventListener('click', options.save);
},
load: function() {
@ -20,29 +22,32 @@ $(function() {
}
if ( parseInt(options.opts.autoAnalyzeHeaders) ) {
$('#option-auto-analyze-headers').attr('checked', 'checked');
d.getElementById('option-auto-analyze-headers').setAttribute('checked', 'checked');
}
if ( parseInt(options.opts.upgradeMessage) ) {
$('#option-upgrade-message').attr('checked', 'checked');
d.getElementById('option-upgrade-message').setAttribute('checked', 'checked');
}
if ( parseInt(options.opts.tracking) ) {
$('#option-tracking').attr('checked', 'checked');
d.getElementById('option-tracking').setAttribute('checked', 'checked');
}
},
save: function() {
options.opts.autoAnalyzeHeaders = $('#option-auto-analyze-headers').is(':checked') ? 1 : 0;
options.opts.upgradeMessage = $('#option-upgrade-message' ).is(':checked') ? 1 : 0;
options.opts.tracking = $('#option-tracking' ).is(':checked') ? 1 : 0;
options.opts.autoAnalyzeHeaders = d.getElementById('option-auto-analyze-headers').checked ? 1 : 0;
options.opts.upgradeMessage = d.getElementById('option-upgrade-message' ).checked ? 1 : 0;
options.opts.tracking = d.getElementById('option-tracking' ).checked ? 1 : 0;
for ( option in options.opts ) {
localStorage[option] = options.opts[option];
}
document.getElementById('options-saved').style.display = 'inline';
setTimeout(function(){document.getElementById('options-saved').style.display = 'none';},2000);
d.getElementById('options-saved').style.display = 'inline';
setTimeout(function(){
d.getElementById('options-saved').style.display = 'none';
}, 2000);
}
};

@ -1,20 +1,27 @@
(function() {
document.addEventListener('DOMContentLoaded', function() {
var
d = document,
analyzeHeaders = d.getElementById('analyze-headers'),
detectedApps = d.getElementById('detected-apps')
;
var popup = {
pollHeaders: null,
init: function() {
$('#options').click(function() {
window.open(chrome.extension.getURL('options.html'));
d.getElementById('options').addEventListener('click', function() {
open(chrome.extension.getURL('options.html'));
});
$('#analyze-headers').text(chrome.i18n.getMessage('analyzeHeaders')).removeAttr('disabled');
analyzeHeaders.innerHTML = chrome.i18n.getMessage('analyzeHeaders');
analyzeHeaders.removeAttribute('disabled');
chrome.tabs.getSelected(null, function(tab) {
if ( tab.url.match(/https?:\/\//) ) {
$('#detected-apps').html('<div class="empty">' + chrome.i18n.getMessage('noAppsDetected') + '</div>');
detectedApps.innerHTML = '<div class="empty">' + chrome.i18n.getMessage('noAppsDetected') + '</div>';
$('#analyze-headers').click(function() {
$(this).attr('disabled', 'disabled');
analyzeHeaders.addEventListener('click', function() {
analyzeHeaders.setAttribute('disabled', 'disabled');
chrome.extension.sendRequest({ id: 'fetch_headers', tab: tab });
@ -22,12 +29,12 @@
});
if ( parseInt(localStorage['autoAnalyzeHeaders']) ) {
$('#analyze-headers').click();
analyzeHeaders.click();
}
} else {
$('#detected-apps').html('<div class="empty">' + chrome.i18n.getMessage('nothingToDo') + '</div>');
detectedApps.innerHTML = '<div class="empty">' + chrome.i18n.getMessage('nothingToDo') + '</div>';
$('#analyze-headers').attr('disabled', 'disabled');
analyzeHeaders.setAttribute('disabled', 'disabled');
}
});
@ -41,12 +48,12 @@
if ( popup.pollHeaders != null ) {
clearTimeout(popup.pollHeaders);
$('#analyze-headers').text(chrome.i18n.getMessage('analyzeHeadersDone'));
analyzeHeaders.innerHTML = chrome.i18n.getMessage('analyzeHeadersDone');
}
}
if ( response.tabCache.count > 0 ) {
$('#detected-apps').html('');
detectedApps.innerHTML = '';
response.tabCache.appsDetected.map(function(appName) {
html =
@ -67,13 +74,13 @@
'</a>' +
'</div>';
$('#detected-apps').append(html);
detectedApps.innerHTML = detectedApps.innerHTML + html;
});
}
});
});
}
}
};
$(function() { popup.init(); });
})();
popup.init();
});

Loading…
Cancel
Save