PageSourceSearch

https://www.koenigseggnc.com/wp-content/themes/aanWordpress/script…?ver=56df6a8d4e54961519e6bc95596ad01e

js koenigseggnc.com collected 2026-10-04 12:19:32 UTC 23,281 bytes, 626 lines download raw bytes

1var locations = [extractDomain(location.href)];
2var pinned_vehicles = {};
3// 
4$(document).ready(function() {
5    if ($(".notificationCount").length) {
6        $.get("/isapi_xml.php?module=my_garage&action=get_notifications_count", function(data) {
7            $(".notificationCount").html(data);
8        });
9    }
10	$("#savedalerts .viewList,#savedalerts .savelist").slick( {
11		fade: false,
12		autoplay: false,
13		autoplaySpeed: 5000,
14		speed: 1500,
15		arrows: true,
16		dots: false,
17		slidesToShow: 4,
18		slidesToScroll: 1,
19		pauseOnHover: false,
20		pauseOnDotsHover: true,	
21		responsive: [
22			{
23				breakpoint: 1400,
24				settings: {
25				slidesToShow: 3,
26				slidesToScroll: 1,
27				arrows: false,
28				dots: false,
29				}
30			},
31			{
32			  breakpoint: 1199,
33			  settings: {
34				slidesToShow: 2,
35				slidesToScroll: 1,
36				arrows: false,
37				dots: false,
38			  }
39			},
40			{
41			  breakpoint: 991,
42			  settings: {
43				slidesToShow: 2,
44				slidesToScroll: 1,
45				arrows: false,
46				dots: false,
47			  }
48			},
49			{
50			  breakpoint: 767,
51			  settings: {
52				slidesToShow: 1,
53				slidesToScroll: 1,
54				arrows: false,
55				dots: false,
56			  }
57			}]
58	});
59});
60
61function init_garage() {
62   
63    $(".view_more").click(function(e) {
64        $(this).parents('.garage_col').find('.hide_this').removeClass("hide_this");
65        $(this).hide()
66    });
67    $("select[name='priceMn']").on('change', function() {
68        var minP = parseInt($(this).val());
69        $('select[name="priceMx"] option').show();
70        $('select[name="priceMx"] option').filter(function() {
71            return parseInt($(this).val()) < minP;
72        }).hide();
73    });
74    $("select[name='priceMx']").on('change', function() {
75        var minP = parseInt($(this).val());
76        $('select[name="priceMn"] option').show();
77        $('select[name="priceMn"] option').filter(function() {
78            return parseInt($(this).val()) > minP;
79        }).hide();
80    });
81    $("select[name='yearMn']").on('change', function() {
82        var minP = parseInt($(this).val());
83        $('select[name="yearMx"] option').show();
84        $('select[name="yearMx"] option').filter(function() {
85            return parseInt($(this).val()) < minP;
86        }).hide();
87    });
88    $("select[name='yearMx']").on('change', function() {
89        var minP = parseInt($(this).val());
90        $('select[name="yearMn"] option').show();
91        $('select[name="yearMn"] option').filter(function() {
92            return parseInt($(this).val()) > minP;
93        }).hide();
94    });
95    $("select[name='mileageMn']").on('change', function() {
96        var minP = parseInt($(this).val());
97        $('select[name="mileageMx"] option').show();
98        $('select[name="mileageMx"] option').filter(function() {
99            return parseInt($(this).val()) < minP;
100        }).hide();
101    });
102    $("select[name='mileageMx']").on('change', function() {
103        var minP = parseInt($(this).val());
104        $('select[name="mileageMn"] option').show();
105        $('select[name="mileageMn"] option').filter(function() {
106            return parseInt($(this).val()) > minP;
107        }).hide();
108    });
109    $("#add_price_car").off().click(function(e) {
110        var make = $("#mgg_make").val(),
111            model = $("#mgg_model").val(),
112            mxYear = $('select[name="yearMx"]').val(),
113            mnYear = $('select[name="yearMn"]').val(),
114            mnPrice = 0,
115            mxPrice = $('select[name="priceMx"]').val(),
116            mnMil = $('select[name="mileageMn"]').val(),
117            mxMil = $('select[name="mileageMx"]').val();
118        if (make) {
119            if (!mnYear) {
120                mnYear = $('select[name="yearMx"] option:last').val();
121            }
122            if (!mxYear) {
123                mxYear = $('select[name="yearMx"] option:eq(1)').val();
124            }
125            if (!mnPrice) {
126                mnPrice = $('select[name="priceMn"] option:eq(1)').val();
127            }
128            if (!mxPrice) {
129                mxPrice = $('select[name="priceMx"] option:last').val();
130            }
131            if (!mnMil) {
132                mnMil = $('select[name="mileageMn"] option:eq(1)').val();
133            }
134            if (!mxMil) {
135                mxMil = $('select[name="mileageMx"] option:last').val();
136            }
137            $.post("/isapi_xml.php?module=my_garage", {
138                action: "notification_add",
139                make: $("#mgg_make").val(),
140                model: $("#mgg_model").val(),
141                color: $("#mgg_color").val(),
142                yearMn: mnYear,
143                yearMx: mxYear,
144                priceMn: mnPrice,
145                priceMx: mxPrice,
146                mileageMn: mnMil,
147                mileageMx: mxMil,
148            }, function(data, status) {
149                if (status === "success") {
150                    if (data.type === 'success') {
151                        $("#mgg_make").val($("#mgg_make option:first").val());
152                        $("#mgg_make option").show();
153                        $("#mgg_model").val($("#mgg_model option:first").val());
154                        $("#mgg_model option").show();
155                        $("#mgg_color").val($("#mgg_color option:first").val());
156                        $('select[name="yearMn"]').val($('#select[name="yearMn"] option:first').val());
157                        $('select[name="yearMn"]').show();
158                        $('select[name="yearMx"]').val($('#select[name="yearMx"] option:first').val());
159                        $('select[name="yearMx"]').show();
160                        $('select[name="priceMn"]').val(0);
161                        $('select[name="priceMn"]').show();
162                        $('select[name="priceMx"]').val($('#select[name="priceMx"] option:first').val());
163                        $('select[name="priceMx"]').show();
164                        $('select[name="mileageMn"]').val($('#select[name="mileageMn"] option:first').val());
165                        $('select[name="mileageMn"]').show();
166                        $('select[name="mileageMx"]').val($('#select[name="mileageMx"] option:first').val());
167                        $('select[name="mileageMx"]').show();
168                        var color;
169                        if (!data.message.color) {
170                            color = 'Any';
171                        } else {
172                            color = data.message.color;
173                        }
174                        
175      var nitif_el = '<div class="save_car">\
176						<div class="deteil">\
177							<div class="car_list_hide">\
178								<div>\
179									'+ data.message.make +' '+ data.message.model +'\
180								</div>\
181								<div><span>Year Range:</span>\
182									'+ data.message.beginyear +'\
183									'+ data.message.endyear +'\
184								</div>\
185								<div><span>Price Range:</span>$\
186									'+ data.message.highprice +'\
187								</div>\
188							</div>\
189							<div class="sClinks">\
190								<span class="del_notif" data-id="'+ data.message.id +'">\
191									<svg xmlns="http://www.w3.org/2000/svg" width="10.917" height="14.036" viewBox="0 0 10.917 14.036">\
192													<path id="ic_delete_forever_24px" d="M5.78,15.476a1.564,1.564,0,0,0,1.56,1.56h6.238a1.564,1.564,0,0,0,1.56-1.56V6.119H5.78ZM7.7,9.924l1.1-1.1,1.661,1.653,1.653-1.653,1.1,1.1-1.653,1.653,1.653,1.653-1.1,1.1-1.653-1.653L8.805,14.33l-1.1-1.1,1.653-1.653ZM13.187,3.78,12.408,3h-3.9l-.78.78H5v1.56H15.917V3.78Z" transform="translate(-5 -3)" fill="#bc0000"/>\
193												</svg>\
194									<span>Remove vehicle</span>\
195								</span>\
196							</div>\
197						</div>\
198					</div>';
199
200                        $(".notif_car").parent('.garage_col').find('.errors').text('');
201                        $(".notif_car").append(nitif_el);
202                    } else if (data.type === 'error') {
203                        alert(data.message);
204                    }
205                }
206            });
207        } else {
208            alert("Please select at least make.");
209        }
210    });
211    $('.saved_cars_bl').on('click', '.save_car .title', function() {
212        $(this).parent().toggleClass("open");
213    });
214    $('.notif_car').on('click', '.save_car .vv_W', function() {
215        $(this).parents('.save_car').toggleClass("open");
216    });
217    $(".pin:not(.hasFunc)").click(function(e) {
218
219        e.preventDefault();
220        e.stopPropagation();
221		pinIt(this);
222	});
223    $(".pin:not(.hasFunc)").addClass("hasFunc");
224    $(".save_this").click(function(e) {
225        e.preventDefault();
226        e.stopPropagation();
227        $(this).parents(".car-col").find(".pin").trigger("click");
228    });
229    $('body').on('click', ".save_this_deteil", function(e) {
230        e.preventDefault();
231        $(this).parents(".deteil").find(".pin").trigger("click");
232    });
233    $.post("/isapi_xml.php?module=my_garage", {
234        action: "get_pined",
235    }, function(data, status) {
236        if (status === "success") {
237            if (data.type === 'success') {
238				pinned_vehicles = data.message;
239				checkPinned();
240                var count = data.message.length;
241                if (count != 10) {
242                    count = count;
243                }
244                $(".pincount span.text").text(count);
245            } else if (data.type === 'error') {
246                $(".pincount span.text").text("00");
247            }
248        }
249    });
250    $('.carAlert').on('click', '.del_alert', function(e) {
251        e.preventDefault();
252        $.post("/isapi_xml.php?module=my_garage", {
253            action: "delete_alert",
254            alert_id: $(this).attr("data-id")
255        }, function(data, status) {
256            if (status === "success") {
257                if (data.type === 'success') {
258                    $(".carAlerts").find("[data-id='" + data.id + "']").parents(".carAlert").remove();
259                } else if (data.type === 'error') {
260                    alert(data.message);
261                }
262            }
263        });
264    });
265    $('.notif_car').on('click', '.save_car span.del_notif', function(e) {
266        e.preventDefault();
267        e.stopPropagation();
268        $.post("/isapi_xml.php?module=my_garage", {
269            action: "delete_notif",
270            notif_id: $(this).attr("data-id")
271        }, function(data, status) {
272            if (status === "success") {
273                if (data.type === 'success') {
274                    $(".notif_car").find("[data-id='" + data.id + "']").parents(".save_car").remove();
275                    if (!$(".notif_car .save_car").length) {
276                        $(".notif_car .errors").text('No matches.');
277                    }
278                } else if (data.type === 'error') {
279                    alert(data.message);
280                }
281            }
282        });
283    });
284    $('.saved_cars_bl').on('click', 'span.del_save', function(e) {
285        $.post("/isapi_xml.php?module=my_garage", {
286            action: "delete_save",
287            car_id: $(this).attr("data-id")
288        }, function(data, status) {
289            if (status === "success") {
290                if (data.type === 'success') {
291                    $(".save_car").find("[data-id='" + data.id + "']").parents(".save_car").remove();
292                    var count = parseInt($(".pincount .text").text());
293                    count = count - 1;
294                    count = "0" + count;
295                    $(".pincount .text").text(count);
296                    $("[data-pin='" + data.id + "']").removeClass("active");
297                } else if (data.type === 'error') {
298                    alert(data.message);
299                }
300            }
301        });
302    });
303    $('.mygarage-auth-section .inner .form').hide();
304    $(".mgg_login").click(function(e) {
305        e.preventDefault();
306        $('.mygarage-auth-section .inner #mgg_login_form').parents(".form").show();
307        $('.mygarage-auth-section').fadeIn();
308    });
309    $('body').on('click', '.mgg_reg', function(e) {
310        e.preventDefault();
311        $('.mygarage-auth-section .inner #mgg_reg_form').parents(".form").show();
312        $('.mygarage-auth-section').fadeIn();
313    });
314    $(".mgg_forgotten").click(function(e) {
315        e.preventDefault();
316        $('.mygarage-auth-section .inner .form').hide("slow");
317        $('.mygarage-auth-section .inner #mgg_lostPasword').parents(".form").show("slow");
318    });
319    $('.mygarage-auth-section .head .exit').on('click', function(e) {
320        e.preventDefault();
321        $('.mygarage-auth-section').fadeOut("slow", function() {
322            $('.mygarage-auth-section .inner .form').hide();
323        });
324    });
325    $('body').on('click', '#edit_prof', function(e) {
326        $('.mygarage-auth-section .inner .form:last-child').hide();
327        var f_name = $('span#f_name').text().trim(),
328            l_name = $('span#l_name').text().trim(),
329            email = $('span#mgg_email').text().trim(),
330            phone = $('span#mgg_phone').text().trim();
331        $("input[name='mgg_fname']").val(f_name);
332        $("input[name='mgg_lname']").val(l_name);
333        $("input[name='mgg_email']").val(email);
334        $("input[name='mgg_phone']").val(phone);
335        $("#mgg_reg_form button").text('Update').addClass('update');
336        $("#mgg_reg_form").parents(".form").show();
337        $('.mygarage-auth-section').fadeIn();
338    });
339    $('body').on('click', 'form#mgg_reg_form button', function(e) {
340        if ($(this).hasClass('update')) {
341            e.preventDefault();
342            $.post("/isapi_xml.php?module=my_garage", {
343                action: "update_user",
344                f_name: $("input[name='mgg_fname']").val(),
345                l_name: $("input[name='mgg_lname']").val(),
346                memail: $("input[name='mgg_email']").val(),
347                mphone: $("input[name='mgg_phone']").val(),
348                password: $("input[name='mgg_password']").val()
349            }, function(data, status) {
350                if (status === "success") {
351                    if (data.type === 'success') {
352                        $('span#f_name').text(data.message.first_name);
353                        $('span#l_name').text(data.message.last_name);
354                        $('span#mgg_email').text(data.message.email);
355                        $('span#mgg_phone').text(data.message.phone);
356                        $('.mygarage-auth-section').fadeOut();
357                    } else if (data.type === 'error') {}
358                }
359            });
360            $(this).removeClass('update');
361        }
362    });
363    $('body').on('click', '.see_notif_list', function(e) {
364        e.preventDefault();
365        $(this).parents('.hide_deteil').find(".car_list_hide").slideToggle("slow", "linear");
366    });
367}
368
369function checkPinned(){
370	var i = 0;
371	while (pinned_vehicles[i]) {
372		var ids = pinned_vehicles[i].id;
373		$("[data-pin='" + ids + "']").addClass("active");
374		i++;
375	}
376	var count = pinned_vehicles.length;
377	if (count != 10) {
378		count = count;
379	}	
380}
381
382function pinIt(obj){
383	if (!$(obj).hasClass("pincount")) {
384		if (!$(obj).hasClass("active")) {
385			$.post("/isapi_xml.php?module=my_garage", {
386				action: "pin_it",
387				car_id: $(obj).attr("data-pin")
388			}, function(data, status) {
389				if (status === "success") {
390					if (data.type === 'success') {
391						insert_save_car(data.id);
392						$("[data-pin='" + data.id + "']").addClass("active");
393						var count = parseInt($(".pincount .text").text());
394						if (count == 9) {
395							count = count + 1;
396						} else {
397							count = count + 1;
398							count = count;
399						}
400						$(".pincount .text").text(count);
401						setAllCookies('pin_it', data.id);
402					} else if (data.type === 'error') {
403						alert(data.message);
404					}
405				}
406			});
407		} else {
408			$.post("/isapi_xml.php?module=my_garage", {
409				action: "delete_save",
410				car_id: $(obj).attr("data-pin")
411			}, function(data, status) {
412				if (status === "success") {
413					if (data.type === 'success') {
414						$(".save_car").find("[data-id='" + data.id + "']").parents(".save_car").remove();
415						var count = parseInt($(".pincount .text").text());
416						count = count - 1;
417						count = count;
418						$(".pincount .text").text(count);
419						$("[data-pin='" + data.id + "']").removeClass("active");
420					} else if (data.type === 'error') {
421						alert(data.message);
422					}
423				}
424			});
425		}
426	}
427}
428
429
430function insert_save_car($id) {
431    $.post("/isapi_xml.php?module=my_garage", {
432        action: "get_car",
433        car_id: $id
434    }, function(data, status) {
435        if (status === "success") {
436            if (data.type === 'success') {
437                data.message = data.message[0];
438                var sold = clink = "";
439                if (data.message.sold != "Available") {
440                    sold = " (Sold)";
441                }
442                clink = $("[data-pin='" + data.id + "']").parent().attr('onclick');
443
444                im_url = $("[data-pin='" + data.id + "']").parent().find('img').attr('src');
445                var $price;
446                if (data.message.price != 0) $price = "$" + number_format(data.message.price);
447                else $price = "Call for price";
448		   		var save_el = 
449						'<div class="car_elem save_car">\
450							<div class="wrap">\
451								<div class="titleBox">\
452									<a href="javascript:;" onclick="'+ clink +'">\
453										' + data.message.year + ' ' + data.message.make + ' ' + data.message.model + sold + '\
454									</a>\
455								</div>\
456								<div class="img_bl">\
457									<a href="javascript:;" onclick="'+ clink +'">\
458										<img src="' + im_url + '" alt="' + data.message.vehicle_name + '">\
459									</a>\
460								</div>\
461								<div class="botAction">\
462									<div class="controls sClinks">\
463										<svg class="active" xmlns="http://www.w3.org/2000/svg" width="10.917" height="14.036" viewBox="0 0 10.917 14.036">\
464											<path id="ic_delete_forever_24px" d="M5.78,15.476a1.564,1.564,0,0,0,1.56,1.56h6.238a1.564,1.564,0,0,0,1.56-1.56V6.119H5.78ZM7.7,9.924l1.1-1.1,1.661,1.653,1.653-1.653,1.1,1.1-1.653,1.653,1.653,1.653-1.1,1.1-1.653-1.653L8.805,14.33l-1.1-1.1,1.653-1.653ZM13.187,3.78,12.408,3h-3.9l-.78.78H5v1.56H15.917V3.78Z" transform="translate(-5 -3)" fill="#bc0000"/>\
465										</svg>\
466										<span class="del_save" data-id="' + data.message.id + '>Remove Vehicle</span>\
467									</div>\
468									<div class="price">\
469										Price: '+ data.message.lower_price +'\
470									</div>\
471								</div>\
472							</div>\
473						</div>';
474		   		var save_el2 = '<div class="save_car new">\
475						<a href="javascript:;" onclick="'+ clink +'">\
476							<div class="descp_bl">\
477								<div class="titles">\
478									' + data.message.year + ' ' + data.message.make + '\
479									<br />\
480									' + data.message.model + sold + '\
481								</div>\
482								<div class="sml_desc">\
483								<div class="miles"><span>Miles:</span>\
484									'+ data.message.mileage +'\
485								</div>\
486								<div class="price">\
487									<span>Price:</span>\
488									'+ data.message.lower_price +'\
489								</div>\
490							</div>\
491							</div>\
492							<div class="img_bl">\
493								<img src="' + im_url + '" alt="' + data.message.vehicle_name + '">\
494							</div>\
495						</a>\
496						<div class="controls sClinks">\
497							<img src="/template/images/icons/del_car.png" alt="">\
498							<span class="del_save" data-id="' + data.message.id + '">Remove Vehicle</span>\
499						</div>\
500					</div>';
501		   
502  
503                $(".saved_cars_bl .list").append(save_el).find(".error").remove();;
504            } else if (data.type === 'error') {}
505        }
506    });
507}
508
509function setAllCookies(name, val) {
510    if (!locations) return false;
511    var fakeImagesDiv = document.createElement('div');
512//     fakeImagesDiv.setAttribute('id', 'fakeImgID');
513    for (var i in locations) {
514        var fakeImg = document.createElement('img');
515        fakeImg.src = 'https://www.' + locations[i] + '/isapi_xml.php?module=my_garage&set_cookie=' + name + '::' + val;
516        fakeImagesDiv.appendChild(fakeImg);
517    }
518}
519
520function mgg_login_submit() {
521    $('#login_submit').attr('disabled', 'disabled').text('Processing');
522    $.post("/isapi_xml.php?module=my_garage", $('#mgg_login_form').serializeArray(), function(text) {
523
524        if (!text.match("^Error")) {
525            setAllCookies('mgg_user', text);
526            setTimeout(function() {
527                location.href = "";
528            }, 3000);
529        } else {
530            $("#mgg_login_form .mgg_error_txt").text("Incorrect login information. Please check your credentials and try again.");
531            $('#login_submit').removeAttr('disabled').text('Login');
532        }
533    });
534    return false;
535}
536
537function mgg_register_submit() {
538    $('#register_submit').attr('disabled', 'disabled').text('Processing');
539    $.post("/isapi_xml.php?module=my_garage", $('#mgg_reg_form').serializeArray(), function(text) {
540		
541		
542        if (!text.match("^Error")) {
543            setAllCookies('mgg_user', text);
544            setTimeout(function() {
545                location.href = "";
546            }, 3000);
547        } else {
548            $('#register_submit').removeAttr('disabled').text('Register');
549            $("#mgg_reg_form .mgg_error_txt").text(text);
550            console.log(text);
551            grecaptcha.reset();
552        }
553    });
554    return false;
555}
556
557function mgg_logout(obj) {
558    $('#logout_submit').attr('disabled', 'disabled').text('Processing');
559    $.get("/isapi_xml.php?module=my_garage&action=logout", function(text) {
560        if (text == 'OK') {
561            setAllCookies('mgg_user', '');
562            setTimeout(function() {
563                location.href = "";
564            }, 3000);
565        }
566    });
567    return false;
568}
569
570function mgg_send_restore() {
571    $.post("/isapi_xml.php?module=my_garage", $('#mgg_lostPasword').serializeArray(), function(text) {
572        if (!text.match("^Error")) {
573            $("#mgg_lostPasword").html(text);
574        } else {
575            $("#mgg_lostPasword .mgg_error_txt").text(text);
576        }
577    });
578    return false;
579}
580
581function number_format(number, decimals, decPoint, thousandsSep) {
582    number = (number + '').replace(/[^0-9+\-Ee.]/g, '')
583    var n = !isFinite(+number) ? 0 : +number
584    var prec = !isFinite(+decimals) ? 0 : Math.abs(decimals)
585    var sep = (typeof thousandsSep === 'undefined') ? ',' : thousandsSep
586    var dec = (typeof decPoint === 'undefined') ? '.' : decPoint
587    var s = ''
588    var toFixedFix = function(n, prec) {
589        var k = Math.pow(10, prec)
590        return '' + (Math.round(n * k) / k).toFixed(prec)
591    }
592    s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.')
593    if (s[0].length > 3) {
594        s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep)
595    }
596    if ((s[1] || '').length < prec) {
597        s[1] = s[1] || ''
598        s[1] += new Array(prec - s[1].length + 1).join('0')
599    }
600    return s.join(dec)
601}
602
603function extractDomain(url) {
604    var domain;
605    if (url.indexOf("://") > -1) {
606        domain = url.split('/')[2];
607    } else {
608        domain = url.split('/')[0];
609    }
610    domain = domain.split(':')[0];
611    return domain;
612}
613
614function toggleNotifications(checked) {
615    var email = JSON.parse($.cookie('mgg_user'))['email'];
616    if (email.length < 5) {
617        alert('Error!');
618        return false;
619    }
620    $.get("/isapi_xml.php?module=my_garage&action=toggleNotification&active="+ checked +"&email="+ email, function(text) {
621        if (text == "OK")
622            alert('Notification turned '+ (checked == true ? 'On' : 'Off') +'.');
623        else
624            alert('Error! No records changed.');
625    });
626}

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.