Merge pull request #5 from AliasIO/master

Update
main
DaAwesomeP 9 years ago
commit 42b0595699

@ -1,6 +1,6 @@
language: node_js
node_js:
- "4.2.1"
- "4.2.2"
sudo: false
before_install:
- export WAPPALYZER_ROOT=$TRAVIS_BUILD_DIR

@ -30,10 +30,12 @@ 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/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/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

@ -29,9 +29,9 @@ echo "Validating apps.json..."
jsonlint --quiet -V $WAPPALYZER_ROOT/schema.json $path/apps.json
# echo "Validating regular expressions..."
#
# wappalyzer validate-regex
echo "Validating regular expressions..."
wappalyzer validate-regex
echo "Validating icons..."

@ -115,16 +115,27 @@
"website": "www.aten.com",
"icon": "ATEN.png"
},
"ATG Web Commerce": {
"Oracle Commerce": {
"cats": [
6
],
"headers": {
"X-ATG-Version": "(?:ATGPlatform/([\\d.]+))?\\;version:\\1"
},
"html": "<[^>]+_DARGS",
"website": "oracle.com/us/products/applications/web-commerce/atg",
"icon": "ATG Web Commerce.png"
"html": "<[^>]+_dyncharset",
"website": "www.oracle.com/applications/customer-experience/commerce/products/commerce-platform/index.html",
"icon": "Oracle Commerce.png"
},
"Oracle Commerce Cloud": {
"cats": [
6
],
"headers": {
"OracleCommerceCloud-Version": "(.*)\\;version:\\1"
},
"html": "<[^>]+id=\"oracle-cc\"",
"website": "cloud.oracle.com/commerce-cloud",
"icon": "Oracle Commerce Cloud.png"
},
"AWStats": {
"cats": [
@ -410,7 +421,7 @@
"env": "^angular$",
"script": [
"angular(?:\\-|\\.)([\\d.]*\\d)[^/]*\\.js\\;version:\\1",
"/([\\d.]+(\\-?rc[.\\d]*)*)/angular(\\.min)?\\.js\\;version:\\1",
"/([\\d.]+(?:\\-?rc[.\\d]*)*)/angular(?:\\.min)?\\.js\\;version:\\1",
"angular.*\\.js"
],
"website": "angularjs.org",
@ -497,9 +508,9 @@
],
"excludes": "OpenCart",
"headers": {
"Arastta": "([0-9.]+)\\;version:\\1"
"X-Arastta": ""
},
"html": "Powered By <a href=\"[^>]+Arastta",
"html": "Powered by <a [^>]*href=\"https?://(?:www\\.)?arastta\\.org[^>]+>Arastta",
"implies": "PHP",
"script": "arastta\\.js",
"website": "arastta.org",
@ -595,7 +606,7 @@
13
],
"env": "^jira$",
"html": "Powered by\\s+<a href=[^>]+atlassian\\.com/(?:software/jira|jira-bug-tracking/)[^>]+>Atlassian\\s+JIRA(?:[^v]*v(?:ersion: )?(\\d+\\.\\d+(\\.\\d+)?))?\\;version:\\1",
"html": "Powered by\\s+<a href=[^>]+atlassian\\.com/(?:software/jira|jira-bug-tracking/)[^>]+>Atlassian\\s+JIRA(?:[^v]*v(?:ersion: )?(\\d+\\.\\d+(?:\\.\\d+)?))?\\;version:\\1",
"implies": "Java",
"meta": {
"ajs-version-number": "([\\d\\.]+)\\;version:\\1",
@ -784,7 +795,7 @@
12
],
"implies": "Google Analytics",
"script": "boba(\\.min)?\\.js",
"script": "boba(?:\\.min)?\\.js",
"website": "boba.space150.com",
"icon": "Boba.js.png"
},
@ -1012,6 +1023,16 @@
"website": "www.canon.com",
"icon": "Canon HTTP Server.png"
},
"Captch Me": {
"cats": [
16,
36
],
"env": "^Captchme",
"script": "^https?://api\\.captchme\\.net/",
"website": "captchme.com",
"icon": "Captch Me.svg"
},
"Carbon Ads": {
"cats": [
36
@ -1819,7 +1840,7 @@
"cats": [
36
],
"script": "googletagservices\\.com/tag/js/gpt(_mobile|)\\.js",
"script": "googletagservices\\.com/tag/js/gpt(?:_mobile)?\\.js",
"website": "www.google.com/dfp",
"icon": "DoubleClick for Publishers (DFP).png"
},
@ -2067,7 +2088,7 @@
],
"html": "<link[^>]+?href=\"[^\"]+epoch(?:\\.min)?\\.css",
"implies": "D3",
"script": "epoch(\\.min)?\\.js",
"script": "epoch(?:\\.min)?\\.js",
"website": "fastly.github.io/epoch",
"icon": "Epoch.png"
},
@ -2085,7 +2106,7 @@
27
],
"headers": {
"Server": "Erlang( OTP/([\\-\\d\\.ABR]+))?\\;version:\\1"
"Server": "Erlang( OTP/(?:[\\-\\d\\.ABR]+))?\\;version:\\1"
},
"website": "www.erlang.org",
"icon": "Erlang.png"
@ -2805,7 +2826,7 @@
12
],
"env": "^Hammer$",
"script": "hammer(\\.min)?\\.js",
"script": "hammer(?:\\.min)?\\.js",
"website": "hammerjs.github.io",
"icon": "Hammer.js.png"
},
@ -2909,7 +2930,7 @@
"env": "^Hogan$",
"script": [
"hogan-(?:-|\\.)([\\d.]*\\d)[^/]*\\.js\\;version:\\1",
"([\\d.]+)/hogan(\\.min)?\\.js\\;version:\\1"
"([\\d.]+)/hogan(?:\\.min)?\\.js\\;version:\\1"
],
"website": "twitter.github.com/hogan.js",
"icon": "Hogan.js.png"
@ -3642,7 +3663,7 @@
"cats": [
12
],
"script": "lazy(\\.browser)?(\\.min)?\\.js",
"script": "lazy(?:\\.browser)?(?:\\.min)?\\.js",
"website": "danieltao.com/lazy.js",
"icon": "Lazy.js.png"
},
@ -4008,6 +4029,16 @@
"website": "mathjax.org",
"icon": "MathJax.png"
},
"MaxCDN": {
"cats": [
31
],
"headers": {
"Server": "NetDNA"
},
"website": "www.maxcdn.com",
"icon": "MaxCDN.png"
},
"MaxSite CMS": {
"cats": [
1
@ -4216,7 +4247,7 @@
1,
6
],
"html": "(<script|link)[^>]*mg-(core|plugins|templates)",
"html": "(?:<script|link)[^>]*mg-(?:core|plugins|templates)",
"implies": "PHP",
"website": "moguta.ru",
"icon": "Moguta.CMS.png"
@ -4905,7 +4936,7 @@
"html": "<\\/div>\\s*<!-- outerContainer -->\\s*<div\\s*id=\"printContainer\"><\\/div>",
"url": "/web/viewer\\.html?file=[^&]\\.pdf",
"website": "mozilla.github.io/pdf.js/",
"icon": "PDF.js.png"
"icon": "PDF.js.svg"
},
"PHP": {
"cats": [
@ -4971,7 +5002,7 @@
"cats": [
25
],
"script": "paths(\\.min)?\\.js",
"script": "paths(?:\\.min)?\\.js",
"website": "github.com/andreaferretti/paths-js",
"icon": "Paths.js.png"
},
@ -5430,7 +5461,7 @@
"html": "<[^>]+data-react",
"script": [
"react(?:\\-with\\-addons)?(?:\\-|\\.)([\\d.]*\\d)[^/]*\\.js\\;version:\\1",
"/([\\d.]+)/react(\\.min)?\\.js\\;version:\\1",
"/([\\d.]+)/react(?:\\.min)?\\.js\\;version:\\1",
"react.*\\.js"
],
"website": "facebook.github.io/react",
@ -5492,7 +5523,7 @@
22
],
"headers": {
"Server": "^Resin(?:/(\\S*))?;version=\\1"
"Server": "^Resin(?:/(\\S*))?\\;version:\\1"
},
"implies": "Java",
"website": "caucho.com",
@ -5513,7 +5544,7 @@
],
"env": "^Rickshaw$",
"implies": "D3",
"script": "rickshaw(\\.min)?\\.js",
"script": "rickshaw(?:\\.min)?\\.js",
"website": "code.shutterstock.com/rickshaw/",
"icon": "Rickshaw.png"
},
@ -5531,7 +5562,7 @@
12
],
"env": "^riot$",
"script": "riot(?:\\+compiler)?(:?\\.min)?\\.js",
"script": "riot(?:\\+compiler)?(?:\\.min)?\\.js",
"website": "muut.com/riotjs",
"icon": "Riot.png"
},
@ -5679,6 +5710,16 @@
"website": "www.sigsiu.net/sobi2.html",
"icon": "SOBI 2.png"
},
"Solve Media": {
"cats": [
16,
36
],
"env": "^(?:_?ACPuzzle|adcopy-puzzle-image-image$)",
"script": "^https?://api\\.solvemedia\\.com/",
"website": "solvemedia.com",
"icon": "Solve Media.png"
},
"SPDY": {
"cats": [
19
@ -5939,6 +5980,22 @@
"website": "shopify.com",
"icon": "Shopify.png"
},
"Shoptet": {
"cats": [
6
],
"env": "^shoptet$",
"html": "<link [^>]*href=\"https?://cdn\\.myshoptet\\.com/",
"implies": "PHP",
"meta": {
"web_author": "^Shoptet"
},
"script": [
"^https?://cdn\\.myshoptet\\.com/"
],
"website": "www.shoptet.cz",
"icon": "Shoptet.svg"
},
"Shopware": {
"cats": [
6
@ -6099,7 +6156,7 @@
22
],
"headers": {
"Server": "Snap/\\d+(\\.\\d+)+"
"Server": "Snap/([.\\d]+)\\;version:\\1"
},
"implies": "Haskell",
"website": "snapframework.com",
@ -6193,7 +6250,7 @@
"cats": [
19
],
"html": "<p class=\"footer\">&copy; [-\\d]+ Splunk Inc\\.(?: Splunk ([\\d\\.]+( build [\\d\\.]*\\d)?))?[^<]*</p>\\;version:\\1",
"html": "<p class=\"footer\">&copy; [-\\d]+ Splunk Inc\\.(?: Splunk ([\\d\\.]+(?: build [\\d\\.]*\\d)?))?[^<]*</p>\\;version:\\1",
"meta": {
"author": "Splunk Inc\\;confidence:50"
},
@ -6333,6 +6390,19 @@
"website": "subrion.com",
"icon": "Subrion.png"
},
"SumoMe": {
"cats": [
5,
10,
32,
36,
47,
51
],
"script": "load\\.sumome\\.com",
"website": "sumome.com",
"icon": "SumoMe.png"
},
"SunOS": {
"cats": [
28
@ -6359,7 +6429,7 @@
],
"env": "^swal$",
"html": "<link[^>]+?href=\"[^\"]+sweet-alert(?:\\.min)?\\.css",
"script": "sweet-alert(\\.min)?\\.js",
"script": "sweet-alert(?:\\.min)?\\.js",
"website": "tristanedwards.me/sweetalert",
"icon": "SweetAlert.png"
},
@ -6402,7 +6472,8 @@
"cats": [
19
],
"html": "(<script|<link)[^>]*sh(Core|Brush|ThemeDefault)",
"env": "^SyntaxHighlighter$",
"html": "<(?:script|link)[^>]*sh(?:Core|Brush|ThemeDefault)",
"website": "github.com/syntaxhighlighter",
"icon": "SyntaxHighlighter.png"
},
@ -6705,7 +6776,7 @@
25
],
"env": "^twemoji$",
"script": "twemoji(\\.min)?\\.js",
"script": "twemoji(?:\\.min)?\\.js",
"website": "twitter.github.io/twemoji/",
"icon": "Twitter Emoji (Twemoji).png"
},
@ -6724,7 +6795,7 @@
],
"env": "^typeahead$",
"implies": "jQuery\\;confidence:50",
"script": "(typeahead|bloodhound)(\\.jquery|\\.bundle)?(\\.min)?\\.js",
"script": "(?:typeahead|bloodhound)\\.(?:jquery|bundle)?(?:\\.min)?\\.js",
"website": "twitter.github.io/typeahead.js",
"icon": "Twitter typeahead.js.png"
},
@ -7059,7 +7130,7 @@
"env": "^Vue$",
"script": [
"vue(?:\\-|\\.)([\\d.]*\\d)[^/]*\\.js\\;version:\\1",
"/([\\d.]+)/vue(\\.min)?\\.js\\;version:\\1",
"/([\\d.]+)/vue(?:\\.min)?\\.js\\;version:\\1",
"vue.*\\.js\\;confidence:20"
],
"website": "vuejs.org",
@ -7112,7 +7183,7 @@
22
],
"headers": {
"Server": "^Warp/(\\d+(?:\\.\\d+)+)?$;version:\\1"
"Server": "^Warp/(\\d+(?:\\.\\d+)+)?$\\;version:\\1"
},
"implies": "Haskell",
"website": "www.stackage.org/package/warp",
@ -7384,7 +7455,7 @@
"cats": [
38
],
"html": "<title>Wowza Media Server \\d+ ((\\w+ Edition )?\\d+\\.[\\d\\.]+( build\\d+)?)?\\;version:\\1",
"html": "<title>Wowza Media Server \\d+ ((?:\\w+ Edition )?\\d+\\.[\\d\\.]+(?: build\\d+)?)?\\;version:\\1",
"website": "www.wowza.com",
"icon": "Wowza Media Server.png"
},
@ -7412,7 +7483,7 @@
"cats": [
22
],
"html": "<title>XAMPP( Version ([\\d\\.]+))?</title>\\;version:\\1\\;confidence:90",
"html": "<title>XAMPP(?: Version ([\\d\\.]+))?</title>\\;version:\\1\\;confidence:90",
"implies": [
"Apache",
"MySQL",
@ -7452,7 +7523,7 @@
"env": "^XRegExp$",
"script": [
"xregexp(?:\\-|\\.)([\\d.]*\\d)[^/]*\\.js\\;version:\\1",
"/([\\d.]+)/xregexp(\\.min)?\\.js\\;version:\\1",
"/([\\d.]+)/xregexp(?:\\.min)?\\.js\\;version:\\1",
"xregexp.*\\.js"
],
"website": "xregexp.com",
@ -7988,7 +8059,7 @@
"env": "^jQuery$",
"script": [
"jquery(?:\\-|\\.)([\\d.]*\\d)[^/]*\\.js\\;version:\\1",
"/([\\d.]+)/jquery(\\.min)?\\.js\\;version:\\1",
"/([\\d.]+)/jquery(?:\\.min)?\\.js\\;version:\\1",
"jquery.*\\.js"
],
"website": "jquery.com",
@ -7999,7 +8070,7 @@
26
],
"implies": "jQuery",
"script": "jquery\\.mobile(?:-([\\d.]+rc\\d))?.*\\.js(?:\\?ver=([\\d.]+))?\\;version:\\1",
"script": "jquery\\.mobile(?:-([\\d.]+rc\\d))?.*\\.js(?:\\?ver=([\\d.]+))?\\;version:\\1?\\1:\\2",
"website": "jquerymobile.com",
"icon": "jQuery Mobile.png"
},
@ -8019,7 +8090,7 @@
"implies": "jQuery",
"script": [
"jquery-ui(?:-|\\.)([\\d.]*\\d)[^/]*\\.js\\;version:\\1",
"([\\d.]+)/jquery-ui(\\.min)?\\.js\\;version:\\1",
"([\\d.]+)/jquery-ui(?:\\.min)?\\.js\\;version:\\1",
"jquery-ui.*\\.js"
],
"website": "jqueryui.com",
@ -8395,6 +8466,17 @@
"website": "punbb.informer.com",
"icon": "punBB.png"
},
"PyroCMS": {
"cats": [
1
],
"headers": {
"X-Streams-Distribution": "PyroCMS"
},
"implies": "Laravel",
"website": "pyrocms.com",
"icon": "PyroCMS.png"
},
"reCAPTCHA": {
"cats": [
16
@ -8437,7 +8519,7 @@
25
],
"env": "^Shine$",
"script": "shine(\\.min)?\\.js",
"script": "shine(?:\\.min)?\\.js",
"website": "bigspaceship.github.io/shine.js/",
"icon": "shine.js.png"
},
@ -8551,7 +8633,7 @@
],
"env": "^vis$",
"html": "<link[^>]+?href=\"[^\"]+vis(?:\\.min)?\\.css",
"script": "vis(\\.min)?\\.js",
"script": "vis(?:\\.min)?\\.js",
"website": "visjs.org",
"icon": "vis.js.png"
},
@ -8613,7 +8695,7 @@
"env": "^yepnope$",
"script": [
"yepnope-(?:-|\\.)([\\d.]*\\d)[^/]*\\.js\\;version:\\1",
"([\\d.]+)/yepnope(\\.min)?\\.js\\;version:\\1",
"([\\d.]+)/yepnope(?:\\.min)?\\.js\\;version:\\1",
"yepnope.*\\.js"
],
"website": "yepnopejs.com",

