1
0

list.html 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Today's to-do List</title>
  7. <style>
  8. body {
  9. background-color: transparent;
  10. color: #ffd39a;
  11. width: 400px;
  12. }
  13. </style>
  14. <script>
  15. function checkForUpdates() {
  16. fetch('/updateTodo')
  17. .then(response => response.json())
  18. .then(data => {
  19. if (data.updated) {
  20. console.log('List has changed, refreshing the page...');
  21. window.location.reload(); // Refresh if votes have changed
  22. } else {
  23. console.log('No changes detected.'); // Log if no changes
  24. }
  25. })
  26. .catch(error => console.error('Error fetching updated list:', error));
  27. }
  28. setInterval(checkForUpdates, 15 * 1000); // Check every 15 seconds
  29. </script>
  30. </head>
  31. <body>
  32. {% if items %}
  33. <h4>Today's to-do List</h4>
  34. <ul id="todo-list">
  35. {% for item in items %}
  36. <li style="text-decoration: {{ 'line-through' if item.crossed == 'yes' else 'none' }};">
  37. {{ item.name }}
  38. </li>
  39. {% endfor %}
  40. </ul>
  41. {% else %}
  42. <h4>Nothing on the to-do list yet</h4>
  43. {% endif %}
  44. </body>
  45. </html>