commit
33c53bd639
@ -1,16 +1,43 @@
|
||||
(function() {
|
||||
try {
|
||||
var i, environmentVars = '', e = document.createEvent('Events');
|
||||
addEventListener('message', (event => {
|
||||
if ( event.data.id !== 'patterns' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
const patterns = event.data.patterns || {};
|
||||
|
||||
const js = {};
|
||||
|
||||
Object.keys(patterns).forEach(appName => {
|
||||
js[appName] = {};
|
||||
|
||||
Object.keys(patterns[appName]).forEach(chain => {
|
||||
js[appName][chain] = {};
|
||||
|
||||
e.initEvent('wappalyzerEvent', true, false);
|
||||
patterns[appName][chain].forEach((pattern, index) => {
|
||||
const value = detectJs(chain);
|
||||
|
||||
for ( i in window ) {
|
||||
environmentVars += i + ' ';
|
||||
if ( value ) {
|
||||
js[appName][chain][index] = value;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById('wappalyzerData').appendChild(document.createComment(environmentVars));
|
||||
document.getElementById('wappalyzerData').dispatchEvent(e);
|
||||
postMessage({ id: 'js', js }, '*');
|
||||
}), false);
|
||||
} catch(e) {
|
||||
// Fail quietly
|
||||
}
|
||||
}());
|
||||
|
||||
function detectJs(chain) {
|
||||
const properties = chain.split('.');
|
||||
|
||||
const value = properties.reduce((parent, property) => {
|
||||
return parent && parent.hasOwnProperty(property) ? parent[property] : null;
|
||||
}, window);
|
||||
|
||||
return typeof value === 'string' ? value : !!value;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 140 B |
Loading…
Reference in new issue