$ = jQuery; if (typeof jQuery != "undefined") { $ = jQuery; } function format_time(hour, minute) { var h = hour > 9 ? "" + hour: "0" + hour; var m = minute > 9 ? "" + minute: "0" + minute; return h+":"+m; } var bookingWidgetController = function () { return { config: { language: $("html").attr("lang") ? $("html").attr("lang").replace(/[-_].*/, '') : $("html").attr("xml:lang").replace(/[-_].*/, ''), base_url: "//zione-cartagena-dot-secure-booking-co3.appspot.com", widget_url: "//zione-cartagena-dot-secure-booking-co3.appspot.com/zionewidget/", only_adults: "", dependcencies_added: typeof(bookingWidgetController) == "undefined" ? false : bookingWidgetController.config.dependcencies_added, datepicker_added: false, css_list : [ "https://cdn.paraty.es/static_files/common/plugins/dates-selector/css/datepicker_ext_inf.css?v=1.10", "//zione-cartagena-dot-secure-booking-co3.appspot.com/static_1/css/zi_one_injection/booking_widget_zi_one_injection.css?v=1.10", "//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css", "https://cdn.paraty.es/static_files/common/plugins/pricescalendar/styles.css?v=1.10", "https://cdn.paraty.es/static_files/common/css/datepicker.redmond/jquery-ui-1.8.16.custom.min.css?v=1.10" ], /*Special configs*/ avoid_guest_autoclose_click: false }, init: function () { this.prepare_dependencies(); }, prepare_dependencies: function () { var base_url = bookingWidgetController.config.base_url, lang = bookingWidgetController.config.language; if (!bookingWidgetController.config.dependcencies_added) { $.getScript("https://cdn.paraty.es/static_files/common/lib/jquery-ui-1.10.1.custom.min.modified.js?v=1.10").done(function () { $.getScript("https://cdn.paraty.es/static_files/common/js/mainWebSkeletonAux_injection.js?v=1.10"); $.getScript("https://cdn.paraty.es/static_files/common/lib/selectric/jquery.selectric.1.8.js?v=1.10").done(function () { $.getScript("https://cdn.paraty.es/static_files/common/lib/jquery-i18n-1.1.1/jquery.i18n.js?v=1.10").done(function () { $.getScript("https://cdn.paraty.es/static_files/common/i18n/messages_" + lang + ".js?v=1.10").done(function () { $.i18n.load(messages); bookingWidgetController.get_booking_widget_html(); bookingWidgetController.config.dependcencies_added = true; }); }); }); }); } }, get_booking_widget_html: function () { bookingWidgetController.load_css(); var language_widget = bookingWidgetController.config.language; $("html").attr("lang", language_widget); $.get(bookingWidgetController.config.widget_url + bookingWidgetController.config.language, function (e) { bookingWidgetController.config.widget_html = $("
").html(e); }).done(function () { bookingWidgetController.add_widget_html(); bookingWidgetController.add_button_mobile_version_html(); bookingWidgetController.adding_tags_to_config(); bookingWidgetController.load_datepicker(); bookingWidgetController.open_widget(); bookingWidgetController.close_widget(); bookingWidgetController.click_listeners(); if ($("#add_analytics_campaings_tracking") && $("#add_analytics_campaings_tracking").length > 0) { injectionCampaignsController.init() } }); }, load_css: function () { var list_css = bookingWidgetController.config.css_list; for (var i = 0; i < list_css.length; i++) { $('head').append($('').attr('href', list_css[i])); } }, add_widget_html: function() { }, add_button_mobile_version_html: function() { let target_container = $("#widget_paraty").length ? $("#widget_paraty") : $("#widget-paraty"); target_container.append($("
").html($.i18n._("reserva_ahora"))); target_container.find("#full_wrapper_booking").append($("")); }, load_datepicker: function () { var lang = bookingWidgetController.config.language, base_url = bookingWidgetController.config.base_url; // Refactor in a external function if (!bookingWidgetController.config.datepicker_added) { $.getScript("https://cdn.paraty.es/static_files/common/plugins/pricescalendar/calendar.plugin.js?v=1.10"); $.getScript("https://cdn.paraty.es/static_files/common/js/datepicker/jquery.ui.datepicker-" + lang + ".js?v=1.10").done(function () { $.getScript("https://cdn.paraty.es/static_files/common/plugins/dates-selector/datepicker_v1.js").done(function () { _set_datepicker_regional($); bookingWidgetController.datepicker_configuration(); $.getScript(base_url + "/static_1/scripts/booking_7.js?v=1.10").done(function () { bookingWidgetController.after_load_booking_script(); bookingWidgetController.custom_functions(); bookingWidgetController.config.datepicker_added = true }); }); }); } }, after_load_booking_script: function() { _set_datepicker_regional($); $(".room_selector").selectric({disableOnMobile: false}); $(".rooms_number").selectric({disableOnMobile: false}); DP_extend_info.init(); bookingWidgetController.prepare_guest_selector(); bookingWidgetController.adding_room_tag_selector(); bookingWidgetController.set_occupancy_number(); bookingWidgetController.update_date_by_timezone(); }, update_date_by_timezone: function() { if ($("#timeLimit").length>0) { var _limit = $("#timeLimit").val(); var _now = new Date(); var _hour = format_time(_now.getHours(), _now.getMinutes()); if (_hour > _limit) { _now.setUTCDate(_now.getUTCDate() + 1); } var datepicker_sd = $('.' + DP_extend_info.config.class_datepicker_sd); datepicker_sd.datepicker('option', 'minDate', new Date(_now.getFullYear(),_now.getMonth(),_now.getDate())); var datestart = _now.getDate()+"/"+(_now.getMonth()+1)+"/"+_now.getFullYear(); updateDates(datestart); $("input[name='startDate']").val(datestart); _set_start_date(datestart); _now.setUTCDate(_now.getUTCDate() + 1); datepicker_departure_date = $.datepicker.formatDate("dd-mm-yy", _now); datepicker_departure_date = datepicker_departure_date.replace(new RegExp("-", "g"), '/'); $("input[name='endDate']").val(datepicker_departure_date); _set_end_date(datepicker_departure_date); $('.departure_datepicker').datepicker('option', 'minDate', _now); } }, datepicker_configuration: function() { DP_extend_info.config.booking_version = '5'; DP_extend_info.config.hotel_path_endpoint = bookingWidgetController.config.base_url; bookingWidgetController.separate_entry_departure_datepicker(); DP_extend_info.config.custom_format_day_month = bookingWidgetController.custom_format_date; }, separate_entry_departure_datepicker: function() { DP_extend_info.config.start_date_selector = ".entry_date_wrapper"; DP_extend_info.config.end_date_selector = ".departure_date_wrapper"; DP_extend_info.config.start_datepicker_span = ".entry_date_wrapper .date_day"; DP_extend_info.config.end_datepicker_span = ".departure_date_wrapper .date_day"; }, custom_format_date: function(dateComponents) { dateComponents = dateComponents.split("/"); var month_names = $.datepicker._defaults.monthNames, html_date = "
%d
%m
%y
", month = (parseInt(dateComponents[1]) - 1); return html_date.replace("%d", dateComponents[0]).replace("%m", month_names[month]).replace("%y", dateComponents[2]); }, prepare_guest_selector: function () { $("select.room_selector").unbind("change"); $("select.room_selector, select.rooms_number").change(function () { bookingWidgetController.set_occupancy_number(); }); }, adding_room_tag_selector: function () { $("select.rooms_number option").each(function (index, element) { var room_tag = parseInt($(element).val()) === 1 ? bookingWidgetController.config.room_tag : bookingWidgetController.config.rooms_tag; $(element).text($(element).text() + " " + room_tag); }); $("select.rooms_number").selectric("refresh"); }, set_occupancy_number: function () { var number_of_rooms = $("select[name='numRooms']").val(), adults_number = 0, kids_number = 0, babies_number = 0; if (number_of_rooms) { for (var room_loop = 1; room_loop <= number_of_rooms; room_loop++) { var actual_select_adults = $("select[name='adultsRoom" + room_loop + "']").val(), actual_select_kids = $("select[name='childrenRoom" + room_loop + "']").val(), actual_select_baby = $("select[name='babiesRoom" + room_loop + "']").val(); adults_number += parseInt(actual_select_adults); kids_number += parseInt(actual_select_kids); babies_number += parseInt(actual_select_baby); } } var target_placeholder = $(".guest_selector .placeholder_text"), placeholder_string = bookingWidgetController.occupancy_format_html(); var room_tag = number_of_rooms === 1 ? bookingWidgetController.config.room_tag : bookingWidgetController.config.rooms_tag; var adult_tag = adults_number === 1 ? bookingWidgetController.config.adult_text : bookingWidgetController.config.adults_text; var kid_tag = kids_number === 1 ? bookingWidgetController.config.kid_text : bookingWidgetController.config.kids_text; var baby_tag = babies_number === 1 ? bookingWidgetController.config.baby_text : bookingWidgetController.config.babies_text; placeholder_string = placeholder_string.replace("@@N_R@@", number_of_rooms).replace("@@T_R@@", room_tag) .replace("@@N_A@@", adults_number).replace("@@T_A@@", adult_tag) .replace("@@N_C@@", kids_number).replace("@@T_C@@", kid_tag) .replace("@@N_B@@", babies_number).replace("@@T_B@@", baby_tag); target_placeholder.html(placeholder_string); }, occupancy_format_html: function() { var occupancy_string = ''; if (this.config.only_adults) { occupancy_string = "@@N_A@@ @@T_A@@"; } else { occupancy_string = "@@N_A@@ @@T_A@@ / @@N_C@@ @@T_C@@"; } return occupancy_string; }, open_widget: function () { $("#floating_button").click(function () { $("#full_wrapper_booking").fadeIn(); }); }, close_widget: function () { $("i.fa-times.close_widget").click(function () { $("#full_wrapper_booking").fadeOut(); }); }, click_listeners: function () { if (!this.config.avoid_guest_autoclose_click) { $("html").click(function (event) { var event_target = $(event.target); if (!event_target.closest(".room_list_wrapper").length && !event_target.closest(".guest_selector").length) { $(".room_list_wrapper").slideUp(); } }); } }, adding_tags_to_config: function () { bookingWidgetController.config.adults_text = $("#adults_tag").val(); bookingWidgetController.config.adult_text = $("#adult_tag").val(); bookingWidgetController.config.kids_text = $("#kids_tag").val(); bookingWidgetController.config.kid_text = $("#kid_tag").val(); bookingWidgetController.config.babies_text = $("#babies_tag").val(); bookingWidgetController.config.baby_text = $("#baby_tag").val(); bookingWidgetController.config.room_tag = $("#room_tag").val(); bookingWidgetController.config.rooms_tag = $("#rooms_tag").val(); }, custom_functions: function(){ } }; }(); const injectionCampaignsController = (function () { return { init() { this.processCampaignInfo(); }, getUrlParameter(sParam) { const sPageURL = decodeURIComponent(window.location.search.substring(1)); const sURLVariables = sPageURL.split('&'); for (const sVariable of sURLVariables) { const [key, value] = sVariable.split('='); if (key === sParam) { return value === undefined ? true : value; } } return undefined; }, createCookie(key, value, durationInDays = 365) { const targetExpiryDate = new Date(); targetExpiryDate.setDate(targetExpiryDate.getDate() + durationInDays); document.cookie = `${key}=${value};path=/;expires=${targetExpiryDate.toUTCString()};`; }, searchCookie(key) { const cookies = document.cookie.split(';'); for (const cookie of cookies) { const [cookieKey, cookieValue] = cookie.trim().split('='); if (cookieKey === key) { return cookieValue; } } return undefined; }, saveCampaignInfo() { const availableCampaignParams = [ 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'utm_id', 'partner' ]; const cookieToSet = {}; availableCampaignParams.forEach(param => { const retrievedParam = this.getUrlParameter(param); if (retrievedParam) { cookieToSet[param] = retrievedParam; } }); if (!$.isEmptyObject(cookieToSet)) { const cookieToSetJson = JSON.stringify(cookieToSet); this.createCookie("analytics_campaign", cookieToSetJson); } }, addCampaignToWidget() { const retrievedCookie = this.searchCookie('analytics_campaign'); if (!retrievedCookie) return; const loadedCookie = JSON.parse(retrievedCookie); $(".paraty-booking-form").each(function () { for (const [keyCampaign, value] of Object.entries(loadedCookie)) { const inputToAppend = $("").attr({ name: keyCampaign, value: value }); $(this).append(inputToAppend); } }); }, processCampaignInfo() { this.saveCampaignInfo(); this.addCampaignToWidget(); } }; })(); bookingWidgetController.add_widget_html = function () { var paraty_widget = bookingWidgetController.config.widget_html; if ($("#widget_paraty").length) { $("#widget_paraty").html(paraty_widget); $("#widget_paraty #full_wrapper_booking .booking_form_title").append($(".cancel_booking_link")); } }; bookingWidgetController.occupancy_format_html = function () { return "@@N_A@@ " + $.i18n._("T_adultos") + " + @@N_C@@ " + $.i18n._("T_ninos"); }; var iterMonth = 0; var availability_dataMonth = {}; function sd_beforeShowDay(date) { var show_day = true, string_date = $.datepicker.formatDate("yy-mm-dd", date), string_date_splited = string_date.split("-"); if (DP_extend_info.config.period_closed) { DP_extend_info.config.period_closed.forEach(function (period) { var last_close = period.last_close, available_days = period.available_days, number_day = date.getDay(); if (last_close) { if (string_date >= last_close) { show_day = false; } } else { if (string_date >= period.close && string_date < period.open) { show_day = available_days && available_days.indexOf(number_day.toString()) > -1 ? true : false; } } }); } var day_to_use = parseInt(string_date_splited[2]); if (iterMonth > day_to_use) { day_to_use = iterMonth + day_to_use; } else { iterMonth = day_to_use; } if (typeof (availability_dataMonth[parseInt(string_date_splited[1])]) != "undefined") { if (string_date_splited.length > 1 && parseInt(string_date_splited[1]) >= parseInt(availability_dataMonth[parseInt(string_date_splited[1])].calendar_start_month)) { if (availability_dataMonth[parseInt(string_date_splited[1])].prices[day_to_use - 1] == "-1") { show_day = false; } } } return [show_day]; } function ed_beforeShowDay(date) { var show_day = true, string_date = $.datepicker.formatDate("yy-mm-dd", date), string_date_splited = string_date.split("-"); if (DP_extend_info.config.period_closed) { DP_extend_info.config.period_closed.forEach(function (period) { var last_close = period.last_close, available_days = period.available_days, number_day = date.getDay(), period_close = period.close, period_open = period.open; if (last_close) { last_close = $.datepicker.parseDate("yy-mm-dd", last_close); last_close.setDate(last_close.getDate() + 1); if (date >= last_close) { show_day = false; } } else { period_close = $.datepicker.parseDate("yy-mm-dd", period_close); period_open = $.datepicker.parseDate("yy-mm-dd", period_open); period_close.setDate(period_close.getDate() + 1); if (date >= period_close && date < period_open) { show_day = available_days && available_days.length && available_days.indexOf(number_day.toString()) > -1; } } }); } date1 = DP_extend_info.config.datepicker_sd_wrapper.val().split("/"); date1 = new Date(parseInt(date1[2]), parseInt(date1[1]) - 1, parseInt(date1[0])); date2 = DP_extend_info.config.datepicker_ed_wrapper.val().split("/"); date2 = new Date(parseInt(date2[2]), parseInt(date2[1]) - 1, parseInt(date2[0])); if (typeof (availability_dataMonth[parseInt(string_date_splited[1])]) != "undefined") { if (string_date_splited.length > 1 && parseInt(string_date_splited[1]) >= parseInt(availability_dataMonth[parseInt(string_date_splited[1])].calendar_start_month)) { if (availability_dataMonth[parseInt(string_date_splited[1])].prices[parseInt(string_date_splited[2])] == "-1") { show_day = false; } } } if (date > date1 && date < date2) { return [show_day, 'ui-datepicker-highlighted', '']; } if (date.getTime() === date1.getTime()) { return [show_day, 'ui-datepicker-start_date', '']; } return [show_day, '', '']; } bookingWidgetController.datepicker_configuration = function () { let is_mobile = ($(window).width() <= 1140); DP_extend_info.config.booking_version = '5'; DP_extend_info.config.hotel_path_endpoint = bookingWidgetController.config.base_url; //DP_extend_info.config.months_show = (is_mobile) ? 3 : 1; DP_extend_info.config.months_show = 1; DP_extend_info.config.months_show_highlight = true; DP_extend_info.config.force_hightlight = true; DP_extend_info.config.custom_format_day_month = function (dateComponents) { dateComponents = dateComponents.split("/"); var month_short = $.datepicker._defaults['monthNamesShort'][parseInt(dateComponents[1], 10) - 1]; return "" + dateComponents[0] + "" + month_short + ""; }; DP_extend_info.init(); DP_extend_info.config.datepicker_sd_wrapper.datepicker("option", "beforeShowDay", sd_beforeShowDay); DP_extend_info.config.datepicker_ed_wrapper.datepicker("option", "beforeShowDay", ed_beforeShowDay); DP_extend_info.adjust_datepickers_positions = function (clicked_element) { if (typeof clicked_element[0] === "undefined") { clicked_element = $('div.start_end_date_wrapper'); } var datepicker_general_wrapper = this.config.datepicker_general_wrapper, clicked_element_position = clicked_element.offset(), top_position = clicked_element_position.top, clicked_element_height = clicked_element.outerHeight(), target_position = 'absolute'; var is_popup_opened = $(".fancybox-opened").length; if (is_popup_opened) { clicked_element = clicked_element.filter(function(index){ return this.closest("#data"); }); clicked_element_position = clicked_element.offset(); } if (clicked_element.closest('#full_wrapper_booking').css('position') == 'fixed' || clicked_element.closest('#wrapper_booking').css('position') == 'fixed') { target_position = 'fixed'; top_position = clicked_element_position.top - $(window).scrollTop(); } var datepicker_height = 0; if (datepicker_general_wrapper.height() < 400) { datepicker_height = datepicker_general_wrapper.height(); } else { var start_date_visible = !(datepicker_general_wrapper.find(".datepicker_ext_inf_sd").css('display') == 'none'), end_date_visible = !(datepicker_general_wrapper.find(".datepicker_ext_inf_ed").css('display') == 'none'); datepicker_height = 400; if (start_date_visible && end_date_visible) { datepicker_general_wrapper.find(".datepicker_ext_inf_ed").css('display', 'none'); datepicker_height = datepicker_general_wrapper.height() } } var total_height_needed = datepicker_height + clicked_element_height + top_position, window_height = $(window).height(); var target_top_position = top_position + clicked_element_height; if (!((window_height + $(window).scrollTop()) > total_height_needed) || (target_position == 'fixed' && total_height_needed > window_height)) { desired_top_position = top_position - (30 + datepicker_height); if (desired_top_position > 50) { target_top_position = desired_top_position; } datepicker_general_wrapper.addClass("datepicker_wrapper_up"); } else { datepicker_general_wrapper.removeClass("datepicker_wrapper_up"); } if (this.config.open_always_up && ((top_position - $(window).scrollTop()) > datepicker_height)) { target_top_position = top_position - datepicker_height - 30; } datepicker_general_wrapper.css({ 'top': target_top_position, 'left': clicked_element_position.left, 'position': target_position }); }; }; bookingWidgetController.adding_room_tag_selector = function () { $("select.rooms_number option").each(function (index, element) { $(element).text($(element).text()); }); $("select.rooms_number").selectric("refresh"); }; function searchCookie(key) { var encontrado = -1; var x = document.cookie; if (x) { var y = x.split(";"); for (var i = 0; i < y.length; i++) { encontrado = y[i].search(key); if (encontrado > -1) { resultado = y[i].split("="); return resultado[1]; } } } } bookingWidgetController.custom_functions = function () { var add_room_html = "
" + $.i18n._("T_anadir") + "
" + $.i18n._("T_eliminar") + "
"; $(".room_list_wrapper").append(add_room_html); $(".room_list_wrapper").on("click", ".add_room", function () { add_room(); }); $(".room_list_wrapper").on("click", ".remove_room", function () { remove_room(); }); $(".destination_wrapper").unbind("click"); var $hotelSelector = $('.hotel_selector'); $(".destination_wrapper").click(function () { $($hotelSelector).slideToggle(); }); $(document).click(function (e) { if (!$hotelSelector.is(e.target) && !$(".destination_wrapper").is(e.target) && $(".destination_wrapper").has(e.target).length === 0) { $hotelSelector.hide(); } }); var scrollThreshold = $(window).height() * 0.7; if ($(window).width() > 1141) { $(window).scroll(function () { if ($(window).scrollTop() >= scrollThreshold) { $("#widget_paraty").addClass('fixed'); } else { $("#widget_paraty").removeClass('fixed'); } }); } bookingWidgetController.config.languages = { "es": "SPANISH", "en": "ENGLISH", }; try { create_link_booking(); } catch (error) { console.log("[Paraty Widget] Error trying to get the utl to booking engine"); } $(".hotel_selector li").click(function () { var hotel_name = $(this).find(".title_selector").html(); $(".destination_wrapper .destination_field .destination").html(hotel_name); }); last_form_class_wrapper = ''; $(".hotel_selector .hotel_selector_option").click(function () { _hotel_selection($(this)); var destination = $("#widget_paraty .destination"), placeholder_text = destination.attr("placeholder").trim().replace(/ *\([^)]*\) */g, ""); destination.attr("placeholder", placeholder_text); $(".hotel_selector").slideUp(); setTimeout(function () { var dest_value = $(".destination").attr("value"); $(".destination").html(dest_value); }, 1000); //Form class wrapper var form_class_wrapper = $(this).attr('form_class'); if (last_form_class_wrapper) { $(".submit_button").removeClass(last_form_class_wrapper); } if (form_class_wrapper) { last_form_class_wrapper = form_class_wrapper; $(".submit_button").addClass(form_class_wrapper); } setTimeout(function () { $(".paraty-booking-form").each(function () { var submit_button = $(this).find(".submit_button"); if (!submit_button.is(':visible') || submit_button.attr('disabled')) { submit_button.trigger('click'); } }); }, 1000); }); $(".booking_0_hotel_custom_selection").click(function () { _custom_set_all_hotels_search($(this)); }); $(window).load(function () { bookingWidgetController.prepare_guest_selector(); var selected_namespace = $("#paraty_widget_namespace").val(); if (selected_namespace) { setTimeout(function () { $(".hotel_selector .hotel_selector_option#" + selected_namespace).trigger("click"); $(".hotel_selector .destiny").hide(); $(".hotel_selector .hotel_selector_option#" + selected_namespace).closest(".destiny").show(); }, 3000); } }); $("#full_wrapper_booking .children_selector select.room_selector").change(function () { check_kids_ages($(this)); }); $("#full_wrapper_booking .kidAgesSelect").selectric(); }; function check_kids_ages(select_element) { const room_wrapper = select_element.closest('li'); const total_kids_selected = select_element.val(); const target_ages_selector = room_wrapper.next('.full_ages_wrapper'); const age_selectors_list = target_ages_selector.find(".kid_age_element_wrapper"); age_selectors_list.each(function(){ $(this).hide(); }); if(parseInt(total_kids_selected) > 0){ const target_selectors = age_selectors_list.slice(0, parseInt(total_kids_selected)); target_selectors.each(function(){ $(this).show(); }); target_ages_selector.slideDown(function(){ $(this).css("overflow", "inherit"); }); } else{ target_ages_selector.slideUp(function () { $(this).css("overflow", "inherit"); }); } } function create_link_booking() { var link_booking = bookingWidgetController.config.base_url + "/booking1?numRooms=1&adultsRoom1=2" + "&adultsRoom2=0&adultsRoom3=0&childrenRoom1=0&childrenRoom2=0&childrenRoom3=0&babiesRoom1=0&" + "babiesRoom2=0&babiesRoom3=0&fromCountry=&language=" + bookingWidgetController.config.languages[bookingWidgetController.config.language]; $(".paraty-booking-link").each(function () { $(this).attr("href", link_booking); }); } function add_room() { var number_rooms = parseInt($("select.rooms_number").val()); console.log(number_rooms); if (number_rooms < 3) { $($(".rooms_number_wrapper .selectricItems li").get(number_rooms)).trigger("click"); bookingWidgetController.set_occupancy_number(); } } function remove_room() { var number_rooms = parseInt($("select.rooms_number").val()); if (number_rooms > 1) { $($(".rooms_number_wrapper .selectricItems li").get(number_rooms - 2)).trigger("click"); bookingWidgetController.set_occupancy_number(); } } function _custom_set_all_hotels_search(clicked_element) { var all_namespaces = clicked_element.attr('namespaces'), hotel_name = clicked_element.attr('hotel_name'), hotel_url = clicked_element.attr('hotel_url'); $(".paraty-booking-form").each(function () { $(this).attr('action', hotel_url); //$(this).find("#namespace").val(all_namespaces); var placeholder_text = hotel_name.trim().replace(/ *\([^)]*\) */g, ""); $(this).find(".destination").val(hotel_name).attr("placeholder", placeholder_text).html(placeholder_text); if (!$(this).find("input[name='applicationIds']").length) { $("").appendTo($(this)); } else { $(this).find("input[name='applicationIds']").val(all_namespaces); } $(this).find("#applicationIds").val(all_namespaces) }); $(".hotel_selector").slideUp(); } bookingWidgetController.init();