valentine 3.5
This commit is contained in:
parent
e89d7add11
commit
a605c28d99
@ -64,7 +64,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
.then(data => {
|
.then(data => {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
document.documentElement.style.setProperty('--bg-image', `url('${data.path}?t=${new Date().getTime()}')`);
|
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 {
|
} else {
|
||||||
alert(data.error || 'Failed to upload background image');
|
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
|
const dodgeThreshold = 100; // pixels
|
||||||
|
|
||||||
document.addEventListener('mousemove', (e) => {
|
document.addEventListener('mousemove', (e) => {
|
||||||
@ -140,11 +140,14 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
const btnCenterX = rect.left + rect.width / 2;
|
const btnCenterX = rect.left + rect.width / 2;
|
||||||
const btnCenterY = rect.top + rect.height / 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) {
|
if (distance < dodgeThreshold) {
|
||||||
const angle = Math.atan2(e.clientY - btnCenterY, e.clientX - btnCenterX);
|
const angle = Math.atan2(dy, dx);
|
||||||
const moveDist = dodgeThreshold - distance + 20;
|
// Move away an equal distance to maintain the threshold
|
||||||
|
const moveDist = dodgeThreshold - distance;
|
||||||
|
|
||||||
let newX = rect.left - Math.cos(angle) * moveDist;
|
let newX = rect.left - Math.cos(angle) * moveDist;
|
||||||
let newY = rect.top - Math.sin(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) {
|
if (noBtn) {
|
||||||
noBtn.addEventListener('click', (e) => {
|
noBtn.addEventListener('click', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
yesScale += 0.15;
|
// Does nothing (no navigation/success), just grows the yes button
|
||||||
|
yesScale += 0.2;
|
||||||
yesBtn.style.transform = `scale(${yesScale})`;
|
yesBtn.style.transform = `scale(${yesScale})`;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -177,7 +181,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
successBox.style.display = 'block';
|
successBox.style.display = 'block';
|
||||||
|
|
||||||
// Hide controls during celebration
|
// 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
|
// Confetti effect
|
||||||
const duration = 15 * 1000;
|
const duration = 15 * 1000;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user