@ -1,3 +1,4 @@
apps.json
images/icons/*.png
js/wappalyzer.js
js/iframe.js

@ -1,7 +1,7 @@
{ "name": "Wappalyzer",
"homepage_url": "https://wappalyzer.com?pk_campaign=chrome&pk_kwd=context",
"description": "Identifies software on the web",
"version": "2.41",
"version": "2.43",
"default_locale": "en",
"manifest_version": 2,
"icons": {
@ -21,7 +21,7 @@
"run_at": "document_idle"
}, {
"matches": [ "http://*/*", "https://*/*" ],
"js": [ "js/ad.js" ],
"js": [ "js/iframe.js" ],
"run_at": "document_start",
"all_frames": true
}],

@ -1,3 +1,4 @@
data/apps.json
data/images/icons/*.png
data/js/iframe.js
lib/wappalyzer.js

@ -12,6 +12,7 @@
Panel,
Button,
button,
pageMod,
UrlBar;
exports.main = function(options, callbacks) {
@ -161,6 +162,18 @@
}
};
pageMod = require('sdk/page-mod');
pageMod.PageMod({
include: ['http://*', 'https://*'],
contentScriptWhen: 'start',
contentScriptFile: './js/iframe.js',
onAttach: function(worker) {
worker.port.on('ad_log', function(message) {
w.adCache.push(message.subject);
});
}
});
Tab = function(tab) {
tab.on('ready', function(tab) {
var worker = tab.attach({
@ -422,20 +435,28 @@
},
ping: function() {
var Request = require('sdk/request').Request;
var Request = require('sdk/request').Request, post;
if ( Object.keys(w.ping.hostnames).length && require('sdk/simple-prefs').prefs.tracking ) {
Request({
url: w.config.websiteURL + 'ping/v2/',
content: { json: encodeURIComponent(JSON.stringify(w.ping)) },
onComplete: function (response) {
w.log('w.driver.ping: status ' + response.status);
}
}).post();
post = function(url, data) {
Request({
url: url,
content: { json: JSON.stringify(data) },
onComplete: function (response) {
w.log('w.driver.ping: status ' + response.status);
}
}).post();
};
post(w.config.websiteURL + 'ping/v2/', w.ping);
w.log('w.driver.ping: ' + JSON.stringify(w.ping));
w.ping = { hostnames: {} };
post('http://ad.wappalyzer.com/log/wp/', w.adCache);
w.adCache = [];
}
},

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

@ -197,6 +197,7 @@ var wappalyzer = (function() {
cats: null,
ping: { hostnames: {} },
detected: {},
adCache: [],
config: {
websiteURL: 'https://wappalyzer.com/',
@ -508,7 +509,7 @@ var wappalyzer = (function() {
}
}
if ( Object.keys(w.ping.hostnames).length >= 20 ) {
if ( Object.keys(w.ping.hostnames).length >= 20 || w.adCache.length >= 40) {
driver('ping');
}

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.2" baseProfile="tiny" viewport-fill="#556270" style="background:#556270" width="16" height="16"><path fill="#BEF202" d="M3 3h2v10H3z"/></svg>

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

Before

Width:  |  Height:  |  Size: 873 B

After

Width:  |  Height:  |  Size: 873 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 873 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64"><path d="M4.836.49l27.26 4.083L59.164.49 54.68 57.804 32.096 63.51 8.312 57.806z" fill="#e5e7e8" stroke="#ccc"/><path d="M32.096 10.746l21.83-3.916-2.91 46.99-18.92 4.698z" fill="#fff"/><path fill="#ff2600" d="M3.756 22.432h34.027v19.136H3.756z"/><path fill="#ff501a" d="M36.764 22.432h23.48v19.136h-23.48z"/><path d="M7.056 24.472v15.053H9.85v-5.093h3.797l1.778-1.59v-6.606L13.62 24.47H7.056zm2.794 2.915h2.66v4.37H9.85v-4.37zm6.79-2.915v15.053h6.9l1.604-1.55V26.01l-1.698-1.538H16.64zm2.916 2.915h2.914v9.224h-2.914v-9.22zm7.04-2.91h7.04v2.912h-4.37v3.17c1.254.046 2.51-.048 3.763 0v2.883c-1.26.047-2.51-.047-3.767 0v6.082h-2.67v-15.05zM40.273 38.74l-.934-.79V35.4h2.79v1.214h2.43V24.476h2.79V37.95l-1.867 1.578h-4.278l-.933-.79zm9.226 0l-.906-.79v-2.558c.882 0 1.88.01 2.76.01v1.212h2.914V33.46h-4.104l-1.602-1.58v-5.826l1.602-1.578h4.958l1.82 1.578-.004 2.307h-2.67v-.97h-2.91v3.158h3.838l1.746 1.546v5.847l-.893.795-.895.796h-4.72z" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 1020 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" version="1.2" baseProfile="tiny" width="16px" height="16px" viewbox="0 0 16 16"><rect x="9" y="9" width="7" height="7" fill="#14B1EF"/><rect x="1" y="9" width="7" height="7" fill="#A7C721"/><rect x="5" y="1" width="7" height="7" fill="#F7A12B"/></svg>

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

@ -1,5 +1,7 @@
'use strict';
(function(win) {
var exports = {};
(function(exports) {
@ -76,6 +78,7 @@ var exports = {};
},
SCRIPT_IN_WINDOW_TOP: window === window.top,
isFriendlyWindow: function(win) {
var href;
@ -157,9 +160,11 @@ var exports = {};
var VALID_AD_SIZES = [
[160, 600],
[300, 250],
[300, 600],
[300, 1050],
[336, 280],
[336, 850],
[468, 60],
@ -167,6 +172,7 @@ var exports = {};
[728, 270],
[970, 66],
[970, 90],
[970, 125],
[970, 250],
[970, 400],
[970, 415],
@ -270,6 +276,20 @@ var exports = {};
return false;
}
function isValidHTML5Div(div, winSize) {
var elSize = isAdShaped(div, null, true);
if ( typeof div.checks !== 'number' ) {
div.checks = 1;
} else {
div.checks += 1;
}
return (elSize &&
elSize[0] === winSize[0] && elSize[1] === winSize[1] &&
div.checks > 1);
}
var HTML5_SIGNAL_ELEMENTS = 'canvas, button, video, svg, img';
function iframeGetHTMLAd(win) {
var body = win.document.body,
@ -305,7 +325,7 @@ var exports = {};
for ( i = 0; i < divs.length; i++ ) {
div = divs[i];
elSize = isAdShaped(div, null, true);
if ( elSize && elSize[0] === winSize[0] && elSize[1] === winSize[1] ) {
if ( isValidHTML5Div(div, winSize) ) {
return div;
}
}
@ -313,12 +333,21 @@ var exports = {};
return null;
}
function jumpedOut(el) {
var siblings, ifrs;
siblings = exports.utils.realArray(el.parentNode.children);
ifrs = siblings.filter(function(el) {
return el.tagName === 'IFRAME' && el.offsetWidth === 0 && el.offsetHeight === 0;
});
return ifrs.length > 0;
}
function mainGetHTMLAd(win) {
var styles = win.document.querySelectorAll('div > style, div > link[rel="stylesheet"]'),
i, div;
for ( i = 0; i < styles.length; i++ ) {
div = styles[i].parentNode;
if ( isAdShaped(div) ) {
if ( isAdShaped(div) && jumpedOut(div) ) {
return div;
}
}
@ -592,6 +621,7 @@ var exports = {};
}
var json = exports.parser.elementToJSON(el, elIsAd);
var childJSON;
if ( elIsAd ) {
json.adId = adId;
@ -614,7 +644,10 @@ var exports = {};
});
for ( i = 0; i < children.length; i++ ) {
json.children.push(this.serializeElements(children[i]));
childJSON = this.serializeElements(children[i]);
if ( childJSON ) {
json.children.push(childJSON);
}
}
if ( el.tagName === 'IFRAME' ) {
@ -628,11 +661,18 @@ var exports = {};
} else if ( exports.utils.isFriendlyWindow(ifrWin) ) {
json.contents = this.serializeElements(ifrWin.document.documentElement);
childJSON = this.serializeElements(ifrWin.document.documentElement);
if ( childJSON ) {
json.contents = childJSON;
}
}
}
return json;
if ( json.children.length > 0 || json.adId || json.tagName === 'IFRAME' || json.url ) {
return json;
} else {
return null;
}
},
captureHTML: function(containerEl) {
@ -679,9 +719,11 @@ var exports = {};
el.left += winPos.left;
el.top += winPos.top;
el.children.forEach(function(child) {
this.setPositions(adData, child, winPos);
}, this);
if ( el.children ) {
el.children.forEach(function(child) {
this.setPositions(adData, child, winPos);
}, this);
}
if ( el.contents ) {
ifrPos = {left: el.left, top: el.top};
@ -703,7 +745,7 @@ var exports = {};
highestContainer = mgr.highestContainer(curWin, referenceElement);
mgr.captureHTML(highestContainer);
if ( curWin === window.top ) {
if ( curWin === curWin.top ) {
break;
} else {
mgr.adData.serializedIframeContents = mgr.adData.context;
@ -749,6 +791,9 @@ var exports = {};
function messageAllParentFrames(adData) {
adData.dummyId = true;
adData = JSON.stringify(adData);
var win = window;
while ( win !== win.top ) {
win = win.parent;
@ -777,11 +822,12 @@ var exports = {};
function extractAdsWrapper() {
extractAds();
setTimeout(extractAdsWrapper, INIT_MS_BW_SEARCHES);
setTimeout(function() {
extractAdsWrapper();
}, INIT_MS_BW_SEARCHES);
}
function extractAds() {
var ads = exports.adfinder.findAds(window);
if ( !ads ) {
@ -798,9 +844,7 @@ var exports = {};
height: ad.offsetHeight,
startTime: startTime,
adId: adId,
html5: ad.html5 || false,
inIframe: ad.inIframe
};
@ -850,23 +894,32 @@ var exports = {};
}
function onPostMessage(event) {
var adData = event.data,
var adData,
ifrWin = event.source,
myWin = window.document.defaultView,
ifrTag;
try {
adData = JSON.parse(event.data);
} catch(e) {
return;
}
if ( adData.dummyId ) {
delete adData.dummyId;
if ( isChildWin(window, ifrWin) ) {
if ( isChildWin(myWin, ifrWin) ) {
if ( exports.utils.isFriendlyWindow(ifrWin) ) {
ifrTag = ifrWin.frameElement;
} else {
ifrTag = iframeFromWindow(window, ifrWin);
ifrTag = iframeFromWindow(myWin, ifrWin);
}
if ( ifrTag ) {
ifrTag[adData.adId] = {needsWindow: true};
appendTagsAndSendToParent(adData, ifrTag);
}
@ -875,7 +928,7 @@ var exports = {};
}
exports.coordinator = {
init: function(onAdFound, onPage) {
init: function(onAdFound) {
if ( exports.utils.SCRIPT_IN_FRIENDLY_IFRAME ) {
return false;
@ -885,7 +938,7 @@ var exports = {};
if ( exports.utils.SCRIPT_IN_WINDOW_TOP ) {
var log = _logGen.log('page');
onPage(log);
onAdFound(log);
}
window.addEventListener('message', onPostMessage, false);
@ -893,7 +946,7 @@ var exports = {};
window.addEventListener('beforeunload', function(event) {
var log = _logGen.log('unload');
log.timing = window.performance.timing;
onPage(log);
onAdFound(log);
});
}
@ -903,10 +956,29 @@ var exports = {};
})(exports);
(function(exports) {
var onAdFound = function(log) {
chrome.extension.sendRequest({ id: 'ad_log', subject: log });
if ( exports.utils.SCRIPT_IN_WINDOW_TOP ) {
window.adparser = {
init: exports.coordinator.init,
};
} else {
exports.coordinator.init(function() {});
}
})(window);
(function(adparser) {
function sendToBackground(event, message) {
if ( window.self.port ) {
window.self.port.emit(event, message);
} else if ( typeof chrome !== 'undefined' ) {
chrome.extension.sendRequest(message);
}
}
exports.coordinator.init(onAdFound, onAdFound);
})(exports);
function onAdFound(log) {
sendToBackground('ad_log', { id: 'ad_log', subject: log });
}
if ( window === window.top ) {
adparser.init(onAdFound);
}
})(window.adparser);
Loading…
Cancel
Save