(function() { self.port.on('displayApps', function(message) { var detectedApps = document.getElementById('detected-apps') empty = document.getElementById('empty'); detectedApps.innerHTML = ''; if ( message.tabCache.count > 0 ) { empty.style.display = 'none'; for ( appName in message.tabCache.appsDetected ) { confidence = message.tabCache.appsDetected[appName].confidenceTotal; version = message.tabCache.appsDetected[appName].version; html = '
' + '' + '' + '' + appName + '' + ( version ? ' ' + version : '' ) + ( confidence < 100 ? ' (' + confidence + '% sure)' : '' ) + '' + ''; message.apps[appName].cats.forEach(function(cat) { html += '' + '' + message.categoryNames[cat] + '' + ''; }); html += '' + '
'; detectedApps.innerHTML = detectedApps.innerHTML + html; } } else { empty.style.display = 'block'; } self.port.emit('resize', document.body.offsetHeight); }); }());