1var requests = []; 2var searchParamsRison = ''; 3var resizeCallback; 4var selectedDatepicker; 5var selectedRooms; 6 7class App { 8 constructor() { 9 this.loadSubclass(onetourismo_plugin_url +'/Assets/js/scripts_user.js?l=3'); 10 this.loadSubclass(onetourismo_plugin_url +'/Assets/js/scripts_hotels_form.js?l=3'); 11 this.loadSubclass(onetourismo_plugin_url +'/Assets/js/scripts_hotels_grid.js?l=3'); 12 this.loadSubclass(onetourismo_plugin_url +'/Assets/js/scripts_hotels_map.js?l=3'); 13 this.loadSubclass(onetourismo_plugin_url +'/Assets/js/scripts_hotels_rooms.js?l=3'); 14 this.loadSubclass(onetourismo_plugin_url +'/Assets/js/scripts_hotels_hotel.js?l=3'); 15 16 // this.loadSubclass(onetourismo_plugin_url +'/Assets/js/requests.js?l=3'); 17 // this.loadSubclass(onetourismo_plugin_url +'/Assets/js/payments.js?l=3'); 18 this.loadSubclass(onetourismo_plugin_url +'/Assets/js/invoice.js?l=3'); 19 this.loadSubclass(onetourismo_plugin_url +'/Assets/js/scripts_hotels_checkout.js?l=3'); 20 21 this.loadSubclass(onetourismo_plugin_url +'/Assets/js/scripts_activities_form.js?l=3'); 22 this.loadSubclass(onetourismo_plugin_url +'/Assets/js/scripts_activities.js?l=3'); 23 this.loadSubclass(onetourismo_plugin_url +'/Assets/js/scripts_activities_activity.js?l=3'); 24 25 AOS.init({ 26 easing: 'ease-in-out-sine', 27 duration: 300, 28 delay: 300, 29 once: true, 30 disable: 'mobile' 31 }); 32 33 this.GUI(); 34 this.initListeners(); 35 } 36 37 GUI() { 38 if (jQuery(window).width() <= 768) { 39 jQuery('.mobile-filters').html('<div class="close-filters">X</div>' + jQuery('.desktop-filters').html()); 40 } 41 42 // if (jQuery('.description-act').outerHeight() < 400) { 43 // jQuery('.read-more-activities').remove(); 44 // } 45 46 jQuery(document).ready(function() { 47 jQuery('.ot_pp svg').addClass('visible_icon'); 48 49 setTimeout(function() { 50 jQuery('.exclude-select2').removeClass('select2-hidden-accessible'); 51 }, 1000); 52 53 setTimeout(function() { 54 jQuery('.ot_pp svg').addClass('visible_icon'); 55 }, 1000) 56 }) 57 58 jQuery('.ot_pp .onetourismo-app-tabs-item:first-child').addClass('selected'); 59 60 jQuery(".main-search .s_col.button").css("margin-top", jQuery(".main-search .s_col.destination label").outerHeight()); 61 62 if (jQuery('#map_hotels').length == 0) { 63 jQuery(".sidebar-filters .filters").css("margin-top", jQuery(".results-header").outerHeight()); 64 } 65 66 jQuery('.item-entry p.label').matchHeight(); 67 jQuery('.item-entry h1').matchHeight(); 68 jQuery('.item-entry p.address').matchHeight(); 69 70 jQuery('.activity-info .name-act').matchHeight(); 71 jQuery('.activity-info .duration-act').matchHeight(); 72 jQuery('.activity-info .type-act').matchHeight(); 73 74 window.onresize = function() { 75 clearTimeout(resizeCallback); 76 resizeCallback = setTimeout(OnetApp.resizedw, 100); 77 }; 78 79 jQuery(document).on("scroll", function() { 80 AOS.refresh(); 81 }); 82 83 if (jQuery('.ot_pp #input-min').length > 0) { 84 jQuery(".js-range-slider").ionRangeSlider({ 85 type: "double", 86 grid: false, 87 step: 1, 88 min: jQuery('.ot_pp #input-min').val(), 89 max: jQuery('.ot_pp #input-max').val(), 90 from: jQuery('.ot_pp #input-min-sel').val(), 91 to: jQuery('.ot_pp #input-max-sel').val(), 92 prefix: "â¬", 93 onFinish: function(data) { 94 jQuery('.ot_pp #input-min-sel').val(data.from); 95 jQuery('.ot_pp #input-max-sel').val(data.to); 96 97 if (pageFilter == 'hotel') { 98 OnetAppHotelsGrid.filterHotelResults(); 99 } 100 else { 101 OnetAppActivities.filterActivitiesResults(); 102 } 103 } 104 }); 105 106 jQuery(".js-range-stars-slider").ionRangeSlider({ 107 type: "double", 108 grid: false, 109 min: jQuery('.ot_pp #input-min-stars').val(), 110 max: jQuery('.ot_pp #input-max-stars').val(), 111 from: jQuery('.ot_pp #input-min-stars-sel').val(), 112 to: jQuery('.ot_pp #input-max-stars-sel').val(), 113 prefix: "", 114 onFinish: function(data) { 115 jQuery('.ot_pp #input-min-stars-sel').val(data.from); 116 jQuery('.ot_pp #input-max-stars-sel').val(data.to); 117 118 OnetAppHotelsGrid.filterHotelResults(); 119 } 120 }); 121 } 122 } 123 124 resizedw() { 125 AOS.refresh(); 126 } 127 128 loadSubclass(jsFile) { 129 let footer = document.getElementsByTagName('body')[0]; 130 let script = document.createElement('script'); 131 132 script.src = jsFile; 133 script.type = 'text/javascript'; 134 135 footer.appendChild(script) 136 } 137 138 initListeners() { 139 jQuery('select[name="ptypes"]').on('change', function() { 140 const selectedValue = jQuery(this).val(); 141 jQuery('#packages_search').attr('action', selectedValue); 142 console.log('Form action updated to:', selectedValue); 143 }); 144 145 jQuery('body').on('click', '.ot_pp .onetourismo-app-tabs-item', function(e) { 146 if (!jQuery(this).hasClass('direct-link')) { 147 e.preventDefault(); 148 149 jQuery('.ot_pp .onetourismo-app-tabs-item').removeClass('selected'); 150 jQuery(this).addClass('selected'); 151 152 jQuery('#tab-ot_pp-srch-tb-hotel, #tab-ot_pp-srch-tb-packages, #tab-ot_pp-srch-tb-cruises, #tab-ot_pp-srch-tb-activities').addClass('hide-form'); 153 jQuery('#tab-' + jQuery(this).attr('id')).removeClass('hide-form'); 154 } 155 }) 156 jQuery('body').on('click', '.btn-group .dropdown-toggle', function() { 157 jQuery('.btn-group .dropdown-menu.show').removeClass('show'); 158 jQuery(this).next().toggleClass('show'); 159 }); 160 161 jQuery('body').on('click', '.dropdown-toggle-btn', function() { 162 jQuery('.dropdown-menu.show').removeClass('show'); 163 jQuery(this).next().toggleClass('show'); 164 }); 165 166 jQuery('.mobile-filters .close-filters').click(function() { 167 jQuery('.mobile-filters').toggleClass('show-them'); 168 }); 169 170 jQuery('.mobile-filter-results').click(function(e) { 171 e.preventDefault(); 172 173 jQuery('.mobile-filters').toggleClass('show-them'); 174 }); 175 176 177 jQuery('.clear_filters').click(function() { 178 if (pageFilter == 'hotel') { 179 OnetAppHotelsGrid.clearfilterHotelResults(); 180 } 181 else { 182 OnetAppActivities.clearfilterActivityResults(); 183 } 184 }); 185 186 jQuery('.ot_pp .flt-item .form-check-input').change(function() { 187 let thisID = jQuery(this).attr('id'); 188 189 jQuery('.sidebar-filters .' + thisID).prop('checked', jQuery(this).prop('checked')); 190 }) 191 192 jQuery('.ot_pp .flt-item .form-check .form-check-label').click(function() { 193 jQuery(this).prev().trigger('click'); 194 }) 195 196 jQuery('body').on('click', '.ot_pp .flt-item .form-check .form-check-label', function() { 197 jQuery(this).prev().trigger('click'); 198 }) 199 200 jQuery('.ot_pp .flt-item input').click(function() { 201 clearTimeout(checkedTimeout); 202 203 checkedTimeout = setTimeout(function() { 204 if (pageFilter == 'hotel') {
205 OnetAppHotelsGrid.filterHotelResults(); 206 } 207 else { 208 OnetAppActivities.filterActivitiesResults(); 209 } 210 }, 1000); 211 }); 212 213 jQuery('.entries-list .pagination .page-item .page-link').click(function(e) { 214 e.preventDefault(); 215 216 if (jQuery('#map_hotels').length == 0) { 217 let selPage = jQuery(this).attr('data-page'); 218 219 if (selPage != '') { 220 OnetApp.setUrlParam('page', selPage, true, true); 221 } 222 } 223 }); 224 225 jQuery('.ot_pp .dropdown-menu li .dropdown-item').click(function(e) { 226 e.preventDefault(); 227 228 if ((!jQuery(this).parent().parent().hasClass('all-currencies')) && (!jQuery(this).parent().parent().hasClass('all-languages'))) { 229 if (jQuery('.otpp-checkout').length == 0) { 230 let sortBy = jQuery(this).attr('data-sort'); 231 let requestID = jQuery('.ot_pp').attr('data-id'); 232 233 OnetApp.setUrlParam('sort', sortBy, true, false); 234 235 if (pageFilter == 'hotel') { 236 OnetAppHotelsGrid.filterHotelResults(); 237 } 238 else { 239 OnetAppActivities.filterActivitiesResults(); 240 } 241 } 242 } 243 }); 244 245 jQuery(document).click(function(event) { 246 var $target = jQuery(event.target); 247 248 if (!$target.closest('.dropdown').length) { 249 jQuery('.dropdown-menu').removeClass('show'); 250 } 251 }); 252 } 253 254 localStorage(action, key, value = '') { 255 switch (action) { 256 case "get": 257 let val = localStorage.getItem(key); 258 return val ? JSON.parse(val) : null; 259 break; 260 261 case "set": 262 localStorage.setItem(key,JSON.stringify(value)); 263 break; 264 265 case "remove": 266 localStorage.removeItem(key); 267 break; 268 } 269 } 270 271 httpGet(url, values) { 272 return new Promise( 273 function (resolve, reject) { 274 const request = new XMLHttpRequest(); 275 requests.push(request); 276 277 let params = JSON.stringify(values); 278 params = JSON.parse(params); 279 280 var data = new FormData(); 281 let toSend = []; 282 283 Object.entries(params).forEach(entry => { 284 const [key, value] = entry; 285 toSend.push(key + '=' + value); 286 }); 287 288 params = toSend.join('&'); 289 request.open('POST', url, true); 290 291 request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 292 293 request.onload = function () { 294 if (this.status === 200) { 295 resolve(this.response); 296 } else { 297 // reject(new Error(this.statusText)); 298 } 299 }; 300 request.onerror = function () { 301 reject(new Error( 302 'XMLHttpRequest Error: '+this.statusText)); 303 }; 304 request.send(params); 305 } 306 ); 307 } 308 309 setCookie(name,value,days) { 310 var expires = ""; 311 if (days) { 312 var date = new Date(); 313 date.setTime(date.getTime() + (days*24*60*60*1000)); 314 expires = "; expires=" + date.toUTCString(); 315 } 316 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 317 } 318 319 getCookie(name) { 320 var nameEQ = name + "="; 321 var ca = document.cookie.split(';'); 322 for(var i=0;i < ca.length;i++) { 323 var c = ca[i]; 324 while (c.charAt(0)==' ') c = c.substring(1,c.length); 325 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 326 } 327 return null; 328 } 329 330 eraseCookie(name) { 331 document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; 332 } 333 334 setUrlParam(param, value, setPageToZero = false, execute = false) { 335 if (searchParamsRison == '') { 336 const urlParams = new URLSearchParams(window.location.search); 337 let searchParams = urlParams.get('search'); 338 searchParamsRison = searchParams; 339 } 340 341 searchParamsRison = searchParamsRison.replace(/\\/g, ''); 342 343 let searchParams = rison.decode(searchParamsRison); 344 345 if (setPageToZero) { 346 if (searchParams.sort == value) { 347 searchParams.reverse = searchParams.reverse !== null ? !searchParams.reverse : false; 348 } else { 349 searchParams.page = 0; 350 } 351 } 352 searchParams[param] = value; 353 searchParams = rison.encode(searchParams); 354 searchParamsRison = searchParams; 355 356 let url; 357 358 if (execute) { 359 if (pageFilter == 'hotel') { 360 if (jQuery('#list_hotels').length == 0) { 361 url = main_url + "/" + hotel_results + "/?search=" + searchParams + '&is_ajax=1'; 362 } 363 else { 364 url = main_url + "/" + hotel_results_map + "/?search=" + searchParams + '&is_ajax=1'; 365 } 366 } 367 else { 368 url = main_url + "/" + activities_results + "/?search=" + searchParams + '&is_ajax=1'; 369 } 370 371 console.log(searchParams); 372 373 window.location.href = url; 374 } 375 } 376} 377 378OnetApp = new App();
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.