-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
172 lines (142 loc) · 4.75 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
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, height=device-height,user-scalable=no, initial-scale=1.0" />
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100%;
display: flex;
flex-flow: column wrap;
overflow: hidden;
background: #FFF;
}
::-webkit-scrollbar {
width: 2px;
height: 2px;
background-color: #ffffff;
}
input {
border-color: #b5b5b5;
border-radius: 5px;
background-color: #FFF;
border: 1px solid #D5D5D5;
padding: 5px 4px 6px;
box-shadow: none !important;
min-width: 200px;
text-indent: 5px;
font-size: 14px;
}
.toolbar {
width: 100%;
height: 36px;
flex: 1;
display: flex;
flex-flow: row wrap;
}
.toolbar .group {
flex: 1;
display: flex;
}
.toolbar .btns {
width: 200px;
display: flex;
flex-flow: row nowrap;
align-items: center;
text-align: center;
}
.toolbar .btns .btn {
width: 24px;
height: 24px;
border-radius: 5px;
cursor: default;
}
.btn {
margin-left: 4px
}
.btn+.btn {
margin: 4px 3px;
}
.toolbar .btns .btn:last-child:hover {
background: #D5D5D5;
}
.toolbar .url {
flex: 8;
display: flex;
flex-flow: row nowrap;
}
.toolbar .url .input {
flex: 1;
margin: 3px 5px 3px 0;
}
.main {
flex: 10;
}
.main iframe {
width: 100%;
}
.icon {
width: 20px;
height: 20px;
margin: 2px;
}
</style>
<script>
function $(eid) {
return document.getElementById(eid)
}
function adjustFrameHeight() {
var clientHeight = document.documentElement.clientHeight;
$('previewer').height = clientHeight - 36;
}
function backward() {
}
function forward() {
}
function homepage() {
refresh('http://127.0.0.1:{{PORT}}');
}
function refresh(url) {
$('previewer').src = url || $('url').value;
}
document.addEventListener('DOMContentLoaded', function() {
// 自适应高度
adjustFrameHeight();
// 绑定事件
$('url').addEventListener('keyup', function(e) {
if (e.keyCode === 13) {
refresh(this.value);
}
}, false)
}, false);
window.onresize = function() {
adjustFrameHeight();
}
</script>
</head>
<body>
<div class="toolbar">
<div class="group btns">
<!--
<a class="btn" onclick="backward();" title="后退"><img class="icon" src="data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAnUlEQVQ4T8XU4Q1AMBCG4dcEjMAGVrKBkWzCCGzCBnKJJiXau1YTfkkkz31316oo/FSFPX4D+6uTVevIklCw+YI6YI+hGuiwBhiA6UvCZEyKhRJmYSEwG3sDfUyGr24V2IDRzfbZsoALUAOHEZSiQVAK+ahps/7mY0txSZPQ2DnMSmo52ElJNdCfqby3X6+em3fRn4N2fW/fLS3/C5536x4VNPnHnQAAAABJRU5ErkJggg=="
alt="后退"></a>
<a class="btn" onclick="forward();" title="前进"><img class="icon" src="data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAnklEQVQ4T8XU4Q2CMBCG4bcT6AawgYyAG7KRjOAIjgATQE4hwQa570wTmvRf8+S7u7aJwisV9jgNbJZKnl5FasIXcAHuwCGqgpawByYPVUGrVEIjoIRGQRfNwQ64eZME6mUPeU/3wPWKHLkGVsAItNvJ/1vyA96P4guzBFHQ0v/EoqCLRUAJi4D29K57Pcsnp/aw+OcgXM3PETXheeAMv/cgFZuJHH4AAAAASUVORK5CYII="
alt="前进"></a>
-->
<a class="btn" onclick="homepage();" title="首页"><img class="icon" src="data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAwElEQVQ4T+3UYQ3CMBDF8f8c4AAkIAEcIAEpSMIBSEACOMAB5JEeaZbuXUf2kSWXJVvza3tv68DC17CwRw+4Ai5l4j3wdIvIwMBi3AuwqANrbFdWdQUsOgWOsdimnlu0BU5h0TqLjsEMS9Ea7MUsGuBcbBIN8AxsAKW5rRJ1n1wkfytB6X4MUJiSVClF1Sn5i/ReqEo7VN1bKf8Cfuf+g59WqIdrNTgJRUE+Sii2h/psDp3nZARowU6rPSw7D2fjbzNDPhWe0Dx+AAAAAElFTkSuQmCC"
alt="首页"></a>
<a class="btn" onclick="refresh();" title="刷新"><img class="icon" src="data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABE0lEQVQ4T72UYXECMRBGHw6oghYF4KCtkuKgdQA4qIOCAyQUB6AAJFRC5zFZJoRcjh837AyTuyS8fPvt5kYMHKOBeTwcOAOmgKOxBw5pjOTmwDpeWgq/gc8OS1xbAY4vwFsfUCUq2wHLTJFKfX8F/oBx2tME+odFUuBzLU7Ac1rw0E6g8o/lqQVRvz6yuSZQg3+Ad+C3Iq2EuaUJjHSfkkc5U7+i2vm8Xur5Ocoqt4B33YES2JdyDtVvC2NfqrKqMIqif/rYCvfYPhPAqleBTkbajjZvLSKTDeDzJbpuSjS2KgSblqGir9R3ztl/l3RrRckPa109lQm+gvUBXbdN4ue7Xm1zz0o/Hv756in07fLgCv8BrUM3FcRyAogAAAAASUVORK5CYII="
alt="刷新"></a>
</div>
<div class="group url"><input id="url" type="text" class="input" value="http://127.0.0.1:{{PORT}}"></div>
</div>
<div class="main">
<iframe id="previewer" src="http://127.0.0.1:{{PORT}}" frameborder="0" />
</div>
</body>
</html>