break out js
This commit is contained in:
parent
12ac382495
commit
b1934fa6ac
48
index.html
48
index.html
|
|
@ -5,53 +5,7 @@
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||||
<title>Route 8 Cameras</title>
|
<title>Route 8 Cameras</title>
|
||||||
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
|
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
|
||||||
<script>
|
<script src="script.js"></script>
|
||||||
$(document).ready(function(){
|
|
||||||
|
|
||||||
var camList = [];
|
|
||||||
camList[1] = ["CLE/CLE034", "Hudson Dr"];
|
|
||||||
camList[2] = ["CLE/CLE036a-L", "Graham Rd"];
|
|
||||||
camList[3] = ["CLE/CLE040-L", "Hampshire Rd"];
|
|
||||||
camList[4] = ["CLE/CLE038-L", "Steels Corners"];
|
|
||||||
camList[5] = ["CLE/CLE044-L", "Barlow Rd"];
|
|
||||||
camList[6] = ["CLE/CLE013-L", "SR 303"];
|
|
||||||
|
|
||||||
camList.forEach(loadTitle); //set titles
|
|
||||||
|
|
||||||
setIMG(camList); //load initial images
|
|
||||||
|
|
||||||
setInterval(setIMG, 6000, camList); //set timer to continuously reload images.
|
|
||||||
|
|
||||||
setInterval(reloadPage, 3600000); //set timer to reload page.
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
function loadTitle(camDat, camNum){
|
|
||||||
|
|
||||||
$("#title" + camNum).text(camDat[1]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function setIMG(camList){
|
|
||||||
|
|
||||||
camList.forEach(loadIMG);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadIMG(camDat, camNum){
|
|
||||||
|
|
||||||
datestr = Date.now();
|
|
||||||
camURL = "https://itscameras.dot.state.oh.us/images/" + camDat[0] + ".jpg?date=" + datestr;
|
|
||||||
$("#cam" + camNum).attr("src", camURL);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function reloadPage(){
|
|
||||||
|
|
||||||
window.location = window.location.href;
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="grid-container">
|
<div class="grid-container">
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
var camList = [];
|
||||||
|
camList[1] = ["CLE/CLE034", "Hudson Dr"];
|
||||||
|
camList[2] = ["CLE/CLE036a-L", "Graham Rd"];
|
||||||
|
camList[3] = ["CLE/CLE040-L", "Hampshire Rd"];
|
||||||
|
camList[4] = ["CLE/CLE038-L", "Steels Corners"];
|
||||||
|
camList[5] = ["CLE/CLE044-L", "Barlow Rd"];
|
||||||
|
camList[6] = ["CLE/CLE013-L", "SR 303"];
|
||||||
|
|
||||||
|
camList.forEach(loadTitle); //set titles
|
||||||
|
|
||||||
|
setIMG(camList); //load initial images
|
||||||
|
|
||||||
|
setInterval(setIMG, 6000, camList); //set timer to continuously reload images.
|
||||||
|
|
||||||
|
setInterval(reloadPage, 3600000); //set timer to reload page.
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
function loadTitle(camDat, camNum){
|
||||||
|
|
||||||
|
$("#title" + camNum).text(camDat[1]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function setIMG(camList){
|
||||||
|
|
||||||
|
camList.forEach(loadIMG);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadIMG(camDat, camNum){
|
||||||
|
|
||||||
|
datestr = Date.now();
|
||||||
|
camURL = "https://itscameras.dot.state.oh.us/images/" + camDat[0] + ".jpg?date=" + datestr;
|
||||||
|
$("#cam" + camNum).attr("src", camURL);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function reloadPage(){
|
||||||
|
|
||||||
|
window.location = window.location.href;
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue