Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
192 lines (183 loc) · 4.81 KB
/
Copy pathscript.js
File metadata and controls
192 lines (183 loc) · 4.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
(() => {
/* ---------- Marquee ---------- */
var words = [
"Full Groom",
"Nail Trim",
"Deshed",
"Blowout",
"Spa Day",
"Puppy Cuts",
"Cat Grooming",
"Teeth Brush",
];
var marquee = document.getElementById("marquee");
if (marquee) {
var line = "";
for (var i = 0; i < 2; i++) {
words.forEach((w) => {
line += `<span>${w} <span class="star">✦</span></span>`;
});
}
marquee.innerHTML = line;
}
/* ---------- Testimonials ---------- */
var reviewsA = [
{
q: "Finally found a groomer who understands poodles! The scissor work is impeccable and she looks like a show dog.",
who: "Amanda T. & Luna",
tint: true,
},
{
q: "My cat is a nightmare to wash, but the team handles him with such grace. Truly stress-free for both of us.",
who: "Robert S. & Oliver",
tint: false,
},
{
q: "The Puppy Spa was the perfect intro for our labradoodle. So patient and gentle. Highly recommend!",
who: "Chloe B. & Barnaby",
tint: true,
},
{
q: "Booked a blowout for our husky and the deshed was unreal. No more fur tumbleweeds in the house.",
who: "Priya N. & Kona",
tint: false,
},
];
var reviewsB = [
{
q: "Professional, clean, and they actually listen to how you want the cut. Best in the city, full stop.",
who: "Mark J. & Buster",
tint: false,
},
{
q: "The nail trimming is quick and stress-free. My dog does not even flinch anymore. Master groomers.",
who: "Sarah K. & Winston",
tint: true,
},
{
q: "They spotted a skin irritation we had missed and recommended a gentle shampoo. These folks really care.",
who: "Jessica P. & Mochi",
tint: false,
},
{
q: "Walk-out result every single time. Tail wagging, coat shining, and a free bandana? Sold.",
who: "Diego R. & Pepper",
tint: true,
},
];
var starSvg =
'<svg viewBox="0 0 24 24"><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"/></svg>';
function cardHtml(r) {
return (
'<div class="t-card' +
(r.tint ? " tint" : "") +
'">' +
'<div class="t-stars" aria-hidden="true">' +
starSvg +
starSvg +
starSvg +
starSvg +
starSvg +
"</div>" +
'<p class="quote">"' +
r.q +
'"</p>' +
'<p class="who">' +
r.who +
"</p>" +
"</div>"
);
}
function rowHtml(list, dir) {
var inner = list.map(cardHtml).join("");
// duplicate for seamless loop
return `<div class="t-row ${dir}">${inner}${inner}</div>`;
}
var rows = document.getElementById("t-rows");
if (rows) {
rows.innerHTML = rowHtml(reviewsA, "left") + rowHtml(reviewsB, "right");
}
/* ---------- Scroll reveal ---------- */
var reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
var revealEls = document.querySelectorAll("[data-reveal], [data-stagger]");
if (reduced || !("IntersectionObserver" in window)) {
revealEls.forEach((el) => {
el.classList.add("in");
});
} else {
var obs = new IntersectionObserver(
(entries) => {
entries.forEach((e) => {
if (e.isIntersecting) {
e.target.classList.add("in");
obs.unobserve(e.target);
}
});
},
{ threshold: 0.12 },
);
revealEls.forEach((el) => {
obs.observe(el);
});
}
/* ---------- Mobile menu ---------- */
var menu = document.getElementById("mobile-menu");
var openBtn = document.getElementById("open-menu");
var closeBtn = document.getElementById("close-menu");
function setMenu(open) {
if (!menu) return;
menu.classList.toggle("open", open);
document.body.style.overflow = open ? "hidden" : "";
}
if (openBtn)
openBtn.addEventListener("click", () => {
setMenu(true);
});
if (closeBtn)
closeBtn.addEventListener("click", () => {
setMenu(false);
});
document.querySelectorAll("[data-mnav]").forEach((a) => {
a.addEventListener("click", () => {
setMenu(false);
});
});
/* ---------- Booking form ---------- */
var form = document.getElementById("booking-form");
if (form) {
form.addEventListener("submit", (e) => {
e.preventDefault();
var btn = form.querySelector(".submit");
var original = btn.textContent;
btn.textContent = "Sending Request…";
btn.disabled = true;
setTimeout(() => {
btn.textContent = "Request Sent!";
btn.classList.add("ok");
form.reset();
setTimeout(() => {
btn.textContent = original;
btn.classList.remove("ok");
btn.disabled = false;
}, 2600);
}, 1300);
});
}
/* ---------- Newsletter ---------- */
var news = document.getElementById("news-form");
if (news) {
news.addEventListener("submit", (e) => {
e.preventDefault();
var btn = news.querySelector("button");
var original = btn.textContent;
btn.textContent = "Checking…";
setTimeout(() => {
btn.textContent = "You're In!";
news.reset();
setTimeout(() => {
btn.textContent = original;
}, 2600);
}, 900);
});
}
})();