1var section_recaptcha; 2function onloadRecaptchaCallback(){ 3 section_recaptcha = grecaptcha.render("register_recaptcha", { 4 'sitekey' : globals.recaptcha_site_key, 5 'lang' : globals.recaptcha_site_lang, 6 }); 7 return; 8} 9 10function submit_prt_request(){ 11 12 $("#submit").hide(); 13 $(".loading_book").show(); 14 $("#reg_error").hide(); 15 16 var city = ''; 17 var city_input = $("#city_input").is(':visible'); 18 if(city_input){ 19 city = $("#city_input").val(); 20 } else { 21 city = $("#city").val(); 22 } 23 $.ajax({ 24 type: "POST", 25 url: "/section_signup/action_hostel_signup", 26 dataType: 'json', 27 data: { 28 csrf_token: csrf_value, 29 name : $("#name").val(), 30 first_name : $("#first_name").val(), 31 last_name : $("#last_name").val(), 32 email : $("#register_email").val(), 33 phone_number : $("#phone-number").intlTelInput("getNumber"), 34 skype_name : $("#skype_name").val(), 35 channel_manager : $("#channel_manager").val(), 36 city : city, 37 country : $("#country").val(), 38 type: 'hostel-signup', 39 'g-recaptcha-response' : $("#g-recaptcha-response").val() 40 }, 41 success:function(resData){ 42 $("#submit").show(); 43 $(".loading_book").hide(); 44 if(resData.status == 'fail'){ 45 grecaptcha.reset(section_recaptcha); 46 $.each( resData.validation_errors, function( index, value ){ 47 if(value != ""){ 48 $('#'+index+'').show(); 49 $('#'+index+'').html(value); 50 $('#'+index+' p').addClass("text-danger"); 51 }else{ 52 $('#'+index+'').hide(); 53 $('#'+index+'').html(""); 54 } 55 }); 56 } 57 else if(resData.status == 'success'){ 58 window.location= '/section_signup/success'; 59 } 60 }, 61 error:function(resData){ 62 63 grecaptcha.reset(section_recaptcha); 64 $("#submit").show(); 65 $(".loading_book").hide(); 66 $("#reg_error").show(); 67 } 68 }).done(function (resData) { 69 70 }); 71} 72 73function submit_prt_partner_request(){ 74 75 $("#submit").hide(); 76 $(".loading_book").show(); 77 $("#reg_error").hide(); 78 79 var city = ''; 80 var city_input = $("#city_input").is(':visible'); 81 if(city_input){ 82 city = $("#city_input").val(); 83 } else { 84 city = $("#city").val(); 85 } 86 $.ajax({ 87 type: "POST", 88 url: "/section_signup/action_partner_signup", 89 dataType: 'json', 90 data: { 91 csrf_token: csrf_value, 92 first_name : $("#first_name").val(), 93 last_name : $("#last_name").val(), 94 email : $("#register_email").val(), 95 phone_number : $("#phone-number").intlTelInput("getNumber"), 96 city : city, 97 country : $("#country").val(), 98 type: 'partner-signup', 99 'g-recaptcha-response' : $("#g-recaptcha-response").val() 100 }, 101 success:function(resData){ 102 103 $("#submit").show(); 104 $(".loading_book").hide(); 105 if(resData.status == 'fail'){ 106 grecaptcha.reset(section_recaptcha); 107 $.each( resData.validation_errors, function( index, value ){ 108 if(value != ""){ 109 $('#'+index+'').show(); 110 $('#'+index+'').html(value); 111 $('#'+index+' p').addClass("text-danger"); 112 }else{ 113 $('#'+index+'').hide(); 114 $('#'+index+'').html(""); 115 } 116 }); 117 } 118 else if(resData.status == 'success'){ 119 window.location= '/section_signup/partner_success'; 120 } 121 }, 122 error:function(resData){ 123 124 grecaptcha.reset(section_recaptcha); 125 $("#submit").show(); 126 $(".loading_book").hide(); 127 $("#reg_error").show(); 128 } 129 }).done(function (resData) { 130 131 }); 132} 133 134 135function submit_partner_with_us_request(){ 136 137 $("#submit").hide(); 138 $(".loading_book").show(); 139 $("#reg_error").hide(); 140 141 $.ajax({ 142 type: "POST", 143 url: "/section_signup/action_partner_with_us_signup", 144 dataType: 'json', 145 data: { 146 csrf_token: csrf_value, 147 type_accommodation : $("#type_accommodation").val(), 148 property_name : $("#property_name").val(), 149 property_address : $("#property_address").val(), 150 first_name : $("#first_name").val(), 151 last_name : $("#last_name").val(), 152 email : $("#register_email").val(), 153 phone_number : $("#phone-number").intlTelInput("getNumber"), 154 skype_name : $("#skype_name").val(), 155 type: 'partner-with-us-signup', 156 'g-recaptcha-response' : $("#g-recaptcha-response").val() 157 }, 158 success:function(resData){ 159 160 $("#submit").show(); 161 $(".loading_book").hide(); 162 if(resData.status == 'fail'){ 163 grecaptcha.reset(section_recaptcha); 164 $.each( resData.validation_errors, function( index, value ){ 165 if(value != ""){ 166 $('#'+index+'').show(); 167 $('#'+index+'').html(value); 168 $('#'+index+' p').addClass("text-danger"); 169 }else{ 170 $('#'+index+'').hide(); 171 $('#'+index+'').html(""); 172 } 173 }); 174 } 175 else if(resData.status == 'success'){ 176 window.location = '/section_signup/partner_with_us_success'; 177 } 178 }, 179 error:function(resData){ 180 181 grecaptcha.reset(section_recaptcha); 182 $("#submit").show(); 183 $(".loading_book").hide(); 184 $("#reg_error").show(); 185 } 186 }).done(function (resData) { 187 188 }); 189} 190 191 192var country_input = $('#country_input').val(); 193var city_input = $('#city_return').val(); 194if (country_input && $.isNumeric(city_input)) { 195 import_city_select_with_city('city', country_input, city_input); 196 $('#city_input').hide(); 197}
197 else if ($.isNumeric(city_input) == false && city_input != '') { 198 $('#city').hide(); 199 $('#city_input').show(); 200 $('#city').prop("disabled", true); 201 $('#city_input').prop("disabled", false); 202 $('#show_city_list').toggle(); 203 $('#suggest_city_').toggle(); 204 $('#city_input').val(city_input); 205 import_city_select_json('city', country_input); 206} 207 208$(document).ready(function () { 209 210 $("#phone-number").intlTelInput({ 211 preferredCountries: ['fr', 'gb', 'de', 'es', 'it', 'us'], 212 separateDialCode: true, 213 initialCountry: "auto" 214 }); 215 216 $(document).on('click', '.suggest_city', function () { 217 $("#city_input").toggle(); 218 var city_input = $("#city_input").is(':visible'); 219 if (city_input) { 220 $('#city_input').prop("disabled", false); 221 $('#city').prop("disabled", true); 222 $('#show_city_list').toggle(); 223 $('#suggest_city_').toggle(); 224 } else { 225 $('#city_input').prop("disabled", true); 226 $('#city').prop("disabled", false); 227 $('#show_city_list').toggle(); 228 $('#suggest_city_').toggle(); 229 } 230 $("#city").toggle(); 231 232 }); 233 $(document).on('keyup', '#city_input', function () { 234 $('#city_error_span').hide(); 235 $('#form_city_error').hide(); 236 }); 237 $(document).on('change', '#city', function () { 238 $('#city_error_span').hide(); 239 $('#form_city_error').hide(); 240 }); 241 $(document).on('change','#country',function () { 242 $("#phone-number").intlTelInput("setCountry", $(this).find(":selected").data("iso2")); 243 import_city_select_json('city', $(this).val()); 244 }); 245 246 247 248 249 $.get('https://ipinfo.io', function() {}, "jsonp").always(function(resp) { 250 var countryCode = (resp && resp.country) ? resp.country : ""; 251 // countryCode 252 $("#country").val($("#country").find("[data-iso2='"+countryCode+"']").prop("value")); 253 $("#phone-number").intlTelInput("setCountry", countryCode); 254 import_city_select_json('city', $("#country").val()); 255 }); 256 257}); 258 259function import_city_select_json(id, country_id) { 260 $('#' + id).prop('disabled', true); 261 262 $.ajax({ 263 type: "GET", 264 url: "/section_signup/city_json", 265 data: {country_id: country_id, csrf_token: csrf_value}, 266 dataType: 'json' 267 }).done(function (data) { 268 $('#' + id).empty(); 269 270 if(data.length == 0 ){ 271 $('#' + id).append($("<option></option>").attr("value", key).text('--N/A--')); 272 } else { 273 $.each(data, function (key, value) { 274 $('#' + id).append($("<option></option>").attr("value", value.id).text(value.name)); 275 }); 276 } 277 $('#' + id).prop('disabled', false); 278 }); 279} 280/** 281 * populates the select with given id with all cities from country_id and preselects city by id from city_id 282 */ 283function import_city_select_with_city_json(id, country_id, city_id) { 284 285 $('#' + id).prop('disabled', true); 286 287 $.ajax({ 288 type: "POST", 289 url: "section_signup/city_json", 290 data: { 291 country_id: country_id, csrf_token: csrf_value 292 } 293 , 294 dataType: 'json' 295 } 296 ). 297 done(function (data) { 298 $('#' + id).empty(); 299 $.each(data, function (key, value) { 300 $('#' + id).append($("<option></option>").attr("value", key).text(value)); 301 }); 302 $('#' + id).val(city_id); 303 $('#' + id).prop('disabled', false); 304 }); 305}
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.