| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Today's to-do List</title>
- <style>
- body {
- background-color: transparent;
- color: #ffd39a;
- width: 400px;
- }
- </style>
- <script>
- function checkForUpdates() {
- fetch('/checkTodo')
- .then(response => response.json())
- .then(data => {
- const newList = data.items; // Assuming LIST is returned as JSON with { items: [...] }
- // Compare current list with new list (you can customize this comparison)
- const currentItems = Array.from(document.querySelectorAll('li')).map(li => li.textContent);
- if (newList.length !== currentItems.length || !currentItems.every((item, index) => item === newList[index].name)) {
- // Refresh the page if the list has changed
- window.location.reload();
- }
- })
- .catch(error => console.error('Error fetching the to-do list:', error));
- }
- setInterval(checkForUpdates, 15 * 1000); // Check every 15 seconds
- </script>
- </head>
- <body>
- {% if items %}
- <h4>Today's to-do List</h4>
- <ul id="todo-list">
- {% for item in items %}
- <li style="text-decoration: {{ 'line-through' if item.crossed == 'yes' else 'none' }};">
- {{ item.name }}
- </li>
- {% endfor %}
- </ul>
- {% else %}
- <h4>Nothing on the to-do list yet</h4>
- {% endif %}
- </body>
- </html>
|