forked from caracal-js/Incognito
-
Notifications
You must be signed in to change notification settings - Fork 0
/
widget.html
68 lines (63 loc) · 2.32 KB
/
widget.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
<!DOCTYPE html>
<html>
<head>
<style>
body {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20px;
margin-top: 20px;
}
.wrapper {
display: flex;
justify-content: center;
align-items: center;
}
.app {
width: 40px;
height: 40px;
background: #333;
border-radius: 50%;
display: inline-block;
align-self: center;
cursor: pointer;
}
.app:hover {
box-shadow: 0 0 0 7px rgba(0, 0, 0, .4);
}
</style>
</head>
<body>
<div class="wrapper">
<div data-href="https://www.google.com" class="app" style="background: url(img/google.svg); background-size: cover"></div>
</div>
<div class="wrapper">
<div data-href="https://discord.com" class="app" style="background: url(img/disc.svg); background-size: cover"></div>
</div>
<div class="wrapper">
<div data-href="https://spotify.com" class="app" style="background: url(img/sptfy.svg); background-size: cover"></div>
</div>
<div class="wrapper">
<div data-href="https://www.youtube.com" class="app" style="background: url(img/yt.svg); background-size: cover"></div>
</div>
<div class="wrapper">
<div data-href="https://twitch.tv" class="app" style="background: url(img/twich.svg); background-size: cover"></div>
</div>
<div class="wrapper">
<div data-href="https://tiktok.com" class="app" style="background: url(img/ttok.svg); background-size: cover"></div>
</div>
<script>
document.querySelectorAll('.app[data-href]').forEach(node => {
node.addEventListener('click', () => {
parent.postMessage({
type: 'access',
href: node.getAttribute('data-href')
})
});
});
window.addEventListener('blur', () => {
parent.postMessage('close-widget');
});
</script>
</body>
</html>