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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
|
<html>
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Flow+Circular&display=swap" rel="stylesheet">
<style>
@font-face {
font-family: f98;
src: url(src/98.ttf);
}
* {
margin: 0;
font-family: f98;
scrollbar-width: none;
}
.window {
width: 56%;
max-width: inherit;
height: 30%;
max-height: inherit;
background-color: #c3c3c3;
position: absolute;
}
.head-border {
width: calc(100% - 2px);
background-color: #010081;
height: 25px;
position: absolute;
top: 1px;
left: 1px;
cursor: grab;
}
.close-button {
width: calc(25px - 7px);
background-color: #c3c3c3;
height: calc(100% - 7px);
position: absolute;
top: 3.5px;
right: 3.5px;
cursor: initial;
}
#root {
position: relative;
background-color: cornsilk;
width: 90%;
height: 90%;
margin-left: 5%;
margin-top: 2.5%;
margin-bottom: 2.5%;
overflow: hidden;
}
.resize-n {
position: absolute;
top: -1px;
width: 100%;
height: 7px;
background-color: rgba(0, 0, 0, 0);
cursor: ns-resize;
}
.resize-s {
position: absolute;
bottom: -1px;
width: 100%;
height: 7px;
background-color: rgba(0, 0, 0, 0);
cursor: ns-resize;
}
.resize-e {
position: absolute;
right: -3px;
width: 7px;
height: 100%;
background-color: rgba(0, 0, 0, 0);
cursor: ew-resize;
}
.resize-w {
position: absolute;
left: -3px;
width: 7px;
height: 100%;
background-color: rgba(0, 0, 0, 0);
cursor: ew-resize;
}
::-webkit-scrollbar {
display: none;
}
.scrollbar {
width: 10px;
height: calc(100% - 26px);
background-color: #aaaaaa;
position: absolute;
bottom: 0;
right: 0;
}
.scrollbar-point {
width: 100%;
background-color: #919191;
position: absolute;
top: 0;
}
</style>
<script>
function window_create(uid, name, content) {
let lines = content.split("</br>").length
let a = ''
a += "<div id='" + uid + "-root' class='window' style='width:" + document.body.clientWidth * .56 + "px;height:" + document.body.clientHeight * .30 + "px;top:0px;left:0px;position:absolute;' window-name='" + name + "'>"
//console.log(document.getElementById(uid).attributes["window-name"].value)
a += "<div id='" + uid + "-head' class='head-border' window-name='" + name + "'> <div style='color:fdffff'>" + name + "</div>"
a += "<div id='" + uid + "-close' class='close-button' window-name='" + name + "'>" + `<svg draggable="false" xmlns="http://www.w3.org/2000/svg" style="position:absolute;left:-3px;top:0px;" xmlns:xlink="http://www.w3.org/1999/xlink" width="23px" height="20px" viewBox="0 0 23 20" version="1.1">
<g id="surface1">
<path style=" stroke:none;fill-rule:evenodd;fill:rgb(2.745098%,3.137255%,2.745098%);fill-opacity:1;" d="M 8.476562 6.042969 C 9.042969 6.042969 9.613281 6.042969 10.179688 6.042969 C 10.179688 6.332031 10.179688 6.625 10.179688 6.914062 C 10.464844 6.914062 10.746094 6.914062 11.03125 6.914062 C 11.03125 7.203125 11.03125 7.492188 11.03125 7.78125 C 11.597656 7.78125 12.167969 7.78125 12.734375 7.78125 C 12.734375 7.492188 12.734375 7.203125 12.734375 6.914062 C 13.019531 6.914062 13.304688 6.914062 13.585938 6.914062 C 13.585938 6.625 13.585938 6.332031 13.585938 6.042969 C 14.15625 6.042969 14.722656 6.042969 15.289062 6.042969 C 15.289062 6.332031 15.289062 6.625 15.289062 6.914062 C 15.007812 6.914062 14.722656 6.914062 14.4375 6.914062 C 14.4375 7.203125 14.4375 7.492188 14.4375 7.78125 C 14.15625 7.78125 13.871094 7.78125 13.585938 7.78125 C 13.585938 8.074219 13.585938 8.363281 13.585938 8.652344 C 13.304688 8.652344 13.019531 8.652344 12.734375 8.652344 C 12.734375 8.941406 12.734375 9.230469 12.734375 9.523438 C 13.019531 9.523438 13.304688 9.523438 13.585938 9.523438 C 13.585938 9.8125 13.585938 10.101562 13.585938 10.390625 C 13.871094 10.390625 14.15625 10.390625 14.4375 10.390625 C 14.4375 10.679688 14.4375 10.972656 14.4375 11.261719 C 14.722656 11.261719 15.007812 11.261719 15.289062 11.261719 C 15.289062 11.550781 15.289062 11.839844 15.289062 12.128906 C 14.722656 12.128906 14.15625 12.128906 13.585938 12.128906 C 13.585938 11.839844 13.585938 11.550781 13.585938 11.261719 C 13.304688 11.261719 13.019531 11.261719 12.734375 11.261719 C 12.734375 10.972656 12.734375 10.679688 12.734375 10.390625 C 12.167969 10.390625 11.597656 10.390625 11.03125 10.390625 C 11.03125 10.679688 11.03125 10.972656 11.03125 11.261719 C 10.746094 11.261719 10.464844 11.261719 10.179688 11.261719 C 10.179688 11.550781 10.179688 11.839844 10.179688 12.128906 C 9.613281 12.128906 9.042969 12.128906 8.476562 12.128906 C 8.476562 11.839844 8.476562 11.550781 8.476562 11.261719 C 8.761719 11.261719 9.042969 11.261719 9.328125 11.261719 C 9.328125 10.972656 9.328125 10.679688 9.328125 10.390625 C 9.613281 10.390625 9.894531 10.390625 10.179688 10.390625 C 10.179688 10.101562 10.179688 9.8125 10.179688 9.523438 C 10.464844 9.523438 10.746094 9.523438 11.03125 9.523438 C 11.03125 9.230469 11.03125 8.941406 11.03125 8.652344 C 10.746094 8.652344 10.464844 8.652344 10.179688 8.652344 C 10.179688 8.363281 10.179688 8.074219 10.179688 7.78125 C 9.894531 7.78125 9.613281 7.78125 9.328125 7.78125 C 9.328125 7.492188 9.328125 7.203125 9.328125 6.914062 C 9.042969 6.914062 8.761719 6.914062 8.476562 6.914062 C 8.476562 6.625 8.476562 6.332031 8.476562 6.042969 Z M 8.476562 6.042969 "/>
</g>
</svg></div></div>`
a += "<div id='" + uid + "-resize-n' class='resize-n'></div>"
a += "<div id='" + uid + "-resize-s' class='resize-s'></div>"
a += "<div id='" + uid + "-resize-e' class='resize-e'></div>"
a += "<div id='" + uid + "-resize-w' class='resize-w'></div>"
a += "<div style='height:25px;'></div>"
a += "<div id='" + uid + "-content-root' class='content-root' style='overflow:scroll;height:calc(100% - 25px);width:100%'><div id='" + uid + "-content-content' class='content-content'>" + content
a += "</div><div id='" + uid + "-content-scrollbar' class='scrollbar'><div id='" + uid + "-content-scrollbar-point' class='scrollbar-point'></div>"
a += "</div>"
a += "</div>"
document.getElementById("root").innerHTML += a
//console.log(document.getElementById(uid + "-content-root").clientHeight / (document.getElementById(uid + "-content-content").clientHeight / document.getElementById(uid + "-content-root").clientHeight))
document.getElementById(uid + "-content-scrollbar-point").style.height = (document.getElementById(uid + "-content-root").clientHeight / (document.getElementById(uid + "-content-content").clientHeight / document.getElementById(uid + "-content-root").clientHeight)) + "px"
if (document.getElementById(uid + "-content-scrollbar-point").clientHeight > document.getElementById(uid + "-content-root").clientHeight)
document.getElementById(uid + "-content-scrollbar-point").style.display = 'none'
//console.log(document.getElementById(uid + "-content-scrollbar-point"))
let elems = document.getElementsByClassName("window")
for (let i = 0; i != elems.length; i++) {
//let elem = elems.item(i).children[0]
let elec = elems.item(i).children
let elem
//console.log(elec)
for (let ii = 0; ii != elec.length; ii++) {
if (elec.item(ii).className == 'head-border') {
elem = elec.item(ii)
break
}
}
let elep = elems.item(i)
let px = 0, py = 0;
if (elem.className == 'head-border') {
elem.onmousedown = ((ev) => {
for (let i = 0; i != elems.length; i++) {
elems.item(i).style.zIndex = 0;
}
elep.style.zIndex = 1
document.body.style.cursor = 'grabbing'
elem.style.cursor = 'grabbing'
px = ev.clientX
py = ev.clientY
document.body.style.userSelect = "none"
document.onmouseup = ((evu) => {
document.body.style.userSelect = "unset"
document.onmousemove = null
document.onmouseup = null
document.body.style.cursor = ''
elem.style.cursor = ''
})
document.onmousemove = ((evm) => {
console.log(elem.id)
elep.style.left = (elep.offsetLeft - (px - evm.clientX)) + "px"
elep.style.top = (elep.offsetTop - (py - evm.clientY)) + "px"
px = (evm.clientX)
py = (evm.clientY)
})
})
}
let minx = 150;
let miny = 150;
['resize-s', 'resize-n', 'resize-e', 'resize-w'].forEach((sel) => {
for (let ii = 0; ii != elec.length; ii++) {
if (elec.item(ii).className == sel) {
elem = elec.item(ii)
break
}
}
if (elem.className == sel) {
elem.onmousedown = ((ev) => {
px = ev.clientX
py = ev.clientY
if (sel == 'resize-s' || sel == 'resize-n')
elem.style.cursor = 'ns-resize'
else
elem.style.cursor = 'ew-resize'
document.body.style.userSelect = "none"
document.onmouseup = ((evu) => {
document.body.style.userSelect = "unset"
document.onmousemove = null
document.onmouseup = null
document.body.style.cursor = 'initial'
})
document.onmousemove = ((evm) => {
if (sel == 'resize-s')
if ((parseInt(elep.style.height.replace("px", "")) + (evm.clientY - py)) > miny) {
elep.style.height = (parseInt(elep.style.height.replace("px", "")) + (evm.clientY - py)) + "px"
} if (sel == 'resize-n') {
if ((parseInt(elep.style.height.replace("px", "")) - (evm.clientY - py)) > miny) {
elep.style.top = (elep.offsetTop - (py - evm.clientY)) + "px"
elep.style.height = (parseInt(elep.style.height.replace("px", "")) - (evm.clientY - py)) + "px"
//console.log(elem.parentElement.parentElement.parentElement)
for (let iii = 0; iii != elem.parentElement.parentElement.parentElement.children.length; iii++) {
//console.log(elem.parentElement.parentElement.parentElement.children.item(iii).className)
if (elem.parentElement.parentElement.parentElement.children.item(iii).className == "content-root") {
for (let iiii = 0; iiii != elem.parentElement.parentElement.parentElement.children.item(iii).children.length; iiii++) {
if (elem.parentElement.parentElement.parentElement.children.item(iii).children.item(iiii).className == "scrollbar") {
for (let iiiii = 0; iiiii != elem.parentElement.parentElement.parentElement.children.item(iii).children.item(iiii).children.length; iii++) {
if (elem.parentElement.parentElement.parentElement.children.item(iii).children.item(iiii).children.item(iiiii).className == "scrollbar-point") {
for (let iiiiii = 0; iiiiii != elem.parentElement.parentElement.parentElement.children.item(iii).children.length; iiiiii++) {
if (elem.parentElement.parentElement.parentElement.children.item(iii).children.item(iiiiii).className == "content-content") {
if (elem.parentElement.parentElement.parentElement.children.item(iii).clientHeight / (elem.parentElement.parentElement.parentElement.children.item(iii).children.item(iiiiii).clientHeight / elem.parentElement.parentElement.parentElement.children.item(iii).clientHeight) < elem.parentElement.parentElement.parentElement.children.item(iii).clientHeight) {
elem.parentElement.parentElement.parentElement.children.item(iii).children.item(iiii).children.item(iiiii).style.display = "block"
elem.parentElement.parentElement.parentElement.children.item(iii).children.item(iiii).children.item(iiiii).style.height = (elem.parentElement.parentElement.parentElement.children.item(iii).clientHeight / (elem.parentElement.parentElement.parentElement.children.item(iii).children.item(iiiiii).clientHeight / elem.parentElement.parentElement.parentElement.children.item(iii).clientHeight)) + "px"
} else {
elem.parentElement.parentElement.parentElement.children.item(iii).children.item(iiii).children.item(iiiii).style.display = "none"
}
break
}
}
break
}
}
break
}
}
break
}
}
//document.getElementById(uid + "-content-scrollbar-point").style.height = (document.getElementById(uid + "-content-root").clientHeight / (document.getElementById(uid + "-content-content").clientHeight / document.getElementById(uid + "-content-root").clientHeight)) + "px"
}
}
if (sel == 'resize-e')
if ((parseInt(elep.style.width.replace("px", "")) + (evm.clientX - px)) > minx) {
elep.style.width = (parseInt(elep.style.width.replace("px", "")) + (evm.clientX - px)) + "px"
} if (sel == 'resize-w') {
console.log((parseInt(elep.style.width.replace("px", "")) - (evm.clientX - px)))
if ((parseInt(elep.style.width.replace("px", "")) - (evm.clientX - px)) > minx) {
elep.style.left = (elep.offsetLeft - (px - evm.clientX)) + "px"
elep.style.width = (parseInt(elep.style.width.replace("px", "")) - (evm.clientX - px)) + "px"
}
}
//
py = (evm.clientY)
px = (evm.clientX)
})
})
}
})
let temp
for (let ii = 0; ii != elec.length; ii++) {
if (elec.item(ii).className == 'content-root') {
console.log(elec.item(ii).className)
temp = elec.item(ii).children
for (let iii = 0; iii != temp.length; iii++) {
console.log(temp.item(iii).className)
if (temp.item(iii).className == 'scrollbar') {
temp = temp.item(iii).children
for (let iiii = 0; iiii != temp.length; iiii++) {
console.log(temp.item(iiii).className)
if (temp.item(iiii).className == 'scrollbar-point') {
elem = temp.item(iiii)
break
}
}
break
}
}
break
}
}
px = 0, py = 0;
if (elem.className == 'scrollbar-point') {
elem.onmousedown = ((ev) => {
document.body.style.cursor = 'grabbing'
elem.style.cursor = 'grabbing'
py = ev.clientY
document.body.style.userSelect = "none"
document.onmouseup = ((evu) => {
document.body.style.userSelect = "unset"
document.onmousemove = null
document.onmouseup = null
document.body.style.cursor = 'initial'
elem.style.cursor = ''
})
document.onmousemove = ((evm) => {
let z = (elem.offsetTop - (py - evm.clientY))
//let b = (elem.clientHeight - elem.offsetTop - (py - evm.clientY))
//console.log(elem.clientHeight/2 - elem.offsetTop - (py - evm.clientY))
if (z > -1 && z < elem.parentElement.clientHeight - elem.clientHeight)
elem.style.top = z + "px"
py = (evm.clientY)
})
})
}
}
}
</script>
</head>
<body
onload="window_create(1,'test!','HIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHI</br></br></br></br></br></br>fwefsdf</br></br></br></br></br></br></br>fwefwr</br>IIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIIIHIIII')">
<div id="root"></div>
</body>
</html>
|