PageSourceSearch

https://www.cityhouseashburn.com/wp-content/themes/mastertemplate-child/js/floorplans.js?x45183&ver=1

js cityhouseashburn.com collected 2026-10-06 22:38:08 UTC 25,200 bytes, 736 lines download raw bytes

1var FpApp = (function () {
2    "use strict";
3
4    /* home slider */
5    var datepickerInitialize = function () {
6        if (jQuery("#datepicker").length) {
7            jQuery("#datepicker").datepicker({
8                dateFormat: "mm/dd/yy",
9                onSelect: function (date, datepicker) {
10                    if (date != "") {
11                        refresh_results();
12                    }
13                },
14            });
15        }
16    };
17
18    var scrollbarIntroduce = function () {
19        setTimeout(function () {
20            jQuery(".system .mt_fp_filter_popup_inner").mCustomScrollbar();
21            jQuery(".system .mt_hztl_scroll").mCustomScrollbar({
22                axis: "x",
23            });
24        }, 100);
25    };
26
27    var showMore = function () {
28        jQuery(".mt_fp_show_more_btn").click(function () {
29            jQuery(".mt_fp_show_more").slideToggle();
30            if (jQuery(this).text() == "Show More") jQuery(this).text("Show Less");
31            else jQuery(this).text("Show More");
32        });
33    };
34
35    var resetDate = function () {
36        jQuery(".reset_availability").click(function () {
37            jQuery("#datepicker").datepicker("setDate", null);
38            refresh_results();
39        });
40    };
41
42    var closePopup = function () {
43        setTimeout(function () {
44            jQuery(document).click(function (e) {
45                if (jQuery(".mt_image_popup").hasClass("opened")) {
46                    if (jQuery(e.target).attr("id") != "popup_img") {
47                        jQuery(".mt_fp_popup").removeClass("opened");
48                        jQuery("body").removeClass("fp-popup-active");
49                    }
50                }
51            });
52        }, 100);
53    };
54
55    var showPopup = function () {
56        jQuery(".mt_fp_popup_btn").click(function () {
57            if (jQuery("#popup_img").length) {
58                jQuery("#popup_img")
59                    .attr("src", jQuery(this).attr("data-url"))
60                    .load(function () {
61                        jQuery(".mt_fp_popup").addClass("opened");
62                        jQuery(".mt_fp_close").focus();
63                    });
64            } else {
65                jQuery(".mt_fp_popup").addClass("opened");
66                jQuery("body").addClass("fp-popup-active");
67                jQuery(".mt_fp_close").focus();
68            }
69        });
70        jQuery(".mt_fp_close").click(function () {
71            jQuery(".mt_fp_popup").removeClass("opened");
72            jQuery("body").removeClass("fp-popup-active");
73        });
74    };
75
76    var showPopupSlider = function () {
77        jQuery(".mt_fp_slider_btn").on("click", function () {
78            jQuery(".mt_slider_popup").addClass("opened");
79            jQuery(".mt_fp_close").focus();
80        });
81        jQuery(".mt_fp_close").click(function () {
82            jQuery(".mt_slider_popup").removeClass("opened");
83        });
84        jQuery(".mt_thumb_slider .slick-next").on(
85            "keydown keypress keyup",
86            function (e) {
87                if (e.keyCode !== 13) {
88                    setTimeout(function () {
89                        jQuery(".mt_popup_close").focus();
90                    }, 100);
91                }
92            }
93        );
94        jQuery(".mt_slider").not(".slick-initialized").slick({
95            slidesToShow: 1,
96            slidesToScroll: 1,
97            arrows: true,
98            fade: true,
99            asNavFor: ".mt_thumb_slider",
100        });
101        jQuery(".mt_thumb_slider").slick({
102            slidesToShow: 2,
103            slidesToScroll: 1,
104            asNavFor: ".mt_slider",
105            centerMode: true,
106            focusOnSelect: true,
107            autoplay: true,
108            adaptiveHeight: true,
109            variableWidth: false,
110            mobileFirst: true,
111            rows: 0,
112            dots: false,
113            responsive: [
114                {
115                    breakpoint: 769,
116                    settings: {
117                        slidesToShow: 3,
118                        slidesToScroll: 1,
119                    },
120                },
121                {
122                    breakpoint: 480,
123                    settings: {
124                        slidesToShow: 2,
125                        slidesToScroll: 1,
126                    },
127                },
128                {
129                    breakpoint: 320,
130                    settings: {
131                        slidesToShow: 2,
132                        slidesToScroll: 1,
133                    },
134                },
135            ],
136        });
137    };
138
139    // var  showEnlargeView = function() {
140    //      jQuery('.mt_image_popup').show();
141    //      jQuery('.mt_image_popup button').focus();
142    //  }
143
144    // for slider height and width calculation
145    var sliderHeight = function () {
146        jQuery(".mt_slider_img").css({ "min-height": window.innerHeight * 0.5 });
147        jQuery(".mt_slider .slick-track").css({
148            "min-height": window.innerHeight * 0.5,
149        });
150        jQuery(".mt_thumb_slider_img").css({
151            "min-height": window.innerHeight * 0.15,
152        });
153        jQuery(".mt_thumb_slider .slick-track").css({
154            "min-height": window.innerHeight * 0.15,
155        });
156    };
157    var submitSearch = function () {
158        jQuery(
159            "#bed_selector input[type=checkbox], #bath_selector input[type=checkbox], #checkbox_filter input[type=checkbox]"
160        ).change(function () {
161            //If any option selected remove other options
162            if (jQuery(this).attr("id") == "any") {
163                jQuery("#bed_selector input[type=checkbox]").prop("checked", false);
164                jQuery("#bed_selector input#any").prop("checked", true);
165            } else if (jQuery(this).parent().parent().hasClass("mt_search_bed")) {
166                jQuery("#bed_selector input#any").prop("checked", false);
167            }
168
169            if (jQuery(this).attr("id") == "bath_any") {
170                jQuery("#bath_selector input[type=checkbox]").prop("checked", false);
171                jQuery("#bath_selector input#bath_any").prop("checked", true);
172            } else if (jQuery(this).parent().parent().hasClass("mt_search_bath")) {
173                jQuery("#bath_selector input#bath_any").prop("checked", false);
174            }
175
176            refresh_results();
177        });
178        jQuery("li.selectivo__option").click(function () {
179            //refresh_results();
180            const myTimeout = setTimeout(refresh_results, 500);
181        });
182    };
183
184    var stickyFilterHt = function () {
185        jQuery(".mt_fp_cnt_sec ").css(
186            "padding-top",
187            jQuery(".mt_filter_sticky_bar").outerHeight()
188        );
189    };
190
191    var stickyFilterCntHt = function () {
192        if (browserWidth() < 992) {
193            var windowHt = jQuery(window).outerHeight() - 150;
194            jQuery(".mt_fp_filter_popup_inner").css("max-height", windowHt);
195        }
196    };
197
198    var stickyFilter = function () {
199        var scrollMin = 507;
200        if (browserWidth() > 992) {
201            if (jQuery(window).scrollTop() > scrollMin) {
202                jQuery(".mt_filter_sticky_bar").addClass("mt_fp_fixed");
203                jQuery(".mt_filter_sticky_bar").css(
204                    "top",
205                    jQuery("header").outerHeight()
206                );
207            } else {
208                jQuery(".mt_filter_sticky_bar").removeClass("mt_fp_fixed");
209                jQuery(".mt_filter_sticky_bar").css("top", "0");
210            }
211        } else {
212            jQuery(".mt_filter_sticky_bar").removeClass("mt_fp_fixed");
213            jQuery(".mt_filter_sticky_bar").css("top", "0");
214        }
215    };
216
217    var showResults = function () {
218        jQuery("#btn_show_count").click(function () {
219            refresh_results("refresh_results");
220            jQuery("body").removeClass("fp-popup-active");
221        });
222    };
223
224    var fpCompareSlider = function () {
225        if (jQuery(".mt_fp_compare_slider").length) {
226            jQuery(".mt_fp_compare_slider").slick({
227                rows: 0,
228                dots: false,
229                arrows: false,
230                infinite: false,
231                slidesToShow: 4,
232                slidesToScroll: 4,
233                responsive: [
234                    {
235                        breakpoint: 991,
236                        settings: {
237                            slidesToShow: 2,
238                            slidesToScroll: 2,
239                        },
240                    },
241                    {
242                        breakpoint: 769,
243                        settings: {
244                            slidesToShow: 2,
245                            slidesToScroll: 2,
246                        },
247                    },
248                    {
249                        breakpoint: 480,
250                        settings: {
251                            slidesToShow: 1,
252                            slidesToScroll: 1,
253                        },
254                    },
255                ],
256            });
257        }
258    };
259
260    /*browser width calculation*/
261    var browserWidth = function () {
262        if (self.innerHeight) {
263            return self.innerWidth;
264        }
265        if (document.documentElement && document.documentElement.clientHeight) {
266            return document.documentElement.clientWidth;
267        }
268        if (document.body) {
269            return document.body.clientWidth;
270        }
271    };
272
273    var updateViewMenu = function () {
274        var view = jQuery("input[name=hidden_view]").val();
275        if (view) {
276            jQuery("div#view_by div a").removeClass("selectivo__option--selected");
277            jQuery("div#view_by div")
278                .find("a[data-value='" + view + "']")
279                .addClass("selectivo__option--selected");
280            jQuery("div#view_by div a").attr("aria-selected", "false");
281            jQuery("div#view_by div a.selectivo__option--selected").attr(
282                "aria-selected",
283                "true"
284            );
285            jQuery("div#view_by input").val(view);
286            jQuery("div#view_by button.selectivo__label").html(
287                jQuery("div#view_by div")
288                    .find("a[data-value='" + view + "']")
289                    .html()
290            );
291        }
292    };
293
294    var updateFilterSelectbox = function () {
295        jQuery("#selectbox_filter div.dropdown").each(function () {
296            var selectedVal = jQuery(this).attr("data-selected");
297            if (selectedVal) {
298                jQuery(this).find("ul li").removeClass("selectivo__option--selected");
299                jQuery(this)
300                    .find("ul li[data-value='" + selectedVal + "']")
301                    .addClass("selectivo__option--selected");
302                jQuery(this).find("ul li").attr("aria-selected", "false");
303                jQuery(this)
304                    .find("ul li.selectivo__option--selected")
305                    .attr("aria-selected", "true");
306                jQuery(this).find("input").val(selectedVal);
307                jQuery(this)
308                    .find("button.selectivo__label")
309                    .html(
310                        jQuery(this)
311                            .find("ul li[data-value='" + selectedVal + "']")
312                            .html()
313                    );
314            }
315        });
316    };
317
318  var updateSortMenu = function () {
319    var sort = jQuery("input[name=hidden_sort]").val();
320    var order = jQuery("input[name=hidden_order]").val();
321    var sort_key = "";
322    if (sort == "minsquarefeet") {
323      if (order == "DESC") {
324        sort_key = "sqft-max";
325      } else {
326        sort_key = "sqft-min";
327      }
328    } else if (sort == "vacantdate") {
329      if (order == "DESC") {
330        sort_key = "avail-max";
331      } else {
332        sort_key = "avail-min";
333      }
334    } else if (sort == "unitrent") {
335      if (order == "DESC") {
336        sort_key = "price-max";
337      } else {
338        sort_key = "price-min";
339      }
340    }
341
342        if (sort_key) {
343            jQuery("div#sort_by ul a").removeClass("selectivo__option--selected");
344            jQuery("div#sort_by ul")
345                .find("a[data-value='" + sort_key + "']")
346                .addClass("selectivo__option--selected");
347            jQuery("div#sort_by ul a").attr("aria-selected", "false");
348            jQuery("div#sort_by ul a.selectivo__option--selected").attr(
349                "aria-selected",
350                "true"
351            );
352            jQuery("div#sort_by input").val(sort_key);
353            jQuery("div#sort_by button.selectivo__label").html(
354                jQuery("div#sort_by ul")
355                    .find("a[data-value='" + sort_key + "']")
356                    .html()
357            );
358        }
359    };
360
361    var compareBtnClick = function () {
362        // jQuery('div.mt_fp_compare_info button').click(function () {
363        //     location = jQuery(this).attr('data-url');
364        // });
365        jQuery("body").on("click", "div.mt_fp_compare_info button", function () {
366            //console.log("compareBtnClick");
367            location = jQuery(this).attr("data-url");
368        });
369    };
370
371    var setMenu = function () {
372        jQuery("ul.primary-menu li").removeClass("current_page_item");
373        jQuery("ul.primary-menu li.link_fp_menu").addClass("current_page_item");
374
375        jQuery("ul.header-menu li").removeClass("current_page_item");
376        jQuery("ul.header-menu li.link_fp_menu").addClass("current_page_item");
377    };
378
379    var initialize = function () {
380        datepickerInitialize();
381        showMore();
382        resetDate();
383        scrollbarIntroduce();
384        stickyFilterHt();
385        stickyFilterCntHt();
386        sliderHeight();
387        submitSearch();
388        showResults();
389        showPopup();
390        closePopup();
391        showPopupSlider();
392        fpCompareSlider();
393        stickyFilter();
394        compareBtnClick();
395        setTimeout(updateViewMenu, 100);
396        setTimeout(updateSortMenu, 100);
397        setTimeout(updateFilterSelectbox, 100);
398        setMenu();
399    };
400
401    var resize = function () {
402        stickyFilterHt();
403        stickyFilter();
404        stickyFilterCntHt();
405    };
406
407    var scroll = function () {
408        stickyFilter();
409    };
410
411    return {
412        initialize: initialize,
413        resize: resize,
414        scroll: scroll,
415        browserWidth: browserWidth,
416    };
417})();
418
419(function (init) {
420    // The global jQuery object is passed as a parameter
421    init(window.jQuery, window, document);
422})(function (jQuery, window, document) {
423    // The jQuery is now locally scoped
424    // Listen for the jQuery ready event on the document
425    jQuery(function () {
426        FpApp.initialize();
427    });
428
429    // Listen for the jQuery resize event on the document
430    jQuery(window).resize(function () {
431        FpApp.resize();
432    });
433
434    jQuery(window).scroll(function () {
435        FpApp.scroll();
436    });
437});
438
439function updateCompareList(element, refresh_url = null) {
440    var unitId = jQuery(element).val();
441
442    jQuery.ajax({
443        url: ajax_url,
444        type: "post",
445        data: {
446            action: "update_compare_list",
447            unitId: unitId,
448        },
449        datatype: "json",
450        beforeSend: function () { },
451        success: function (result) {
452            var data = JSON.parse(result);
453            if (data.status == "Success") {
454                if (refresh_url) {
455                    location = refresh_url;
456                }
457                if (data.count >= 4) {
458                    jQuery(
459                        "div.mt_fp_compare_chk input[type=checkbox]:not(:checked)"
460                    ).prop("disabled", true);
461                } else {
462                    jQuery("div.mt_fp_compare_chk input[type=checkbox]").prop(
463                        "disabled",
464                        false
465                    );
466                }
467                if (data.count > 1) {
468                    jQuery("div.mt_fp_compare_info button").removeClass(
469                        "mt_compare_disabled"
470                    );
471                } else {
472                    jQuery("div.mt_fp_compare_info button").addClass(
473                        "mt_compare_disabled"
474                    );
475                }
476            } else {
477            }
478        },
479    });
480}
481
482function refresh_results(type = "refresh_count") {
483    var currentRequest = null;
484    var bed = [];
485    var bath = [];
486    var checkbox = [];
487    var avail = "";
488
489  var sort = jQuery("input[name=hidden_sort]").val();
490  var order = jQuery("input[name=hidden_order]").val();
491  var pagenumber = jQuery("input[name=hidden_pagenumber]").val();
492  var view = jQuery("input[name=hidden_view]").val();
493  var search_level = jQuery("input[name=search_level]").val();
494  var floorplanid = jQuery("input[name=floorplanid]").val();
495
496    var data = new Array();
497
498    data = {
499        action: "fp_submit_search_child",
500        type: type,
501        sort: sort,
502        order: order,
503        pagenumber: pagenumber,
504        view: view,
505        search_level: search_level,
506        floorplanid: floorplanid
507    };
508
509    if (jQuery("#bed_selector").length > 0) {
510        bed = jQuery("#bed_selector input:checkbox:checked")
511            .map(function () {
512                return jQuery(this).val();
513            })
514            .get();
515
516        data["bed"] = bed;
517    }
518
519    if (jQuery("#bath_selector").length > 0) {
520        bath = jQuery("#bath_selector input:checkbox:checked")
521            .map(function () {
522                return jQuery(this).val();
523            })
524            .get();
525
526        data["bath"] = bath;
527    }
528
529    if (jQuery("#checkbox_filter").length > 0) {
530        checkboxfilter = jQuery("#checkbox_filter input:checkbox:checked")
531            .map(function () {
532                return jQuery(this).val();
533            })
534            .get();
535
536        data[jQuery("#checkbox_filter").attr("data-key")] = checkboxfilter;
537    }
538
539    if (jQuery("#avail_filter").length > 0) {
540        avail = jQuery("input#datepicker").val();
541        data["availability"] = avail;
542    }
543
544    if (jQuery("#selectbox_filter").length > 0) {
545        jQuery("#selectbox_filter")
546            .find("div.dropdown")
547            .each(function () {
548                data[jQuery(this).attr("data-key")] = jQuery(this)
549                    .find("input[type=hidden]")
550                    .val();
551            });
552    }
553
554    currentRequest = jQuery.ajax({
555        type: "POST",
556        data: data,
557        url: ajax_url,
558        beforeSend: function () {
559            if (type == "refresh_count") {
560                jQuery("#btn_show_count").html("Loading");
561            }
562        },
563        success: function (result) {
564            if (type == "refresh_count") {
565                var data = JSON.parse(result);
566                jQuery("#btn_show_count").html(data.submit_btn_label);
567                jQuery("#btn_filter_results").attr(
568                    "data-filter-label",
569                    data.filter_btn_label
570                );
571                jQuery("#btn_filter_results").attr(
572                    "data-filter-status",
573                    data.filter_enabled
574                );
575                jQuery("#btn_filter_results").attr("data-filter-count", data.count);
576                jQuery("#btn_filter_results").attr(
577                    "data-search-url",
578                    data.fp_search_url
579                );
580                jQuery("#btn_filter_results").attr("data-sort-url", data.sort_url);
581                jQuery("#btn_filter_results").attr("data-view-url", data.view_url);
582            } else if (type == "refresh_results") {
583                if (view == "list") {
584                    jQuery(".mt_fp_list_view").replaceWith(result);
585                    jQuery(".mt_fp_popup").removeClass("opened");
586                    jQuery(".mt_fp_list_view").fadeIn("slow");
587                } else if (view == "grid") {
588                    jQuery(".mt_fp_grid_view").replaceWith(result);
589                    jQuery(".mt_fp_popup").removeClass("opened");
590                    jQuery(".mt_fp_grid_view").fadeIn("slow");
591                }
592
593                if (jQuery("#btn_filter_results").attr("data-filter-status") == "on") {
594                    jQuery("#btn_filter_results").html(
595                        jQuery("#btn_filter_results").attr("data-filter-label")
596                    );
597                    jQuery("div.ring-container").show();
598                } else {
599                    jQuery("#btn_filter_results").html(
600                        jQuery("#btn_filter_results").attr("data-default-label")
601                    );
602                    jQuery("div.ring-container").hide();
603                }
604
605                const refineSearchLimit = parseInt(
606                    jQuery("#btn_filter_results").attr("data-refine-search-limit")
607                );
608                const totalCount = parseInt(
609                    jQuery("#btn_filter_results").attr("data-filter-count")
610                );
611
612                if (totalCount > refineSearchLimit) {
613                    jQuery(".mt_fp_notification").show();
614                    setTimeout(function () {
615                        jQuery(".mt_fp_cnt_sec ").css(
616                            "padding-top",
617                            jQuery(".mt_filter_sticky_bar").outerHeight()
618                        );
619                    }, 100);
620                } else {
621                    jQuery(".mt_fp_notification").hide();
622                    setTimeout(function () {
623                        jQuery(".mt_fp_cnt_sec ").css(
624                            "padding-top",
625                            jQuery(".mt_filter_sticky_bar").outerHeight()
626                        );
627                    }, 100);
628                }
629
630                if (totalCount <= 0) {
631                    jQuery(".mt_fp_no_results").show();
632                } else {
633                    jQuery(".mt_fp_no_results").hide();
634                }
635
636                window.history.replaceState(
637                    "page2",
638                    "Title",
639                    jQuery("#btn_filter_results").attr("data-search-url")
640                );
641                window.history.pushState(
642                    {},
643                    "",
644                    jQuery("#btn_filter_results").attr("data-search-url")
645                );
646
647                update_sort_url();
648                update_view_url();
649            }
650        },
651        error: function (e) {
652            // Error
653        },
654    });
655}
656
657function clear_form() {
658    jQuery('#bed_selector input[type="checkbox"]').prop("checked", false);
659    jQuery('#bath_selector input[type="checkbox"]').prop("checked", false);
660    jQuery("#datepicker").val("");
661    jQuery('#checkbox_filter input[type="checkbox"]').prop("checked", false);
662    jQuery("div#selectbox_filter div.dropdown").each(function () {
663        jQuery(this)
664            .find("button.selectivo__label")
665            .html(jQuery(this).find("ul li[data-value='']").html());
666        jQuery(this).find("input[type=hidden]").val("");
667    });
668    refresh_results();
669}
670
671function update_view_url() {
672  jQuery("#view_by div a").each(function () {
673    var val = jQuery(this).attr("data-value");
674    var url = jQuery("#btn_filter_results").attr("data-view-url");
675    if(url == '') {
676      return false;
677    }
678    if (val == "list") {
679      jQuery(this).attr("href", url + "&view=list");
680    } else if (val == "grid") {
681      jQuery(this).attr("href", url + "&view=grid");
682    }
683  });
684}
685
686function update_sort_url() {
687  jQuery("#sort_by ul a").each(function () {
688    var val = jQuery(this).attr("data-value");
689    var url = jQuery("#btn_filter_results").attr("data-sort-url");
690    if(url == '') {
691      return false;
692    }
693    if (val == "sqft-min") {
694      jQuery(this).attr("href", url + "&sort=minsquarefeet&order=ASC");
695    } else if (val == "sqft-max") {
696      jQuery(this).attr("href", url + "&sort=minsquarefeet&order=DESC");
697    } else if (val == "price-min") {
698      jQuery(this).attr("href", url + "&sort=unitrent&order=ASC");
699    } else if (val == "price-max") {
700      jQuery(this).attr("href", url + "&sort=unitrent&order=DESC");
701    } else if (val == "avail-min") {
702      jQuery(this).attr("href", url + "&sort=vacantdate&order=ASC");
703    } else if (val == "avail-max") {
704      jQuery(this).attr("href", url + "&sort=vacantdate&order=DESC");
705    }
706  });
707}
708
709function backToSearchResults() {
710    location = document.referrer;
711}
712
713function switch_image(elm) {
714    var url = jQuery(elm).attr("data-url");
715    jQuery(".mt_fp_image #img").hide();
716    jQuery(".mt_fp_image #loader").show();
717    jQuery(".mt_fp_image #img")
718        .attr("src", url)
719        .load(function () {
720            jQuery(".mt_fp_image #loader").hide();
721            jQuery(".mt_fp_image #img").fadeIn("slow");
722            jQuery(".mt_enlarge_btn").attr("data-url", url);
723        });
724}
725
726jQuery(".mt_control_btn .mt_play").on("click", function () {
727    if (jQuery(".mt_play").hasClass("paused")) {
728        jQuery(".mt_thumb_slider").slick("slickPause");
729        //            jQuery('.mt_thumb_slider').slick('slickPlay');
730        //            jQuery('.mt_play').removeClass('paused');
731    } else {
732        jQuery(".mt_thumb_slider").slick("slickPlay");
733        //            jQuery('.mt_thumb_slider').slick('slickPause');
734        //            jQuery('.mt_play').addClass('paused');
735    }
736});

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.