-
Notifications
You must be signed in to change notification settings - Fork 129
Expand file tree
/
Copy pathscript.js
More file actions
161 lines (131 loc) · 4.87 KB
/
Copy pathscript.js
File metadata and controls
161 lines (131 loc) · 4.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
let routine = {
name: "Morning Exercise",
time: "07:00",
repeat: "Every Day",
};
let routines = [routine];
function listRoutines() {
let routineList = document.getElementById("routine-list");
// routineList.innerHTML = "";
routines.forEach(function (routine, index) {
routineList.innerHTML += `
<div class="routine">
<h3>${routine.name}</h3>
<p>Time: ${routine.time}</p>
<p>Repeat: ${routine.repeat}</p>
<button onclick="deleteRoutine(${index})">Delete</button>
</div>
`;
});
}
function addRoutine() {
let name = document.getElementById("name").value;
let time = document.getElementById("time").value;
let repeat = document.getElementById("repeat").value;
let newRoutine = {
name: name,
time: time,
repeat: repeat,
};
routines.push(newRoutine);
listRoutines();
}
function deleteRoutine(index) {
routines.splice(index, 1);
listRoutines();
}
document.addEventListener("DOMContentLoaded", function () {
listRoutines();
});
document.addEventListener("DOMContentLoaded", function () {
const heroContent = document.querySelector(".hero-content");
heroContent.classList.add("active");
});
document.addEventListener("DOMContentLoaded", function () {
const heroContent = document.querySelector(".hero-content");
heroContent.classList.add("active");
lastScrollPosition = 0;
window.addEventListener("scroll", function () {
const featuresSection = document.querySelector(".features");
const featuresSectionTop = featuresSection.offsetTop;
const scrollPosition = window.scrollY;
if (scrollPosition > featuresSectionTop - window.innerHeight / 2) {
featuresSection.classList.add("active");
} else {
featuresSection.classList.remove("active");
}
// Check scroll direction
if (scrollPosition > lastScrollPosition) {
// Scrolling down
featuresSection.classList.add("active");
} else {
// Scrolling up
featuresSection.classList.remove("active");
}
lastScrollPosition = scrollPosition;
});
});
// const themeIcon = document.getElementById("theme-icon");
// const body = document.body;
// themeIcon.addEventListener("click", () => {
// console.log("A runs");
// body.classList.toggle("dark-mode");
// body.classList.toggle("light-mode");
// console.log(body.classList);
// // Toggle between sun and moon icons
// if (body.classList.contains("dark-mode")) {
// console.log("turn dark");
// // themeIcon.src = "assets/images/moon_1.png"; // Change to moon icon for dark mode
// } else {
// console.log("turn light");
// // themeIcon.src = "assets/images/sun.png"; // Change to sun icon for light mode
// }
// console.log("end");
// });
// window.onload = function () {
// // Select all tour steps and the overlay
// const tourSteps = document.querySelectorAll('.tour-step');
// const tourOverlay = document.getElementById('tourOverlay');
// let currentStep = 0; // Track which step we're on
// // Show the tour overlay
// tourOverlay.style.display = 'flex';
// // Function to show the current step
// function showStep(step) {
// // Hide all steps
// tourSteps.forEach((stepElement, index) => {
// stepElement.style.display = index === step ? 'block' : 'none';
// });
// }
// // Show the first step
// showStep(currentStep);
// // Function to go to the next step
// function nextStep() {
// currentStep++;
// if (currentStep < tourSteps.length) {
// showStep(currentStep);
// } else {
// endTour(); // End the tour if we are at the last step
// }
// }
// // Function to end the tour
// function endTour() {
// tourOverlay.style.display = 'none'; // Hide the tour overlay
// }
// // Function to skip the tour and redirect to the home page
// function skipTour() {
// tourOverlay.style.display = 'none'; // Hide the tour overlay
// }
// // Event listeners for the buttons
// document.getElementById('nextStep1').addEventListener('click', nextStep);
// document.getElementById('nextStep2').addEventListener('click', nextStep);
// document.getElementById('nextStep3').addEventListener('click', nextStep);
// document.getElementById('endTour').addEventListener('click', endTour);
// // Skip tour button for all steps
// document.querySelectorAll('#skipTour').forEach(button => {
// button.addEventListener('click', skipTour);
// });
// // Go to Profile Setup Button
// document.getElementById('goToProfile').addEventListener('click', function () {
// window.location.href = 'pages/Profile.html'; // Redirect to the actual profile setup page (change URL as needed)
// });
// };