PageSourceSearch

https://elitere.com.vn/assets/js/common.js

js elitere.com.vn collected 2026-10-05 18:36:17 UTC 6,938 bytes, 221 lines download raw bytes

1
2let loadComponents = () => {
3  let coms = $("#footer, #featured-projects, #navbar_top, #let-us-help");
4  coms.each(function (index, value) {
5    let com = $(this);
6    if (com.data("template") !== undefined) {
7      com.load(com.data("template"), function () {
8        if (com.attr("id") === "navbar_top") {
9          initMenu();
10          addToCart();
11          if (com.data("logo-color") !== undefined) {
12            $('path, polygon, circle', com).attr('fill', com.data("logo-color"));
13          }
14        }
15      });
16    }
17  });
18}
19let initMenu = () => {
20  let navbarTop = $("#navbar_top"),
21    header = $(".header", navbarTop);
22  if (window.matchMedia("(max-width: 768px)").matches) {
23    $(".shopping-cart, .page-container").css('padding-top', (parseInt(header.position().top) + parseInt(header.height())));
24  }
25  window.addEventListener('scroll', function () {
26    if (window.scrollY > 115) {
27      document.getElementById('navbar_top').classList.add('sticky-top');
28      // add padding top to show content behind navbar
29      navbar_height = document.querySelector('.navbar').offsetHeight;
30      //document.body.style.paddingTop = navbar_height + 'px';
31      if (window.matchMedia("(max-width: 768px)").matches) {
32        $('path, polygon, circle', navbarTop).attr('fill', "#ffffff");
33      }
34    } else {
35      document.getElementById('navbar_top').classList.remove('sticky-top');
36      // remove padding top from body
37      //document.body.style.paddingTop = '0';
38      if (window.matchMedia("(max-width: 768px)").matches) {
39        $('path, polygon, circle', navbarTop).attr('fill', navbarTop.data("logo-color"));
40      }
41    }
42  });
43
44  $('.navbar .dropdown-menu a.dropdown-toggle.dropdown-item').click(function (e) {
45    
46    if (!$(this).next().hasClass('show')) {
47      $(this).parents('.dropdown-menu').first().find('.show').removeClass('show menu-style');
48    } 
49    var $subMenu = $(this).next('.dropdown-menu');
50    $subMenu.toggleClass('show');
51    $subMenu.prev().toggleClass('show');
52
53
54    $(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function (e) {
55      $('.navbar .dropdown-submenu .show').removeClass('show');
56      $('.navbar .dropdown-submenu .menu-style').removeClass('show');
57    });
58    return false;
59
60  });
61  if (!window.matchMedia("(max-width: 768px)").matches) {
62    document.querySelectorAll('.navbar .nav-item, .navbar .dropdown-submenu').forEach(function (everyitem) {
63
64      everyitem.addEventListener('mouseover', function (e) {
65
66        let el_link = this.querySelector('a[data-toggle]'),
67          ulList = this.closest(".dropdown-menu");
68
69
70        if (el_link != null) {
71          let nextEl = el_link.nextElementSibling;
72          el_link.classList.add('show');
73          nextEl.classList.add('show');
74          
75        }
76        if (ulList != null) {
77          ulList.classList.add("menu-style");
78        }
79
80      });
81      everyitem.addEventListener('mouseleave', function (e) {
82        let el_link = this.querySelector('a[data-toggle]'),
83        ulList = this.closest(".dropdown-menu");
84
85        if (el_link != null) {
86          let nextEl = el_link.nextElementSibling;
87          el_link.classList.remove('show');
88          nextEl.classList.remove('show');
89          ulList.classList.remove("menu-style");
90        }
91        if (ulList != null) {
92          ulList.classList.remove("menu-style");
93        }
94
95      })
96    });
97  }
98}
99
100
101var max = $('.js-range-slider-price').data('max');
102var from = $('.js-range-slider-price').data('from');
103var to = $('.js-range-slider-price').data('to');
104let dropdownRentBuy = (dropdown) => {
105  let form = dropdown.closest("form"),
106  price = $("#price-range-slider"),
107  area = $("#area-range-slider"),
108  lblPrice;
109  if(price.length > 0) {
110    lblPrice = price.prev("label").find("span");
111  }
112    $(".dropdown-item", dropdown).click(function (e) {
113      $(".dropdown-item.active", dropdown).removeClass("active");
114      e.preventDefault();
115      $(e.target).addClass("active");
116      dropdown.on('hidden.bs.dropdown', function (event) {
117        form[0].reset();
118        $('.selectpicker', form).selectpicker('refresh');
119
120        let priceInstance = price.data("ionRangeSlider"),
121        areaIInstance = area.data("ionRangeSlider");
122        switch(e.target.innerText) {
123          case "BUY":
124            lblPrice.text("Billion");
125            $('[name=property_type_id]').val('sale');
126            if (lang_id == 2) {
127                var instance = $('.js-range-slider-price').data("ionRangeSlider");
128                instance.update({
129                  max: 500,
130                  from: 0,
131                  to: 500,
132                });
133            }
134            break;
135          case "MUA":
136            lblPrice.text("tá»·");
137            $('[name=property_type_id]').val('sale');
138            break;
139          case "RENT":  
140            lblPrice.text("USD");
141            $('[name=property_type_id]').val('rent');
142            if (lang_id == 2) {
143                var instance = $('.js-range-slider-price').data("ionRangeSlider");
144                instance.update({
145                  max: 5000,
146                  from: 0,
147                  to: 5000,
148                });
149            }
150            break;
151          case "THUÊ":  
152            lblPrice.text("triệu");
153            $('[name=property_type_id]').val('rent');
154            break;
155        }
156        $(event.relatedTarget).text(e.target.innerText);
157      });
158    });
159   
160}
161
162let initwRunner = () => {
163    $(".js-range-slider-price").ionRangeSlider(
164    {
165      skin: "round",
166      type: "double",
167      grid: true,
168      min: 0,
169      max: max,
170      from: from,
171      to: to,
172      prefix: ""
173    }
174  );
175  
176    //max = $('.js-range-slider-area').data('max');
177    from = $('.js-range-slider-area').data('from');
178    to = $('.js-range-slider-area').data('to'); 
179  $(".js-range-slider-area").ionRangeSlider(
180    {
181			skin: "round",
182      type: "double",
183      grid: true,
184      min: 0,
185      max: 1000,
186      from: from,
187      to: to,
188      prefix: ""
189  }
190  );
191}
192let addToCart = () => {
193  let banner = $('.cart-banner'),
194    addToCartBtns = $('.add-to-cart');
195    addToCartBtns.each(function (index, value) {
196      let btn = $(this);
197      btn.click(function (e) {
198        banner.addClass("added");
199        $('.num',banner).text(parseInt($('.num',banner).text()) + 1) ; 
200        setTimeout(() => {
201          banner.removeClass("added");
202        }, 3000);
203        return false;
204      });
205    })
206
207}
208
209let dropdownAdvanceMobile = () => {
210  $(".search-open").click(function (e) {
211    $('.dropdown-menu-advance-search').toggleClass("show");
212  return false;
213
214});
215}
216
217$(document).ready(function () {
218  if($('.selectpicker').length) {
219    $('.selectpicker').selectpicker();
220  }
221})

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.