forked from J-A-A-M/ukraine_alarm_map
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinternal_web_server.html
185 lines (173 loc) · 9.77 KB
/
internal_web_server.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
173
174
175
176
177
178
179
180
181
182
183
184
185
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Simple Web Page with Input and Sliders</title>
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css'>
<style>
body { background-color: #4396ff; }
.btn {padding: 0.15rem 0.15rem;}
.container { padding: 20px; }
.box_yellow { background-color: #fff0d5; padding: 20px; border-radius: 10px; box-shadow: 0 0 10px rgba(0,0,0,.1); }
.box_blue { background-color: #4396ff; padding: 20px; border-radius: 10px; box-shadow: 0 0 10px rgba(0,0,0,.1); }
label { font-weight: bold; }
#sliderValue1, #sliderValue2, #sliderValue3, #sliderValue4 { font-weight: bold; color: #070505; }
.color-box { width: 30px; height: 30px; display: inline-block; margin-left: 10px; border: 1px solid #ccc; vertical-align: middle; }
.full-screen-img {width: 100%;height: 100%;object-fit: cover;}";
</style>
</head>
<body>
<form>
<div class='container mt-3'>
<h1 class='text-center'>Simple Web Page</h1>
<div class='row'>
<div class='col-md-6 offset-md-3'>
<div class='row' id="accordion">
<div class='box_yellow col-md-12 mt-2'>
<img class='full-screen-img' src='http://alerts.net.ua/alerts_map.png'>
</div>
<div class='box_yellow col-md-12 mt-2'>
<h4 class='text-left'>Simple Web Page</h4>
<div class='form-group'>
<label for='inputField'>Input Field</label>
<input type='text' class='form-control' id='inputField' placeholder='Enter value'>
</div>
<div class='form-group'>
<label for='slider1'>Slider 1: <span id='sliderValue1'>50</span></label>
<input type='range' class='form-control-range' id='slider1' min='0' max='100' value='50'>
</div>
<div class='form-group'>
<label for='slider3'>Hue Slider 1: <span id='sliderValue3'>180</span></label>
<input type='range' class='form-control-range' id='slider3' min='0' max='360' value='180'>
<div class='color-box' id='colorBox1'></div>
</div>
<div class='form-group'>
<label for='slider4'>Hue Slider 2: <span id='sliderValue4'>90</span></label>
<input type='range' class='form-control-range' id='slider4' min='0' max='360' value='90'>
<div class='color-box' id='colorBox2'></div>
</div>
</div>
<div class='box_yellow col-md-12 mt-2'>
<h5 class='text-left'>Simple Web Page
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseContent1" aria-expanded="false" aria-controls="collapseContent1">
Toggle
</button>
</h5>
<div class="collapse show" id="collapseContent1" data-parent="#accordion">
<div class='form-group'>
<label for='slider4'>Hue Slider 3: <span id='sliderValue5'>90</span></label>
<input type='range' class='form-control-range' id='slider5' min='0' max='360' value='90'>
<div class='color-box' id='colorBox3'></div>
</div>
<div class='form-group'>
<label for='selectBox'>Select Box</label>
<select class='form-control' id='selectBox'>
<option value='option1'>Option 1</option>
<option value='option2'>Option 2</option>
<option value='option3'>Option 3</option>
</select>
</div>
<div class='form-group form-check'>
<input type='checkbox' class='form-check-input' id='checkbox'>
<label class='form-check-label' for='checkbox'>Checkbox</label>
</div>
</div>
</div>
<div class='box_yellow col-md-12 mt-2'>
<h5 class='text-left'>Simple Web Page
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseContent2" aria-expanded="false" aria-controls="collapseContent2">
Toggle
</button>
</h5>
<div class="collapse show" id="collapseContent2" data-parent="#accordion">
<div class='form-group'>
<label for='slider4'>Hue Slider 3: <span id='sliderValue5'>90</span></label>
<input type='range' class='form-control-range' id='slider5' min='0' max='360' value='90'>
<div class='color-box' id='colorBox3'></div>
</div>
<div class='form-group'>
<label for='selectBox'>Select Box</label>
<select class='form-control' id='selectBox'>
<option value='option1'>Option 1</option>
<option value='option2'>Option 2</option>
<option value='option3'>Option 3</option>
</select>
</div>
<div class='form-group form-check'>
<input type='checkbox' class='form-check-input' id='checkbox'>
<label class='form-check-label' for='checkbox'>Checkbox</label>
</div>
</div>
</div>
<div class='box_yellow col-md-12 mt-2'>
<button type='submit' class='btn btn-primary full-screen-img'>Зберегти налаштування</button>
</div>
</div>
</div>
</div>
</div>
</form>
<script src='https://code.jquery.com/jquery-3.5.1.slim.min.js'></script>
<script src='https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.3/dist/umd/popper.min.js'></script>
<script src='https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js'></script>
<script>
const sliders = ['slider1', 'slider3', 'slider4', 'slider5'];
sliders.forEach(slider => {
const sliderElem = document.getElementById(slider);
const sliderValueElem = document.getElementById(slider.replace('slider', 'sliderValue'));
sliderElem.addEventListener('input', () => sliderValueElem.textContent = sliderElem.value);
});
function updateColorBox(boxId, hue) {
const rgbColor = hsbToRgb(hue, 100, 100);
document.getElementById(boxId).style.backgroundColor = `rgb(${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b})`;
}
const initialHue1 = parseInt(slider3.value);
const initialRgbColor1 = hsbToRgb(initialHue1, 100, 100);
document.getElementById('colorBox1').style.backgroundColor = `rgb(${initialRgbColor1.r}, ${initialRgbColor1.g}, ${initialRgbColor1.b})`;
const initialHue2 = parseInt(slider4.value);
const initialRgbColor2 = hsbToRgb(initialHue2, 100, 100);
document.getElementById('colorBox2').style.backgroundColor = `rgb(${initialRgbColor2.r}, ${initialRgbColor2.g}, ${initialRgbColor2.b})`;
const initialHue3 = parseInt(slider5.value);
const initialRgbColor3 = hsbToRgb(initialHue3, 100, 100);
document.getElementById('colorBox3').style.backgroundColor = `rgb(${initialRgbColor3.r}, ${initialRgbColor3.g}, ${initialRgbColor3.b})`;
function hsbToRgb(h, s, b) {
h /= 360;
s /= 100;
b /= 100;
let r, g, bl;
if (s === 0) {
r = g = bl = b;
} else {
const i = Math.floor(h * 6);
const f = h * 6 - i;
const p = b * (1 - s);
const q = b * (1 - f * s);
const t = b * (1 - (1 - f) * s);
switch (i % 6) {
case 0: r = b, g = t, bl = p; break;
case 1: r = q, g = b, bl = p; break;
case 2: r = p, g = b, bl = t; break;
case 3: r = p, g = q, bl = b; break;
case 4: r = t, g = p, bl = b; break;
case 5: r = b, g = p, bl = q; break;
}
}
return {
r: Math.round(r * 255),
g: Math.round(g * 255),
b: Math.round(bl * 255)
};
}
sliders.slice(1).forEach((slider, index) => {
const sliderElem = document.getElementById(slider);
const colorBoxElem = document.getElementById('colorBox' + (index + 1));
sliderElem.addEventListener('input', () => {
const hue = parseInt(sliderElem.value);
updateColorBox(colorBoxElem.id, hue);
document.getElementById(slider.replace('slider', 'sliderValue')).textContent = hue;
});
});
</script>
</body>
</html>