From 89abca5ca77796df4c46ea3695ffd9ab85c69848 Mon Sep 17 00:00:00 2001 From: pallxk Date: Sun, 27 Dec 2015 14:35:40 +0800 Subject: [PATCH] Add support for svg icons in drivers --- bin/wappalyzer-links | 4 ++++ src/drivers/bookmarklet/.gitignore | 1 + src/drivers/bookmarklet/js/driver.js | 2 +- src/drivers/chrome/.gitignore | 1 + src/drivers/chrome/js/driver.js | 2 +- src/drivers/chrome/js/popup.js | 2 +- src/drivers/firefox/.gitignore | 1 + src/drivers/firefox/data/js/panel.js | 2 +- src/drivers/firefox/driver.js | 4 ++-- src/drivers/html/.gitignore | 1 + src/drivers/html/js/driver.js | 2 +- 11 files changed, 15 insertions(+), 7 deletions(-) diff --git a/bin/wappalyzer-links b/bin/wappalyzer-links index 9501a383d..2afbfada0 100755 --- a/bin/wappalyzer-links +++ b/bin/wappalyzer-links @@ -30,19 +30,23 @@ echo "Creating hard links..." ln -f $path/wappalyzer.js $path/drivers/firefox/lib ln -f $path/apps.json $path/drivers/firefox/data ln -f $path/icons/*.png $path/drivers/firefox/data/images/icons +ln -f $path/icons/*.svg $path/drivers/firefox/data/images/icons ln -f $path/utils/*.js $path/drivers/firefox/data/js ln -f $path/wappalyzer.js $path/drivers/chrome/js ln -f $path/apps.json $path/drivers/chrome ln -f $path/icons/*.png $path/drivers/chrome/images/icons +ln -f $path/icons/*.svg $path/drivers/chrome/images/icons ln -f $path/utils/*.js $path/drivers/chrome/js ln -f $path/wappalyzer.js $path/drivers/bookmarklet/js ln -f $path/icons/*.png $path/drivers/bookmarklet/images/icons +ln -f $path/icons/*.svg $path/drivers/bookmarklet/images/icons ln -f $path/wappalyzer.js $path/drivers/html/js ln -f $path/apps.json $path/drivers/html ln -f $path/icons/*.png $path/drivers/html/images/icons +ln -f $path/icons/*.svg $path/drivers/html/images/icons ln -f $path/wappalyzer.js $path/drivers/php/js ln -f $path/apps.json $path/drivers/php diff --git a/src/drivers/bookmarklet/.gitignore b/src/drivers/bookmarklet/.gitignore index 0d9a93f5c..d03f42c47 100644 --- a/src/drivers/bookmarklet/.gitignore +++ b/src/drivers/bookmarklet/.gitignore @@ -1,3 +1,4 @@ images/icons/*.png +images/icons/*.svg js/wappalyzer.js js/apps.js diff --git a/src/drivers/bookmarklet/js/driver.js b/src/drivers/bookmarklet/js/driver.js index 65a6f64a7..a40554b11 100644 --- a/src/drivers/bookmarklet/js/driver.js +++ b/src/drivers/bookmarklet/js/driver.js @@ -147,7 +147,7 @@ '
' + '' + '' + - ' ' + app + + ' ' + app + '' + '' ; diff --git a/src/drivers/chrome/.gitignore b/src/drivers/chrome/.gitignore index 88270d2f7..60dc6455a 100644 --- a/src/drivers/chrome/.gitignore +++ b/src/drivers/chrome/.gitignore @@ -1,4 +1,5 @@ apps.json images/icons/*.png +images/icons/*.svg js/wappalyzer.js js/iframe.js diff --git a/src/drivers/chrome/js/driver.js b/src/drivers/chrome/js/driver.js index d4b035bde..2644d6ed0 100644 --- a/src/drivers/chrome/js/driver.js +++ b/src/drivers/chrome/js/driver.js @@ -193,7 +193,7 @@ for ( appName in w.detected[url] ) { w.apps[appName].cats.forEach(function(cat) { if ( cat == match && !found ) { - chrome.pageAction.setIcon({ tabId: tab.id, path: 'images/icons/' + appName + '.png' }); + chrome.pageAction.setIcon({ tabId: tab.id, path: 'images/icons/' + w.apps[appName].icon }); found = true; } diff --git a/src/drivers/chrome/js/popup.js b/src/drivers/chrome/js/popup.js index 15ed8bd2f..957b22b4f 100644 --- a/src/drivers/chrome/js/popup.js +++ b/src/drivers/chrome/js/popup.js @@ -35,7 +35,7 @@ document.addEventListener('DOMContentLoaded', function() { html = '
' + '' + - '' + + '' + '' + appName + '' + ( version ? ' ' + version : '' ) + ( confidence < 100 ? ' (' + confidence + '% sure)' : '' ) + '' + ''; diff --git a/src/drivers/firefox/.gitignore b/src/drivers/firefox/.gitignore index 975eec334..871b16778 100644 --- a/src/drivers/firefox/.gitignore +++ b/src/drivers/firefox/.gitignore @@ -1,4 +1,5 @@ data/apps.json data/images/icons/*.png +data/images/icons/*.svg data/js/iframe.js lib/wappalyzer.js diff --git a/src/drivers/firefox/data/js/panel.js b/src/drivers/firefox/data/js/panel.js index 40e233d96..16bb9986c 100644 --- a/src/drivers/firefox/data/js/panel.js +++ b/src/drivers/firefox/data/js/panel.js @@ -35,7 +35,7 @@ }); }(appName)); - img.setAttribute('src', 'images/icons/' + appName + '.png'); + img.setAttribute('src', 'images/icons/' + message.apps[appName].icon); img.setAttribute('height', '16'); img.setAttribute('width', '16'); diff --git a/src/drivers/firefox/driver.js b/src/drivers/firefox/driver.js index 5df3aa7c3..4e60afbe4 100644 --- a/src/drivers/firefox/driver.js +++ b/src/drivers/firefox/driver.js @@ -249,7 +249,7 @@ }; Button.prototype.setIcon = function(appName) { - var url = typeof appName === 'undefined' ? './images/icon32.png' : './images/icons/' + appName + '.png'; + var url = typeof appName === 'undefined' ? './images/icon32.png' : './images/icons/' + w.apps[appName].icon; this.button.icon = url; }; @@ -303,7 +303,7 @@ UrlBar.prototype.addIcon = function(appName) { var icon = this.document.createElement('image'), - url = typeof appName === 'undefined' ? 'images/icon32.png' : 'images/icons/' + appName + '.png', + url = typeof appName === 'undefined' ? 'images/icon32.png' : 'images/icons/' + w.apps[appName].icon, tooltipText = ( typeof appName !== 'undefined' ? appName + ' - ' + require('sdk/l10n').get('clickForDetails') + ' - ' : '' ) + require('sdk/l10n').get('name'); icon.setAttribute('src', require('sdk/self').data.url(url)); diff --git a/src/drivers/html/.gitignore b/src/drivers/html/.gitignore index c73e01d30..01d2786a1 100644 --- a/src/drivers/html/.gitignore +++ b/src/drivers/html/.gitignore @@ -1,3 +1,4 @@ apps.json images/icons/*.png +images/icons/*.svg js/wappalyzer.js diff --git a/src/drivers/html/js/driver.js b/src/drivers/html/js/driver.js index 1ad4a4986..0e14f59af 100644 --- a/src/drivers/html/js/driver.js +++ b/src/drivers/html/js/driver.js @@ -51,7 +51,7 @@ document.getElementById('apps').innerHTML = ''; for ( app in w.detected[url] ) { - document.getElementById('apps').innerHTML += ' ' + app + '
'; + document.getElementById('apps').innerHTML += ' ' + app + '
'; }; },