-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSCRIPT.JS
More file actions
86 lines (77 loc) · 2.77 KB
/
SCRIPT.JS
File metadata and controls
86 lines (77 loc) · 2.77 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
// Sidebar Toggle (Optional if collapsible)
document.querySelectorAll('.sidebar ul li').forEach(item => {
item.addEventListener('click', function () {
document.querySelectorAll('.sidebar ul li').forEach(i => i.classList.remove('active'));
this.classList.add('active');
});
});
// Search Bar Focus Effect
const searchInput = document.querySelector("header input");
searchInput.addEventListener("focus", () => {
searchInput.style.boxShadow = "0px 0px 10px rgba(0, 0, 0, 0.2)";
});
searchInput.addEventListener("blur", () => {
searchInput.style.boxShadow = "none";
});
// Add New Button Click Effect
document.querySelector(".add-btn").addEventListener("click", () => {
alert("Feature coming soon!");
});
// Calendar Date Selection
document.querySelectorAll(".dates span").forEach(date => {
date.addEventListener("click", function () {
document.querySelectorAll(".dates span").forEach(d => d.classList.remove("active"));
this.classList.add("active");
});
});
// Progress Bar Animation
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll(".progress-bar").forEach(bar => {
bar.style.width = bar.getAttribute("data-progress") + "%";
});
});
// Hover Effect on Course Cards
document.querySelectorAll(".course-card").forEach(card => {
card.addEventListener("mouseenter", function () {
this.style.transform = "scale(1.05)";
this.style.transition = "0.3s";
});
card.addEventListener("mouseleave", function () {
this.style.transform = "scale(1)";
});
});
// Interactive Leaderboard Highlight
document.querySelectorAll(".leaderboard tbody tr").forEach(row => {
row.addEventListener("mouseenter", function () {
this.style.backgroundColor = "#f4f4f4";
});
row.addEventListener("mouseleave", function () {
this.style.backgroundColor = "white";
});
});
document.addEventListener('DOMContentLoaded', function () {
const ctx = document.getElementById('progressChart').getContext('2d');
const dates = <?php echo json_encode($dates); ?>;
const activities = <?php echo json_encode($activities); ?>;
const progressChart = new Chart(ctx, {
type: 'line',
data: {
labels: dates,
datasets: [{
label: 'Tasks Completed',
data: activities,
backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 2
}]
},
options: {
scales: {
y: {
beginAtZero: true,
stepSize: 1
}
}
}
});
});