-
Notifications
You must be signed in to change notification settings - Fork 0
/
sbs.html
96 lines (93 loc) · 3.29 KB
/
sbs.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="images/favicon.png">
<title>Lesmodule</title>
<style>
body,html {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
}
container {
position: relative;
display: flex;
width: 100%;
height: 100%;
}
#lestekst {
width: 375px;
}
#kaart {
flex-grow: 1;
}
#dragbar {
width: 5px;
height: 100%;
background-color: lightgray;
cursor: ew-resize;
}
iframe {
border: none;
}
.ignoreevents {
pointer-events: none;
}
</style>
<script>
function startDragging(event) {
event.preventDefault();
const hostSelector = event.target.getAttribute("target");
if (!hostSelector) return;
const host = document.querySelector(hostSelector);
if (!host) return;
document.querySelectorAll('iframe').forEach(iframe=>iframe.classList.add('ignoreevents'));
const startHostWidth = host.offsetWidth;
const xOffset = event.pageX;
const mouseDragHandler = (moveEvent) => {
moveEvent.preventDefault();
const primaryButtonPressed = moveEvent.buttons === 1;
if (!primaryButtonPressed) {
document.body.removeEventListener("pointermove", mouseDragHandler);
document.querySelectorAll('iframe').forEach(iframe=>iframe.classList.remove('ignoreevents'));
return;
}
host.style.width = startHostWidth + (xOffset - moveEvent.pageX) + "px";
};
document.body.addEventListener("pointermove", mouseDragHandler);
}
function init () {
document.querySelector('#dragbar').addEventListener('mousedown', startDragging);
let params = new URLSearchParams(window.location.search);
let tekstwidth = params.get('tekstwidth');
if (tekstwidth) {
let width = parseInt(tekstwidth);
if (!isNaN(width) && width > 0) {
document.querySelector('#lestekst').style.width=`${width}px`;
}
}
let teksturl = params.get('teksturl');
if (!teksturl && teksturl !== '') {
teksturl = "sbshelp.html"
}
document.querySelector('#lestekst').src = teksturl;
let kaarturl = params.get('kaarturl');
if (!(kaarturl && kaarturl !== '')) {
kaarturl = "index.html#configurl=maps/layers.json"
}
document.querySelector('#kaart').src = kaarturl;
}
window.addEventListener('load', init)
</script>
</head>
<body>
<container>
<iframe src="about:blank" id="kaart" name="kaart"></iframe>
<div id="dragbar" target="#lestekst"></div>
<iframe src="about:blank" scrolling="auto" name="lestekst" id="lestekst"></iframe>
</container>
</body>
</html>