/** * Bookmarklet driver */ (function() { if ( typeof wappalyzer === 'undefined' ) { return; } var w = wappalyzer, debug = true d = window.document, container = d.getElementById('wappalyzer-container'), domain = window.top.location.host, url = window.top.location.href, hasOwn = Object.prototype.hasOwnProperty; w.driver = { timeout: 1000, /** * Log messages to console */ log: function(args) { if ( debug && console != null && console[args.type] != null ) { console[args.type](args.message); } }, /** * Initialize */ init: function() { w.driver.getEnvironmentVars(); w.driver.getResponseHeaders(); }, getEnvironmentVars: function() { w.log('func: getEnvironmentVars'); var i, env = []; for ( i in window ) { env.push(i); } w.analyze(domain, url, { html: d.documentElement.innerHTML, env: env }); }, getResponseHeaders: function() { w.log('func: getResponseHeaders'); var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.onreadystatechange = function() { if ( xhr.readyState === 4 && xhr.status ) { var headers = xhr.getAllResponseHeaders().split("\n"); if ( headers.length > 0 && headers[0] != '' ) { w.log('responseHeaders: ' + xhr.getAllResponseHeaders()); var responseHeaders = {}; headers.forEach(function(line) { var name, value; if ( line ) { name = line.substring(0, line.indexOf(': ')); value = line.substring(line.indexOf(': ') + 2, line.length - 1); responseHeaders[name.toLowerCase()] = value; } }); w.analyze(domain, url, { headers: responseHeaders }); } } } xhr.send(); }, /** * Display apps */ displayApps: function() { w.log('func: diplayApps'); var i, first = true, app, category, html; html = '' + 'Close' + '' + '