-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
77 lines (77 loc) · 2.53 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tuko</title>
</head>
<body>
<p style="font-size: 3rem; text-align: center;">Tuko</p>
<p id="code"></p>
<div class="center">
<input type="text" id="connection" placeholder="2nd display code"><br><br>
<button id="connect">Connect</button>
</div>
<div id="connectionbox" class="center">
<p>Someone on your internet is requesting to connect.</p>
<button id="accept">Accept</button>
<button id="decline">Decline</button>
</div>
<style>
#code {
text-align: center;
font-size: 2rem;
}
#connection {
width: 40vw;
height: 5vh;
text-align: center;
font-size: 1rem;
}
.center {
text-align: center;
margin: auto;
}
#connect {
background-color: white;
width: 20vw;
height: 5vh;
transition: width 0.5s, background-color 0.5s, color 0.5s;
}
#connect:hover {
width: 50vw;
background-color: black;
color: white;
}
#connectionbox {
border: 1px solid black;
width: 30vw;
margin-top: 20px;
visibility: hidden;
}
</style>
<script>
require('electron').ipcRenderer.on('channel', function(err, arg) {
switch(arg[0]){
case 'dc':
document.getElementById('code').innerHTML = "Your display code is: "+arg[1]
break
case 'request':
document.getElementById('connectionbox').style.visibility = 'visible'
break
}
})
document.getElementById('accept').addEventListener('click', function(){
require('electron').ipcRenderer.send('channel', ['accept'])
document.getElementById('connectionbox').style.visibility = 'hidden'
})
document.getElementById('decline').addEventListener('click', function(){
document.getElementById('connectionbox').style.visibility = 'hidden'
})
document.getElementById('connect').addEventListener('click', function(){
require('electron').ipcRenderer.send('channel', ['request', document.getElementById('connection').value])
})
</script>
</body>
</html>