1csrf_token = $('meta[name="csrf-token"]').attr('content') 2daterangepicker_format = $('meta[name="daterangepicker_format"]').attr('content'); 3 4$(document).ready(function () { 5 //Detail Page Room BEGIN 6 if(CURRENT_ROUTE_NAME == 'room_details') { 7 $("#detail-gallery").lightSlider({ 8 gallery: false, 9 item: 1, 10 loop: true, 11 pager: false, 12 thumbItem: 9, 13 slideMargin: 0, 14 enableDrag: false, 15 enableTouch: false, 16 currentPagerPosition: "left", 17 onSliderLoad: function (el) { 18 el.lightGallery({ 19 selector: "#detail-gallery .lslide", 20 subHtmlSelectorRelative: true, 21 mode: "lg-fade", 22 closable: true, 23 autoWidth: true, 24 mousewheel: false, 25 enableDrag: true, 26 enableSwipe: true, 27 loop: true, 28 hideControlOnEnd: true, 29 slideEndAnimatoin: false, 30 thumbItem: 5, 31 thumbnail: true, 32 animateThumb: true, 33 }); 34 }, 35 }); 36 } 37 //Detail Page Room END 38 39 setTimeout(() => { 40 $('.skel-static').removeClass("skel-static"); 41 $('.skel-static-img').removeClass("skel-static-img"); 42 $('.skel-static-home-img').removeClass("skel-static-home-img"); 43 $('.skel-static-gallery').removeClass("skel-static-gallery"); 44 $('.skel-inside-load').removeClass("skel-inside-load"); 45 },500); 46 47 48 $(".wish-list").click(function () { 49 $(".wishlist-icon") 50 .removeClass("bi-heart") 51 .toggleClass("bi-heart-fill"); 52 }); 53 54 $(".nav-input-child").click(function () { 55 $(".nav-input-child").removeClass("active"); 56 $(this).addClass("active"); 57 }); 58 59 //Profile Menu Active BEGIN 60 $(".profile-menu-ul li").click(function () { 61 $(".profile-menu-ul li").removeClass("active"); 62 $(this).addClass("active"); 63 }); 64 //Profile Menu Active END 65 66 //Filter Menu Active BEGIN 67 $(".guest-main-div ul li").click(function () { 68 $(".guest-main-div ul li").removeClass("active"); 69 $(this).addClass("active"); 70 }); 71 //Filter Menu Active END 72 73 //Navbar Open BEGIN 74 $(".action-navbar").click(function () { 75 $(".select-search-fixed").addClass("expand-nav"); 76 $('.show_search_error').addClass('d-none') 77 $('.show_latlng_error').addClass('d-none') 78 $('body').addClass('overflow-hidden') 79 }); 80 81 $('body').click(function(event) { 82 // Check if the clicked element is not inside a 'nav' element 83 if (!$(event.target).closest('nav').length && !$(event.target).parents('.table-condensed').length) { 84 $(".select-search-fixed").removeClass("expand-nav"); 85 $('.suggest-location-div').dropdown('hide'); 86 $('.header-guest').dropdown('hide'); 87 $('body').removeClass('overflow-hidden'); 88 } 89 }); 90 //Navbar Open END 91 92 //Detail Page Scrollspy Navbar BEGIN 93 $(window).scroll(function() { 94 if (window.pageYOffset > 580) { 95 $(".detail-scrollspy").addClass("detail-scroll-translate"); 96 } else { 97 $(".detail-scrollspy").removeClass("detail-scroll-translate"); 98 } 99 }); 100 //Detail Page Scrollspy Navbar BEGIN 101 102 //Default Show Location Box BEGIN 103 $('.any-where').click(function(e){ 104 // e.stopPropagation(); 105 setTimeout(function () { 106 $('.suggest-location-div').dropdown('toggle'); 107 }, 100); 108 109 }); 110 $('.guests').click(function(e){ 111 setTimeout(function () { 112 $('.header-guest').dropdown('toggle'); 113 }, 100); 114 115 }); 116 117 $('.any-week').click(function(e){ 118 setTimeout(function () { 119 $('#checkin-nav').focus(); 120 }, 300); 121 122 }); 123 //Default Show Location Box END 124 125 //Hide Default Show Location BEGIN 126 $("#guests-nav, #checkin-nav, #checkout-nav, .desktop-nav").click(function () { 127 $('.suggest-location-div').dropdown('hide'); 128 $('.become-host-dropdown').dropdown('hide'); 129 }); 130 $("#checkin-nav, #checkout-nav, #location-nav, .desktop-nav").click(function () { 131 $('.header-guest').dropdown('hide'); 132 });
133 //Hide Default Show Location END 134}); 135 136// disable form when submit 137function disable_form(element) { 138 $(element).css('pointer-events', 'none') 139} 140 141app.controller("new_home", [ 142 "$scope", 143 "$http", 144 "$rootScope", 145 "$filter", 146 function ($scope, $http, $rootScope, $filter) { 147 $scope.property_loading = false 148 $scope.just_booked_loading = false 149 $scope.our_community_loading = false 150 $scope.most_viewed_loading = false 151 152 $scope.slickConfig = { 153 enabled: true, 154 draggable: false, 155 rtl: $("html").attr('lang') == 'ar' ? true : false, 156 prevArrow: 157 "<button type='button' class='slick-prev pull-left room-card-btn' aria-label='Slide-left'><i class='bi bi-arrow-left'></i></button>", 158 nextArrow: 159 "<button type='button' class='slick-next pull-right room-card-btn' aria-label='Slide-right'><i class='bi bi-arrow-right'></i></i></button>", 160 responsive:[ 161 { 162 breakpoint: 2500, 163 settings: { 164 slidesToShow: 6, 165 }, 166 }, 167 { 168 breakpoint: 1800, 169 settings: { 170 slidesToShow: 5, 171 }, 172 }, 173 { 174 breakpoint: 1400, 175 settings: { 176 slidesToShow: 5, 177 }, 178 }, 179 { 180 breakpoint: 1200, 181 settings: { 182 slidesToShow: 4, 183 }, 184 }, 185 { 186 breakpoint: 991, 187 settings: { 188 slidesToShow: 3, 189 }, 190 }, 191 { 192 breakpoint: 576, 193 settings: { 194 slidesToShow: 1, 195 }, 196 }, 197 ], 198 }; 199 $scope.slickConfigRoomImg = { 200 enabled: true, 201 draggable: false, 202 dots: true, 203 rtl: $("html").attr('lang') == 'ar' ? true : false, 204 prevArrow: 205 "<button type='button' class='slick-prev pull-left room-arow-btn' aria-label='Slide-left'><i class='bi bi-chevron-left'></i></button>", 206 nextArrow: 207 "<button type='button' class='slick-next pull-right room-arow-btn' aria-label='Slide-right'><i class='bi bi-chevron-right'></i></i></button>", 208 }; 209 $scope.slickConfigTypes = { 210 enabled: true, 211 draggable: false, 212 rtl: $("html").attr('lang') == 'ar' ? true : false, 213 prevArrow: 214 `<div class='arrow-shadow arrow-left'><img loading='lazy' src='${APP_URL}/images/chevron-left-circle.svg' alt='Site Logo' class='img-arrow left'></img></img>`, 215 nextArrow: 216 `<div class='arrow-shadow arrow-right'><img loading='lazy' src='${APP_URL}/images/chevron-right-circle.svg' alt='Site Logo' class='img-arrow right'></img></div>`, 217 responsive:[ 218 { 219 breakpoint: 1500, 220 settings: { 221 slidesToShow: 14, 222 }, 223 }, 224 { 225 breakpoint: 1300, 226 settings: { 227 slidesToShow: 12, 228 }, 229 }, 230 { 231 breakpoint: 1000, 232 settings: { 233 slidesToShow: 9, 234 }, 235 }, 236 { 237 breakpoint: 768, 238 settings: { 239 slidesToShow: 7, 240 }, 241 }, 242 { 243 breakpoint: 576, 244 settings: { 245 slidesToShow: 3, 246 arrows: false, 247 }, 248 }, 249 ], 250 }; 251 $scope.slickConfigCommunity = { 252 enabled: true, 253 draggable: false, 254 prevArrow: 255 "<button type='button' class='slick-prev pull-left room-card-btn' aria-label='Slide-left'><i class='bi bi-arrow-left'></i></button>", 256 nextArrow: 257 "<button type='button' class='slick-next pull-right room-card-btn' aria-label='Slide-right'><i class='bi bi-arrow-right'></i></i></button>", 258 responsive:[ 259 { 260 breakpoint: 2100, 261 settings: { 262 slidesToShow: 3, 263 }, 264 }, 265 { 266 breakpoint: 1400, 267 settings: { 268 slidesToShow: 3, 269 }, 270 }, 271 { 272 breakpoint: 1200, 273 settings: { 274 slidesToShow: 2, 275 }, 276 }, 277 { 278 breakpoint: 991, 279 settings: { 280 slidesToShow: 2, 281 }, 282 }, 283 { 284 breakpoint: 576, 285 settings: { 286 slidesToShow: 1, 287 }, 288 }, 289 ], 290 }; 291 292 293 // Just booked, most viewed, our community section scripts starts // 294 $scope.community_and_property_sections = function () { 295 // $(".our-community-carousel-loading").addClass("loading"); 296 // $(".property-types-courosel-loading").addClass("loading"); 297 $http 298 .get(APP_URL + "/community_and_property_sections") 299 .then(function (response) { 300 $scope.our_community_banners = 301 response.data.our_community_banners; 302 $scope.property_types = response.data.property_types; 303 $scope.applyScope(); 304 $scope.property_loading = true 305 $scope.our_community_loading = true 306 307 setTimeout(() => { 308 $(".property-types-courosel.default-fade").addClass("div-fade"); 309 $(".our-community-carousel.default-fade").addClass("div-fade"); 310 // $('.property-types-courosel-loading').removeClass('d-none') 311 // $scope.update_slider(".our-community-carousel"); 312 // $scope.update_slider(".property-types-courosel"); 313 }, 0); 314 }); 315 }; 316 317 $scope.booking_sections = function () { 318 319 // $(".just-booked-carousel-loading").addClass("loading"); 320 // $(".most-viewed-carousel-loading").addClass("loading"); 321 322 $http.get(APP_URL + "/booking_sections").then(function (response) { 323 $scope.just_booked = response.data.just_booked; 324 $scope.most_viewed = response.data.most_viewed; 325 $scope.random_seeall_for_just_booked = response.data.random_seeall_for_just_booked; 326 $scope.random_seeall_for_most_viewed = response.data.random_seeall_for_most_viewed; 327 $scope.applyScope(); 328 329 $scope.just_booked_loading = true 330 $scope.most_viewed_loading = true 331 332 $(".just-booked-carousel.default-fade").addClass("div-fade"); 333 $(".most-viewed-carousel.default-fade").addClass("div-fade"); 334 // setTimeout(() => { 335 // $scope.update_image_slider(".just-booked-image-carousel"); 336 // $scope.update_image_slider(".most-viewed-image-carousel"); 337 // $scope.update_slider(".just-booked-carousel"); 338 // $scope.update_slider(".most-viewed-carousel"); 339 // }, 20); 340 }); 341 }; 342 343 $scope.host_exp_section = function () { 344 // $(".host-experience-carousel-loading").addClass("loading"); 345 346 $scope.experience_loading = false 347 $http.get(APP_URL + "/host_exp_section").then(function (response) { 348 $scope.host_experiences = response.data.host_experiences; 349 $scope.get_random_exp_pics = response.data.get_random_exp_pics; 350 $scope.applyScope(); 351 352 $scope.experience_loading = true 353 $('.host-experience-carousel.default-fade').addClass('div-fade') 354 // setTimeout(() => { 355 // $scope.update_image_slider(".exp-image-carousel"); 356 // $scope.update_slider(".host-experience-carousel"); 357 // }, 20); 358 }); 359 }; 360 361 $scope.coupon_offer = function () { 362 $http 363 .get(APP_URL + "/get_coupon_offer") 364 .then(function (response) { 365 $scope.coupon_offer = response.data.coupon_offer; 366 $scope.random_seeall_offer = response.data.get_random_pics; 367 $scope.applyScope(); 368 }); 369 }; 370 // Just booked, most viewed, our community section scripts ends // 371 }, 372]); 373 374app.controller("new_header", [ 375 "$scope", 376 "$http", 377 "$rootScope", 378 function ($scope, $http, $rootScope) { 379 $('.exp-guest-select').addClass('d-none') 380 $('.flash-close').click(function() { 381 $('.flash-container').hide() 382 }) 383 384 $('.currency_click').click(function() { 385 $scope.previous_currency = $('#cls_currency li.active a').data('id') 386 }) 387 388 // google autocomplete functionality 389 let timeout; 390 let delay = 500; 391 $('#location-nav, #mob-location-nav').keyup(function(e) { 392 $scope.element_id = $(e.target).attr('id') 393 if(e.target.value == '') { 394 $('.suggest-location-div').dropdown('show') 395 $('.suggest-location-div .google-results').hide() 396 $('.suggest-location-div .region-section').show() 397 $('.home_latitude').val('') 398 $('.home_longitude').val('') 399 400 $('.google-results-mob').empty() 401 $('.search-region-mob').show() 402 return false 403 } 404 if(timeout) clearTimeout(timeout); 405 timeout = setTimeout(function() { getPlaceResults(e.target.value); }, delay); 406 }) 407 408 function getPlaceResults(input_data){ 409 var service = new google.maps.places.AutocompleteService(); 410 service.getQueryPredictions({ 411 input: input_data, 412 types: ['establishment', 'geocode'] 413 414 }, displaySuggestions); 415 } 416 417 var displaySuggestions = function(predictions, status) { 418 if (status != google.maps.places.PlacesServiceStatus.OK) { 419 return; 420 } 421 predictions.unshift({description: 'Use Current location',data_id:''}); 422 init_autocomplete(predictions); 423 }; 424 425 function init_autocomplete(data) { 426 if($scope.element_id == 'mob-location-nav') { 427 $('.search-region-mob').hide() 428 $('.google-results-mob').empty().show()
429 create_autocomplete_element(data, 'ul.google-results-mob') 430 } else { 431 $('.suggest-location-div').dropdown('show') 432 $('.suggest-location-div .region-section').hide() 433 $('.suggest-location-div .google-results').show() 434 $('.google-results').empty() 435 create_autocomplete_element(data, 'ul.google-results') 436 } 437 } 438 439 function create_autocomplete_element(data, element) { 440 data.forEach(function(prediction) { 441 var li = document.createElement('li'); 442 li.appendChild(document.createTextNode(prediction.description)); 443 li.setAttribute('data_id',prediction.place_id); 444 li.setAttribute('class','place_search'); 445 $(element).each(function() { 446 $(this).append(li) 447 }) 448 449 place_search() 450 }); 451 } 452 453 function place_search() { 454 $('.place_search').click(function(){ 455 place_id = $(this).attr('data_id'); 456 if(place_id=='' || place_id == "undefined") 457 getCurrentLocation(); 458 else 459 getLatLong('placeId',place_id); 460 461 $('.google-results-mob').hide() 462 }) 463 } 464 465 function getCurrentLocation() { 466 if (navigator.geolocation) { 467 navigator.geolocation.getCurrentPosition((position) => { 468 getLatLong('location',{lat:position.coords.latitude,lng:position.coords.longitude}); 469 }) 470 } 471 } 472 473 function getLatLong(search_by,place_id) { 474 var geocoder = new google.maps.Geocoder(); 475 var result = ""; 476 geocoder.geocode( { [search_by]: place_id}, function(results, status) { 477 if (status == google.maps.GeocoderStatus.OK) { 478 let formatted_address = results[0].formatted_address 479 $('#location-nav').val(formatted_address); 480 $('#mob-location-nav').val(formatted_address) 481 $('.header-search-div.any-where').text(formatted_address) 482 483 $('.home_latitude').val(results[0].geometry.location.lat()) 484 $('.home_longitude').val(results[0].geometry.location.lng()) 485 $('.google_results').empty() 486 } 487 }); 488 } 489 490 $('.langlcick').click(function() { 491 let data = $(this).attr('data-id') 492 $http.post(APP_URL + "/set_session", { 493 language: data, 494 headers: { 'X-CSRF-TOKEN': csrf_token } 495 }).then(function(data) { 496 location.reload(); 497 }); 498 }); 499 500 $('.currcick').click(function() { 501 let data = $(this).attr('data-id') 502 $http.post(APP_URL + "/set_session", { 503 currency: data, 504 previous_currency: $scope.previous_currency, 505 headers: { 'X-CSRF-TOKEN': csrf_token }, 506 }).then(function(data) { 507 location.reload(); 508 }); 509 }); 510 511 $scope.get_location_from_region = function(region) { 512 $('#location-nav').val(region.name) 513 $('#mob-location-nav').val(region.name) 514 $('.home_latitude').val(region.latitude) 515 $('.home_longitude').val(region.longitude) 516 $('.header-search-div.any-where').text(region.name) 517 } 518 519 $(function () { 520 $('#checkin-nav, #checkout-nav').daterangepicker( 521 { 522 opens: "center", 523 minDate: moment(), 524 "alwaysShowCalendars": true, 525 dateLimitMin:{ 526 "days": 1 527 }, 528 autoUpdateInput: false, 529 autoApply: true, 530 locale: { 531 format: daterangepicker_format 532 } 533 }, 534 function (start, end, label) { 535 let selectedStartDate = start.format(daterangepicker_format); 536 let selectedEndDate = end.format(daterangepicker_format); 537 538 const active_search_type = $('.place-online-ul li.active').data('value') 539 if(selectedStartDate == selectedEndDate && active_search_type != 'exp') { 540 selectedEndDate = end.add(1, 'days').format(daterangepicker_format) 541 } 542 543 $checkinInput = $('#checkin-nav'); 544 $checkoutInput = $('#checkout-nav'); 545 546 $checkinInput.val(selectedStartDate); 547 $checkoutInput.val(selectedEndDate); 548 549 let checkOutPicker = $checkoutInput.data('daterangepicker'); 550 checkOutPicker.setStartDate(selectedStartDate); 551 checkOutPicker.setEndDate(selectedEndDate); 552 553 let checkInPicker = $checkinInput.data('daterangepicker'); 554 checkInPicker.setStartDate(selectedStartDate); 555 checkInPicker.setEndDate(selectedEndDate); 556 557 $('.header-search-div.any-week').text(selectedStartDate + ' - ' + selectedEndDate) 558 } 559 ); 560 }); 561 562 $(".guest-dropdown li").click(function(event) { 563 event.preventDefault() 564 let value = $(this).data('value') 565 $('#guests-nav').val(value) 566 $('.header-search-div.guests').text(value + Guests_text) 567 }) 568 569 $('.place-online-ul li').click(function(event) { 570 event.preventDefault() 571 $('.place-online-ul li.active').removeClass('active') 572 $('#guests-nav').val('') 573 574 let value = $(this).data('value') 575 if(value == 'exp') { 576 $('.room-guest-dropdown').addClass('d-none') 577 $('.exp-guest-dropdown').removeClass('d-none') 578 } else { 579 $('.exp-guest-dropdown').addClass('d-none') 580 $('.room-guest-dropdown').removeClass('d-none') 581 } 582 $('.search-type-' + value).addClass('active') 583 584 }) 585 586 $('.search-icon').click(function(event) { 587 event.preventDefault() 588 $('.show_search_error').addClass('d-none') 589 $('.show_latlng_error').addClass('d-none') 590 591 const locations = $('#location-nav').val() 592 if(locations == '') { 593 $('.show_search_error').removeClass('d-none') 594 $('.suggest-location-div').dropdown('hide') 595 return false 596 } 597 598 const latitude = $('.home_latitude').val() 599 const longitude = $('.home_longitude').val() 600 if(latitude == '' || longitude == '') { 601 $('.show_latlng_error').removeClass('d-none') 602 $('.suggest-location-div').dropdown('hide') 603 return false 604 } 605 606 const header_checkin = $('#checkin-nav').val() 607 const header_checkout = $('#checkout-nav').val() 608 const header_guests = $('#guests-nav').val() 609 const active_search_type = $('.place-online-ul li.active').data('value') 610 const current_refinement = active_search_type == 'stay' ? 'Homes' : 'Experiences'; 611 612 window.location.href = APP_URL + '/s?location=' + locations + '&checkin=' + header_checkin + '&checkout=' + header_checkout + '&guests=' + header_guests + '¤t_refinement=' + current_refinement; 613 }) 614 // Header functionality ends // 615 616 // Mobile functionality starts // 617 $(function () { 618 $('input[name="mobroomdate"]').daterangepicker( 619 { 620 opens: "center", 621 minDate: moment(), 622 "alwaysShowCalendars": true, 623 dateLimitMin:{ 624 "days": 1 625 }, 626 autoUpdateInput: false, 627 autoApply: true, 628 locale: { 629 format: daterangepicker_format 630 }, 631 } 632 ); 633 634 $('input[name="mobroomdate"]').on('apply.daterangepicker', function(ev, picker) { 635 // Execute your actions when the date range is applied 636 let startDate = picker.startDate.format(daterangepicker_format); 637 let endDate = picker.endDate.format(daterangepicker_format); 638 639 const active_search_type = $('.mob-search-type.active').attr('id') 640 if(startDate == endDate && active_search_type != 'experience-tab') { 641 endDate = picker.startDate.add(1, 'days').format(daterangepicker_format) 642 } 643 644 $('input[name="mobroomdate"]').val(startDate + ' - ' + endDate) 645 }) 646 }); 647 648 $('.mob-search-type').click(function(e) { 649 if(e.target.id == 'experience-tab') { 650 $('.room-guest-select').addClass('d-none') 651 $('.exp-guest-select').removeClass('d-none') 652 } else { 653 $('.exp-guest-select').addClass('d-none') 654 $('.room-guest-select').removeClass('d-none') 655 } 656 }) 657 658 $rootScope.mob_search_form_submit = function() { 659 $('.mob-location-error').remove() 660 const mob_locations = $('#mob-location-nav').val() 661 if(mob_locations == '') { 662 $( "<p class='text-danger mob-location-error'> Please choose location atleast </p>" ).insertAfter('.search-dest-div') 663 return false 664 } 665 666 const home_latitude = $('.home_latitude').val() 667 const home_longitude = $('.home_longitude').val() 668 if(home_latitude == '' || home_longitude == '') { 669 $( "<p class='text-danger mob-location-error'> Please choose location from regions or google autocomplete </p>" ).insertAfter('.search-dest-div') 670 return false 671 } 672 673 const active_search_type = $('.mob-search-type.active').data('value') 674 const mob_guests = active_search_type == 'stay' ? $('.room-guest-select :selected').val() : $('.exp-guest-select :selected').val() 675 const mob_dates = $('#mob-dates').val() 676 const dates = mob_dates.split(' - ') 677 let mob_checkin = '' 678 let mob_checkout = '' 679 if(dates != '') { 680 mob_checkin = dates[0].trim() 681 mob_checkout = dates[1].trim() 682 } 683 const current_refinement = active_search_type == 'stay' ? 'Homes' : 'Experiences'; 684 685 window.location.href = APP_URL + '/s?location=' + mob_locations + '&checkin=' + mob_checkin + '&checkout=' + mob_checkout + '&guests=' + mob_guests + '¤t_refinement=' + current_refinement; 686 } 687 // Mobile functionality ends // 688 689 $rootScope.set_values_in_header = function(urlParams){
690 let req_guest = urlParams.get('guests'); 691 req_guest = req_guest ?? 1 692 let guestText = req_guest == 1 ? `${req_guest} ${Guest_text}` : `${req_guest} ${Guests_text}` 693 $('.guest-text').text(guestText) 694 $('#guests-nav').val(req_guest) 695 696 const req_dates = $('#datesfilter').val() 697 if(req_dates != '') { 698 $('.header-search-div.any-week').find('span').text(req_dates) 699 const split_dates = req_dates.split(' - ') 700 $('#checkin-nav').val(split_dates[0].trim()) 701 $('#checkout-nav').val(split_dates[1].trim()) 702 } 703 704 const req_location = urlParams.get('location'); 705 if(req_location != '' && req_location) { 706 $('.header-search-div.any-where').find('span').text(req_location) 707 $('#location-nav').val(req_location) 708 } 709 } 710}]) 711 712app.controller("newAppController", [ 713 "$scope", 714 "$http", 715 "$rootScope", 716 "$filter", 717 function ($scope, $http, $rootScope, $filter) { 718 $rootScope.applyScope = function () { 719 if (!$scope.$$phase) { 720 $scope.$apply(); 721 } 722 }; 723 724 $rootScope.get_regions = function() { 725 $http.get(APP_URL + "/get_regions").then(function (response) { 726 $scope.regions = response.data.home_city; 727 $scope.applyScope(); 728 }); 729 } 730 731 $rootScope.update_slider = function (selector) { 732 let options = getOptions(selector); 733 734 $(selector).slick(options); 735 $(selector + '-loading').removeClass('loading') 736 $(selector + '-seeall').removeClass('d-none') 737 }; 738 739 $rootScope.update_image_slider = function (selector) { 740 setTimeout(() => { 741 $(selector).slick({ 742 dots: true, 743 lazyLoad: 'ondemand', 744 infinite: false, 745 slidesToShow: 1, 746 slidesToScroll: 1, 747 rtl: $("html").attr('lang') == 'ar' ? true : false, 748 prevArrow: 749 "<button type='button' class='slick-prev pull-left room-arow-btn' aria-label='Slide-left'><i class='bi bi-chevron-left'></i></button>", 750 nextArrow: 751 "<button type='button' class='slick-next pull-right room-arow-btn' aria-label='Slide-right'><i class='bi bi-chevron-right'></i></i></button>", 752 }); 753 }, 20); 754 }; 755 756 function getOptions(selector) { 757 let obj = {}; 758 759 obj["infinite"] = false; 760 if (selector == ".property-types-courosel") { 761 obj["rtl"] = $("html").attr('lang') == 'ar' ? true : false; 762 obj["slidesToScroll"] = 3; 763 obj["lazyLoad"] = 'ondemand'; 764 obj["slidesToShow"] = ROUTE_NAME == 'search_page' ? 11 : 14; 765 obj["prevArrow"] = 766 "<div class='arrow-shadow arrow-left'><button type='button' class='slick-prev pull-left room-arow-btn' aria-label='Slide-left'><i class='bi bi-chevron-left'></i></button>"; 767 obj["nextArrow"] = 768 "<div class='arrow-shadow arrow-right'><button type='button' class='slick-next pull-right room-arow-btn' aria-label='Slide-right'><i class='bi bi-chevron-right'></i></i></button></div>"; 769 obj["responsive"] = [ 770 { 771 breakpoint: 1500, 772 settings: { 773 slidesToShow: 14, 774 }, 775 }, 776 { 777 breakpoint: 1300, 778 settings: { 779 slidesToShow: 12, 780 }, 781 }, 782 { 783 breakpoint: 1000, 784 settings: { 785 slidesToShow: 9, 786 }, 787 }, 788 { 789 breakpoint: 768, 790 settings: { 791 slidesToShow: 7, 792 }, 793 }, 794 { 795 breakpoint: 576, 796 settings: { 797 slidesToShow: 3,
798 arrows: false, 799 }, 800 }, 801 ]; 802 } else if(selector == ".our-community-carousel") { 803 obj["rtl"] = $("html").attr('lang') == 'ar' ? true : false; 804 obj["slidesToScroll"] = 1; 805 obj["lazyLoad"] = 'ondemand'; 806 obj["slidesToShow"] = 3; 807 obj["draggable"] = false; 808 obj["swipe"] = false; 809 obj["prevArrow"] = 810 "<button type='button' class='slick-prev pull-left room-card-btn' aria-label='Button Left'><i class='bi bi-arrow-left'></i></button>"; 811 obj["nextArrow"] = 812 "<button type='button' class='slick-next pull-right room-card-btn' aria-label='Button Right'><i class='bi bi-arrow-right'></i></i></i></button>"; 813 obj["responsive"] = [ 814 { 815 breakpoint: 1900, 816 settings: { 817 slidesToShow: 4, 818 }, 819 }, 820 { 821 breakpoint: 1700, 822 settings: { 823 slidesToShow: 3, 824 }, 825 }, 826 { 827 breakpoint: 1400, 828 settings: { 829 slidesToShow: 3, 830 }, 831 }, 832 { 833 breakpoint: 1200, 834 settings: { 835 slidesToShow: 2, 836 }, 837 }, 838 { 839 breakpoint: 991, 840 settings: { 841 slidesToShow: 2, 842 }, 843 }, 844 { 845 breakpoint: 576, 846 settings: { 847 slidesToShow: 1, 848 }, 849 }, 850 ]; 851 }else if(selector == ".smiliar-carousel") { 852 obj["rtl"] = $("html").attr('lang') == 'ar' ? true : false; 853 obj["slidesToScroll"] = 1; 854 obj["lazyLoad"] = 'ondemand'; 855 obj["slidesToShow"] = 4; 856 obj["draggable"] = false; 857 obj["swipe"] = false; 858 obj["prevArrow"] = 859 "<button type='button' class='slick-prev pull-left room-card-btn' aria-label='Button Left'><i class='bi bi-arrow-left'></i></button>"; 860 obj["nextArrow"] = 861 "<button type='button' class='slick-next pull-right room-card-btn' aria-label='Button Right'><i class='bi bi-arrow-right'></i></i></i></button>"; 862 obj["responsive"] = [ 863 { 864 breakpoint: 1800, 865 settings: { 866 slidesToShow: 4, 867 }, 868 }, 869 { 870 breakpoint: 1400, 871 settings: { 872 slidesToShow: 4, 873 }, 874 }, 875 { 876 breakpoint: 1300, 877 settings: { 878 slidesToShow: 4, 879 }, 880 }, 881 { 882 breakpoint: 991, 883 settings: { 884 slidesToShow: 3, 885 }, 886 }, 887 { 888 breakpoint: 576, 889 settings: { 890 slidesToShow: 1, 891 }, 892 }, 893 ]; 894 } else { 895 obj["rtl"] = $("html").attr('lang') == 'ar' ? true : false; 896 obj["slidesToScroll"] = 1; 897 obj["lazyLoad"] = 'ondemand'; 898 obj["slidesToShow"] = 6; 899 obj["draggable"] = false;
900 obj["swipe"] = false; 901 obj["prevArrow"] = 902 "<button type='button' class='slick-prev pull-left room-card-btn' aria-label='Button Left'><i class='bi bi-arrow-left'></i></button>"; 903 obj["nextArrow"] = 904 "<button type='button' class='slick-next pull-right room-card-btn' aria-label='Button Right'><i class='bi bi-arrow-right'></i></i></i></button>"; 905 obj["responsive"] = [ 906 { 907 breakpoint: 1900, 908 settings: { 909 slidesToShow: 6, 910 }, 911 }, 912 { 913 breakpoint: 1700, 914 settings: { 915 slidesToShow: 5, 916 }, 917 }, 918 { 919 breakpoint: 1400, 920 settings: { 921 slidesToShow: 5, 922 }, 923 }, 924 { 925 breakpoint: 1200, 926 settings: { 927 slidesToShow: 4, 928 }, 929 }, 930 { 931 breakpoint: 991, 932 settings: { 933 slidesToShow: 3, 934 }, 935 }, 936 { 937 breakpoint: 576, 938 settings: { 939 slidesToShow: 1, 940 }, 941 }, 942 ]; 943 } 944 945 return obj; 946 } 947 948 $rootScope.community_and_property_sections = function () { 949 $(".property-types-courosel-loading").addClass("loading"); 950 951 return $http.get(APP_URL + "/community_and_property_sections") 952 .then(function (response) { 953 $scope.property_types = response.data.property_types; 954 $scope.applyScope(); 955 956 setTimeout(() => { 957 $scope.update_slider(".property-types-courosel"); 958 }, 20); 959 }); 960 } 961 962 $rootScope.setGetParameter = function(paramName, paramValue) { 963 var url = window.location.href; 964 965 if (url.indexOf(paramName + "=") >= 0) { 966 var prefix = url.substring(0, url.indexOf(paramName)); 967 var suffix = url.substring(url.indexOf(paramName)); 968 suffix = suffix.substring(suffix.indexOf("=") + 1); 969 suffix = (suffix.indexOf("&") >= 0) ? suffix.substring(suffix.indexOf("&")) : ""; 970 url = prefix + paramName + "=" + paramValue + suffix; 971 } else { 972 if (url.indexOf("?") < 0) 973 url += "?" + paramName + "=" + paramValue; 974 else 975 url += "&" + paramName + "=" + paramValue; 976 } 977 history.pushState(null, null, url); 978 } 979 980 $rootScope.show_more = function(parent, child, measure_el, length) { 981 var $this = $(parent); 982 if ($this.find(measure_el).length > length) { 983 $(parent).append('<div class="mt-2"><a href="javascript:;" class="fs-14 text-decoration-underline show-more-desc fw-semibold">'+ show_more +'</a></div>'); 984 } 985 986 $(parent + ' ' + child).slice(0, (length + 1)).addClass('shown'); 987 $(parent + ' ' + child).not('.shown').hide(); 988 $(parent + ' ' + '.show-more-desc').on('click',function(){ 989 const toggleText = $(this).text() == show_more ? show_less : show_more 990 991 $(parent + ' ' + child).not('.shown').toggle(300); 992 $(this).toggleClass(show_less).text(toggleText); 993 }); 994 } 995 996 $scope.saveWishlist = function(room_details, type) { 997 if (typeof USER_ID == 'object') { 998 $http.get(APP_URL + "/wishlist_list", {}).then(function(response) { 999 window.location.href = APP_URL + '/login'; 1000 }); 1001 return false;
1002 } 1003 1004 var name = type == 'Rooms' ? room_details.name : room_details.title; 1005 var img = type == 'Rooms' ? (room_details.all_photos.length ? room_details.all_photos[0].original_image : room_details.photo_name) : (room_details.all_photos.length ? room_details.all_photos[0].og_image : room_details.photo_name); 1006 var city_name = type == 'Rooms' ? room_details.rooms_address.city : room_details.host_experience_location.city; 1007 var host_img = room_details.users.profile_picture.header_src; 1008 $scope.room_id = room_details.id; 1009 $scope.type = type; 1010 1011 $('.background-listing-img').css('background-image', 'url(' + img + ')'); 1012 $('.host-profile-img').attr('src', host_img); 1013 $('.wl-modal-listing-name').text(name); 1014 $('.wl-modal-listing-address').text(city_name); 1015 $('.add-wishlist').addClass('loading'); 1016 $('#wish_list_text').val(city_name) 1017 1018 $http.get(APP_URL + "/wishlist_list?id=" + $scope.room_id +"&type="+ type, {}).then(function(response) { 1019 $('.wl-modal-form').addClass('d-none'); 1020 $('.add-wishlist').removeClass('loading'); 1021 $('.create-wl').removeClass('d-none'); 1022 $scope.wishlist_list = response.data; 1023 }); 1024 } 1025 1026 $scope.wishlist_row_select = function(index) { 1027 $http.post(APP_URL + "/save_wishlist", { 1028 data: $scope.room_id, 1029 wishlist_id: $scope.wishlist_list[index].id, 1030 saved_id: $scope.wishlist_list[index].saved_id, 1031 type: $scope.type, 1032 }).then(function(response) { 1033 $scope.wishlist_list[index].saved_id = (response.data == 'null') ? null : response.data; 1034 }); 1035 1036 $scope.wishlist_list[index].saved_id = ($('#wishlist_row_' + index).hasClass('text-dark-gray')) ? null : 1; 1037 } 1038 1039 $(document).on('click', '.create-wl', function() { 1040 $('.wl-modal-form').removeClass('d-none'); 1041 $(this).addClass('d-none'); 1042 }) 1043 1044 $(document).on('submit', '.wl-modal-form', function(event) { 1045 event.preventDefault(); 1046 $('.add-wishlist').addClass('loading'); 1047 $http.post(APP_URL + "/wishlist_create", { 1048 data: $('#wish_list_text').val(), 1049 id: $scope.room_id 1050 }).then(function(response) { 1051 $('.wl-modal-form').addClass('d-none'); 1052 $('.add-wishlist').removeClass('loading'); 1053 $('.create-wl').removeClass('d-none'); 1054 $('#wish_list_text').val(''); 1055 $scope.wishlist_list = response.data; 1056 event.preventDefault(); 1057 }); 1058 event.preventDefault(); 1059 }) 1060 1061 $('#wishlist-modal').on('hidden.bs.modal', function () { 1062 var null_count = $filter('filter')($scope.wishlist_list, { 1063 saved_id: null 1064 }); 1065 var checked = (null_count.length == $scope.wishlist_list.length) ? false : true; 1066 $('.wishlist-widget-' + $scope.room_id).each(function() { 1067 $(this).prop('checked', checked) 1068 }); 1069 }) 1070}]) 1071 1072app.controller("coupon_page", [ 1073 "$scope", 1074 "$http", 1075 "$rootScope", 1076 "$filter", 1077 function ($scope, $http, $rootScope, $filter) { 1078 1079 $scope.slickConfig = { 1080 enabled: true, 1081 draggable: false, 1082 slidesToShow: 1, 1083 dots:true, 1084 rtl: $("html").attr('lang') == 'ar' ? true : false, 1085 prevArrow: 1086 "<button type='button' class='slick-prev prev-arrow pull-left coupon-btn before-unset' aria-label='Slide-left'><i class='bi bi-chevron-left'></i></button>", 1087 nextArrow: 1088 "<button type='button' class='slick-next next-arrow pull-right coupon-btn before-unset' aria-label='Slide-right'><i class='bi bi-chevron-right'></i></button>", 1089 1090 }; 1091 1092 setTimeout(() => { 1093 $('.skel-container').addClass('d-none'); 1094 $('.inside-offer').removeClass('d-none'); 1095 $('.inside-skeleton').hide(); 1096 }, 300); 1097 1098 1099}]) 1100 1101// copy coupon start 1102function CopyToClipboard (containerid) { 1103 var btnCopy = document.getElementById( "copy" ); 1104 var main = document.getElementById( "maincontent" ); 1105 // Create a new textarea element and give it id='temp_element' 1106 var textarea = document.createElement("textarea"); 1107 textarea.id = "temp_element";
1108 // Optional step to make less noise on the page, if any! 1109 textarea.style.height = 0; 1110 // Now append it to your page somewhere, I chose <body> 1111 document.body.appendChild(textarea); 1112 // Give our textarea a value of whatever inside the div of id=containerid 1113 textarea.value = document.getElementById(containerid).innerText; 1114 // Now copy whatever inside the textarea to clipboard 1115 var selector = document.querySelector("#temp_element"); 1116 selector.select(); 1117 document.execCommand("copy"); 1118 // Remove the textarea 1119 document.body.removeChild(textarea); 1120 // Add copied text after click 1121 if ( document.execCommand( "copy" ) ) { 1122 btnCopy.classList.add( "copied" ); 1123 1124 var temp = setInterval( function(){ 1125 btnCopy.classList.remove( "copied" ); 1126 clearInterval(temp); 1127 }, 600 ); 1128 1129 } else { 1130 console.info( "document.execCommand went wrongâ¦" ); 1131 } 1132 1133 } 1134 1135 1136// coupon end
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.