Week 1 | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
Morning (6:00 - 10:00) | |||||||
Midday (10:00 - 14:00) | |||||||
Afternoon (14:00 - 18:00) | |||||||
Evening (18:00 - 22:00) | |||||||
Week 2 | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
Morning (6:00 - 10:00) | |||||||
Midday (10:00 - 14:00) | |||||||
Afternoon (14:00 - 18:00) | |||||||
Evening (18:00 - 22:00) | |||||||
Week 3 | |||||||
Week 4 | |||||||
Month 2 | |||||||
Month 3 | |||||||
Week 1 | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
Morning (6:00 - 10:00) | |||||||
Midday (10:00 - 14:00) | |||||||
Afternoon (14:00 - 18:00) | |||||||
Evening (18:00 - 22:00) | |||||||
Week 2 | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
Morning (6:00 - 10:00) | |||||||
Midday (10:00 - 14:00) | |||||||
Afternoon (14:00 - 18:00) | |||||||
Evening (18:00 - 22:00) | |||||||
Week 3 | |||||||
Week 4 | |||||||
Month 2 | |||||||
Month 3 |
Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday | |
Morning (6:00 - 10:00) | |||||||
Midday (10:00 - 14:00) | |||||||
Afternoon (14:00 - 18:00) | |||||||
Evening (18:00 - 22:00) | |||||||
Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday | |
Morning (6:00 - 10:00) | |||||||
Midday (10:00 - 14:00) | |||||||
Afternoon (14:00 - 18:00) | |||||||
Evening (18:00 - 22:00) |
Weekdays | Morning (6:00 - 10:00) | Midday (10:00 - 14:00) | Afternoon (14:00 - 18:00) | Evening (18:00 - 22:00) |
None at all | ||||
Less than usual | ||||
An average amount | ||||
More than average | ||||
Much more than average | ||||
Weekends | Morning (6:00 - 10:00) | Midday (10:00 - 14:00) | Afternoon (14:00 - 18:00) | Evening (18:00 - 22:00) |
None at all | ||||
Less than usual | ||||
An average amount | ||||
More than average | ||||
Much more than average | ||||
Weekdays | Morning (6:00 - 10:00) | Midday (10:00 - 14:00) | Afternoon (14:00 - 18:00) | Evening (18:00 - 22:00) |
None at all | ||||
Less than usual | ||||
An average amount | ||||
More than average | ||||
Much more than average | ||||
Weekends | Morning (6:00 - 10:00) | Midday (10:00 - 14:00) | Afternoon (14:00 - 18:00) | Evening (18:00 - 22:00) |
None at all | ||||
Less than usual | ||||
An average amount | ||||
More than average | ||||
Much more than average |
' + response_text[j] + '
'; $(BotResponse).appendTo(".chats").hide().fadeIn(1000); + + setTimeout(()=> { + $(".timeslots_table").toggle(); + } + ,20000); } else if(response_text[j].includes("Now, I want to ask when you have more energy than usual. We could make use of this opportunity to schedule a walk if you are also free at the time.")){ - $(".energy_levels_table").toggle(); + + setTimeout(()=> { + $(".energy_levels_table").toggle(); + } + ,10000); var BotResponse = '' + response_text[j] + '
'; @@ -350,10 +354,18 @@ function setBotResponse(response) { document.getElementById("month_3").innerHTML = "Walking for up to " + month_3 + " hours per week, distributed across 6 time slots each week"; - $(".plan_table").toggle(); + $(".plan_table").css("display","block"); + + $(".plan").css("display","table"); number_plan = 1; } + else if(response_text[j].includes("That's right, your first walk is on")){ + var BotResponse = '' + response_text[j] + '
'; + $(BotResponse).appendTo(".chats").hide().fadeIn(1000); + + $(".plan_after_week_2").css("display", "table-row"); + } else if(response_text[j].includes("this is a message for javascript: enable the buttons")){ var button = document.getElementById("submit_plan_button"); @@ -376,80 +388,110 @@ function setBotResponse(response) { days.forEach(element => document.getElementById(element).classList.add("toggleable")); - button.style.display = "table"; + setTimeout(function(){ + button.style.display = "table"; + } + ,35000); } else if(response_text[j].includes("What can you take away from this example for yourself? Please type this in the chat.") || response_text[j].includes("The question was: What can you take away from this example for yourself?")){ var BotResponse = '' + response_text[j] + '
'; $(BotResponse).appendTo(".chats").hide().fadeIn(1000); - - $('.usrInput').attr("disabled",false); - $(".usrInput").prop('placeholder', "Type something..."); - current_takeaway = 1; + setTimeout(function(){ + $('.usrInput').attr("disabled",false); + $(".usrInput").prop('placeholder', "Type something..."); + current_takeaway = 1; + blink_and_select(); + } + ,5000); } else if(response_text[j].includes("How about this example? What can you take away for yourself? Please type this in the chat.") || response_text[j].includes("The question was: What can you take away from this second example for yourself?")){ var BotResponse = '' + response_text[j] + '
'; $(BotResponse).appendTo(".chats").hide().fadeIn(1000); - - $('.usrInput').attr("disabled",false); - $(".usrInput").prop('placeholder', "Type something..."); - current_takeaway = 2; + setTimeout(function(){ + $('.usrInput').attr("disabled",false); + $(".usrInput").prop('placeholder', "Type something..."); + current_takeaway = 2; + blink_and_select(); + } + ,5000); } else if(response_text[j].includes("Please type your answer as a number with one decimal point.")){ var BotResponse = '' + response_text[j] + '
'; $(BotResponse).appendTo(".chats").hide().fadeIn(1000); - - $('.usrInput').attr("disabled",false); - $(".usrInput").prop('placeholder', "Type something..."); - check_week_3 = true; + setTimeout(function(){ + $('.usrInput').attr("disabled",false); + $(".usrInput").prop('placeholder', "Type something..."); + check_week_3 = true; + blink_and_select(); + } + ,5000); } else if(response_text[j].includes("You can see the first two weeks planned in detail.")){ var BotResponse = '' + response_text[j] + '
'; $(BotResponse).appendTo(".chats").hide().fadeIn(1000); - - $('.usrInput').attr("disabled",false); - $(".usrInput").prop('placeholder', "Type something..."); - check_first_walk = true; + setTimeout(function(){ + $('.usrInput').attr("disabled",false); + $(".usrInput").prop('placeholder', "Type something..."); + check_first_walk = true; + blink_and_select(); + } + ,5000); } else if(response_text[j].includes("User barrier: ")){ - - $('.usrInput').attr("disabled",false); - $(".usrInput").prop('placeholder', "Type something..."); - barrier_strategy = true; barrier_type = response_text[j].split("User barrier: ")[1]; + setTimeout(function(){ + $('.usrInput').attr("disabled",false); + $(".usrInput").prop('placeholder', "Type something..."); + barrier_strategy = true; + blink_and_select(); + } + ,5000); } else if(response_text[j].includes("The question was: How can you overcome this barrier?")){ var BotResponse = '' + response_text[j] + '
'; $(BotResponse).appendTo(".chats").hide().fadeIn(1000); - - $('.usrInput').attr("disabled",false); - $(".usrInput").prop('placeholder', "Type something..."); - barrier_strategy = true; + setTimeout(function(){ + $('.usrInput').attr("disabled",false); + $(".usrInput").prop('placeholder', "Type something..."); + barrier_strategy = true; + blink_and_select(); + } + ,5000); } - else if(response_text[j].includes("I see. Thank you for informing me. Would you mind briefly describing your barrier to me in the chat?") || response_text[j].includes("The question was: Would you mind briefly describing your barrier to me in the chat?")){ + else if(response_text[j].includes("Would you mind briefly describing your barrier to me in the chat?") || response_text[j].includes("The question was: Would you mind briefly describing your barrier to me in the chat?")){ var BotResponse = '' + response_text[j] + '
'; $(BotResponse).appendTo(".chats").hide().fadeIn(1000); - - $('.usrInput').attr("disabled",false); - $(".usrInput").prop('placeholder', "Type something..."); - identified_barrier = true; + setTimeout(function(){ + $('.usrInput').attr("disabled",false); + $(".usrInput").prop('placeholder', "Type something..."); + identified_barrier = true; + blink_and_select(); + } + ,5000); } else if(response_text[j].includes("Okay! Now, you have your approach to this barrier. Here is a strategy I thought about.") || response_text[j].includes("The question was: How can you overcome this barrier after having read my suggestion?")){ var BotResponse = '' + response_text[j] + '
'; $(BotResponse).appendTo(".chats").hide().fadeIn(1000); - - $('.usrInput').attr("disabled",false); - $(".usrInput").prop('placeholder', "Type something..."); - barrier_repeat = true; + setTimeout(function(){ + $('.usrInput').attr("disabled",false); + $(".usrInput").prop('placeholder', "Type something..."); + barrier_repeat = true; + blink_and_select(); + } + ,5000); } else if(response_text[j].includes("Good choice!") || response_text[j].includes("The question was: How do you think planning can help you do this?")){ var BotResponse = '' + response_text[j] + '
'; $(BotResponse).appendTo(".chats").hide().fadeIn(1000); - - $('.usrInput').attr("disabled",false); - $(".usrInput").prop('placeholder', "Type something..."); - planning = true; + setTimeout(function(){ + $('.usrInput').attr("disabled",false); + $(".usrInput").prop('placeholder', "Type something..."); + planning = true; + blink_and_select(); + } + ,5000); } // otherwise, display the message else{ @@ -473,7 +515,6 @@ function setBotResponse(response) { if (response.length > 1){ //show typing symbol again var delay_typing = 600 + delay_first_message; - // var delay_typing = 20; setTimeout(function () { showBotTyping(); }, delay_typing) @@ -521,15 +562,17 @@ function doScaledTimeout(i, response, summed_timeout) { }, summed_timeout); } -function blink() { + +function blink_and_select() { + document.getElementById("userInput").focus(); + document.getElementById("userInput").select(); + var f = document.getElementById('keypad'); + f.style.animation = 'border-flicker-yellow 3s ease-out'; setTimeout(function() { - f.style.boxShadow = '5px 5px 50px #09ff00'; - setTimeout(function() { - f.style.boxShadow = 'none'; - }, 1000); - }, 1000); - } + f.style.animation = 'none'; + }, 5000); + //====================================== Toggle chatbot ======================================= @@ -612,22 +655,25 @@ function select_energy(clicked_id){ var time_slot = document.getElementById(clicked_id); - time_slot.style.backgroundColor = "#82e876"; - if(clicked_id.includes("0")){ - time_slot.innerHTML = "None at all" + time_slot.innerHTML = "None at all"; + time_slot.style.backgroundColor = "#F7F97A"; } else if (clicked_id.includes("1")){ - time_slot.innerHTML = "Less than usual" + time_slot.innerHTML = "Less than usual"; + time_slot.style.backgroundColor = "#B1F97D"; } else if (clicked_id.includes("2")){ - time_slot.innerHTML = "An average amount" + time_slot.innerHTML = "An average amount"; + time_slot.style.backgroundColor = "#82E876"; } else if (clicked_id.includes("3")){ - time_slot.innerHTML = "More than average" + time_slot.innerHTML = "More than average"; + time_slot.style.backgroundColor = "#21E4AE"; } else if (clicked_id.includes("4")){ - time_slot.innerHTML = "Much more than average" + time_slot.innerHTML = "Much more than average"; + time_slot.style.backgroundColor = "#4EB3F5"; } } @@ -710,6 +756,11 @@ function check_selected_timeslots(){ } } +function day_only(id){ + const day = id.split('_')[0]; + return day; +} + function check_selected_timeslots_initial(){ var button = document.getElementById("submit_timeslots_button"); @@ -725,21 +776,28 @@ function check_selected_timeslots_initial(){ "sunday_morning_slot", "sunday_midday_slot", "sunday_afternoon_slot", "sunday_evening_slot" ] - var count = 0; - days.forEach(element_id => count+= check_inner_HTML(element_id)); - var selected_slots = []; - days.forEach(element_id => selected_slots.push(slots_selected_initial(element_id))); + var selected_slots_day_only = []; + + days.forEach(function(element_id) { + count+= check_inner_HTML(element_id); + selected_slots.push(slots_selected_initial(element_id)); + }); var selected_slots = selected_slots.filter(function (el) { return el != ""; }); + selected_slots.forEach(function(element_id) { + if (!selected_slots_day_only.includes(day_only(element_id))) { + selected_slots_day_only.push(day_only(element_id)) + } + }); - if(count >= 4){ + if(selected_slots_day_only.length >= 4 || selected_slots_day_only.length == 3 && count >=4){ button.style.display = "none"; table.style.display = "none"; @@ -759,7 +817,7 @@ function check_selected_timeslots_initial(){ } else{ - window.alert("Please select at least four time slots."); + window.alert("Please select at least four time slots and at least four different days."); } } @@ -899,20 +957,50 @@ function addSuggestion(textToAdd) { setTimeout(function () { $(".usrInput").prop('placeholder', "Use one of the buttons to answer."); + var suggestions = textToAdd; var suggLength = textToAdd.length; - $('