Cleaned up code dealing with categories, fixed FF XML tree display, fixed global variable to avoid conflicts

main
ElbertF 13 years ago
parent c4a50369ad
commit abf3e5f2ab

@ -1,5 +1,5 @@
(function() {
self = {
var self = {
element: false,
prevUrl: '',
@ -10,6 +10,8 @@
},
log: function(message) {
return; //
var consoleService = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
consoleService.logStringMessage("Wappalyzer content.js: " + message);
@ -61,6 +63,10 @@
getEnvironmentVars: function() {
self.log('getEnvironmentVars');
if ( content.document.contentType != 'text/html' ) {
return;
}
var environmentVars = '';
try {
@ -112,5 +118,5 @@
self.init();
return app;
return self;
})();

@ -0,0 +1,19 @@
addEventListener('load', function() {
if ( typeof wappalyzer != undefined ) {
var preferences = document.getElementById('wappalyzer-options')
.getElementsByTagName('preferences')[0]
;
if ( preferences ) {
for ( i in wappalyzer.cats ) {
var preference = document.createElement('preference');
preference.setAttribute('id', 'wappalyzer-cat' + i);
preference.setAttribute('name', 'wappalyzer.cat' + i);
preference.setAttribute('type', 'bool');
preferences.appendChild(preference);
}
}
}
}, false);

@ -12,6 +12,7 @@
<script type="application/x-javascript" src="chrome://wappalyzer/content/evaluate.js"/>
<script type="application/x-javascript" src="chrome://wappalyzer/content/apps.js"/>
<script type="application/x-javascript" src="chrome://wappalyzer/content/options.js"/>
<prefpane label="&wappalyzer.options;">
<preferences>
@ -20,29 +21,7 @@
<preference id="wappalyzer-show-apps" name="wappalyzer.showApps" type="int" />
<preference id="wappalyzer-popup" name="wappalyzer.popupOnHover" type="bool" />
<preference id="wappalyzer-custom-apps" name="wappalyzer.customApps" type="string"/>
<preference id="wappalyzer-cat1" name="wappalyzer.cat1" type="bool" />
<preference id="wappalyzer-cat2" name="wappalyzer.cat2" type="bool" />
<preference id="wappalyzer-cat3" name="wappalyzer.cat3" type="bool" />
<preference id="wappalyzer-cat4" name="wappalyzer.cat4" type="bool" />
<preference id="wappalyzer-cat5" name="wappalyzer.cat5" type="bool" />
<preference id="wappalyzer-cat6" name="wappalyzer.cat6" type="bool" />
<preference id="wappalyzer-cat7" name="wappalyzer.cat7" type="bool" />
<preference id="wappalyzer-cat8" name="wappalyzer.cat8" type="bool" />
<preference id="wappalyzer-cat9" name="wappalyzer.cat9" type="bool" />
<preference id="wappalyzer-cat10" name="wappalyzer.cat10" type="bool" />
<preference id="wappalyzer-cat11" name="wappalyzer.cat11" type="bool" />
<preference id="wappalyzer-cat12" name="wappalyzer.cat12" type="bool" />
<preference id="wappalyzer-cat13" name="wappalyzer.cat13" type="bool" />
<preference id="wappalyzer-cat14" name="wappalyzer.cat14" type="bool" />
<preference id="wappalyzer-cat15" name="wappalyzer.cat15" type="bool" />
<preference id="wappalyzer-cat16" name="wappalyzer.cat16" type="bool" />
<preference id="wappalyzer-cat17" name="wappalyzer.cat17" type="bool" />
<preference id="wappalyzer-cat18" name="wappalyzer.cat18" type="bool" />
<preference id="wappalyzer-cat19" name="wappalyzer.cat19" type="bool" />
<preference id="wappalyzer-cat20" name="wappalyzer.cat20" type="bool" />
<preference id="wappalyzer-cat21" name="wappalyzer.cat21" type="bool" />
<preference id="wappalyzer-cat22" name="wappalyzer.cat22" type="bool" />
<preference id="wappalyzer-cat23" name="wappalyzer.cat23" type="bool" />
<!-- Category preferences are injected by options.js -->
</preferences>
<tabbox>

@ -1,7 +1,7 @@
// Wappalyzer by ElbertF 2009 http://elbertf.com
var wappalyzer = (function() {
self = {
var self = {
apps: {},
appsDetected: 0,
browser: false,
@ -50,8 +50,14 @@ var wappalyzer = (function() {
self.newInstall = self.prefs.getBoolPref('newInstall');
self.version = self.prefs.getCharPref('version');
for ( var i = 1; i <= 23; i ++ ) {
self.showCats[i] = self.prefs.getBoolPref('cat' + i);
var i = 0;
while ( ++ i ) {
try {
self.showCats[i] = self.prefs.getBoolPref('cat' + i);
} catch (e) {
break;
}
}
var locationPref = self.prefs.getIntPref('location');
@ -113,58 +119,41 @@ var wappalyzer = (function() {
return;
}
switch(data) {
case 'customApps':
switch(true) {
case data == 'customApps':
self.customApps = self.prefs.getCharPref('customApps');
break;
case 'debug':
case data == 'debug':
self.debug = self.prefs.getBoolPref('debug');
break;
case 'enableTracking':
case data == 'enableTracking':
self.enableTracking = self.prefs.getBoolPref('enableTracking');
break;
case 'popupOnHover':
case data == 'popupOnHover':
self.popupOnHover = self.prefs.getBoolPref('popupOnHover');
self.moveLocation();
break;
case 'showApps':
case data == 'showApps':
self.showApps = self.prefs.getIntPref('showApps');
break;
case 'location':
case data == 'location':
var locationPref = self.prefs.getIntPref('location');
self.moveLocation(locationPref);
break;
case 'cat1': self.showCats[ 1] = self.prefs.getIntPref( 'cat1'); break;
case 'cat2': self.showCats[ 2] = self.prefs.getIntPref( 'cat2'); break;
case 'cat3': self.showCats[ 3] = self.prefs.getIntPref( 'cat3'); break;
case 'cat4': self.showCats[ 4] = self.prefs.getIntPref( 'cat4'); break;
case 'cat5': self.showCats[ 5] = self.prefs.getIntPref( 'cat5'); break;
case 'cat6': self.showCats[ 6] = self.prefs.getIntPref( 'cat6'); break;
case 'cat7': self.showCats[ 7] = self.prefs.getIntPref( 'cat7'); break;
case 'cat8': self.showCats[ 8] = self.prefs.getIntPref( 'cat8'); break;
case 'cat9': self.showCats[ 9] = self.prefs.getIntPref( 'cat9'); break;
case 'cat10': self.showCats[10] = self.prefs.getIntPref('cat10'); break;
case 'cat11': self.showCats[11] = self.prefs.getIntPref('cat11'); break;
case 'cat12': self.showCats[12] = self.prefs.getIntPref('cat12'); break;
case 'cat13': self.showCats[13] = self.prefs.getIntPref('cat13'); break;
case 'cat14': self.showCats[14] = self.prefs.getIntPref('cat14'); break;
case 'cat15': self.showCats[15] = self.prefs.getIntPref('cat15'); break;
case 'cat16': self.showCats[16] = self.prefs.getIntPref('cat16'); break;
case 'cat17': self.showCats[17] = self.prefs.getIntPref('cat17'); break;
case 'cat18': self.showCats[18] = self.prefs.getIntPref('cat18'); break;
case 'cat19': self.showCats[19] = self.prefs.getIntPref('cat19'); break;
case 'cat20': self.showCats[20] = self.prefs.getIntPref('cat20'); break;
case 'cat21': self.showCats[21] = self.prefs.getIntPref('cat21'); break;
case 'cat22': self.showCats[22] = self.prefs.getIntPref('cat22'); break;
case 'cat23': self.showCats[23] = self.prefs.getIntPref('cat23'); break;
case data.test(/^cat[0-9]+$/):
var cat = data.replace(/^cat([0-9]+)$/, '$1');
self.showCats[cat] = self.prefs.getIntPref('cat' + cat);
break;
}
},

@ -3,7 +3,7 @@
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>wappalyzer@crunchlabz.com</em:id>
<em:version>1.16.0</em:version>
<em:version>1.17.0</em:version>
<em:type>2</em:type>
<em:unpack>true</em:unpack>
@ -12,7 +12,7 @@
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>4.0</em:minVersion>
<em:maxVersion>8.*</em:maxVersion>
<em:maxVersion>9.*</em:maxVersion>
</Description>
</em:targetApplication>

Binary file not shown.