Add support for excluded and included domains

pull/110/head
Daksh Shah 2020-09-06 15:46:29 +05:30
parent 83678756c7
commit 91b07fd56c
No known key found for this signature in database
GPG Key ID: F111A753041D81AD
1 changed files with 10 additions and 0 deletions

View File

@ -17,6 +17,16 @@ import { removeTrailingSlash } from '../lib/url';
// eslint-disable-next-line no-undef
if (!script || (__DNT__ && doNotTrack())) return;
const excludedDomains = script.getAttribute('excluded-domains')
? script.getAttribute('excluded-domains').split(',')
: [];
const allowedDomains = script.getAttribute('included-domains')
? script.getAttribute('included-domains').split(',')
: [];
const isExcludedDomain = excludedDomains.includes(window.location.hostname);
const isAllowedDomain = allowedDomains.includes(window.location.hostname);
if (isExcludedDomain || !isAllowedDomain) return;
const website = script.getAttribute('data-website-id');
const hostUrl = script.getAttribute('data-host-url');
const root = hostUrl