Not using innerHTML

main
Elbert Alias 11 years ago
parent 7c9ab5eea4
commit ccb04dde94

@ -1,40 +1,86 @@
(function() {
self.port.on('displayApps', function(message) {
var
detectedApps = document.getElementById('detected-apps')
empty = document.getElementById('empty');
div, a, img, label, name,
d = document,
detectedApps = d.getElementById('detected-apps'),
empty = d.getElementById('empty');
detectedApps.innerHTML = '';
while ( detectedApps.firstChild ) {
detectedApps.removeChild(detectedApps.firstChild);
}
if ( message.tabCache.count > 0 ) {
empty.style.display = 'none';
for ( appName in message.tabCache.appsDetected ) {
div = d.createElement('div');
a = d.createElement('a');
img = d.createElement('img');
label = d.createElement('span');
name = d.createElement('span');
confidence = message.tabCache.appsDetected[appName].confidenceTotal;
version = message.tabCache.appsDetected[appName].version;
html =
'<div class="detected-app">' +
'<a target="_blank" href="https://wappalyzer.com/applications/' + appName.toLowerCase().replace(/ /g, '-').replace(/[^\w-]/g, '') + '?utm_source=firefox&utm_medium=panel&utm_campaign=extensions">' +
'<img src="images/icons/' + appName + '.png" width="16" height="16">' +
'<span class="label"><span class="name">' + appName + '</span>' + ( version ? ' ' + version : '' ) + ( confidence < 100 ? ' (' + confidence + '% sure)' : '' ) + '</span>' +
'</a>';
div.setAttribute('class', 'detected-app');
message.apps[appName].cats.forEach(function(cat) {
html +=
'<a target="_blank" href="https://wappalyzer.com/categories/' + message.categories[cat] + '?utm_source=firefox&utm_medium=panel&utm_campaign=extensions">' +
'<span class="category"><span class="name">' + message.categoryNames[cat] + '</span></span>' +
'</a>';
a.setAttribute('href', '#');
a.addEventListener('click', function(e) {
e.preventDefault();
self.port.emit('goToUrl', 'applications/' + appName.toLowerCase().replace(/ /g, '-').replace(/[^\w-]/g, ''));
});
html +=
'</a>' +
'</div>';
img.setAttribute('src', 'images/icons/' + appName + '.png');
img.setAttribute('height', '16');
img.setAttribute('width', '16');
label.setAttribute('class', 'label');
name.setAttribute('class', 'name');
name.appendChild(d.createTextNode(appName));
label.appendChild(name);
label.appendChild(d.createTextNode(( version ? ' ' + version : '' ) + ( confidence < 100 ? ' (' + confidence + '% sure)' : '')));
a.appendChild(img)
a.appendChild(label)
div.appendChild(a);
message.apps[appName].cats.forEach(function(cat) {
a = d.createElement('a');
label = d.createElement('span');
name = d.createElement('span');
a.setAttribute('href', '#');
a.addEventListener('click', function(e) {
e.preventDefault();
self.port.emit('goToUrl', 'categories/' + message.categories[cat]);
});
label.setAttribute('class', 'category');
name.setAttribute('class', 'name');
name.appendChild(d.createTextNode(message.categoryNames[cat]));
label.appendChild(name);
a.appendChild(label);
div.appendChild(a);
});
detectedApps.innerHTML = detectedApps.innerHTML + html;
detectedApps.appendChild(div);
}
} else {
empty.style.display = 'block';
empty.style.display = 'inherit';
}
self.port.emit('resize', document.body.offsetHeight);

@ -103,6 +103,12 @@
panel.port.on('resize', function(height) {
panel.height = height;
});
panel.port.on('goToUrl', function(url) {
panel.hide();
w.driver.goToURL({ url: w.config.websiteURL + url, medium: 'panel' });
});
}
createWidget = function() {
@ -267,6 +273,14 @@
w.log('display apps');
if ( panel === undefined ) {
if ( sp.prefs.urlbar ) {
createPanel();
} else {
createWidget();
}
}
if ( tabCache[tabs.activeTab.id] === undefined ) {
initTab(tabs.activeTab);
}

@ -8,7 +8,7 @@
"description": "Identifies software on the web",
"author": "Elbert Alias",
"license": "GPLv3",
"version": "3.0.2",
"version": "3.0.4",
"main": "driver",
"preferences": [{
"name": "tracking",

@ -446,12 +446,12 @@
"headers": { "Server": "CherryPy\\/?([\\d\\.]+)?\\;version:\\1" },
"implies": "Python"
},
"Chitika"{
"website": "chitika.com",
"cats": [ 36 ],
"script": "https?://scripts\\.chitika\\.net/",
"env": "ch_c(?:lient|olor_site_link)"
},
"Chitika": {
"website": "chitika.com",
"cats": [ 36 ],
"script": "https?://scripts\\.chitika\\.net/",
"env": "ch_c(?:lient|olor_site_link)"
},
"CKEditor": {
"website": "ckeditor.com",
"cats": [ 24 ],
@ -1656,16 +1656,6 @@
"cats": [ 27 ],
"headers": { "X-Powered-By": "\\bLua(?: ([\\d.]+))?\\;version:\\1" }
},
"M.R. Inc Webserver": {
"website": "mrincworld.com",
"cats": [ 22 ],
"headers": { "Server": "M\\.R\\. Inc Inc Webserver" }
},
"M.R. Inc Wild CMS": {
"website": "mrincworld.com",
"cats": [ 1, 6 ],
"headers": { "X-Powered-By": "M\\.R\\. Inc Inc Wild CMS" }
},
"Magento": {
"website": "www.magentocommerce.com",
"cats": [ 6 ],
@ -1915,6 +1905,16 @@
"cats": [ 1 ],
"meta": { "generator": "Movable Type" }
},
"M.R. Inc Webserver": {
"website": "mrincworld.com",
"cats": [ 22 ],
"headers": { "Server": "M\\.R\\. Inc Inc Webserver" }
},
"M.R. Inc Wild CMS": {
"website": "mrincworld.com",
"cats": [ 1, 6 ],
"headers": { "X-Powered-By": "M\\.R\\. Inc Inc Wild CMS" }
},
"Mura CMS": {
"website": "www.getmura.com",
"cats": [ 1, 11 ],