-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
107 lines (90 loc) · 2.94 KB
/
main.js
File metadata and controls
107 lines (90 loc) · 2.94 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
console.log("Hello from Place-for-Us!"); // 🌟 YEH LINE YAHAN HOGI
let loveNotes = [];
function addLoveNote() {
const input = document.getElementById('notesInput');
const noteText = input.value.trim();
if (!noteText) {
alert('Please enter a note!');
return;
}
loveNotes.push(noteText);
input.value = '';
renderLoveNotes();
}
function renderLoveNotes() {
const container = document.getElementById('notesList');
if (!container) return;
container.innerHTML = loveNotes.map(note => `<li class="note-item">${note}</li>`).join('');
}
document.addEventListener('DOMContentLoaded', function() {
const btn = document.getElementById('notesBtn');
if (btn) btn.onclick = addLoveNote;
});
let coupleGoals = [];
function addGoal(event) {
event.preventDefault();
const input = document.getElementById('goalInput');
const goalText = input.value.trim();
if (!goalText) {
alert('Please enter a goal!');
return;
}
coupleGoals.push({ text: goalText, completed: false });
input.value = '';
renderGoals();
}
function toggleGoalCompletion(index) {
coupleGoals[index].completed = !coupleGoals[index].completed;
renderGoals();
}
function renderGoals() {
const container = document.getElementById('goalsList');
if (!container) return;
container.innerHTML = coupleGoals.map((goal, index) => `
<li class="goal-item">
<div class="goal-checkbox ${goal.completed ? 'completed' : ''}" onclick="toggleGoalCompletion(${index})"></div>
<div class="goal-text ${goal.completed ? 'completed' : ''}">${goal.text}</div>
</li>
`).join('');
}
document.addEventListener('DOMContentLoaded', function() {
const goalsForm = document.getElementById('goalsForm');
if (goalsForm) goalsForm.addEventListener('submit', addGoal);
renderPlaylistSongs();
renderLoveNotes();
renderGoals();
// Set greeting message
const greetingEl = document.getElementById('greeting');
if (greetingEl) {
greetingEl.textContent = 'Hello, my love 💙';
greetingEl.style.fontSize = '2.5rem';
greetingEl.style.fontWeight = '600';
greetingEl.style.color = 'white';
greetingEl.style.textAlign = 'center';
}
anniversaryEl.innerHTML = `
<div>We have been together for <strong>${diffDays}</strong> days 💖</div>
<br>
<div class="daily-quote" id="today-quote">“You are my favorite notification.”</div>
`;
}
});
// Show modal by adding 'visible' class
function showModal(id) {
const modal = document.getElementById(id);
if (modal) {
modal.classList.add('visible');
}
}
// Hide modal by removing 'visible' class
function hideModal(id) {
const modal = document.getElementById(id);
if (modal) {
modal.classList.remove('visible');
}
}
function renderPlaylistSongs() {
const container = document.getElementById('playlistResult');
if (!container) return;
container.innerHTML = '';
}