-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuserInterface.html
137 lines (135 loc) · 4.33 KB
/
userInterface.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<!DOCTYPE html>
<html lang="zh">
<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>当前做种统计</title>
</head>
<body>
<div id="ss-container">
<div id="ss-high-friction-bar">
<div class="ss-graph"></div>
<div class="ss-graph"></div>
<div class="ss-graph"></div>
<div class="ss-graph"></div>
</div>
<div id="ss-notice">
<span id="ss-notice-text"></span>
</div>
<div id="ss-result"></div>
</div>
<script>
let ssContainer = document.getElementById("ss-container");
let ssBar = document.getElementById("ss-high-friction-bar");
// 鼠标在 ssBar 上按下时,使 ssContainer 跟随鼠标移动
ssBar.onmousedown = function (e) {
let x = e.clientX - ssContainer.offsetLeft;
let y = e.clientY - ssContainer.offsetTop;
// 增大 ssContainer 的阴影效果
ssContainer.style.boxShadow = "0 0 10px 5px rgba(0, 0, 0, 0.1)";
document.onmousemove = function (e) {
ssContainer.style.left = e.clientX - x - 12 + "px";
ssContainer.style.top = e.clientY - y - 12 + "px";
// 防止鼠标移出浏览器窗口
if (e.clientX - x - 12 < 0) {
ssContainer.style.left = 0;
}
if (e.clientY - y - 12 < 0) {
ssContainer.style.top = 0;
}
if (e.clientX - x - 12 > document.documentElement.clientWidth - ssContainer.offsetWidth) {
ssContainer.style.left = document.documentElement.clientWidth - ssContainer.offsetWidth + "px";
}
if (e.clientY - y - 12 > document.documentElement.clientHeight - ssContainer.offsetHeight) {
ssContainer.style.top = document.documentElement.clientHeight - ssContainer.offsetHeight + "px";
}
}
}
// 鼠标松开时,停止移动
document.onmouseup = function () {
// 恢复 ssContainer 的阴影效果
ssContainer.style.boxShadow = "0 0 5px 2px rgba(0, 0, 0, 0.1)";
document.onmousemove = null;
}
</script>
</body>
<style>
#ss-high-friction-bar {
display: flex;
flex-direction: column;
justify-content: start;
align-items: center;
margin-bottom: 6px;
cursor: move;
}
.ss-graph {
height: 1px;
width: 60px;
background-color: rgba(0, 0, 0, 0.1);
margin-bottom: 2px;
}
#ss-container {
font-family: "Helvetica Neue", Helvetica, Arial;
font-size: 0.8rem;
line-height: 1.45;
color: rgba(0, 0, 0, 0.76);
box-sizing: border-box;
min-width: 20vw;
max-width: 80vw;
width: auto;
height: auto;
min-height: 15vh;
max-height: 90vh;
background-color: rgba(255, 255, 255, 0.96);
position: fixed;
left: 0;
top: 0;
border-radius: 6px;
margin: 12px;
padding: 12px;
box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.1);
transition: box-shadow 0.1s ease-in-out;
overflow: auto;
z-index: 9999;
}
#ss-container:hover {
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.25);
background-color: white;
}
#ss-notice {
background-color: rgba(0, 0, 0, 0.05);
width: fit-content;
padding: 0.2rem;
border-radius: 3px;
}
#ss-result {
margin-top: 0.4rem;
}
#ss-result table {
border-collapse: collapse;
margin-top: 0.4rem;
}
#ss-result table, #ss-result th, #ss-result td {
border: 0;
/* background-color: rgba(4,150,255,1); */
}
#ss-result th {
background-color: rgba(4, 142, 255, 0.96);
color: rgba(255, 255, 255, 0.96);
}
#ss-result th, #ss-result td {
text-align: left;
padding: 0.2rem 1rem;
}
#ss-result tr:nth-child(odd) {
background-color: rgba(0, 0, 0, 0.05);
}
#ss-result tr:nth-child(even) {
background-color: rgba(0, 0, 0, 0.1);
}
#ss-result td {
font-size: inherit;
}
</style>
</html>