-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
154 lines (138 loc) · 3.39 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
<!DOCTYPE html>
<html>
<head>
<title>DRKB 3.1</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="description" content="Delphi Russian Knowledge Base"/>
<meta name="keywords" content="delphi, drkb, vcl, winapi, language, database, network, graphics, algorithm, opengl, directx, math, activex, reporting, development, knowledge, base, russian"/>
<link rel="icon" href="favicon.ico" type="image/icon"/>
<style>
/* Layout */
* {
box-sizing: border-box;
}
html, body, iframe {
border: 0;
padding: 0;
margin: 0;
}
html, body {
width: 100vw;
height: 100vh;
}
body {
overflow: hidden; /* Needed for stupid Firefox showing double scroll bars */
}
#container {
width: 100%;
height: 100%;
display: flex;
}
#left {
width: 20%;
}
#right {
width: 80%;
}
/* Pane divider */
#separator {
position: absolute;
top: 0;
left: 20%;
width: 8px;
height: 100vh;
z-index: 1;
cursor: col-resize;
user-select: none;
}
/* Divider handle */
#separator:before {
content: '';
position: absolute;
top: 50%;
left: 2px;
width: 1px;
height: 2em;
margin-top: -1em;
background: #ccc;
display: block;
}
#separator:after {
content: '';
position: absolute;
top: 50%;
left: 5px;
width: 1px;
height: 2em;
margin-top: -1em;
background: #ccc;
display: block;
}
/* This is needed for separator to work */
#overlay {
position: absolute;
width: 100%;
height: 100vh;
z-index: 1000;
display: none;
}
/* Printing */
@media print {
#left {display: none !important;}
#overlay {display: none !important;}
#separator {display: none !important;}
}
</style>
<script>
"use strict"
/* Message from TOC `iframe` */
window.onmessage = (msg) => {
if (msg.data.msg === "article") {
document.title = msg.data.title;
document.getElementById ("article").setAttribute ("src", msg.data.link);
}
};
/* Resize TOC and content windows */
function enableSeparator (separator) {
const first = document.getElementById("left");
const second = document.getElementById("right");
const overlay = document.getElementById("overlay");
separator.onmousedown = onMouseDown;
function onMouseDown (e) {
document.onmousemove = onMouseMove;
overlay.style.display = "block";
document.onmouseup = () => {
document.onmousemove = document.onmouseup = null;
overlay.style.display = "none";
}
}
function onMouseMove (e) {
const adj = separator.offsetWidth / 2;
let lw = e.clientX - adj;
let rw = document.body.offsetWidth - e.clientX + adj;
if (lw < 200) {
lw = 200;
rw = document.body.offsetWidth - lw;
} else if (rw < 640) {
rw = 640;
lw = document.body.offsetWidth - rw;
}
separator.style.left = lw + "px";
first.style['width'] = lw + "px";
second.style['width'] = rw + "px";
}
}
document.addEventListener("DOMContentLoaded", (e) => {
enableSeparator(document.getElementById("separator"));
});
</script>
</head>
<body>
<div id="overlay"></div>
<div id="container">
<div id="separator"></div>
<div id="left"><iframe id="toc" width="100%" height="100%" src="main.html"></iframe></div>
<div id="right"><iframe id="article" width="100%" height="100%" src="splash.html"></iframe></div>
</div>
</body>
</html>