PageSourceSearch

https://pemco.com/_elements/getaquote/getaquote.js

js pemco.com collected 2026-10-02 04:09:04 UTC 8,301 bytes, 198 lines download raw bytes

1var OnPageLOB = '';
2if (!window.getAQuoteLoaded) {
3    getAQuoteLoaded = true;
4    $(function () {
5		setupQuoteWidget();
6		if(window.QueryLOB == "autorenter") window.QueryLOB = "auto + renter";
7		if(window.QueryLOB == "autohome") window.QueryLOB = "auto + home";
8		if(window.QueryLOB == "autocondo") window.QueryLOB = "auto + condo";
9        $('.getaQuoteLOBText').text(window.QueryLOB || window.PageLOB || "Auto");
10		$('.getaQuoteLabel').text(getLOBLabel(window.QueryLOB || window.PageLOB || "Auto"));
11
12        let queryParams = new URLSearchParams(window.location.search);
13        if (queryParams.get("zip")) {
14            $('#invalid-zip').html(" (" + queryParams.get("zip") + ") ");
15        }
16
17		// landing pages
18		var npQuote = $('.npQuote');
19		if(npQuote.length > 0){
20			var thisProduct = $('.npQuote').find('.productquote').attr('class').toLowerCase().split('productquote ')[1].split('quote')[0];
21			$('.getaQuoteLOBText').text(thisProduct);
22			$('.getaQuoteLabel').text(getLOBLabel(thisProduct));
23		}
24
25		
26		function getLOBLabel(lob) {
27			switch(lob.toLowerCase()) {
28				case  "auto": return "Auto Insurance"; break;
29				case  "auto + renter": return "Auto + Renters Insurance"; break;
30				case  "auto + home": return "Auto + Home Insurance"; break;
31				case  "auto + condo": return "Auto + Condo Insurance"; break;
32				case  "home": return "Home Insurance"; break;
33				case  "condo": return "Condo Insurance"; break;
34				case  "renters": return "Renters Insurance"; break;
35				case  "renter": return "Renters Insurance"; break;
36				case  "boat": return "Boat Insurance"; break;
37				case  "umbrella": return "Umbrella Insurance"; break;
38			}
39			
40		}
41		
42		function setupQuoteWidget() {
43			var routeValues = window.location.pathname.toLowerCase().replace(/\/page\//g, '/').replace(/(^\/)|(\/$)/g, '').split('/');
44			var url = "/" + routeValues.join("/") + '/';
45			window.PageLOB = "";
46			$.each([{ r: "auto", l: "Auto" }, { r: "home", l: "Home" }, { r: "home/renters", l: "Renter" }, { r: "home/condominium", l: "Condo" }, { r: "boat", l: "Boat" }, { r: "Umbrella", l: "Umbrella" }], function () {
47				if (url.indexOf("/" + this.r.toLowerCase() + "/") > -1) {
48					window.PageLOB = this.l;
49				}
50				else {
51					window.PageLOB = OnPageLOB;
52				}
53			});
54		}
55		
56        function buildUrl(lob, zip) {
57            lob = (lob || 'auto').toLowerCase();
58			switch (lob) {
59				case "auto + renter": lob = "autorenter"; quote = "AutoPlusRenter"; break;
60				case "auto + home": lob = "autohome"; quote = "AutoPlusHome"; break;
61				case "auto + condo": lob = "autocondo"; quote = "AutoPlusCondo"; break;
62				case "autohome": quote = "AutoPlusHome"; break;
63				case "autocondo": quote = "AutoPlusCondo"; break;
64				case "autorenter": quote = "AutoPlusRenter"; break;
65				default: quote = lob; break;
66			}
67			
68            var url = '/get-a-quote';
69			
70            var paidPromoSource = ''
71			var paidKWID = ''
72			
73			var queryParams = window.location.search.toLowerCase().substr(1).split('&').reduce(function (q, query) {
74				var chunks = query.split('=');
75				var key = chunks[0];
76				var value = chunks[1];
77				return (q[key] = value, q);
78				}, {}
79			);		
80			
81			paidPromoSource = queryParams['promosource'];
82			paidKWID = queryParams['kwid'];
83			if(paidKWID == undefined || paidKWID == '')
84				paidKWID = queryParams['refkeywords'];
85			
86            url += '?lob=' + encodeURIComponent(lob);
87            url += '&zip=' + encodeURIComponent(zip);
88            if (window.FIA)
89                url += '&FIA=' + window.FIA;
90			
91			if(paidPromoSource != undefined && paidPromoSource.length > 0)
92				url += '&promoSource=' + encodeURIComponent(paidPromoSource);			
93            else if (window.promoSource != undefined && promoSource.length > 0)
94                url += '&promoSource=' + promoSource;
95			
96			gclkid = queryParams['gclid']
97			if(gclkid != undefined && gclkid.length > 0)
98				url += '&gclkid=' + encodeURIComponent(gclkid);
99
100			msclkid = queryParams['msclkid']
101			if(msclkid != undefined && msclkid.length > 0)
102				url += '&msclkid=' + encodeURIComponent(msclkid);
103
104			utm_source = queryParams['utm_source']
105			if(utm_source != undefined && utm_source.length > 0)
106				url += '&utm_source=' + encodeURIComponent(utm_source);
107
108			utm_medium = queryParams['utm_medium']
109			if(utm_medium != undefined && utm_medium.length > 0)
110				url += '&utm_medium=' + encodeURIComponent(utm_medium);
111
112			utm_campaign = queryParams['utm_campaign']
113			if(utm_campaign != undefined && utm_campaign.length > 0)
114				url += '&utm_campaign=' + encodeURIComponent(utm_campaign);
115
116			utm_term = queryParams['utm_term']
117			if(utm_term != undefined && utm_term.length > 0)
118				url += '&utm_term=' + encodeURIComponent(utm_term);
119
120			utm_content = queryParams['utm_content']
121			if(utm_content != undefined && utm_content.length > 0)
122				url += '&utm_content=' + encodeURIComponent(utm_content);
123			
124			if(quote != undefined && quote.length > 0)
125				url += '&quote=' + encodeURIComponent(quote);
126			
127            if (window.refType != undefined && refType.length > 0)
128                url += '&refType=' + refType;
129			
130            if (window.refSite != undefined && refSite.length > 0)
131				url += '&refSite=' + (refSite.indexOf('?') > -1 ? refSite.substr(0,refSite.indexOf('?')) : refSite);
132			
133			if(paidKWID != undefined && paidKWID.length > 0)
134				url += '&refKeywords=' + encodeURIComponent(paidKWID);
135            else if (window.refKeywords != undefined && refKeywords.length > 0)
136                url += '&refKeywords=' + refKeywords;
137			
138            if (window.refSourceID != undefined && refSourceID.length > 0)
139                url += '&refSourceID=' + refSourceID;		
140				
141            return url;
142        }
143        $('.getaQuoteGo').click(function () {
144            var $p = $(this).closest('.getAQuoteWidget');
145            var zip = $p.find('.getaQuoteZIP').val();
146            var lob = $p.find('.getaQuoteLOBText').text();
147			switch(lob.toLowerCase()) {
148				case  "auto insurance": lob = "auto"; break;
149				case  "auto + renters insurance": lob = "autorenter"; break;
150				case  "auto + home insurance": lob = "autohome"; break;
151				case  "auto + condo insurance": lob = "autocondo"; break;
152				case  "home insurance": lob = "home"; break;
153				case  "condo insurance": lob = "condo"; break;
154				case  "renters insurance": lob = "renter"; break;
155				case  "boat insurance": lob = "boat"; break;
156				case  "umbrella insurance": lob = "umbrella"; break;
157			}
158				
159			lob = lob.length == 0 ? $(".quoteButtons").find(".active").text().trim() : lob;
160
161			if ((lob.length == 0 || zip.length == 0) && $(".zipLabel").length > 0)
162			{
163				if(lob.length == 0) $(".typeLabel").addClass("err"); else $(".typeLabel").removeClass("err");
164				if(zip.length == 0) $(".zipLabel").addClass("err"); else $(".zipLabel").removeClass("err");
165				return;
166			}
167
168            document.location.href = buildUrl(lob, zip);
169        });
170        $('.getaQuoteZIP').keyup(function (e) {
171            if ((e.keyCode ? e.keyCode : e.which) == '13')
172                $(this).closest('.getAQuoteWidget').find('.getaQuoteGo').trigger('click');
173            else {
174				var self = this;
175				// only appy ZIP change to current widget
176					$(this).closest('.pemcoform').find('.getaQuoteZIP').each(function () {
177                    if (this != self) this.value = self.value;
178                });
179            }
180
181        });
182        $('.getaQuoteLOBDropdown').on('show.bs.dropdown', function (e) {
183            var $this = $(this);
184            var selection = $this.find('.getaQuoteLOBText').text();
185            $this.find('.getaQuoteLOBDropdown li').show();
186            $this.find('.getaQuoteLOBDropdown li a').each(function (i, v) {
187                if ($(v).text() == selection)
188                    $(v).parent('li').hide();
189            });
190        });
191        $('body').on('click', '.getaQuoteLOBDropdown li a', function (e) {
192			e.preventDefault();
193			// only appy LOB change to current widget
194			$(this).closest('.pemcoform').find('.getaQuoteLOBText').text($(this).text());
195			$(this).closest('.pemcoform').find('.getaQuoteLabel').text($(this).text());
196        });
197    });
198};

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.