Show app on mouseover

Show app on mouseover
Reduce dependency with jQuery
main
Camille Barneaud 12 years ago
parent 961bcc015f
commit f85176f3a4

@ -154,9 +154,7 @@
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 = $('<image/>').attr('src', 'chrome://wappalyzer/skin/images/icon_hot.png'); $('<image>').attr('src', 'chrome://wappalyzer/skin/images/icon_hot.png').prependTo(document.getElementById('wappalyzer-container'));
$('#wappalyzer-container').prepend(image);
} }
w.detected[url].map(function(app, i) { w.detected[url].map(function(app, i) {
@ -171,40 +169,31 @@
if ( showCat ) { if ( showCat ) {
if ( prefs.getBoolPref('showIcons') ) { if ( prefs.getBoolPref('showIcons') ) {
image = $('<image/>').attr('src', 'chrome://wappalyzer/skin/images/icons/' + app + '.png'); $('<image>').attr('src', 'chrome://wappalyzer/skin/images/icons/' + app + '.png').attr('tooltiptext', app + ' - ' + strings.getString('wappalyzer.cat' + w.apps[app].cats[i])).prependTo(document.getElementById('wappalyzer-container'));
$('#wappalyzer-container').prepend(image);
} }
menuSeparator = $('<menuseparator/>'); $('<menuseparator>').appendTo(document.getElementById('wappalyzer-menu'));
$('#wappalyzer-menu').append(menuSeparator); $('#wappalyzer-menu')
.append($('<menuitem>')
menuItem = $('<menuitem/>')
.attr('class', 'wappalyzer-application menuitem-iconic') .attr('class', 'wappalyzer-application menuitem-iconic')
.attr('image', 'chrome://wappalyzer/skin/images/icons/' + app + '.png') .attr('image', 'chrome://wappalyzer/skin/images/icons/' + app + '.png')
.attr('label', app) .attr('label', app)
; .attr('name', app)
.on('command', function() {
menuItem.bind('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, '') });
}); }));
$('#wappalyzer-menu').append(menuItem);
for ( j in w.apps[app].cats ) { for ( j in w.apps[app].cats ) {
var cat = w.apps[app].cats[j]; var cat = w.apps[app].cats[j];
menuItem = $('<menuitem/>') $('#wappalyzer-menu')
.append($('<menuitem>')
.attr('class', 'wappalyzer-category') .attr('class', 'wappalyzer-category')
.attr('label', strings.getString('wappalyzer.cat' + cat)) .attr('label', strings.getString('wappalyzer.cat' + cat))
; .on('command', function() {
menuItem.bind('command', function() {
w.driver.goToURL({ url: w.config.websiteURL + 'categories/' + w.categories[cat] }); w.driver.goToURL({ url: w.config.websiteURL + 'categories/' + w.categories[cat] });
}); }));
$('#wappalyzer-menu').append(menuItem);
} }
break; break;
@ -214,20 +203,16 @@
w.driver.lastDisplayed = JSON.stringify(w.detected[url]); w.driver.lastDisplayed = JSON.stringify(w.detected[url]);
} else { } else {
image = $('<image/>').attr('src', 'chrome://wappalyzer/skin/images/icon.png'); $('<image>')
.attr('src', 'chrome://wappalyzer/skin/images/icon.png')
$('#wappalyzer-container').prepend(image); .prependTo(document.getElementById('wappalyzer-container'));
menuSeparator = $('<menuseparator/>');
$('#wappalyzer-menu').append(menuSeparator); $('<menuseparator>').appendTo(document.getElementById('wappalyzer-menu'));
menuItem = $('<menuitem/>') $('<menuitem>')
.attr('disabled', 'true') .attr('disabled', 'true')
.attr('label', strings.getString('wappalyzer.noAppsDetected')) .attr('label', strings.getString('wappalyzer.noAppsDetected'))
; .appendTo(document.getElementById('wappalyzer-menu'));
$('#wappalyzer-menu').append(menuItem);
w.driver.lastDisplayed = 'empty'; w.driver.lastDisplayed = 'empty';
} }
@ -295,11 +280,10 @@
*/ */
function container() { function container() {
if ( prefs.getBoolPref('addonBar') ) { if ( prefs.getBoolPref('addonBar') ) {
$('#wappalyzer-container').prependTo($('#wappalyzer-addonbar')); $('#wappalyzer-container').prependTo(document.getElementById('wappalyzer-addonbar'));
$('#wappalyzer-addonbar').attr('collapsed', 'false');
} else { } else {
$('#wappalyzer-container').prependTo($('#urlbar-icons')); $('#wappalyzer-container').prependTo(document.getElementById('urlbar-icons'));
$('#wappalyzer-addonbar').attr('collapsed', 'true'); $('#wappalyzer-addonbar').attr('collapsed', 'true');
} }
@ -310,32 +294,27 @@
*/ */
function bindings() { function bindings() {
// Menu items // Menu items
var prefix = '#wappalyzer-menu-'; var prefix = 'wappalyzer-menu-';
$(prefix + 'preferences' ) document.getElementById(prefix + 'preferences').onclick = function() {
.bind('command', function() {
w.driver.goToURL({ url: 'chrome://wappalyzer/content/xul/preferences.xul' }) w.driver.goToURL({ url: 'chrome://wappalyzer/content/xul/preferences.xul' })
}); };
$(prefix + 'feedback') document.getElementById(prefix + 'feedback').onclick = function() {
.bind('command', function() {
w.driver.goToURL({ url: w.config.websiteURL + 'contact' }) w.driver.goToURL({ url: w.config.websiteURL + 'contact' })
}); };
$(prefix + 'website') document.getElementById(prefix + 'website').onclick = function() {
.bind('command', function() {
w.driver.goToURL({ url: w.config.websiteURL }) w.driver.goToURL({ url: w.config.websiteURL })
}); };
$(prefix + 'github' ) document.getElementById(prefix + 'github').onclick = function() {
.bind('command', function() {
w.driver.goToURL({ url: w.config.githubURL }) w.driver.goToURL({ url: w.config.githubURL })
}); };
$(prefix + 'twitter') document.getElementById(prefix + 'twitter').onclick = function() {
.bind('command', function() { w.driver.goToURL({ url: w.config.twitterURL })
w.driver.goToURL({ url: w.config.twitterURL}) };
});
} }
w.init(); w.init();

Loading…
Cancel
Save