Relocalise some code

main
Camille Barneaud 12 years ago
parent 3b78dd1b27
commit dfdb07a552

@ -18,7 +18,7 @@
/**
* Initialize
*/
init: function(callback) {
init: function() {
w.log('init');
chrome.browserAction.setBadgeBackgroundColor({ color: [255, 102, 0, 255] });
@ -44,14 +44,14 @@
var version = chrome.app.getDetails().version;
if ( localStorage['version'] == null ) {
w.config.firstRun = true;
firstRun = true;
// Set defaults
for ( option in defaults ) {
localStorage[option] = defaults[option];
}
} else if ( version !== localStorage['version'] && localStorage['upgradeMessage'] ) {
w.config.upgraded = true;
upgraded = true;
}
localStorage['version'] = version;
@ -112,7 +112,14 @@
tabCache[tabId] = null;
});
callback();
if ( firstRun ) {
driver('goToURL', { url: w.config.websiteURL + 'installed', medium: 'install' });
firstRun = false;
}
if ( upgraded ) {
driver('goToURL', { url: w.config.websiteURL + 'upgraded', medium: 'upgrade' });
upgraded = false;
}
},
goToURL: function(args) {

@ -7,7 +7,10 @@
if ( wappalyzer == null ) return;
var w = wappalyzer, prefs, strings;
var w = wappalyzer,
firstRun = false,
upgraded = false,
prefs, strings;
const
d = document,
@ -30,7 +33,7 @@
/**
* Initialize
*/
init: function(callback) {
init: function() {
var handler = function() {
window.removeEventListener('load', handler, false);
@ -68,9 +71,9 @@
addon.version = addon.version;
if ( !prefs.getCharPref('version') ) {
w.config.firstRun = true;
firstRun = true;
} else if ( prefs.getCharPref('version') != addon.version ) {
w.config.upgraded = true;
upgraded = true;
}
prefs.setCharPref('version', addon.version);
@ -109,7 +112,17 @@
gBrowser.tabContainer.addEventListener('TabSelect', w.driver.displayApps, false);
callback();
if ( firstRun ) {
driver('goToURL', { url: w.config.websiteURL + 'installed', medium: 'install' });
firstRun = false;
}
if ( upgraded ) {
driver('goToURL', { url: w.config.websiteURL + 'upgraded', medium: 'upgrade' });
upgraded = false;
}
});
};

@ -172,15 +172,9 @@ var wappalyzer = (function() {
config: {
environment: 'dev', // dev | live
version: false,
websiteURL: 'http://wappalyzer.com/',
twitterURL: 'https://twitter.com/Wappalyzer',
githubURL: 'https://github.com/ElbertF/Wappalyzer',
firstRun: false,
upgraded: false
},
/**
@ -214,19 +208,7 @@ var wappalyzer = (function() {
}
// Initialize driver
driver('init', function() {
if ( w.config.firstRun ) {
driver('goToURL', { url: w.config.websiteURL + 'installed', medium: 'install' });
w.config.firstRun = false;
}
if ( w.config.upgraded ) {
driver('goToURL', { url: w.config.websiteURL + 'upgraded', medium: 'upgrade' });
w.config.upgraded = false;
}
});
driver('init');
},
/**

Loading…
Cancel
Save