// 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
Efficient Medical and Organ Deliveries in NJ and soon the Tri-State Area
908 298 5656
neatly@neatlymultiservices.com
Tri-State Med Deliveries is dedicated to providing swift and reliable medical and organ delivery services in the Tri-State area. Our focus is on ensuring the safe and timely transport of vital medical supplies and organs for transplant.
What Our Clients Say
“Tri-State Med Deliveries exceeded our expectations with their prompt and secure medical supply deliveries. Highly recommended.”
bottom of page