PageSourceSearch

https://faciliteacasa.com/caixa/js/home.js?1790087248

js faciliteacasa.com collected 2026-10-08 23:16:25 UTC 39,291 bytes, 850 lines download raw bytes

1/**
2 * When the google static map img fails it will load the default image.
3 * @param {object} img The img element.
4 */
5function googleMapStaticImgError(img){
6    img.src = img.getAttribute('data-alt-src')
7    console.error('Static map load failed.');
8}
9
10(function() {
11    let check_resize_timeout;
12    let saved_searches_glide = null;
13    let discount_properties_glide = null;
14    let location_carousel_glide = null;
15
16    /**
17     * Render the location section for small screens.
18     */
19    function renderSmallScreenLocationSection(){
20        let location_carousel = document.querySelector('.glide-locations')
21        if (location_carousel !== null) {
22            return;
23        }
24
25        let properties_items = '';
26        for(i in location_properties.location_title) {
27            const image_id = location_properties.location_img[i]
28            const location_url = properties_url + location_properties.location_qobrix_url[i]
29            properties_items += `<li class="glide__slide carousel-location-group__item" data-url="${location_url}">
30                <div class="carousel-location-group__item__title">${location_properties.location_title[i]}</div>
31                <img src="/files/download/${image_id}" class="carousel-location-group__item__img" alt="Location image" loading="lazy"/>
32            </li>`
33        }
34        const html = `<div class="glide glide-locations">
35            <div class="glide__track pb-[32px]" data-glide-el="track">
36                <ul class="glide__slides">
37                ${properties_items}
38                </ul>
39            </div>
40            <div class="glide__arrows" data-glide-el="controls">
41                <div class="glide__arrow glide__arrow--left group" data-glide-dir="<">
42                    <svg width="32" height="32" viewBox="0 0 32 32" fill="none" class="stroke-black group-hover:stroke-white" xmlns="http://www.w3.org/2000/svg">
43                        <path d="M23 16H11" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
44                        <path d="M15 21L10 16L15 11" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
45                    </svg>
46                </div>
47                <div class="glide__arrow glide__arrow--right group" data-glide-dir=">">
48                    <svg width="32" height="32" viewBox="0 0 32 32" fill="none" class="stroke-black group-hover:stroke-white" xmlns="http://www.w3.org/2000/svg">
49                        <path d="M9 16H21" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
50                        <path d="M17 21L22 16L17 11" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
51                    </svg>
52                </div>
53            </div>
54        </div>`
55
56        const location_sm_elm = document.querySelector('.location-section-sm')
57        location_sm_elm.insertAdjacentHTML("beforeend", html)
58
59        location_carousel_glide = new Glide('.glide-locations', {
60            type: 'carousel',
61            startAt: 0,
62            perView: 2,
63            gap: 10,
64            breakpoints: {
65                425: {
66                    perView: 1
67                },
68                768: {
69                    perView: 2
70                }
71            }
72        }).mount();
73
74        const carousel_Location_items = document.querySelectorAll('.carousel-location-group__item');
75        carousel_Location_items.forEach(item => {
76            item.addEventListener('click', function() {
77                const location_url = item.getAttribute('data-url');
78                const location_name = item.querySelector('.carousel-location-group__item__title').textContent;
79                if (typeof TealiumTracker !== 'undefined') {
80                    const tealium_object = new TealiumTracker();
81
82                    const event_data = {
83                        "events": 'click_productsModule',
84                        "event_category": 'modulo descubre la oferta inmobiliaria',
85                        "event_action": 'click en modulo',
86                        "event_label": location_name.trim()
87                    };
88                    tealium_object.trackEvent(event_data, 'link');
89                }
90                window.location = location_url;
91            })
92        });
93    }
94
95    function checkScreenSize(){
96        clearTimeout(check_resize_timeout);
97        check_resize_timeout = setTimeout(() => {
98            const search_section = document.querySelector('.homepage-single-location-section');
99            const search_placeholder = document.querySelector('.qcf-single-select-ajax .qcf-field-group__label')
100
101            let window_width = window.innerWidth;
102            if (window_width < 1024) {
103                search_placeholder.innerHTML = search_section.getAttribute('data-search-placeholder-sm')
104                enableSavedSearchGlide()
105                renderSmallScreenLocationSection()
106            } else if (window_width < 1280) {
107                renderSmallScreenLocationSection()
108            } else {
109                search_placeholder.innerHTML = search_section.getAttribute('data-search-placeholder-lg')
110                if (saved_searches_glide) {
111                    saved_searches_glide.destroy();
112                    saved_searches_glide = null;
113                }
114            }
115        }, 200);
116    }
117
118    /**
119     * Enable saved search slider.
120     */
121    function enableSavedSearchGlide(){
122        if (!saved_searches_glide) {
123            const saved_searches_elem = document.querySelector('.glide
123-saved-searches')
124            if (saved_searches_elem === null) {
125                return;
126            }
127
128            saved_searches_glide = new Glide('.glide-saved-searches', {
129                type: 'slider',
130                startAt: 0,
131                perView: 3,
132                gap: 24,
133                breakpoints: {
134                    425: {
135                        perView: 1
136                    },
137                    768: {
138                        perView: 2
139                    },
140                    1023: {
141                        perView: 2
142                    },
143                    1024: {
144                        perView: 3
145                    },
146                    1439: {
147                        perView: 3,
148                    },
149                    1440: {
150                        perView: 4
151                    }
152                }
153            }).mount()
154        }
155    }
156
157    /**
158     * Enable saved search slider.
159     */
160    function enableDiscountPropertiesGlide(){
161        if (!discount_properties_glide) {
162            const saved_searches_elem = document.querySelector('.glide-properties')
163            if (saved_searches_elem === null) {
164                return;
165            }
166
167            discount_properties_glide = new Glide('.glide-properties', {
168                type: document.querySelectorAll('.glide-properties .glide__slide').length <= 4 ? 'slider' : 'carousel',
169                startAt: 0,
170                perView: 4,
171                gap: 24,
172                breakpoints: {
173                    767: {
174                        perView: 1
175                    },
176                    768: {
177                        perView: 2
178                    },
179                    1023: {
180                        perView: 2
181                    },
182                    1024: {
183                        perView: 3
184                    },
185                    1439: {
186                        perView: 3,
187                    },
188                    1440: {
189                        perView: 4
190                    }
191                }
192            }).mount()
193        }
194    }
195
196    const startBtn = document.getElementById("startPolygonBtn");
197    if (startBtn) {
198        startBtn.addEventListener("polygon:drawing-started-btn", function() {
199            if (typeof TealiumTracker !== 'undefined') {
200                const tealium_object = new TealiumTracker();
201                const event_data = {
202                    "event_category": "mapa poligonal",
203                    "event_action": "click en boton",
204                    "event_label": "dibuja tu zona",
205                    "events": "click_poligonalMap",
206                };
207                tealium_object.trackEvent(event_data, 'link');
208
209                setTimeout(() => {
210                    const view_event_data = {
211                        "events": "pageview",
212                    };
213                    tealium_object.trackEvent(view_event_data, 'view');
214                }, 100);
215            }
216        });
217
218        startBtn.addEventListener("polygon:drawing-cancelled-btn", function() {
219            if (typeof TealiumTracker !== 'undefined') {
220                const tealium_object = new TealiumTracker();
221                const event_data = {
222                    "event_category": "mapa poligonal",
223                    "event_action": "click en boton",
224                    "event_label": "cancelar",
225                    "events": "click_poligonalMap",
226                };
227                tealium_object.trackEvent(event_data, 'link');
228            }
229        });
230
231        const polygonMapContainer = document.getElementById("map-polygon");
232        if (polygonMapContainer) {
233            polygonMapContainer.addEventListener("click", function(e) {
234                const closeBtn = e.target.closest(".closeIcon_polygon");
235                if (closeBtn) {
236                    if (typeof TealiumTracker !== 'undefined') {
237                        const tealium_object = new TealiumTracker();
238
239                        const event_data = {
240                            "event_category": "mapa poligonal",
241                            "event_action": "click en boton",
242                            "event_label": "definir zona",
243                            "events": "click_poligonalMap",
244                        };
245                        tealium_object.trackEvent(event_data, 'link');
246                    }
247                }
248            });
249
250            polygonMapContainer.addEventListener("polygon:no-properties-found", function() {
251                if (typeof TealiumTracker !== 'undefined') {
252                    const tealium_object = new TealiumTracker();
253                    const event_data = {
254                        "page_category": "inmuebles no encontrados",
255                        "events": "pageview",
256                    };
257                    tealium_object.trackEvent(event_data, "view");
258                }
259            });
260        }
261
262        startBtn.addEventListener("polygon:drawing-finished-btn", function(e) {
263            if (typeof TealiumTracker !== 'undefined') {
264                const tealium_object = new TealiumTracker();
265                const event_data = {
266                    "event_category": "mapa poligonal",
267                    "event_action": "click en boton",
268                    "event_label": startBtn.textContent.trim().toLowerCase(),
269                    "events": "click_poligonalMap",
270                };
271                tealium_object.trackEvent(event_data, 'link');
272            }
273
274            const urlParams = new URLSearchParams(window.location.search);
275
276            const saleRent = urlParams.get("sale_rent") || "for_sale";
277            let url = properties_url;
278            if (saleRent === "for_rent") {
279                url += "/alquilar/";
280            } else {
281                url += "/comprar/";
282            }
283            url += "?area_of_interest=" + encodeURIComponent(e.detail.coordsString);
284            // The zone was drawn on a map, so the catalog opens on its map view: the
285            // desktop tab and the mobile full-screen map are restored from different
286            // parameters, and the width breakpoint is the one the catalog itself uses.
287            url += window.innerWidth > 1024 ? "&tab=section-map" : "&view_mode=mapa";
288            window.location.href = url;
289        })
290    }
291
292    document.addEventListener('DOMContentLoaded',function(){
293        const urlParams = new URLSearchParams(window.location.search);
294
295        if (polygonSearchEnabled === 'yes') {
296            QoetixMapPolygon.saleRent = urlParams.get("sale_rent") || "for_sale";
297        }
298
299        QoetixCustomFields.eventActions();
300        ContactUs.eventAgentTel()
301
302        enableDiscountPropertiesGlide();
303
304        const special_buttons = document.querySelectorAll('.special-checkbox')
305        special_buttons.forEach(btn => {
306            btn.addEventListener('click', function(){
307
308                params = {
309                    id: btn.closest('.saved-search-item').id,
310                    status: btn.checked,
311                }
312
313                fetch('/api/saved-searches/update-status', {
314                    method: 'POST',
315                    body: JSON.stringify(params),
316                    headers: {
317                        'Content-type': 'application/json; charset=UTF-8'
318                    },
319                }).then(function (response) {
320                    return response.json();
321                }).then(function (response) {
322                })
323            })
324        })
325
326        const action_btns = document.querySelectorAll('.saved-search-item__details__title__actions')
327        action_btns.forEach(_action_btn => {
328            _action_btn.addEventListener('click', function(e){
329                e.preventDefault()
330                e.stopPropagation();
331
332                const existing_open = document.querySelectorAll('.saved-search-item__details__title__actions--open')
333                existing_open.forEach(element => {
334                    if (element !== _action_btn) {
335                        element.classList.remove('saved-search-item__details__title__actions--open')
336                    }
337                });
338
339                this.classList.toggle('saved-search-item__details__title__actions--open')
340            })
341        })
342
343        const delete_action_btns = document.querySelectorAll('.saved-search-item__details__title__actions__list__item--delete')
344        delete_action_btns.forEach(_action_btn => {
345            _action_btn.addEventListener('click', function(e){
346                e.preventDefault()
347                e.stopPropagation();
348
349                const deleteSavedSearchModal = new CaixaModal({className: 'saved-searches-delete'});
350                deleteSavedSearchModal.open(`<div class="flex flex-col gap-3">
351                        <h4 class="m-0 p-0 pt-[54px] text-[24px] leading-[28.8px] text-theme-primary-color font-medium text-[#333333] text-center">Eliminar búsqueda</h4>
352                        <div class="font-[Roboto] text-[16px] leading-[20.8px] text-center">¿Estas seguro que deseas eliminar tu búsqueda? Dejarás de recibir notificaciones de nuevos inmuebles.</div>
353                    </div>
354                <div class="flex flex-col lg:flex-row gap-2">
355                    <button class="saved-search-btn-cancel btn btn-pill btn-secondary font-semibold block text-center order-2 lg:order-1">Cancelar</button>
356                    <button class="saved-search-btn-confirm btn btn-pill btn-primary flex-1 font-semibold block text-center order-1 lg:order-2">Si, eliminar búsqueda</button>
357                </div>
358                `)
359
360                document.querySelector('.saved-search-btn-cancel').addEventListener('click', function(){
361                    deleteSavedSearchModal.close()
362                })
363
364                document.querySelector('.saved-search-btn-confirm').addEventListener('click', function(){
365                    if (this.classList.contains('disabled')) {
366                        return;
367                    }
368
369                    this.classList.add('disabled')
370
371                    fetch('/api/saved-searches/delete/' + _action_btn.closest('.saved-search-item').getAttribute('id'), {
372                        method: 'DELETE',
373                        headers: {
374                            'Content-type': 'application/json; charset=UTF-8',
375                        },
376                    }).then(function (response) {
377                        return response.json();
378                    }).then(function (response) {
379                        if (response.status) {
380                            window.location.reload();
381                        } else {
382                            deleteSavedSearchModal.close()
383
384                            console.error('Failed to delete lead');
385                        }
386                    })
387                })
388            })
389        })
390
391        const edit_action_btns = document.querySelectorAll('.saved-search-item__details__title__actions__list__item--edit')
392        edit_action_btns.forEach(_action_btn => {
393            _action_btn.addEventListener('click', function(e){
394                e.preventDefault()
395                e.stopPropagation();
396
397                const editSavedSearchModal = new CaixaModal({className: 'saved-searches-delete'});
398                editSavedSearchModal.open(`<div class="flex flex-col gap-3">
399                    <h4 class="m-0 p-0 pt-[54px] text-[24px] leading-[28.8px] text-theme-primary-color font-medium text-[#333333]">Renombrar búsqueda</h4>
400                </div>
401                <div class="flex flex-col gap-2">
402                    <div class="font-[Roboto] text-[12px] leading-[14.06px] text-[#000000]">Colocarle un nombre a la búsqueda</div>
403                    <div>
404                        <input type="text" class="py-3 px-2 border border-solid border-[#
404E8E7E1] focus:outline-none rounded-[8px] font-[Roboto] w-full text-[14px] leading-[16.41px] box-border" name="saved_search_name" id="saved_search_name" placeholder="Viviendas en ${_action_btn.getAttribute('data-district')}" value="${_action_btn.getAttribute('data-name')}">
405                    </div>
406                </div>
407                <div class="flex flex-col lg:flex-row gap-2">
408                    <button class="saved-search-btn-cancel btn btn-pill btn-secondary font-semibold block text-center order-2 lg:order-1">Cancelar</button>
409                    <button class="saved-search-btn-confirm btn btn-pill btn-primary flex-1 font-semibold block text-center order-1 lg:order-2">Renombrar búsqeda</button>
410                </div>
411                `)
412
413                document.querySelector('.saved-search-btn-cancel').addEventListener('click', function(){
414                    editSavedSearchModal.close()
415                })
416
417                document.querySelector('.saved-search-btn-confirm').addEventListener('click', function(){
418                    if (this.classList.contains('disabled')) {
419                        return;
420                    }
421
422                    this.classList.add('disabled')
423                    const new_lead_name = document.querySelector('#saved_search_name')?.value ?? '';
424                    fetch('/api/saved-searches/update/' + _action_btn.closest('.saved-search-item').getAttribute('id') + '/' + new_lead_name, {
425                        method: 'POST',
426                        body: JSON.stringify({custom_saved_search_name: new_lead_name}),
427                        headers: {
428                            'Content-type': 'application/json; charset=UTF-8'
429                        },
430                    }).then(function (response) {
431                        return response.json();
432                    }).then(function (response) {
433                        if (response.status) {
434                            window.location.reload();
435                        } else {
436                            editSavedSearchModal.close()
437
438                            console.error('Failed to update lead');
439                        }
440                    })
441                })
442            })
443        })
444
445        checkScreenSize()
446
447        window.addEventListener('resize', checkScreenSize);
448
449        const sale_rent_btns = document.querySelectorAll('.for-sale-rent-btns__item')
450        sale_rent_btns.forEach(btn => {
451            btn.addEventListener('click', function(){
452                if (typeof TealiumTracker !== 'undefined') {
453                    const tealium_object = new TealiumTracker();
454                    let event_data = {
455                        "events": 'click_singleFilter',
456                        "event_category": 'filtro simple',
457                        "event_action": 'click en filtro compra_alquiler',
458                        "event_label": 'aplicar filtro ' + this.innerText.trim().toLowerCase()
459                    };
460                    tealium_object.trackEvent(event_data, 'link');
461                }
462                if (this.classList.contains('for-sale-rent-btns__item--active')) {
463                    return;
464                }
465
466                document.querySelectorAll('.for-sale-rent-btns__item--active').forEach(_btn => {
467                    _btn.classList.remove('for-sale-rent-btns__item--active')
468                })
469
470                this.classList.add('for-sale-rent-btns__item--active')
471
472                window.location = window.location.pathname + '?sale_rent=' + this.getAttribute('data-value');
473           
474            })
475        })
476
477        const search_btn = document.querySelector('#search_btn')
478        search_btn.addEventListener('click', function() {
479            const parent_group = document.querySelector('.qcf-select-ajax--single-location')
480            const location_input = document.querySelector('input[name="location"]')
481            const search_helper = document.querySelector('.search_helper');
482            const search_input = document.querySelector('#search_location');
483            const search_value = search_input ? search_input.value : '';
484            const event_data = {
485                "event_label": search_btn.textContent,
486                "page_internal_search_kw": search_value
487            };
488            if (location_input === null) {
489                parent_group.classList.add('has-error')
490                search_helper.innerHTML = 'Escribe un criterio de búsqueda para comenzar. ';
491                search_helper.classList.add('search_helper--has-error')
492                search_input.addEventListener('change', function fn(){
493                    search_helper.innerHTML = '';
494                    search_helper.classList.remove('search_helper--has-error')
495                    parent_group.classList.remove('has-error')
496                    search_input.removeEventListener('change', fn)
497                });
498                event_data.events = "pageview";
499                event_data.page_subcategory1 = "buscador error";
500                if (typeof TealiumTracker !== 'undefined') {
501                    const tealium_object = new TealiumTracker();
502                    tealium_object.trackEvent(event_data, 'view');
503                }
504            } else {
505                search_helper.innerHTML = '';
506                search_helper.classList.remove('search_helper--has-error')
507                parent_group.classList.remove('has-error')
508                const location_arr = location_input.value.split('.');
509
510                const sale_rent = document.querySelector('.for-sale-rent-btns__item--active')?.getAttribute('data-value') ?? 'for_sale';
511
512                const route = new PropertiesRoute(sale_rent, null, location_arr[0]);
513
514                if (location_arr[1] !== '*') {
515                    route.params.area = location_arr[1];
516                }
517
518                if (location_arr[2] !== '*') {
519                    route.params.subarea = location_arr[2];
520                }
521
522                if (location_arr[3] !== '*') {
523                    route.params.post_code = location_arr[3];
524                }
525
526                event_data.events = "click_searchBar";
527                event_data.event_category = "buscador generico";
528                event_data.event_action = "click en boton";
529                if (typeof TealiumTracker !== 'undefined') {
530                    const tealium_object = new TealiumTracker();
531                    tealium_object.trackEvent(event_data, 'link');
532                }
533
534                window.location = route.buildUrl();
535            }
536        });
537
538        const location_search_result = document.querySelector('.qcf-single-select-ajax.qcf-select-ajax--single-location');
539        location_search_result?.addEventListener('select-ajax:changed', () => {
540            search_btn.click();
541        });
542
543        const location_group_items = document.querySelectorAll('.location-group__item');
544        location_group_items.forEach(item => {
545            item.addEventListener('click', function() {
546                const location_url = item.getAttribute('data-url');
547                const location_name = item.querySelector('.location-group__item__inner__label a').textContent;
548                if (typeof TealiumTracker !== 'undefined') {
549                    const tealium_object = new TealiumTracker();
550
551                    const event_data = {
552                        "events": 'click_productsModule',
553                        "event_category": 'modulo descubre la oferta inmobiliaria',
554                        "event_action": 'click en modulo',
555                        "event_label": location_name.trim()
556                    };
557                    tealium_object.trackEvent(event_data, 'link');
558                }
559                window.location = location_url;
560            })
561        });
562
563        const feature_service_items = document.querySelectorAll('.feature-service-item');
564        feature_service_items.forEach(item => {
565            item.addEventListener('click', function() {
566                if (typeof TealiumTracker !== 'undefined') {
567                    const tealium_object = new TealiumTracker();
568                    const event_data = {
569                        "events": 'click_productsModule',
570                        "event_category": 'modulo hogar facil',
571                        "event_action": 'click en boton',
572                        "event_label": item.querySelector('h3').textContent.trim()
573                    };
574                    tealium_object.trackEvent(event_data, 'link');
575                }
576            })
577        });
578
579        const mortgage_btn = document.querySelector('.mortgage-btn');
580        mortgage_btn.addEventListener('click', function() {
581            if (typeof TealiumTracker !== 'undefined') {
582                const tealium_object = new TealiumTracker();
583                const event_data = {
584                    "events": 'click_mortgage',
585                    "event_category": 'calcular hipoteca',
586                    "event_action": 'click en boton',
587                    "event_label": mortgage_btn.textContent.trim()
588                };
589                tealium_object.trackEvent(event_data, 'link');
590            }
591        });
592
593        const location_list_items = document.querySelectorAll('.location-list__item__areas a');
594        location_list_items.forEach(item => {
595            item.addEventListener('click', function() {
596                const location_name = item.textContent.trim();
597                if (typeof TealiumTracker !== 'undefined') {
598                    const tealium_object = new TealiumTracker();
599                    const event_data = {
600                        "events": 'click_singleFilter',
601                        "event_category": 'filtro simple',
602                        "event_action": 'click en filtro provincias',
603                        "event_label": 'aplicar filtro ' + location_name
604                    };
605                    tealium_object.trackEvent(event_data, 'link');
606                }
607            })
608        });
609
610
611        const property_items = document.querySelectorAll('.property-item');
612        property_items.forEach(item => {
613            item.addEventListener('click', function() {
614                if (typeof TealiumTracker !== 'undefined') {
615                    const tealium_object = new TealiumTracker();
616                    const event_data = {
617                        "events": 'click_productsModule',
618                        "event_category": 'modulo inmuebles mayores rebajas',
619                        "event_action": 'click en producto',
620                        "event_label": item.querySelector('.property-item__inner__row2__details__name').textContent.trim(),
621                        "prod_category": item.dataset.category,
622                        "prod_id": item.dataset.ref,
623                        "prod_rooms": item.dataset.rooms,
624                        "prod_bathrooms": item.dataset.bathrooms,
625                        "prod_type": item.dataset.subcategory,
626                        "prod_surface": item.dataset.surface,
627                        "prod_status": item.dataset.constructionStage === 'completed' ? 'obra nueva' : '' || '',
628                        "prod_floor": item.dataset.floor,
629                        "prod_state": item.dataset.state,
630                        "prod_pvp_price": item.dataset.pvpPrice,
631                        "prod_pvp_sale": item.dataset.pvpSale,
632                        "prod_energy_cert": item.dataset.energyCert,
633                        "prod_owner": item.dataset.agent,
634                        "prod_publication_status": item.dataset.websiteStatus,
635                        "prod_publication_date": item.dataset.publicationDate,
636                        "prod_characteristics": item.dataset.characteristics,
637                        "prod_otherfilters": item.dataset.otherFilters,
638                    };
639                    tealium_object.trackEvent(event_data, 'link');
640                }
641            })
642        });
643
644        const agent_mobile_phones = document.querySelectorAll('.agent-phone-btn')
645        agent_mobile_phones.forEach(_btn => {
646            _btn.addEventListener('click', function(e){
647                e.stopPropagation();
648                const propertyID = _btn.getAttribute('property-id');
649                const property_item = document.querySelector('a.property-item[id="' + propertyID + '"]');
650
651                if (typeof TealiumTracker !== 'undefined') {
652                    const tealium_object = new TealiumTracker();
653                    const event_data = {
654                        "events": 'click_cta',
655                        "event_category": 'ver telefono home',
656                        "event_action": 'click en boton',
657                        "event_label": 'llamar',
658                        "prod_category": property_item.dataset.category,
659                        "prod_id": property_item.dataset.ref,
660                        "prod_rooms": property_item.dataset.rooms,
661                        "prod_bathrooms": property_item.dataset.bathrooms,
662                        "prod_type": property_item.dataset.subcategory,
663                        "prod_surface": property_item.dataset.surface,
664                        "prod_status": property_item.dataset.constructionStage === 'completed' ? 'obra nueva' : '' || '',
665                        "prod_floor": property_item.dataset.floor,
666                        "prod_state": property_item.dataset.state,
667                        "prod_pvp_price": property_item.dataset.pvpPrice,
668                        "prod_pvp_sale": property_item.dataset.pvpSale,
669                        "prod_energy_cert": property_item.dataset.energyCert,
670                        "prod_owner": property_item.dataset.agent,
671                        "prod_publication_status": property_item.dataset.websiteStatus,
672                        "prod_publication_date": property_item.dataset.publicationDate,
673                        "prod_characteristics": property_item.dataset.characteristics,
674                        "prod_otherfilters": property_item.dataset.otherFilters,
675                    };
676                    tealium_object.trackEvent(event_data, 'link');
677                }
678            });
679        });
680
681        const saved_searches_link = document.querySelector('.saved-searches-link');
682        saved_searches_link?.addEventListener('click', function(e) {
683            e.preventDefault();
684            if (typeof TealiumTracker !== 'undefined') {
685                const tealium_object = new TealiumTracker();
686                const count = parseInt(e.currentTarget.dataset.numSaved || 0, 10);
687                const event_data = {
688                    'page_category': 'home',
689                    'event_category': 'ver busquedas guardadas',
690                    'event_action': 'click en texto',
691                    'event_label': e.currentTarget.textContent.trim(),
692                    'num_properties': count,
693                    'num_saved': count,
694                    'events': 'pageview',
695                };
696                tealium_object.trackEvent(event_data, 'view');
697            }
698            window.location.href = e.currentTarget.href;
699        });
700
701        if (polygonSearchEnabled === 'yes') {
702            const locationContainer = document.querySelector(".qcf-select-ajax--single-location");
703            const polygonButton = document.querySelector("#polygon_search_modal--btn");
704            const contentDiv = locationContainer.querySelector(".qcf-field-group__content");
705            const input = locationContainer.querySelector("#search_location");
706            const updateHomeSearchLayout = () => {
707                const hasText = input.value.trim() !== "";
708                if (contentDiv) {
709                    contentDiv.style.display = hasText ? "block" : "none";
710                }
711                if (polygonButton) {
712                    polygonButton.classList.toggle("hidden", hasText);
713                }
714            };
715
716            if (input) {
717                input.addEventListener("input", updateHomeSearchLayout);
718                input.addEventListener("focus", updateHomeSearchLayout);
719            }
720
721            locationContainer.addEventListener("click", function () {
722                if (locationContainer.classList.contains("qcf-field-group--open") && input.value.trim() === "") {
723                    polygonButton.classList.remove("hidden");
724                    if (contentDiv) {
725                        contentDiv.style.display = "none";
726                    }
727                }
728            });
729
730            document.addEventListener("click", function (event) {
731                if (!locationContainer.contains(event.target) && !polygonButton.contains(event.target)) {
732                    polygonButton.classList.add("hidden");
733                    if (contentDiv) {
734                        contentDiv.style.display = "none";
735                    }
736                }
737            });
738
739            const polygonModal = document.getElementById("polygon_search_modal");
740            const polygonOpenBtn = document.getElementById("polygon_search_modal--open");
741            const polygonCloseBtn = document.getElementById("polygon_search_modal--close");
742            polygonOpenBtn.addEventListener("click", () => {
743                if (typeof TealiumTracker !== 'undefined') {
744                    const tealium_object = new TealiumTracker();
745                    const event_data = {
746                        "event_category": 'mapa poligonal',
747                        "event_action": "click en boton",
748                        "event_label": "abrir mapa poligonal",
749                        "events": "click_poligonalMap",
750                    };
751                    tealium_object.trackEvent(event_data, 'link');
752                }
753
754                polygonModal.classList.remove("opacity-0", "pointer-events-none");
755                polygonModal.classList.add("opacity-100", "pointer-events-auto");
756                polygonModal.classList.add("polygon_search_modal--enabled");
757
758                setTimeout(() => {
759                    if (typeof TealiumTracker !== 'undefined') {
760                        const tealium_object = new TealiumTracker();
761                        const event_data = {
762                            "events": "pageview",
763                        };
764                        tealium_object.trackEvent(event_data, 'view');
765                    }
766                }, 100);
767
768                polygonModal.classList.remove("hidden");
769                polygonModal.classList.add("flex");
770                polygonModal.classList.add("polygon_search_modal--enabled");
771                document.body.classList.add("disable-scrolling");
772
773                // Safety net for any close path that did not clean up after itself.
774                if (typeof QoetixMapPolygon !== "undefined") {
775                    QoetixMapPolygon.cancelDrawing(false);
776                }
777
778                QoetixMap.resetMapPosition();
779            });
780
781            polygonCloseBtn.addEventListener("click", () => {
782                polygonModal.classList.remove("flex");
783                polygonModal.classList.add("hidden");
784                polygonModal.classList.remove("polygon_search_modal--enabled");
785                document.body.classList.remove("disable-scrolling");
786
787                // Closing mid-draw interrupts the drawing, so release the viewport with it -
788                // otherwise the map reopens frozen. Not a cancel the user clicked, so no event.
789                if (typeof QoetixMapPolygon !== "undefined") {
790                    QoetixMapPolygon.cancelDrawing(false);
791                }
792            });
793        }
794
795        const trackRenovateEquipAnalytics = (btn) => {
796            if (typeof TealiumTracker !== 'undefined') {
797                const tealium_object = new TealiumTracker();
798                const event_data = {
799                    "events": 'click_productsModule',
800                    "event_category": 'modulo reforma y equipa',
801                    "event_action": 'click en modulo',
802                    "event_label": btn.getAttribute('data-title')
803                };
804                tealium_object.trackEvent(event_data, 'link');
805            }
806        }
807        const renovate_equip_btns = document.querySelectorAll('.renovate-equip-btn');
808        renovate_equip_btns.forEach(btn => {
809            btn.addEventListener('c-modal-redirection:click', () => trackRenovateEquipAnalytics(btn));
810            btn.addEventListener('click', function(e) {
811                if (btn.classList.contains('c-modal-redirection')) {
812                    return;
813                }
814                e.preventDefault();
815                trackRenovateEquipAnalytics(btn);
816                setTimeout(() => {
817                    window.location.href = btn.href;
818                }, 1000);
819
820            });
821        });
822
823        const trackFeatureServiceAnalytics = (btn) => {
824            if (typeof TealiumTracker !== 'undefined') {
825                const tealium_object = new TealiumTracker();
826                const event_data = {
827                    "events": 'click_productsModule',
828                    "event_category": 'modulo todo que necesitas',
829                    "event_action": 'click en modulo',
830                    "event_label": btn.getAttribute('data-title')
831                };
832                tealium_object.trackEvent(event_data, 'link');
833            }
834        }
835        const feature_service_btns = document.querySelectorAll('.feature-service-btn');
836        feature_service_btns.forEach(btn => {
837            btn.addEventListener('c-modal-redirection:click', () => trackFeatureServiceAnalytics(btn));
838            btn.addEventListener('click', function(e) {
839                if (btn.classList.contains('c-modal-redirection')) {
840                    return;
841                }
842                e.preventDefault();
843                trackFeatureServiceAnalytics(btn);
844                setTimeout(() => {
845                    window.location.href = btn.href;
846                }, 1000);
847            });
848        });
849    })
850})();

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.