Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
fix(stupidity): isolating all the extension
Browse files Browse the repository at this point in the history
  • Loading branch information
mathkr committed Feb 20, 2020
1 parent a4946f5 commit 74ed02a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 45 deletions.
12 changes: 7 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# 1.5.0
# 1.4.3

## Features
## Bug fixes

- Ported to run on Firefox too
- Not all the injected script was isolated from the current page

## Bug fixes
# 1.4.2

- Extension logged some things in dev console
## Features

- Ported to run on Firefox too

# 1.4.1

Expand Down
78 changes: 38 additions & 40 deletions src/nc.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,52 @@
// quantcast
function kickQuantcast(mutations) {
var qcReady = mutations.some(mutation => {
return mutation.target.firstChild &&
mutation.target.firstChild.classList &&
mutation.target.firstChild.classList.contains('qc-cmp-ui-container')
});

if (qcReady) {
window.__cmpui('setAndSaveAllConsent', false);
(function () {
function kickQuantcast(mutations) {
var qcReady = mutations.some(mutation => {
return mutation.target.firstChild &&
mutation.target.firstChild.classList &&
mutation.target.firstChild.classList.contains('qc-cmp-ui-container')
});

if (qcReady) {
window.__cmpui('setAndSaveAllConsent', false);
}
}
}

const observer = new MutationObserver(kickQuantcast);
observer.observe(document.body, {childList: true});

function registerCookie(newCookie) {
if (!document.cookie.indexOf(newCookie)) {
document.cookie = newCookie;
function registerCookie(newCookie) {
if (!document.cookie.indexOf(newCookie)) {
document.cookie = newCookie;
}
}
}

registerCookie('cookieconsent_status=deny');
registerCookie('notice_preferences=0:');
registerCookie('notice_gdpr_prefs=0:');

function elClick(selector, callback) {
if (document.querySelector(selector)) {
document.querySelector(selector).click();
function elClick(selector, callback) {
if (document.querySelector(selector)) {
document.querySelector(selector).click();

if (callback) {
callback();
if (callback) {
callback();
}
}
}
}

function fireEvent(selector, event) {
if (document.querySelector(selector)) {
const evObj = document.createEvent('Events');
evObj.initEvent(event, true, false);
document.querySelector(selector).dispatchEvent(evObj);
function fireEvent(selector, event) {
if (document.querySelector(selector)) {
const evObj = document.createEvent('Events');
evObj.initEvent(event, true, false);
document.querySelector(selector).dispatchEvent(evObj);
}
}
}

const domains = {
'www.greenweez.com': '.cookies_banner',
'twitter.com': '#banners'
};
registerCookie('cookieconsent_status=deny');
registerCookie('notice_preferences=0:');
registerCookie('notice_gdpr_prefs=0:');

// quantcast
(new MutationObserver(kickQuantcast)).observe(document.body, {childList: true});

const domains = {
'www.greenweez.com': '.cookies_banner',
'twitter.com': '#banners'
};

(function () {
let kickCmpmngr = 0;

const kick = setInterval(function () {
Expand Down Expand Up @@ -90,7 +89,6 @@ const domains = {
});
});


}

// platform behind seloger.com, french flat search engine, still don't know wich one it is
Expand Down

0 comments on commit 74ed02a

Please sign in to comment.