From 1ef76b194506fae5aeddb6fb6b39be5e4180091d Mon Sep 17 00:00:00 2001 From: Eric Fawcett Date: Mon, 18 Oct 2021 02:33:42 +0000 Subject: [PATCH] break out configuration --- config.php.new | 14 ++++++++++++++ index.php | 8 +++++++- script.js | 14 +++----------- 3 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 config.php.new diff --git a/config.php.new b/config.php.new new file mode 100644 index 0000000..e2bcaf9 --- /dev/null +++ b/config.php.new @@ -0,0 +1,14 @@ + 'Route 8 - Stow' //html page title +]; + +$camList = [ //list of cam titles and urls - currently must be 6 + ['Hudson Dr', 'https://itscameras.dot.state.oh.us/images/CLE/CLE034.jpg'], + ['Graham Rd', 'https://itscameras.dot.state.oh.us/images/CLE/CLE036a-L.jpg'], + ['Hampshire Rd', 'https://itscameras.dot.state.oh.us/images/CLE/CLE040-L.jpg'], + ['Steels Corners', 'https://itscameras.dot.state.oh.us/images/CLE/CLE038-L.jpg'], + ['Barlow Rd', 'https://itscameras.dot.state.oh.us/images/CLE/CLE044-L.jpg'], + ['SR 303', 'https://itscameras.dot.state.oh.us/images/CLE/CLE013-L.jpg'] +]; +?> \ No newline at end of file diff --git a/index.php b/index.php index 2c7c534..c0c03b8 100644 --- a/index.php +++ b/index.php @@ -1,10 +1,16 @@ + - Route 8 Cameras + <?=$config['page_title']?> + diff --git a/script.js b/script.js index ea19f49..11cdb3a 100644 --- a/script.js +++ b/script.js @@ -1,12 +1,4 @@ $(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 @@ -20,7 +12,7 @@ $(document).ready(function(){ function loadTitle(camDat, camNum){ - $("#title" + camNum).text(camDat[1]); + $("#title" + (camNum+1)).text(camDat[0]); } @@ -33,8 +25,8 @@ function setIMG(camList){ 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); + camURL = camDat[1] + "?date=" + datestr; + $("#cam" + (camNum+1)).attr("src", camURL); }