1(function () { 2 'use strict'; 3 4 var BOOKING = 'https://live.ipms247.com/booking/book-rooms-balekaresortspa'; 5 var CAL_FORMAT = 'dd-mm-yy'; 6 7 console.log('BALEKA_REDIRECT_LOADED'); 8 9 function toEzeeDate(ddmmyyyy) { 10 var p = ddmmyyyy.split('/'); 11 if (p.length !== 3) return ddmmyyyy; 12 return p[0] + '-' + p[1] + '-' + p[2]; 13 } 14 15 function closePopup() { 16 // 1. ESC key (modal config: escToClose = true) 17 document.dispatchEvent(new KeyboardEvent('keydown', { 18 key: 'Escape', 19 code: 'Escape', 20 keyCode: 27, 21 which: 27, 22 bubbles: true 23 })); 24 25 // 2. Click backdrop 26 var backdrop = document.querySelector( 27 '#brxe-uewbmq .x-modal_backdrop, ' + 28 '.book-modal .x-modal_backdrop' 29 ); 30 if (backdrop) { 31 backdrop.click(); 32 } 33 34 // 3. Click all close triggers 35 document.querySelectorAll('.book-modal [data-x-modal-close]').forEach(function (el) { 36 el.click(); 37 }); 38 39 // 4. Remove open classes only (no inline styles â popup can reopen) 40 var modal = document.querySelector('#brxe-uewbmq, .book-modal.x-modal'); 41 if (modal) { 42 modal.classList.remove('x-modal_open'); 43 } 44 document.body.classList.remove('x-modal_open'); 45 document.documentElement.classList.remove('x-modal_open'); 46 } 47 48 function resetPopupStyles() { 49 // Clear old inline styles if previous version broke reopen 50 document.querySelectorAll( 51 '.book-modal, .book-modal .x-modal_backdrop, .book-modal .x-modal_container' 52 ).forEach(function (el) { 53 el.removeAttribute('style'); 54 }); 55 } 56 57 function postToIpms(checkin, checkout, adults, children, rooms) { 58 var f = document.createElement('form'); 59 f.method = 'POST'; 60 f.action = BOOKING; 61 f.target = '_blank'; 62 63 var data = { 64 eZ_chkin: checkin, 65 eZ_chkout: checkout, 66 calformat: CAL_FORMAT, 67 eZ_adult: adults || '2', 68 eZ_child: children || '0', 69 eZ_room: rooms || '1', 70 ArDt: checkin, 71 HotelId: 'balekaresortspa' 72 }; 73 74 for (var key in data) { 75 if (!data.hasOwnProperty(key)) continue; 76 var input = document.createElement('input'); 77 input.type = 'hidden'; 78 input.name = key; 79 input.value = data[key]; 80 f.appendChild(input); 81 } 82 83 document.body.appendChild(f); 84 f.submit(); 85 document.body.removeChild(f); 86 87 closePopup(); 88 setTimeout(closePopup, 100); 89 } 90 91 function fromRoiForm(form) { 92 var entrada = form.querySelector('[name="entrada"]'); 93 var salida = form.querySelector('[name="salida"]'); 94 if (!entrada || !salida) return; 95 96 var checkin = toEzeeDate(entrada.value); 97 var checkout = toEzeeDate(salida.value); 98 99 var adults = '2'; 100 var children = '0'; 101 var rooms = '1'; 102 103 var occInput = form.querySelector('[name="occupancies"]'); 104 if (occInput && occInput.value) { 105 try { 106 var occ = JSON.parse(occInput.value); 107 if (occ[0]) { 108 adults = occ[0].adults || '2'; 109 children = occ[0].children || '0'; 110 } 111 rooms = String(occ.length || 1); 112 } catch (e) {} 113 } 114 115 postToIpms(checkin, checkout, adults, children, rooms); 116 } 117 118 function blockBook(ev) { 119 if (!ev.target.closest('.roi-search-engine__field--action')) return; 120 121 var form = ev.target.closest('.roi-search-engine__form'); 122 if (!form) return; 123 124 ev.preventDefault(); 125 ev.stopImmediatePropagation(); 126 fromRoiForm(form); 127 return false; 128 } 129 130 document.addEventListener('mousedown', blockBook, true); 131 document.addEventListener('click', blockBook, true); 132 133 document.addEventListener('submit', function (ev) { 134 if (!ev.target.classList.contains('roi-search-engine__form')) return; 135 ev.preventDefault(); 136 ev.stopImmediatePropagation(); 137 fromRoiForm(ev.target); 138 }, true); 139 140 // Reset styles when BOOK NOW clicked â popup opens normally again 141 document.addEventListener('click', function (ev) { 142 if (!ev.target.closest('.book-triger')) return; 143 resetPopupStyles(); 144 }, true); 145 146})();
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.