diff --git a/index.html b/index.html index 06ffa0a..2c7c534 100644 --- a/index.html +++ b/index.html @@ -5,53 +5,7 @@ Route 8 Cameras - +
diff --git a/script.js b/script.js new file mode 100644 index 0000000..ea19f49 --- /dev/null +++ b/script.js @@ -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; + +} \ No newline at end of file