valentine 3.5
This commit is contained in:
parent
e89d7add11
commit
a605c28d99
@ -64,7 +64,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
document.documentElement.style.setProperty('--bg-image', `url('${data.path}?t=${new Date().getTime()}')`);
|
||||
location.reload(); // Reload to update the "Remove" button visibility
|
||||
location.reload();
|
||||
} else {
|
||||
alert(data.error || 'Failed to upload background image');
|
||||
}
|
||||
@ -130,7 +130,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
});
|
||||
|
||||
// "No" Button Dodging Logic
|
||||
// "No" Button Proximity Evasion Logic
|
||||
const dodgeThreshold = 100; // pixels
|
||||
|
||||
document.addEventListener('mousemove', (e) => {
|
||||
@ -140,11 +140,14 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const btnCenterX = rect.left + rect.width / 2;
|
||||
const btnCenterY = rect.top + rect.height / 2;
|
||||
|
||||
const distance = Math.hypot(e.clientX - btnCenterX, e.clientY - btnCenterY);
|
||||
const dx = e.clientX - btnCenterX;
|
||||
const dy = e.clientY - btnCenterY;
|
||||
const distance = Math.hypot(dx, dy);
|
||||
|
||||
if (distance < dodgeThreshold) {
|
||||
const angle = Math.atan2(e.clientY - btnCenterY, e.clientX - btnCenterX);
|
||||
const moveDist = dodgeThreshold - distance + 20;
|
||||
const angle = Math.atan2(dy, dx);
|
||||
// Move away an equal distance to maintain the threshold
|
||||
const moveDist = dodgeThreshold - distance;
|
||||
|
||||
let newX = rect.left - Math.cos(angle) * moveDist;
|
||||
let newY = rect.top - Math.sin(angle) * moveDist;
|
||||
@ -161,11 +164,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
});
|
||||
|
||||
// "No" Click Logic
|
||||
// "No" Click Logic - On the off chance it is pressed
|
||||
if (noBtn) {
|
||||
noBtn.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
yesScale += 0.15;
|
||||
// Does nothing (no navigation/success), just grows the yes button
|
||||
yesScale += 0.2;
|
||||
yesBtn.style.transform = `scale(${yesScale})`;
|
||||
});
|
||||
}
|
||||
@ -177,7 +181,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
successBox.style.display = 'block';
|
||||
|
||||
// Hide controls during celebration
|
||||
document.querySelector('.admin-controls').style.display = 'none';
|
||||
const adminControls = document.querySelector('.admin-controls');
|
||||
if (adminControls) adminControls.style.display = 'none';
|
||||
|
||||
// Confetti effect
|
||||
const duration = 15 * 1000;
|
||||
@ -206,4 +211,4 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}, 15000);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user