PageSourceSearch

https://www.collegiate-ac.es/propeller/themes/propeller/assets/roomCardsAlternative.7317c3.js

js collegiate-ac.es collected 2026-10-07 16:42:28 UTC 10,734 bytes, 1 lines download raw bytes

1(self.webpackChunkwordpress_template=self.webpackChunkwordpress_template||[]).push([[628],{80:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>u});var n=r(8187),o=r(6236),a=r(4525),i=r(379),l=r(6541);function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var c={filters:[],clonedElement:null};const u=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.element=t,this.roomCardsWrap=document.querySelector(".js-room-cards-alternative-wrap"),this.propertyName=document.body.hasAttribute("data-property")?document.body.getAttribute("data-property"):"",this.countryCode=this.element.dataset.countryCode,this.cityName=document.body.hasAttribute("data-city")?document.body.getAttribute("data-city"):"",this.lang=document.body.getAttribute("data-current-lang"),this.domain=document.body.getAttribute("data-current-domain"),this.toggleFilterClose=document.querySelector(".js-toggle-filter-close-alternative"),this.toggleFilterOpen=document.querySelector(".js-toggle-filter-open-alternative"),this.carousel=null,c.clonedElement||(c.clonedElement=this.roomCardsWrap.cloneNode(!0),this.bindCheckboxFilters()),this.initializeComponents(),this.initStaySelectionForm()}return function(e,t,r){t&&s(e.prototype,t),r&&s(e,r)}
1(e,[{key:"bindCheckboxFilters",value:function(){var e=this;document.querySelectorAll(".js-checkbox-filter-alternative input").forEach((function(t){t.addEventListener("click",(function(t){var r=c.filters.indexOf(t.target.value);-1!==r?c.filters.splice(r,1):c.filters.push(t.target.value),c.filters.length>0&&window.dataLayer&&window.dataLayer.push({event:"filter_rooms",filter_type:c.filters,property_name:e.propertyName}),e.filterRoomCards()}))}))}},{key:"filterRoomCards",value:function(){var t=document.querySelector(".js-room-cards-alternative-wrap");t.innerHTML="",t.appendChild(c.clonedElement.cloneNode(!0)),function(e){var t=e.querySelectorAll(".is-main .js-room-cards-card"),r=e.querySelectorAll(".is-nav .js-room-cards-card");t.forEach((function(e,t){var n=e.getAttribute("data-categories")?e.getAttribute("data-categories").split(","):[];0===c.filters.length||c.filters.some((function(e){return n.includes(e)}))||(e.remove(),r[t]&&r[t].remove())}))}(t),document.querySelectorAll(".js-room-cards-alternative").forEach((function(t){return new e(t)}))}},{key:"initStaySelectionForm",value:function(){var e=document.querySelector(".js-room-cards-alternative-stay-selection");e&&e.addEventListener("change",(function(){var t,r=new FormData(e),n=r.get("academicYear"),o=r.get("bookingType");("shortStay"===o||n&&o)&&(null===(t=document.querySelector(".js-room-cards-alternative-main"))||void 0===t||t.scrollIntoView({behavior:"smooth"}));document.querySelector(".js-choosen-stay").textContent="shortStay"===o?"Short Stay":"Long Stay - ".concat(n||e.getAttribute("data-default-academic-year"))}));var t=document.querySelector(".js-change-stay");t&&e&&t.addEventListener("click",(function(){e.scrollIntoView({behavior:"smooth"})}))}},{key:"initializeComponents",value:function(){var e=this;requestAnimationFrame((function(){if(e.element&&void 0!==e.element)try{e.carousel=new o.Z(e.element).carousel}catch(e){console.log("CarouselCard init error: ",e)}window.dispatchEvent(new Event("resize")),e.bindRoomPlans(),e.bindRoomPlansIncluded(),e.bindRoomBookNow(),e.bindClickOpen(),e.bindToggleFilter();var t=e.element.querySelectorAll(".js-carousel");t.length>0&&Array.from(t).forEach((function(e){new a.default(e),e.querySelectorAll(".js-video").length>0&&new l.Z})),e.initDatePickers()}))}},{key:"initDatePickers",value:function(){var e={},t=new Date;t.setDate(t.getDate()+10),this.element.querySelectorAll(".js-flatpickr-end").forEach((function(r){var o=r.getAttribute("data-room-type-id"),a=new n.Z(r,{altFormat:"d/m/Y",altInput:!0,dateFormat:"Y-m-d",defaultDate:t,disableMobile:!0,minDate:t});e[o]=a}));var r=new Date;r.setDate(r.getDate()+3),this.element.querySelectorAll(".js-flatpickr-start").forEach((function(t){var o=t.getAttribute("data-room-type-id");new n.Z(t,{altFormat:"d/m/Y",altInput:!0,dateFormat:"Y-m-d",defaultDate:r,disableMobile:!0,minDate:r,onChange:function(t){if(0!==t.length){var r=t[0],n=new Date(r);if(n.setDate(n.getDate()+7),e[o]){var a,i;e[o].set("minDate",n);var l=e[o].selectedDates[0];l&&l<n&&e[o].clear(),e[o].jumpToDate((null==e||null===(a=e[o])||void 0===a||null===(i=a.selectedDates)||void 0===i?void 0:i[0])||n,!1),e[o].open()}}else e[o]&&e[o].clear()}})}))}},{key:"bindClickOpen",value:function(){document.querySelectorAll(".js-open-item-alternative").forEach((function(e){e.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest(".c-cards-v2__content");e.target.classList.contains("show-more")&&t.classList.add("open-item"),e.target.classList.contains("show-less")&&t.classList.remove("open-item"),window.dispatchEvent(new Event("resize"))}))}))}},{key:"bindToggleFilter",value:function(){var e=this;if(this.toggleFilterOpen&&this.toggleFilterClose){var t=this.toggleFilterOpen.parentElement.querySelector(".c-room-cards-v2__filter-checkboxes");this.toggleFilterOpen.addEventListener("click",(function(r){t.classList.add("open-filter"),e.toggleFilterOpen.style.display="none",e.toggleFilterClose.style.display="block"})),this.toggleFilterClose.addEventListener("click",(function(r){t.classList.remove("open-filter"),e.toggleFilterOpen.style.display="block",e.toggleFilterClose.style.display="none"}))}}},{key:"bindRoomBookNow",value:function(){var e=this;document.querySelectorAll(".js-room-card-book-now-alternative").forEach((function(t){t.addEventListener("click",(function(){var r=t.closest(".
1js-room-cards-card"),n=r.querySelector(".js-room-card-select");void 0!==window.dataLayer&&window.dataLayer.push({user_id:"",event:"book_room",property:e.propertyName,room_type:r.getAttribute("data-room")?r.getAttribute("data-room"):"",date:n?n.value:"",country:e.countryCode,city:e.cityName})}))}))}},{key:"bindRoomPlans",value:function(){this.element.querySelectorAll(".js-room-plan-cta").forEach(this.bindRoomPlanCTA.bind(this))}},{key:"bindRoomPlanCTA",value:function(e){var t=this;e.addEventListener("click",(function(r){r.preventDefault();var n=e.href,o=t.element.closest(".js-room-cards-alternative-wrap");if(o){var a=o.querySelectorAll(".js-popup");a&&Array.prototype.forEach.call(a,(function(e){if("room_cards"===e.getAttribute("data-popup")){var t=e.querySelector(".js-popup-image");t.src="",t.src=n,e.classList.remove("is-hidden"),new i.Z}}))}}))}},{key:"bindRoomPlansIncluded",value:function(){this.element.querySelectorAll(".js-room-plan-included-cta").forEach(this.bindRoomPlanIncludedCTA.bind(this))}},{key:"bindRoomPlanIncludedCTA",value:function(e){var t=this;e.addEventListener("click",(function(r){r.preventDefault();var n=e.getAttribute("data-room"),o=e.getAttribute("data-content"),a=t.element.closest(".js-room-cards-alternative-wrap");if(a){var l=a.querySelectorAll(".js-popup");l&&(Array.prototype.forEach.call(l,(function(e){if("room_cards_included"===e.getAttribute("data-popup")){var t=e.querySelector(".js-popup-title"),r=e.querySelector(".js-popup-inner");e.classList.remove("is-hidden"),r.innerHTML=o,t.innerHTML=n,new i.Z}})),void 0!==window.dataLayer&&window.dataLayer.push({user_id:"",event:"whats_included",room_type:n,city:t.cityName,country:t.countryCode}))}}))}}]),e}()},4525:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var n=r(6001);function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}const a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.element=t,this.parent=t.parentElement,this.createCarousel()}return function(e,t,r){t&&o(e.prototype,t),r&&o(e,r)}(e,[{key:"createCarousel",value:function(){var e=this;this.carousel=new n.Z(this.element,{autoPlay:!!this.element.hasAttribute("data-autoplay")&&4e3,cellAlign:this.element.hasAttribute("data-cell-align")?this.element.getAttribute("data-cell-align"):"left",draggable:!this.element.hasAttribute("data-prevent-drag"),pageDots:!1,prevNextButtons:!1,setGallerySize:this.element.hasAttribute("data-set-gallery-size"),adaptiveHeight:this.element.hasAttribute("data-adaptive-height"),watchCSS:!0,wrapAround:!this.element.hasAttribute("data-disable-wrap-around"),contain:this.element.hasAttribute("data-carousel-contain"),on:{ready:function(){this.element.classList.add("flickity-ready")},deactivate:function(){this.element.classList.remove("flickity-ready")}}}),this.carousel.on("dragStart",(function(){e.carousel.slider.style.pointerEvents="none"})),this.carousel.on("dragEnd",(function(){e.carousel.slider.style.pointerEvents="auto"})),this.carouselArrows(),this.carouselPager(),this.carouselVideos(),this.carouselLazyload(),this.element.hasAttribute("data-window-id")&&(window[this.element.getAttribute("data-window-id")]=this.carousel)}},{key:"carouselArrows",value:function(){return new Promise(function(e,t){var n,o,a,i;return n=this,o=this.element.querySelectorAll(".js-carousel .js-carousel-arrow"),0===(a=this.parent.querySelectorAll(".js-carousel-arrow")).length?e():Promise.resolve(r.e(735).then(r.bind(r,5261))).then((function(r){try{return i=r.default,Array.prototype.forEach.call(a,(function(e){n.nodelistContainsNode(o,e)||new i(e,n.carousel)})),e()}catch(e){return t(e)}}),t)}.bind(this))}},{key:"carouselPager",value:function(){return new Promise(function(e,t){var n;return(n=this.parent.querySelector(".js-carousel-pager"))?Promise.resolve(r.e(512).then(r.bind(r,315))).then(function(r){try{return new(0,r.default)(n,this.carousel),e()}catch(e){return t(e)}}.bind(this),t):e()}.bind(this))}},{key:"carouselVideos",value:function(){return new Promise(function(e,t){var n,o,a;return n=this,0===(o=this.element.querySelectorAll(".js-video")).length?e():Promise.resolve(r.e(133).then(r.bind(r,2737))).then((function(r){try{return a=r.default,Array.prototype.forEach.call(o,(function(e){var t=0;window.innerWidth<700&&(t=3e3),setTimeout((function(){new a(e,n.carousel)}),t)}
1)),e()}catch(e){return t(e)}}),t)}.bind(this))}},{key:"nodelistContainsNode",value:function(e,t){for(var r=0;r<e.length;r++){if(e[r]===t)return!0}return!1}},{key:"carouselLazyload",value:function(){var e=this;this.carousel.cells&&this.carousel.getCellElements().forEach((function(t){var r=t.querySelectorAll(".js-lazyload:not(js-video-image)");if(r.length>0)for(var n=0;n<r.length;n++)r[n].addEventListener("lazyloaded",(function(){return e.carousel.cellSizeChange(t)}),{once:!0})}))}}]),e}()}}]);

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.