diff --git a/drivers/firefox-sdk/data/css/panel.css b/drivers/firefox-sdk/data/css/panel.css index 8670ae7df..d37ac28e6 100644 --- a/drivers/firefox-sdk/data/css/panel.css +++ b/drivers/firefox-sdk/data/css/panel.css @@ -54,39 +54,8 @@ img { margin: 5px 0 0 24px; } -.empty { +#empty { color: #999; font-style: italic; text-align: center; } - -#buttons { - margin-top: 12px; - overflow: hidden; -} - - #buttons button { - height: 32px; - } - -#analyze-headers { - float: left; - width: 158px; -} - - #analyze-headers.pending { - background-image: url('../images/pending2.gif'); - background-position: center center; - background-repeat: no-repeat; - text-indent: -999px; - } - -#options { - background-image: url('../images/options.png'); - background-position: center center; - background-repeat: no-repeat; - float: right; - height: 32px; - min-width: 32px; - width: 32px; -} diff --git a/drivers/firefox-sdk/data/js/panel.js b/drivers/firefox-sdk/data/js/panel.js index eb68f80b9..5a4228f7c 100644 --- a/drivers/firefox-sdk/data/js/panel.js +++ b/drivers/firefox-sdk/data/js/panel.js @@ -1,10 +1,14 @@ (function() { self.port.on('displayApps', function(message) { - var detectedApps = document.getElementById('detected-apps'); + var + detectedApps = document.getElementById('detected-apps') + empty = document.getElementById('empty'); detectedApps.innerHTML = ''; if ( message.tabCache.count > 0 ) { + empty.style.display = 'none'; + for ( appName in message.tabCache.appsDetected ) { confidence = message.tabCache.appsDetected[appName].confidenceTotal; version = message.tabCache.appsDetected[appName].version; @@ -29,6 +33,8 @@ detectedApps.innerHTML = detectedApps.innerHTML + html; } + } else { + empty.style.display = 'block'; } self.port.emit('resize', document.body.offsetHeight); diff --git a/drivers/firefox-sdk/data/panel.html b/drivers/firefox-sdk/data/panel.html index b64badd09..b1a10015c 100644 --- a/drivers/firefox-sdk/data/panel.html +++ b/drivers/firefox-sdk/data/panel.html @@ -7,6 +7,8 @@ +
+
diff --git a/drivers/firefox-sdk/lib/driver.js b/drivers/firefox-sdk/lib/driver.js index 02c88980a..761fb6ab6 100644 --- a/drivers/firefox-sdk/lib/driver.js +++ b/drivers/firefox-sdk/lib/driver.js @@ -9,6 +9,7 @@ headersCache = {}, categoryNames = {}, data = require('sdk/self').data, + ss = require('sdk/simple-storage'), tabs = require('sdk/tabs'), panel = require('sdk/panel').Panel({ width: 250, @@ -24,11 +25,7 @@ }); tabs.on('open', function(tab) { - tabCache[tab.id] = { - count: 0, - appsDetected: [], - analyzed: [] - }; + tabCache[tab.id] = { count: 0, appsDetected: [] }; }); tabs.on('close', function(tab) { @@ -75,6 +72,18 @@ init: function(callback) { var json = JSON.parse(data.load('apps.json')); + try { + var version = require('sdk/self').version; + + if ( !ss.storage.version ) { + w.driver.goToURL({ url: w.config.websiteURL + 'installed', medium: 'install' }); + } else if ( version !== ss.storage.version ) { + w.driver.goToURL({ url: w.config.websiteURL + 'upgraded', medium: 'upgrade' }); + } + + ss.storage.version = version; + } catch(e) { } + w.apps = json.apps; w.categories = json.categories; @@ -83,11 +92,7 @@ } for each ( var tab in tabs ) { - tabCache[tab.id] = { - count: 0, - appsDetected: [], - analyzed: [] - }; + tabCache[tab.id] = { count: 0, appsDetected: [] }; } var httpRequestObserver = { @@ -125,11 +130,21 @@ httpRequestObserver.init(); }, + goToURL: function(args) { + var url = args.url + ( typeof args.medium === 'undefined' ? '' : '?utm_source=firefox&utm_medium=' + args.medium + '&utm_campaign=extensions'); + + tabs.open(url); + }, + displayApps: function() { var count = w.detected[tabs.activeTab.url] ? Object.keys(w.detected[tabs.activeTab.url]).length.toString() : '0'; w.log('display apps'); + if ( tabCache[tabs.activeTab.id] === undefined ) { + tabCache[tabs.activeTab.id] = { count: 0, appsDetected: [] }; + } + tabCache[tabs.activeTab.id].count = count; tabCache[tabs.activeTab.id].appsDetected = w.detected[tabs.activeTab.url]; diff --git a/drivers/firefox-sdk/locale/en-UK.properties b/drivers/firefox-sdk/locale/en-GB.properties similarity index 100% rename from drivers/firefox-sdk/locale/en-UK.properties rename to drivers/firefox-sdk/locale/en-GB.properties