-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathh.js
More file actions
193 lines (140 loc) · 6.26 KB
/
h.js
File metadata and controls
193 lines (140 loc) · 6.26 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
const data = window.location.search;
//console.log(myname);
const fname = document.getElementById('fname');
const timer = document.getElementById('timer');
const wisher = document.getElementById('wisher');
let urlParam = new URLSearchParams(data);
let n = urlParam.get('n') || "Hrishikesh";
let d = urlParam.get('d') || "1.1";
let m = urlParam.get('m') || "Always";
console.log(typeof(urlParam.get('d')));
console.log(m);
console.log(n);
const input = d; // Example input
const [day, month] = input.split(".").map(Number); // Split and convert to numbers
// Create a new Date object with the current year
const year = new Date().getFullYear();
const date = new Date(year, month - 1, day); // JavaScript months are 0-based
// Ensure the preloader shows for 5 seconds before hiding
window.addEventListener("DOMContentLoaded", () => {
setTimeout(() => {
// Fade out the preloader
const preloader = document.getElementById("preloader");
preloader.classList.add("fade-out");
// Wait for the fade-out effect to complete before hiding
setTimeout(() => {
preloader.style.display = "none"; // Fully hide the preloader
document.getElementById("content").style.display = "block"; // Show main content
}, 1000); // Match this with the CSS transition duration
}, 1000); // 000ms = 1 seconds
});
// Countdown function
function startCountdown(targetDate) {
const interval = setInterval(() => {
const now = new Date();
const timeRemaining = targetDate - now;
if (timeRemaining <= 0) {
clearInterval(interval);
//console.log("Countdown finished!");
document.getElementById('countdown').style.display = 'none';
document.getElementById('flscrn').style.display = 'none';
startGreetings();
return;
}
else{
document.getElementById('countdown').style.display = 'flex';
document.getElementById('flscrn').style.display = 'flex';
// Calculate time components
let days = Math.floor(timeRemaining / (1000 * 60 * 60 * 24));
let hours = Math.floor((timeRemaining % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
let minutes = Math.floor((timeRemaining % (1000 * 60 * 60)) / (1000 * 60));
let seconds = Math.floor((timeRemaining % (1000 * 60)) / 1000);
days = String(days).padStart(2,"0");
hours = String(hours).padStart(2,"0");
minutes = String(minutes).padStart(2,"0");
seconds = String(seconds).padStart(2,"0");
// Display countdown
// console.log(`${days}d ${hours}h ${minutes}m ${seconds}s`);
timer.textContent = `${days} : ${hours} : ${minutes} : ${seconds}`;
}
}, 1000); // Update every second
}
// Start the countdown
startCountdown(date);
function startGreetings(){
document.getElementById('greetings').style.display = 'flex';
fname.textContent = String(n);
wisher.textContent = String("Yours, "+m+".");
// Start displaying quotes
setTimeout(() => {
displayQuote(); // Show the first quote
setInterval(displayQuote, 6000); // Change quote every 3 seconds
}, 5000);
}
let BDquotes = [
"🥳 Cheers to another year of being amazing! Have the best birthday ever!",
"💫Another trip around the sun and still glowing brighter than ever!",
"🌻Another year older, wiser, and way cooler",
"🎉Here's to a year of dreams fulfilled, goals achieved, and memories created",
"🪐May your day be full of cosmic joy and stellar surprises.",
"💖May your birthday be as special and incredible as you make everyone feel every day.",
"🥂May your day be sweeter than your favorite dessert and just as memorable",
"✨ Keep shining and spreading your magic.",
];
BDquotes.push(`🎂Go ahead, eat all the cake you want today—it's your day ${n}!`);
const quoteContainer = document.getElementById('slider');
let currentIndex = 0;
// Function to handle showing and animating quotes
function displayQuote() {
const allQuotes = document.querySelectorAll('.quote');
// Hide all quotes
allQuotes.forEach(quote => {
quote.style.display = 'none'; // Hide the quote
quote.style.animation = 'none'; // Reset the animation
});
// Show and animate the current quote
const currentQuote = allQuotes[currentIndex];
currentQuote.style.display = 'block';
currentQuote.style.animation = 'opacity 6s infinite';
// Move to the next quote
currentIndex = (currentIndex + 1) % BDquotes.length;
}
// Add quotes to the DOM
BDquotes.forEach(quote => {
const quoteDiv = document.createElement('div');
quoteDiv.classList.add('quote');
quoteDiv.textContent = quote;
quoteContainer.appendChild(quoteDiv);
});
//fullscreen mode.
const fullscreenButton = document.getElementById('fullscreenButton');
fullscreenButton.addEventListener('click', () => {
// Check if we're currently in fullscreen
if (!document.fullscreenElement) {
// Enter fullscreen
if (document.documentElement.requestFullscreen) {
document.documentElement.requestFullscreen();
} else if (document.documentElement.webkitRequestFullscreen) {
document.documentElement.webkitRequestFullscreen();
} else if (document.documentElement.msRequestFullscreen) {
document.documentElement.msRequestFullscreen();
}
fullscreenButton.textContent = "X-FullScrn"; // Update button text
} else {
// Exit fullscreen
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
fullscreenButton.textContent = "FullScreen"; // Update button text
}
});
// Update button text when the user exits fullscreen with the Esc key
document.addEventListener('fullscreenchange', () => {
if (!document.fullscreenElement) {
fullscreenButton.textContent = "Fullscreen";
}
});