diff --git a/src/drivers/webextension/css/options.css b/src/drivers/webextension/css/options.css index bd6096f5f..a5398318c 100644 --- a/src/drivers/webextension/css/options.css +++ b/src/drivers/webextension/css/options.css @@ -84,7 +84,7 @@ a:active { #about { border-top: 1px solid #dbdbdb; margin-top: 2.5rem; - padding: 1.5rem 0 1.5rem 0; + padding: 1.5rem 0 0 0; } #about img { diff --git a/src/drivers/webextension/css/popup.css b/src/drivers/webextension/css/popup.css index 6c91d5888..b95650b77 100644 --- a/src/drivers/webextension/css/popup.css +++ b/src/drivers/webextension/css/popup.css @@ -75,22 +75,3 @@ img { font-style: italic; text-align: center; } - -#footer { - border-top: 1px solid #ccc; - margin-top: 17px; - overflow: hidden; - padding-top: 11px; -} - -#footer a { - text-decoration: none; -} - -#footer a:hover { - border-bottom: 1px solid #dbdbdb; -} - -#options { - float: right; -} diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index 77a9b71cd..9519d680d 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -64,52 +64,10 @@ localStorage['version'] = version; } catch(e) { } - function newMsg(message, sender, sendResponse) { - var - hostname, - a = document.createElement('a'); - - if ( typeof message.id != 'undefined' ) { - w.log('message: ' + message.id); - - switch ( message.id ) { - case 'log': - w.log(message.message); - - break; - case 'analyze': - tab = sender.tab; - - a.href = tab.url.replace(/#.*$/, ''); - - hostname = a.hostname; - - if ( headersCache[a.href] !== undefined ) { - message.subject.headers = headersCache[a.href]; - } - - w.analyze(hostname, a.href, message.subject); - - break; - case 'ad_log': - w.adCache.push(message.subject); - - break; - case 'get_apps': - sendResponse({ - tabCache: tabCache[message.tab.id], - apps: w.apps, - categories: w.categories - }); - - break; - } - } - } - if (typeof chrome === "undefined") { - browser.runtime.onMessage.addListener(newMsg); + if ( typeof chrome === 'undefined' ) { + browser.runtime.onMessage.addListener(w.driver.onMessage); } else { - chrome.runtime.onMessage.addListener(newMsg); + chrome.runtime.onMessage.addListener(w.driver.onMessage); } browser.tabs.query({}).then(function(tabs) { @@ -168,6 +126,49 @@ } }, + onMessage: function(message, sender, sendResponse) { + var + hostname, + a = document.createElement('a'); + + if ( typeof message.id != 'undefined' ) { + w.log('message: ' + message.id); + + switch ( message.id ) { + case 'log': + w.log(message.message); + + break; + case 'analyze': + tab = sender.tab; + + a.href = tab.url.replace(/#.*$/, ''); + + hostname = a.hostname; + + if ( headersCache[a.href] !== undefined ) { + message.subject.headers = headersCache[a.href]; + } + + w.analyze(hostname, a.href, message.subject); + + break; + case 'ad_log': + w.adCache.push(message.subject); + + break; + case 'get_apps': + sendResponse({ + tabCache: tabCache[message.tab.id], + apps: w.apps, + categories: w.categories + }); + + break; + } + } + }, + goToURL: function(args) { var url = args.url + ( typeof args.medium === 'undefined' ? '' : '?pk_campaign=chrome&pk_kwd=' + args.medium); diff --git a/src/drivers/webextension/js/popup.js b/src/drivers/webextension/js/popup.js index 4293aed21..14e6fb162 100644 --- a/src/drivers/webextension/js/popup.js +++ b/src/drivers/webextension/js/popup.js @@ -10,11 +10,6 @@ document.addEventListener('DOMContentLoaded', function() { popup = { init: function() { - - d.getElementById('options').addEventListener('click', function() { - window.open(browser.extension.getURL('options.html')); - }); - browser.tabs.query({ active: true }).then(function(tabs) { if ( tabs[0].url.match(/https?:\/\//) ) { detectedApps.innerHTML = '