-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage-webcam.php
More file actions
89 lines (85 loc) · 3.58 KB
/
Copy pathpage-webcam.php
File metadata and controls
89 lines (85 loc) · 3.58 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
<?php
/**
* The template for displaying webcam
*/
get_header();
?>
<header class="page-header">
<div class="overlay-dark"></div>
<div class="container breadcrumbs-wrapper">
<div class="breadcrumbs d-flex flex-column justify-content-center">
<h3><?php wp_title(''); ?></h3>
</div>
</div>
</header>
<section class="white-section blog-section single-post-section">
<div class="container">
<div class="row">
<div class="col single-post-wrapper">
<script>
var timeout = 2000;
var timeout2 = 5000;
function refresh() {
for(var index=1;index<3;index++){
var cam = document.getElementById("cam" + index);
if(cam != null && cam.getAttribute("class") != "hideCam") {
cam.setAttribute("src", "https://old.digit.fi/webcam/webcam" +index+".jpg?"+(new Date()).getTime());
}
}
setTimeout('refresh()',timeout);
}
setTimeout('refresh()',timeout2);
function viewCam(x) {
for(var index=1;index<3;index++){
var cam = document.getElementById("cam"+index);
var camDiv = document.getElementById("Cam"+index);
if(cam != null){
if(index == x){
if (index == 1) {
document.getElementById("Cam2").setAttribute("class", "hideCam");
} else {
document.getElementById("Cam1").setAttribute("class", "hideCam");
}
cam.setAttribute("class","viewCam");
camDiv.setAttribute("class","col-lg-12 col-sm-12");
cam.setAttribute("onclick","javascript:hideCam("+index+");");
} else {
cam.setAttribute("class","hideCam");
}
}
}
}
function hideCam(x) {
for(var index=1;index<3;index++){
var cam = document.getElementById("cam"+index);;
var camDiv = document.getElementById("Cam"+index);
if(cam != null) {
if (index == 1) {
document.getElementById("Cam2").setAttribute("class", "col-lg-6 col-sm-12");
} else {
document.getElementById("Cam1").setAttribute("class", "col-lg-6 col-sm-12");
}
cam.setAttribute("class","webCam");
camDiv.setAttribute("class","col-lg-6 col-sm-12");
if(index == x){
cam.setAttribute("onclick","javascript:viewCam("+index+");");
}
}
}
}
</script>
<div class="container">
<div class="row">
<div class="col-lg-6 col-sm-12" id="Cam1">
<img class="webCam" src="https://old.digit.fi/webcam/webcam1.jpg" id="cam1" onclick="javascript:viewCam(1);">
</div>
<div class="col-lg-6 col-sm-12" id="Cam2">
<img class="webCam" src="https://old.digit.fi/webcam/webcam2.jpg" id="cam2" onclick="javascript:viewCam(2);">
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<?php get_footer(); ?>