-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
103 lines (85 loc) · 2.72 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
103
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="dist/ab.d.js"></script>
</head>
<body>
<div id="app">
<div class="container">
<h1>AB.d.js</h1>
<p>The AdBlocker detector and tester</p>
<div class="results">
<div class="result" id="result-dom"></div>
<div class="result" id="result-interceptor"></div>
</div>
<p id="final-result" style="color: #4f4">Adblock non detected</p>
</div>
</div>
<style>
body {
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
background-color: #121212;
color: #ddd;
}
#app {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.container {
border: 1px solid #fff2;
border-radius: 12px;
padding: 10px 20px;
}
h1 {
letter-spacing: 4px;
font-weight: 400;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
text-align: center;
}
p {
text-align: center;
}
.results {
display: flex;
flex-direction: column;
gap: 3px;
}
.result {
border: 1px solid #fff2;
border-radius: 12px;
padding: 5px 10px;
}
</style>
<script>
function toggleOn() {
document.getElementById("final-result").style.color = "#f44";
document.getElementById("final-result").innerHTML = "Adblock detected";
}
function runTest(fn, id, name) {
fn().then((res) => {
const success = `✅ Pass ${name} test.`;
const err = `❌ Triggered ${name} test.`;
document.getElementById(id).innerHTML = res ? err : success;
if (res) {
toggleOn();
}
})
}
async function main() {
const el = document.getElementById("app");
const abd = window.ABD;
runTest(window.ABD.runTestDom, "result-dom", "DOM");
runTest(window.ABD.runTestScriptInterceptor, "result-interceptor", "Scripts Interceptor");
}
main();
</script>
</body>
</html>