-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
103 lines (90 loc) · 3.79 KB
/
index.html
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Whitelist Domain</title>
<link rel="stylesheet" href="style.css?a=1">
<script>
function whitelistDomain(event) {
event.preventDefault(); // Prevent the form from submitting the traditional way
const domain = document.getElementById('domain').value;
// Create an AJAX request
const xhr = new XMLHttpRequest();
xhr.open('POST', 'whitelist-add.php', true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onload = function() {
if (xhr.status === 200) {
// Display the response
document.getElementById('result').innerHTML = xhr.responseText;
} else {
document.getElementById('result').innerHTML = 'An error occurred.';
}
};
xhr.send('domain=' + encodeURIComponent(domain));
}
function listWhitelistedDomains(event) {
event.preventDefault();
// Create an AJAX request to list whitelisted domains
const xhr = new XMLHttpRequest();
xhr.open('POST', 'whitelist-add.php', true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onload = function() {
if (xhr.status === 200) {
// Display the response
document.getElementById('result').innerHTML = xhr.responseText;
} else {
document.getElementById('result').innerHTML = 'An error occurred.';
}
};
xhr.send('action=list');
}
function disableForXMin(event) {
if (confirm("💥💥Only do this if necessary!!💥💥\n\nIt is always better to add a domain to the whitelist")) {
event.preventDefault(); // Prevent default button action
// Create an AJAX request to list whitelisted domains
const xhr = new XMLHttpRequest();
xhr.open('POST', 'whitelist-add.php', true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onload = function() {
if (xhr.status === 200) {
// Display the response
document.getElementById('result').innerHTML = xhr.responseText;
} else {
document.getElementById('result').innerHTML = 'An error occurred.';
}
};
xhr.send('action=disable');
} else {
document.getElementById('result').innerHTML = "Canceled Disabling All Blocking";
}
}
</script>
</head>
<body>
<div class="main">
<h1>Whitelist a Domain</h1>
<div class="content">
<form onsubmit="whitelistDomain(event)">
<label for="domain">Domain:</label>
<br>
<br>
<input type="text" id="domain" name="domain" placeholder="ads.google.com" required>
<br>
<br>
<button type="submit">Whitelist</button>
</form>
<div class="but2cont">
<button class="button2" onclick="listWhitelistedDomains(event)">List Whitelisted Domains</button>
</div>
<div id="result"></div>
<br>
<br>
<hr>
<div class="but2cont">
<button class="button2" onclick="disableForXMin(event)">Disable All Blocking for 5 Min</button>
</div>
</div>
</div>
</body>
</html>