-
Notifications
You must be signed in to change notification settings - Fork 5
/
click_scripts.js
39 lines (36 loc) · 1.4 KB
/
click_scripts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* Contains functions triggered by clicks, to be inserted into page.
*/
// Add compatibility for Chromuim-based browsers
var browser = browser || chrome;
try {
// Close notification when 'X' button is clicked.
document.getElementById('CCPAClose').onclick = function () {
// console.log("closed")
var popup = document.getElementById('CCPAPopup');
var popupBody = document.getElementById('CCPABody');
var close = document.getElementById('CCPAClose');
var moreInfo = document.getElementById('CCPAMoreInfo');
var button = document.getElementById('CCPAButton');
popup.style.display = 'none';
popupBody.style.display='none';
close.style.display = 'none';
moreInfo.style.display = 'none';
button.style.display = 'none';
}
// Find and click CCPA opt-out link
document.getElementById('CCPAButton').onclick = function () {
var pageElements = document.getElementsByTagName('*');
for (var i = 0; i < pageElements.length; i++) {
// If opt-out link is found, click it.
if (pageElements[i].innerHTML.toLowerCase().search('do not sell') != -1
|| pageElements[i].innerHTML.toLowerCase().search('don\'t sell') != -1) {
pageElements[i].click();
}
}
}
} catch (err) {
if (err.name != "TypeError") {
console.error(err);
}
}