-
Notifications
You must be signed in to change notification settings - Fork 207
Expand file tree
/
Copy pathpopup.js
More file actions
63 lines (56 loc) · 2.59 KB
/
Copy pathpopup.js
File metadata and controls
63 lines (56 loc) · 2.59 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import GDPRConfig from './GDPRConfig.js';
import Language from './Language.js';
let frontTab = document.querySelector(".fronttab");
if (frontTab){
chrome.tabs.query({
active: true,
currentWindow: true
}, (tabs) => {
const urlObj = new URL(tabs[0].url);
const url = urlObj.host;
let activeInput = document.querySelector(".siteselector input");
document.querySelector("#site").textContent = url;
document.querySelector("#unhandled_site").textContent = url;
document.querySelector("#settings").addEventListener("click", function () {
chrome.runtime.openOptionsPage();
window.close();
});
GDPRConfig.isActive(url).then((active) => {
activeInput.checked = active;
});
activeInput.addEventListener("input", () => {
GDPRConfig.setPageActive(url, activeInput.checked);
});
GDPRConfig.getDebugValues().then((settings) => {
let confirmationInput = document.querySelector("#no-confirmation");
confirmationInput.checked = (settings.skipSubmitConfirmation === true);
confirmationInput.addEventListener("input", () => {
settings.skipSubmitConfirmation = confirmationInput.checked;
GDPRConfig.setDebugValues(settings);
});
document.querySelector("#unhandled").addEventListener("click", () => {
document.querySelector(".fronttab").style.display = "none";
document.querySelector(".unhandledtab").style.display = "block";
if (settings.skipSubmitConfirmation){
document.querySelector("#unhandled_send").click();
}
});
document.querySelector("#unhandled_cancel").addEventListener("click", () => {
document.querySelector(".unhandledtab").style.display = "none";
document.querySelector(".fronttab").style.display = "block";
window.close();
});
document.querySelector("#unhandled_send").addEventListener("click", () => {
fetch("https://gdprconsent.projects.cavi.au.dk/report.php?url=" + encodeURIComponent(url));
document.querySelector(".unhandledtab").style.display = "none";
document.querySelector(".unhandledtab_complete").style.display = "block";
setTimeout(() => {
window.close();
}, 1250);
});
});
});
window.addEventListener("DOMContentLoaded", ()=>{
Language.doLanguage();
});
}