diff --git a/scripts.js b/scripts.js deleted file mode 100644 index 87a7e8e..0000000 --- a/scripts.js +++ /dev/null @@ -1,61 +0,0 @@ -let delayTimeout; - -function post(path, value) { - fetch(path, { - method: "POST", - headers: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - body: encodeURIComponent(value) - }); -} - -function get(path, value) { - fetch(path, { - method: "GET", - headers: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - }); -} - -function updateColor() { - const color = document.getElementById('color').value; - post("POST", "/color", color); -} - -function updatePattern(pattern) { - const patternButtons = document.querySelectorAll('button[name="pattern"]'); - //patternButtons.forEach(button => button.disabled = true); - post("/pattern", pattern); -} - -function updateDelay() { - clearTimeout(delayTimeout); - delayTimeout = setTimeout(function() { - const delay = document.getElementById('delay').value; - post('/delay', delay); - }, 500); -} - -function updateNumLeds(event) { - event.preventDefault(); - const numLeds = document.getElementById('num_leds').value; - post('/num_leds', numLeds); -} - -document.addEventListener('DOMContentLoaded', function() { - document.getElementById('color').addEventListener('input', updateColor); - document.getElementById('delay').addEventListener('input', updateDelay); - document.getElementById('led_form').addEventListener('submit', updateNumLeds); - - const patternButtons = document.querySelectorAll('button[name="pattern"]'); - patternButtons.forEach(function(button) { - button.addEventListener('click', function(event) { - event.preventDefault(); - const pattern = this.value; - updatePattern(pattern); - }); - }); -}); - diff --git a/styles.css b/styles.css deleted file mode 100644 index 418247e..0000000 --- a/styles.css +++ /dev/null @@ -1,79 +0,0 @@ -body { - font-family: Arial, sans-serif; - padding: 20px; -} - -h1, h2 { - color: #333; -} - -form { - margin-bottom: 20px; -} - -input[type="number"], input[type="color"], input[type="range"] { - margin-right: 10px; -} - -button { - padding: 5px 10px; - background-color: #007bff; - color: white; - border: none; - border-radius: 5px; - cursor: pointer; -} - -button:hover { - background-color: #0056b3; -} - -#delay_value { - display: inline-block; - width: 80px; -} - -#patterns_radio_buttons label { - display: block; -} -body { - font-family: Arial, sans-serif; - background-color: #f0f0f0; - margin: 0; - padding: 20px; -} - -h1 { - color: #333; -} - -form { - margin-bottom: 20px; -} - -label { - display: block; - margin-bottom: 5px; - font-weight: bold; -} - -input[type="text"], -input[type="range"], -input[type="color"], -button { - margin-bottom: 10px; - padding: 10px; - font-size: 16px; -} - -button:disabled { - background-color: #ccc; -} - -button { - margin-right: 5px; - padding: 10px 20px; - font-size: 16px; - cursor: pointer; -} -