Код: Выделить всё
// Handles displaying bay modals
const bay_modal = document.getElementById("bay_modal");
const modal_title = document.getElementById("bay_modal_title")
const modal_buttons = document.getElementsByClassName("bay_modal_button");
const bay_modal_quit = document.getElementById("bay_modal_quit")
const bay_modal_from_selection = document.getElementById("from")
const bay_modal_to_selection = document.getElementById("to")
// Close the modal when the exit button is clicked
bay_modal_quit.addEventListener('click', function() {
bay_modal.style = "visibility: hidden;"
})
// Add event listeners to each bay button to open the modal
for (let i = 0; i < modal_buttons.length; i++) {
modal_buttons[i].addEventListener('click', async function() {
// Get data about the bay
bay_data = JSON.parse(
fetch("{{ url_for('route_scheduler')}}", {body: JSON.stringify(
{ request_type: "GET_HYDRATE_DATA", bay_identifier: modal_buttons[i].id }
)}));
const scheduleFrom = {};
const scheduleTo = {};
bay_data.schedule.forEach(sch => {
scheduleFrom[sch[0]] = true;
scheduleTo[sch[1]] = true;
});
for (let j = 0; j < 25; j++) {
if (scheduleFromDict[j]) {
bay_modal_from_selection[j].style = "background: red;";
};
if (scheduleToDict[j]) {
bay_modal_to_selection[j].style = "background: red;";
};
};
modal_title.innerText = modal_buttons[i].name;
bay_modal.style = "visibility: visible;";
});
};
Код: Выделить всё
bay_modal_quit.addEventListener('click', function() {
^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.TemplateSyntaxError: expected token ',', got 'click'
Подробнее здесь: https://stackoverflow.com/questions/791 ... g-in-flask
Мобильная версия