Last active
December 28, 2017 17:17
-
-
Save davlgd/146d058351cb698fe79c585d01cc5fed to your computer and use it in GitHub Desktop.
Tracking Trackers - Etape 8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| chrome.browserAction.setBadgeBackgroundColor({color:"black"}); | |
| var counter = 0; | |
| var result = new Object(); | |
| var isUpdatable = true; | |
| var timer = setTimeout(function(){ | |
| console.log(result); | |
| isUpdatable = false; | |
| }, 300000); | |
| chrome.webRequest.onCompleted.addListener(function(thisRequest) | |
| { | |
| if (thisRequest.initiator) | |
| { | |
| var initHost = new URL(thisRequest.initiator).host; | |
| var urlHost = new URL(thisRequest.url).host; | |
| if (initHost != urlHost && isUpdatable) | |
| { | |
| if (!result[initHost]) result[initHost] = 1; | |
| else result[initHost]++; | |
| counter++; | |
| console.log(thisRequest); | |
| chrome.browserAction.setBadgeText({text:counter.toString()}); | |
| } | |
| } | |
| },{urls: ["<all_urls>"]}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment