-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresp.html
118 lines (104 loc) · 2.5 KB
/
resp.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="screen-orientation" content="landscape">
<meta name="full-screen" content="yes">
<title>请作答</title>
<style type="text/css">
html {
background-color: #1E1E1E;
color: white;
height: 100vh;
width: 100vw;
-webkit-tap-highlight-color: transparent;
}
body {
margin: 10vh auto;
padding: 0;
height: 80vh;
width: 81vw;
}
div.container {
display: flex;
justify-content: center;
align-items: center;
height: 80vh;
width: 40vw;
margin: 0;
padding: 0;
background-color: black;
cursor: pointer;
}
div.container > div {
height: 20vh;
width: 10vw;
background-color: gray;
}
div.container:hover > div {
background-color: darkgray;
}
div.container:active > div {
background-color: lightgray;
}
div.left {
float: left;
border-radius: 5vh 0 0 5vh;
}
div.right {
float: right;
border-radius: 0 5vh 5vh 0;
}
div#left {
clip-path: polygon(0% 50%, 100% 0%, 100% 100%);
}
div#right {
clip-path: polygon(0% 0%, 0% 100%, 100% 50%);
}
</style>
<script type="text/javascript">
async function refresh()
{
let response = await fetch('/status', {
method: 'GET',
});
if (!response.ok) {
alert(`Error : ${response.status}, ${response.statusText}`)
}
var returned = await response.json()
if (response.ok) {
if (returned.state == 'finished' || returned.state == 'waiting') {
location.href = "/ctrl.html"
}
}
}
async function choose(which)
{
data = {
'response': which,
}
let response = await fetch('/resp', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
}
</script>
</head>
<body onload="setInterval(refresh, 900)">
<div class="container left" onmousedown="choose('left')">
<!--div class="container left" ontouchstart="choose('left')"-->
<div id="left"></div>
</div>
<div class="container right" onmousedown="choose('right')">
<!--div class="container right" ontouchstart="choose('right')"-->
<div id="right"></div>
</div>
<!-- <footer>Copyright (C) 2023 LiTuX, all wrongs reserved.</footer> -->
</body>
</html>