-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrapper.html
More file actions
135 lines (129 loc) · 4.35 KB
/
wrapper.html
File metadata and controls
135 lines (129 loc) · 4.35 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>All Visualizations</title>
<style>
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
background: #f0f0f0;
}
.slider-wrapper {
width: 100vw;
height: 100vh;
overflow: hidden;
position: relative;
}
.slider-container {
display: flex;
width: 600vw; /* 6 * 100vw */
height: 100vh;
transition: transform 0.3s ease;
}
iframe {
width: 100vw;
height: 100vh;
border: none;
}
.nav-dots {
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 10px;
z-index: 1000;
}
.dot {
width: 12px;
height: 12px;
border-radius: 50%;
background: rgba(0,0,0,0.3);
cursor: pointer;
z-index: 1000;
pointer-events: auto;
}
.dot.active {
background: #23cd3c;
}
</style>
</head>
<body>
<div class="slider-wrapper">
<div class="slider-container" id="slider">
<iframe src="/ecg_single.html" title="ECG Single"></iframe>
<iframe src="/ecg_multi.html" title="ECG Multi"></iframe>
<iframe src="/signal_single.html" title="Signal Single"></iframe>
<iframe src="/signal_multi.html" title="Signal Multi"></iframe>
<iframe src="/data-calculator.html" title="Data Calculator"></iframe>
<iframe src="/kumu.html" title="Kumu"></iframe>
</div>
</div>
<div class="nav-dots">
<div class="dot active" data-slide="0"></div>
<div class="dot" data-slide="1"></div>
<div class="dot" data-slide="2"></div>
<div class="dot" data-slide="3"></div>
<div class="dot" data-slide="4"></div>
<div class="dot" data-slide="5"></div>
</div>
<script>
const slider = document.getElementById('slider');
const dots = document.querySelectorAll('.dot');
let currentSlide = 0;
const iframes = slider.querySelectorAll('iframe');
iframes.forEach(iframe => {
iframe.addEventListener('click', () => {
iframe.contentWindow.focus();
});
});
function updateSlide(index) {
currentSlide = index;
slider.style.transform = `translateX(-${index * 100}vw)`;
dots.forEach((dot, i) => {
dot.classList.toggle('active', i === index);
});
// Send reset message to the current iframe
if (iframes[index]) {
iframes[index].contentWindow.postMessage('reset', '*');
}
}
window.addEventListener('keydown', (e) => {
if (e.ctrlKey) {
if (e.key === 'ArrowLeft') {
e.preventDefault();
const prev = (currentSlide - 1 + 6) % 6;
updateSlide(prev);
} else if (e.key === 'ArrowRight') {
e.preventDefault();
const next = (currentSlide + 1) % 6;
updateSlide(next);
}
} else if (e.key === 'r' || e.key === 'R') {
e.preventDefault();
if (iframes[currentSlide]) {
iframes[currentSlide].contentWindow.postMessage('reset', '*');
}
}
}, true);
// Listen for forwarded key events from iframes
window.addEventListener('message', (e) => {
if (e.data.type === 'keydown' && e.data.ctrlKey) {
if (e.data.key === 'ArrowLeft') {
const prev = (currentSlide - 1 + 6) % 6;
updateSlide(prev);
} else if (e.data.key === 'ArrowRight') {
const next = (currentSlide + 1) % 6;
updateSlide(next);
}
}
});
dots.forEach((dot, index) => {
dot.addEventListener('click', () => updateSlide(index));
});
</script>
</body>
</html>