PageSourceSearch

https://www.parkerpreferred.com/js/cta-mobilecq.js

js parkerpreferred.com collected 2026-09-30 16:17:16 UTC 4,525 bytes, 86 lines download raw bytes

1// Inject Fixed CTA //
2(() => {
3	function initCTA() {
4		const geoMeta = document.querySelector('meta[name="geo.region"]');
5		if (!geoMeta) return;
6		const page = (location.pathname.split("/").pop() || "").toLowerCase();
7		const isCallOnly = ["insurance-quotes.html", "compare-quotes.html"].includes(page);
8		const phone =
9			document.querySelector('a[href^="tel:"]')?.href.replace(/^tel:/i, "") ||
10			(document.querySelector(".phone-automate")?.textContent.match(/[\d\(\)\-\s]{10,}/) || [""])[0] ||
11			"";
12		const agency =
13			[...document.querySelectorAll('a[title*="Get directions to"], a[aria-label*="Get directions to"]')]
14				.map(a => (a.title || a.ariaLabel || "").match(/to\s+(.+?)(?:\(|$)/i)?.[1])
15				.find(Boolean) ||
16			document.querySelector(".copyright a")?.childNodes[0]?.nodeValue?.trim() ||
17			"";
18
19		const state = geoMeta.content?.split("-")[1] || "";
20
21		if (!document.getElementById("global-fixed-cta-style")) {
22			const style = document.createElement("style");
23			style.id = "global-fixed-cta-style";
24			style.textContent = `
25				.fixed-cta{position:fixed;left:0;bottom:0;width:100%;z-index:9999;padding:10px 0;
26				background:rgba(63,63,63,.95);border-top:1px solid #3f3f3f;display:flex;justify-content:center;align-items:center;transform: translateY(100%);
27  transition: transform 0.3s ease !important;will-change: transform;backdrop-filter: blur(10px);-webkit-backdrop-filter: blur(10px);}
28				#scroll-close{position: relative;background:#fff;width:20px;height:20px;margin:0 0 0 15px;border-radius:50%;border:none;box-shadow:1px 1px 3px rgba(0, 0, 0, 0.8);}
29				#scroll-close:before, #scroll-close:after{content:"";position:absolute;top:50%;left:50%;width:10px;background:#000;height:2px;}
30				#scroll-close:before{transform:translate(-50%, -50%) rotate(-45deg);}
31				#scroll-close:after{transform: translate(-50%, -50%) rotate(45deg);}
32				.fixed-cta .container{display:flex;gap:20px;align-items:center;justify-content:center}
33				.fixed-cta .container a{padding:5px 10px;border-radius:5px;text-decoration:none;height: 35px;display: flex;align-items: center;justify-content: center;max-width:150px;gap: 5px;width: 100%;box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8)}
34				.fixed-cta .container .cta-qte-btn{background:#cdc187;color:#2f2f2f;}
35				.fixed-cta .container .cta-call-btn{background:#fff;color:#2f2f2f;}
36				.fixed-cta .container .cta-qte-btn:hover,.fixed-cta .container .cta-qte-btn:active,.fixed-cta .container .cta-call-btn:hover,.fixed-cta .container .cta-call-btn:active{opacity:0.8;}
37				.fixed-cta h2{color:#ffffff;}
38				.fixed-cta.cta-animate-up {transform: translateY(0);}
39				@media screen and (max-width: 767px){
40				.fixed-cta .container {gap: 10px;flex-direction: column;}
41				.fixed-cta h2{margin-top:0px;}
42				#scroll-close{position:absolute;top:-10px;left:15px;margin:0px;}
43				}`;
44			document.head.appendChild(style);
45		}
46		if (document.querySelector(".fixed-cta")) return;
47		const section = document.createElement("section");
48		section.className = "fixed-cta";
49		const container = document.createElement("div");
50		container.className = "container";
51		const h2 = document.createElement("h2");
52		h2.textContent = "Insurance questions? We're here to help.";
53		container.appendChild(h2);
54		let quoteTitle = `Get Instant ${state ? state + " " : ""}Insurance Quotes${agency ? " with " + agency : ""}`;
55		if (!isCallOnly) {
56			const q = document.createElement("a");
57			q.className = "cta-qte-btn";
58			q.href = "insurance-quotes.html";
59			q.innerHTML = "Get a Quote";
60			q.title = q.ariaLabel = quoteTitle;
61			container.appendChild(q);
62		}
63		const c = document.createElement("a");
64		c.className = "cta-call-btn";
65		const cleanPhone = phone.replace(/\D/g, "");
66		c.href = cleanPhone ? "tel:" + cleanPhone : "#";
67		c.innerHTML = phone ? `Call ${phone}` : "Call";
68		const callTitle = phone ? `Call ${agency}` : "Call us";
69		c.title = callTitle;
70		c.setAttribute("aria-label", callTitle);
71		container.appendChild(c);
72		const close = document.createElement("button");
73		close.id = "scroll-close";
74		close.onclick = () => {section.classList.remove("cta-animate-up");setTimeout(() => {section.style.display = "none";}, 300);};
75		section.append(close, container);
76		document.body.prepend(section);
77		setTimeout(() => {
78    	section.classList.add("cta-animate-up");
79	}, 50);
80	}
81	if (document.readyState === "loading") {
82		document.addEventListener("DOMContentLoaded", initCTA);
83	} else {
84		initCTA();
85	}
86})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.