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.

56 lines
1.8 KiB

document.addEventListener('DOMContentLoaded', function() {
var d = document;
var options = {
opts: defaults,
init: function() {
options.load();
d.getElementById('github' ).addEventListener('click', function() { window.open(wappalyzer.config.githubURL); });
d.getElementById('twitter' ).addEventListener('click', function() { window.open(wappalyzer.config.twitterURL); });
12 years ago
d.getElementById('wappalyzer').addEventListener('click', function() { window.open(wappalyzer.config.websiteURL + '?utm_source=chrome&utm_medium=options&utm_campaign=extensions'); });
d.getElementById('options-save').addEventListener('click', options.save);
},
load: function() {
for ( option in options.opts ) {
if ( value = localStorage[option] ) {
options.opts[option] = value;
}
}
if ( parseInt(options.opts.autoAnalyzeHeaders) ) {
d.getElementById('option-auto-analyze-headers').setAttribute('checked', 'checked');
}
if ( parseInt(options.opts.upgradeMessage) ) {
d.getElementById('option-upgrade-message').setAttribute('checked', 'checked');
}
if ( parseInt(options.opts.tracking) ) {
d.getElementById('option-tracking').setAttribute('checked', 'checked');
}
},
save: function() {
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];
}
d.getElementById('options-saved').style.display = 'inline';
setTimeout(function(){
d.getElementById('options-saved').style.display = 'none';
}, 2000);
}
};
options.init();
});