// masterPage.js
// Neatly - Medical Courier Website
// Site-wide Wix Velo interactions
import wixLocation from 'wix-location-frontend';
import wixWindow from 'wix-window-frontend';
import { local } from 'wix-storage-frontend';
const SITE_CONFIG = {
businessName: "Neatly",
// Random placeholder. You can edit later.
phone: "(973) 555-4182",
// Placeholder. Replace with your real business email inside Wix/Velo.
email: "dispatch@neatlycourier.com",
serviceArea: "Serving New Jersey — Tri-State expansion coming soon",
colors: {
primaryGreen: "#00A86B",
darkGreen: "#006B4F",
lightGreen: "#E8FFF5",
navyText: "#12324A",
white: "#FFFFFF",
softGray: "#F5F7FA",
statAccent: "#FFB703"
},
pages: {
home: "/",
services: "/services",
compliance: "/compliance",
process: "/how-it-works",
schedule: "/schedule-pickup",
contact: "/contact"
}
};
$w.onReady(function () {
setupBrandStyle();
setupFooter();
setupNavigation();
setupMobileMenu();
setupCallToActionButtons();
setupFloatingScheduleButton();
setupCookieBanner();
setupBackToTopBehavior();
});
/* -----------------------------
SAFE HELPERS
----------------------------- */
function getElement(selector) {
try {
return $w(selector);
} catch (error) {
return null;
}
}
function click(selector, handler) {
const element = getElement(selector);
if (element && typeof element.onClick === "function") {
element.onClick(handler);
}
}
function show(selector, effect = "fade") {
const element = getElement(selector);
if (element && typeof element.show === "function") {
element.show(effect);
}
}
function hide(selector, effect = "fade") {
const element = getElement(selector);
if (element && typeof element.hide === "function") {
element.hide(effect);
}
}
function expand(selector) {
const element = getElement(selector);
if (element && typeof element.expand === "function") {
element.expand();
}
}
function collapse(selector) {
const element = getElement(selector);
if (element && typeof element.collapse === "function") {
element.collapse();
}
}
function setText(selector, value) {
const element = getElement(selector);
if (element && "text" in element) {
element.text = value;
}
}
function setStyle(selector, styles) {
const element = getElement(selector);
if (!element || !("style" in element)) {
return;
}
Object.keys(styles).forEach((key) => {
try {
element.style[key] = styles[key];
} catch (error) {
// Some Wix elements/designs do not support every style property.
}
});
}
function cleanPhone(phone) {
return phone.replace(/\D/g, "");
}
/* -----------------------------
BRAND STYLE
----------------------------- */
function setupBrandStyle() {
const green = SITE_CONFIG.colors.primaryGreen;
const darkGreen = SITE_CONFIG.colors.darkGreen;
const white = SITE_CONFIG.colors.white;
// Header
setStyle("#siteHeader", {
backgroundColor: white,
borderColor: SITE_CONFIG.colors.lightGreen
});
// Primary CTA buttons
[
"#schedulePickupBtn",
"#floatingScheduleBtn",
"#acceptCookieBtn"
].forEach((buttonId) => {
setStyle(buttonId, {
backgroundColor: green,
color: white,
borderColor: green
});
});
// Secondary CTA buttons
[
"#callDispatchBtn",
"#emailDispatchBtn"
].forEach((buttonId) => {
setStyle(buttonId, {
backgroundColor: white,
color: darkGreen,
borderColor: green
});
});
// Back to top button
setStyle("#backToTopBtn", {
backgroundColor: darkGreen,
color: white,
borderColor: darkGreen
});
// Floating schedule box
setStyle("#floatingScheduleBox", {
backgroundColor: SITE_CONFIG.colors.lightGreen,
borderColor: green
});
// Cookie banner
setStyle("#cookieBannerBox", {
backgroundColor: SITE_CONFIG.colors.white,
borderColor: SITE_CONFIG.colors.lightGreen
});
}
/* -----------------------------
FOOTER
----------------------------- */
function setupFooter() {
const currentYear = new Date().getFullYear();
setText("#footerYearTxt", `© ${currentYear} ${SITE_CONFIG.businessName}. All rights reserved.`);
setText("#footerPhoneTxt", SITE_CONFIG.phone);
setText("#footerEmailTxt", SITE_CONFIG.email);
setText("#footerServiceAreaTxt", SITE_CONFIG.serviceArea);
}
/* -----------------------------
NAVIGATION
----------------------------- */
function setupNavigation() {
click("#navHomeBtn", () => goTo(SITE_CONFIG.pages.home));
click("#navServicesBtn", () => goTo(SITE_CONFIG.pages.services));
click("#navComplianceBtn", () => goTo(SITE_CONFIG.pages.compliance));
click("#navProcessBtn", () => goTo(SITE_CONFIG.pages.process));
click("#navScheduleBtn", () => goTo(SITE_CONFIG.pages.schedule));
click("#navContactBtn", () => goTo(SITE_CONFIG.pages.contact));
}
function goTo(pageUrl) {
wixLocation.to(pageUrl);
}
/* -----------------------------
MOBILE MENU
----------------------------- */
function setupMobileMenu() {
collapse("#mobileMenuBox");
click("#openMenuBtn", () => {
expand("#mobileMenuBox");
show("#mobileMenuBox", "fade");
});
click("#closeMenuBtn", () => {
hide("#mobileMenuBox", "fade");
collapse("#mobileMenuBox");
});
const mobileNavButtons = [
"#navHomeBtn",
"#navServicesBtn",
"#navComplianceBtn",
"#navProcessBtn",
"#navScheduleBtn",
"#navContactBtn"
];
mobileNavButtons.forEach((buttonId) => {
click(buttonId, () => {
hide("#mobileMenuBox", "fade");
collapse("#mobileMenuBox");
});
});
}
/* -----------------------------
CTA BUTTONS
----------------------------- */
function setupCallToActionButtons() {
click("#schedulePickupBtn", () => {
wixLocation.to(SITE_CONFIG.pages.schedule);
});
click("#callDispatchBtn", () => {
wixLocation.to(`tel:${cleanPhone(SITE_CONFIG.phone)}`);
});
click("#emailDispatchBtn", () => {
const subject = encodeURIComponent("Medical Courier Pickup Request");
const body = encodeURIComponent(
"Hello Neatly,\n\n" +
"I would like to discuss a medical courier pickup.\n\n" +
"Business / Facility Name:\n" +
"Contact Name:\n" +
"Phone Number:\n" +
"Pickup City:\n" +
"Delivery City:\n" +
"Service Needed:\n" +
"Preferred Pickup Time:\n\n" +
"Please do not include patient information in this email."
);
wixLocation.to(`mailto:${SITE_CONFIG.email}?subject=${subject}&body=${body}`);
});
click("#footerPhoneTxt", () => {
wixLocation.to(`tel:${cleanPhone(SITE_CONFIG.phone)}`);
});
click("#footerEmailTxt", () => {
wixLocation.to(`mailto:${SITE_CONFIG.email}`);
});
}
/* -----------------------------
FLOATING SCHEDULE BUTTON
----------------------------- */
function setupFloatingScheduleButton() {
hide("#floatingScheduleBox");
hide("#backToTopBtn");
click("#floatingScheduleBtn", () => {
wixLocation.to(SITE_CONFIG.pages.schedule);
});
const heroAnchor = getElement("#heroAnchor");
if (heroAnchor && typeof heroAnchor.onViewportLeave === "function") {
heroAnchor.onViewportLeave(() => {
show("#floatingScheduleBox", "fade");
show("#backToTopBtn", "fade");
});
heroAnchor.onViewportEnter(() => {
hide("#floatingScheduleBox", "fade");
hide("#backToTopBtn", "fade");
});
} else {
show("#floatingScheduleBox", "fade");
}
}
/* -----------------------------
BACK TO TOP
----------------------------- */
function setupBackToTopBehavior() {
click("#backToTopBtn", () => {
wixWindow.scrollTo(0, 0);
});
}
/* -----------------------------
COOKIE / PRIVACY BANNER
----------------------------- */
function setupCookieBanner() {
const cookieChoice = local.getItem("neatlyCookieChoice");
if (cookieChoice === "accepted" || cookieChoice === "declined") {
collapse("#cookieBannerBox");
return;
}
expand("#cookieBannerBox");
show("#cookieBannerBox", "fade");
click("#acceptCookieBtn", () => {
local.setItem("neatlyCookieChoice", "accepted");
hide("#cookieBannerBox", "fade");
collapse("#cookieBannerBox");
});
click("#declineCookieBtn", () => {
local.setItem("neatlyCookieChoice", "declined");
hide("#cookieBannerBox", "fade");
collapse("#cookieBannerBox");
});
}
top of page
Tri-State Med Deliveries is a reliable and efficient medical and organ delivery service operating within the Tri-State area, encompassing New York, New Jersey, and Connecticut. Our dedicated team is committed to ensuring safe and timely deliveries, providing peace of mind to medical facilities and individuals alike. With a focus on professionalism and compassion, we handle each delivery with the utmost care and urgency. Contact us today to experience our exceptional delivery service.
Frequently asked questions
An FAQ section can be used to quickly answer common questions about your business like "Where do you ship to?", "What are your opening hours?", or "How can I book a service?".
FAQs are a great way to help site visitors find quick answers to common questions about your business and create a better navigation experience.
FAQs can be added to any page on your site or to your Wix mobile app, giving access to members on the go.
bottom of page