|
|
@ -7,9 +7,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
if ( wappalyzer == null ) return;
|
|
|
|
if ( wappalyzer == null ) return;
|
|
|
|
|
|
|
|
|
|
|
|
var w = wappalyzer, prefs, strings, $;
|
|
|
|
var w = wappalyzer, prefs, strings;
|
|
|
|
|
|
|
|
|
|
|
|
const
|
|
|
|
const
|
|
|
|
|
|
|
|
d = document,
|
|
|
|
Cc = Components.classes,
|
|
|
|
Cc = Components.classes,
|
|
|
|
Ci = Components.interfaces
|
|
|
|
Ci = Components.interfaces
|
|
|
|
;
|
|
|
|
;
|
|
|
@ -35,7 +36,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
w.log('w.driver: browser window loaded');
|
|
|
|
w.log('w.driver: browser window loaded');
|
|
|
|
|
|
|
|
|
|
|
|
strings = document.getElementById('wappalyzer-strings');
|
|
|
|
strings = d.getElementById('wappalyzer-strings');
|
|
|
|
|
|
|
|
|
|
|
|
// Read apps.json
|
|
|
|
// Read apps.json
|
|
|
|
var xhr = Cc['@mozilla.org/xmlextras/xmlhttprequest;1'].createInstance(Ci.nsIXMLHttpRequest);
|
|
|
|
var xhr = Cc['@mozilla.org/xmlextras/xmlhttprequest;1'].createInstance(Ci.nsIXMLHttpRequest);
|
|
|
@ -54,13 +55,6 @@
|
|
|
|
xhr.send(null);
|
|
|
|
xhr.send(null);
|
|
|
|
|
|
|
|
|
|
|
|
AddonManager.getAddonByID('wappalyzer@crunchlabz.com', function(addon) {
|
|
|
|
AddonManager.getAddonByID('wappalyzer@crunchlabz.com', function(addon) {
|
|
|
|
// Load jQuery
|
|
|
|
|
|
|
|
Cc['@mozilla.org/moz/jssubscript-loader;1'].getService(Ci.mozIJSSubScriptLoader).loadSubScript('chrome://wappalyzer/content/js/lib/jquery.min.js');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$ = jQuery;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jQuery.noConflict(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Preferences
|
|
|
|
// Preferences
|
|
|
|
prefs = Cc['@mozilla.org/preferences-service;1'].getService(Ci.nsIPrefService).getBranch('extensions.wappalyzer.');
|
|
|
|
prefs = Cc['@mozilla.org/preferences-service;1'].getService(Ci.nsIPrefService).getBranch('extensions.wappalyzer.');
|
|
|
|
|
|
|
|
|
|
|
@ -141,7 +135,15 @@
|
|
|
|
* Display apps
|
|
|
|
* Display apps
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
displayApps: function() {
|
|
|
|
displayApps: function() {
|
|
|
|
var menuItem, menuSeparator, image, url = gBrowser.currentURI.spec.split('#')[0];
|
|
|
|
var
|
|
|
|
|
|
|
|
i, j, elements, menuItem, menuSeparator, image,
|
|
|
|
|
|
|
|
remove = [],
|
|
|
|
|
|
|
|
container = d.getElementById('wappalyzer-container'),
|
|
|
|
|
|
|
|
menu = d.getElementById('wappalyzer-menu'),
|
|
|
|
|
|
|
|
url = gBrowser.currentURI.spec.split('#')[0]
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( !container ) { return; }
|
|
|
|
|
|
|
|
|
|
|
|
if ( w.detected[url] != null && w.detected[url].length ) {
|
|
|
|
if ( w.detected[url] != null && w.detected[url].length ) {
|
|
|
|
// No change
|
|
|
|
// No change
|
|
|
@ -150,14 +152,25 @@
|
|
|
|
if ( w.driver.lastDisplayed === 'empty' ) { return; }
|
|
|
|
if ( w.driver.lastDisplayed === 'empty' ) { return; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Do not combine these, for some reason it causes the "remove bookmark" button text to disappear
|
|
|
|
elements = {
|
|
|
|
$('#wappalyzer-container > image' ).attr('class', 'wappalyzer-remove');
|
|
|
|
images: container.getElementsByTagName('image'),
|
|
|
|
$('#wappalyzer-menu > menuitem' ).attr('class', 'wappalyzer-remove');
|
|
|
|
menuItems: menu .getElementsByTagName('menuitem'),
|
|
|
|
$('#wappalyzer-menu > menuseparator').attr('class', 'wappalyzer-remove');
|
|
|
|
menuSeparators: menu .getElementsByTagName('menuseparator')
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for ( i in elements ) {
|
|
|
|
|
|
|
|
for ( j = elements[i].length - 1; j >= 0; j -- ) {
|
|
|
|
|
|
|
|
remove.push(elements[i][j]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( w.detected[url] != null && w.detected[url].length ) {
|
|
|
|
if ( w.detected[url] != null && w.detected[url].length ) {
|
|
|
|
if ( !prefs.getBoolPref('showIcons') ) {
|
|
|
|
if ( !prefs.getBoolPref('showIcons') ) {
|
|
|
|
$('<image>').attr('src', 'chrome://wappalyzer/skin/images/icon_hot.png').prependTo(document.getElementById('wappalyzer-container'));
|
|
|
|
image = d.createElement('image');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
image.setAttribute('src', 'chrome://wappalyzer/skin/images/icon_hot.png');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
container.appendChild(image);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
w.detected[url].map(function(app, i) {
|
|
|
|
w.detected[url].map(function(app, i) {
|
|
|
@ -171,38 +184,45 @@
|
|
|
|
} catch(e) { }
|
|
|
|
} catch(e) { }
|
|
|
|
|
|
|
|
|
|
|
|
if ( showCat ) {
|
|
|
|
if ( showCat ) {
|
|
|
|
$('<menuseparator>').appendTo(document.getElementById('wappalyzer-menu'));
|
|
|
|
menuSeparator = d.createElement('menuseparator');
|
|
|
|
|
|
|
|
menuItem = d.createElement('menuitem');
|
|
|
|
$('#wappalyzer-menu')
|
|
|
|
|
|
|
|
.append($('<menuitem>')
|
|
|
|
menuItem.setAttribute('class', 'wappalyzer-application menuitem-iconic');
|
|
|
|
.attr('class', 'wappalyzer-application menuitem-iconic')
|
|
|
|
menuItem.setAttribute('image', 'chrome://wappalyzer/skin/images/icons/' + app + '.png');
|
|
|
|
.attr('image', 'chrome://wappalyzer/skin/images/icons/' + app + '.png')
|
|
|
|
menuItem.setAttribute('label', app);
|
|
|
|
.attr('label', app)
|
|
|
|
menuItem.setAttribute('name', app);
|
|
|
|
.attr('name', app)
|
|
|
|
|
|
|
|
.on('command', function() {
|
|
|
|
menuItem.addEventListener('command', function() {
|
|
|
|
w.driver.goToURL({ url: w.config.websiteURL + 'applications/' + app.toLowerCase().replace(/ /g, '-').replace(/[^\w-]/g, '') });
|
|
|
|
w.driver.goToURL({ url: w.config.websiteURL + 'applications/' + app.toLowerCase().replace(/ /g, '-').replace(/[^\w-]/g, '') });
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
menu.appendChild(menuSeparator);
|
|
|
|
|
|
|
|
menu.appendChild(menuItem);
|
|
|
|
|
|
|
|
|
|
|
|
for ( j in w.apps[app].cats ) {
|
|
|
|
for ( j in w.apps[app].cats ) {
|
|
|
|
cat = w.apps[app].cats[j];
|
|
|
|
cat = w.apps[app].cats[j];
|
|
|
|
|
|
|
|
|
|
|
|
categories.push(strings.getString('wappalyzer.cat' + cat));
|
|
|
|
categories.push(strings.getString('wappalyzer.cat' + cat));
|
|
|
|
|
|
|
|
|
|
|
|
$('#wappalyzer-menu')
|
|
|
|
menuItem = d.createElement('menuitem');
|
|
|
|
.append($('<menuitem>')
|
|
|
|
|
|
|
|
.attr('class', 'wappalyzer-category')
|
|
|
|
menuItem.setAttribute('class', 'wappalyzer-category');
|
|
|
|
.attr('label', strings.getString('wappalyzer.cat' + cat))
|
|
|
|
menuItem.setAttribute('label', strings.getString('wappalyzer.cat' + cat));
|
|
|
|
.on('command', function() {
|
|
|
|
|
|
|
|
w.driver.goToURL({ url: w.config.websiteURL + 'categories/' + w.categories[cat] });
|
|
|
|
menuItem.addEventListener('command', function() {
|
|
|
|
}));
|
|
|
|
w.driver.goToURL({ url: w.config.websiteURL + 'categories/' + w.categories[cat] });
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
menu.appendChild(menuItem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( prefs.getBoolPref('showIcons') ) {
|
|
|
|
if ( prefs.getBoolPref('showIcons') ) {
|
|
|
|
$('<image>')
|
|
|
|
image = d.createElement('image');
|
|
|
|
.attr('src', 'chrome://wappalyzer/skin/images/icons/' + app + '.png')
|
|
|
|
|
|
|
|
.attr('tooltiptext', app + ' - ' + categories.join(', '))
|
|
|
|
image.setAttribute('src', 'chrome://wappalyzer/skin/images/icons/' + app + '.png');
|
|
|
|
.prependTo(document.getElementById('wappalyzer-container'))
|
|
|
|
image.setAttribute('tooltiptext', app + ' - ' + categories.join(', '));
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
container.appendChild(image);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -212,24 +232,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
w.driver.lastDisplayed = JSON.stringify(w.detected[url]);
|
|
|
|
w.driver.lastDisplayed = JSON.stringify(w.detected[url]);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$('<image>')
|
|
|
|
image = d.createElement('image');
|
|
|
|
.attr('src', 'chrome://wappalyzer/skin/images/icon.png')
|
|
|
|
menuSeparator = d.createElement('menuseparator');
|
|
|
|
.prependTo(document.getElementById('wappalyzer-container'));
|
|
|
|
menuItem = d.createElement('menuitem');
|
|
|
|
|
|
|
|
|
|
|
|
$('<menuseparator>').appendTo(document.getElementById('wappalyzer-menu'));
|
|
|
|
image.setAttribute('src', 'chrome://wappalyzer/skin/images/icon.png');
|
|
|
|
|
|
|
|
|
|
|
|
$('<menuitem>')
|
|
|
|
menuItem.setAttribute('disabled', 'true');
|
|
|
|
.attr('disabled', 'true')
|
|
|
|
menuItem.setAttribute('label', strings.getString('wappalyzer.noAppsDetected'));
|
|
|
|
.attr('label', strings.getString('wappalyzer.noAppsDetected'))
|
|
|
|
|
|
|
|
.appendTo(document.getElementById('wappalyzer-menu'));
|
|
|
|
container.appendChild(image);
|
|
|
|
|
|
|
|
menu .appendChild(menuSeparator);
|
|
|
|
|
|
|
|
menu .appendChild(menuItem);
|
|
|
|
|
|
|
|
|
|
|
|
w.driver.lastDisplayed = 'empty';
|
|
|
|
w.driver.lastDisplayed = 'empty';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Do not combine these either, see above
|
|
|
|
for ( i in remove ) {
|
|
|
|
$('image.wappalyzer-remove' ).remove();
|
|
|
|
remove[i].parentNode.removeChild(remove[i]);
|
|
|
|
$('menuitem.wappalyzer-remove' ).remove();
|
|
|
|
}
|
|
|
|
$('menuseparator.wappalyzer-remove').remove();
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -292,13 +313,12 @@
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function container() {
|
|
|
|
function container() {
|
|
|
|
if ( prefs.getBoolPref('addonBar') ) {
|
|
|
|
if ( prefs.getBoolPref('addonBar') ) {
|
|
|
|
$('#wappalyzer-container').prependTo(document.getElementById('wappalyzer-addonbar'));
|
|
|
|
d.getElementById('wappalyzer-addonbar').appendChild(d.getElementById('wappalyzer-container'));
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$('#wappalyzer-container').prependTo(document.getElementById('urlbar-icons'));
|
|
|
|
d.getElementById('urlbar-icons').appendChild(d.getElementById('wappalyzer-container'));
|
|
|
|
|
|
|
|
|
|
|
|
$('#wappalyzer-addonbar').attr('collapsed', 'true');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
d.getElementById('wappalyzer-addonbar').setAttribute('collapsed', prefs.getBoolPref('addonBar') ? 'true' : 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -308,23 +328,23 @@
|
|
|
|
// Menu items
|
|
|
|
// Menu items
|
|
|
|
var prefix = 'wappalyzer-menu-';
|
|
|
|
var prefix = 'wappalyzer-menu-';
|
|
|
|
|
|
|
|
|
|
|
|
document.getElementById(prefix + 'preferences').onclick = function() {
|
|
|
|
d.getElementById(prefix + 'preferences').onclick = function() {
|
|
|
|
w.driver.goToURL({ url: 'chrome://wappalyzer/content/xul/preferences.xul' })
|
|
|
|
w.driver.goToURL({ url: 'chrome://wappalyzer/content/xul/preferences.xul' })
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
document.getElementById(prefix + 'feedback').onclick = function() {
|
|
|
|
d.getElementById(prefix + 'feedback').onclick = function() {
|
|
|
|
w.driver.goToURL({ url: w.config.websiteURL + 'contact' })
|
|
|
|
w.driver.goToURL({ url: w.config.websiteURL + 'contact' })
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
document.getElementById(prefix + 'website').onclick = function() {
|
|
|
|
d.getElementById(prefix + 'website').onclick = function() {
|
|
|
|
w.driver.goToURL({ url: w.config.websiteURL })
|
|
|
|
w.driver.goToURL({ url: w.config.websiteURL })
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
document.getElementById(prefix + 'github').onclick = function() {
|
|
|
|
d.getElementById(prefix + 'github').onclick = function() {
|
|
|
|
w.driver.goToURL({ url: w.config.githubURL })
|
|
|
|
w.driver.goToURL({ url: w.config.githubURL })
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
document.getElementById(prefix + 'twitter').onclick = function() {
|
|
|
|
d.getElementById(prefix + 'twitter').onclick = function() {
|
|
|
|
w.driver.goToURL({ url: w.config.twitterURL })
|
|
|
|
w.driver.goToURL({ url: w.config.twitterURL })
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|