1function jobsearch_loc_levels_names_to_address(rand_num) { 2 var loc_loc_1 = jQuery('#location_location1_' + rand_num).val(); 3 var loc_loc_2 = ''; 4 var loc_loc_3 = ''; 5 6 // 7 var locMapType = jobsearch_plugin_vars.locmap_type; 8 // 9 10 if (jQuery('select[name=jobsearch_field_location_location2]').length > 0) { 11 loc_loc_2 = jQuery('select[name=jobsearch_field_location_location2]').val(); 12 } else if (jQuery('input[name=jobsearch_field_location_location2]').length > 0) { 13 loc_loc_2 = jQuery('input[name=jobsearch_field_location_location2]').val(); 14 } 15 if (jQuery('#location_location3_' + rand_num).length > 0) { 16 loc_loc_3 = jQuery('#location_location3_' + rand_num).val(); 17 } 18 19 var loc_request = jQuery.ajax({ 20 url: jobsearch_location_common_vars.ajax_url, 21 method: "POST", 22 data: { 23 'loc_loc_1': loc_loc_1, 24 'loc_loc_2': loc_loc_2, 25 'loc_loc_3': loc_loc_3, 26 'action': 'jobsearch_loc_levels_names_to_address' 27 }, 28 dataType: "json" 29 }); 30 loc_request.done(function (response) { 31 if (typeof response.locadres !== 'undefined' && response.locadres != '') { 32 if (jQuery('#check_loc_addr_' + rand_num).val() == '') { 33 jQuery('#jobsearch_location_address_' + rand_num).val(response.locadres); 34 jQuery('#jobsearch_location_address_' + rand_num).trigger('change'); 35 } 36 } 37 }); 38} 39 40function jobsearch_loc_levels_to_mapcords(_this, rand_num) { 41 // 42 var locMapType = jobsearch_plugin_vars.locmap_type; 43 var mapbox_access_token = jobsearch_plugin_vars.mapbox_token; 44 var is_map_allow = jobsearch_plugin_vars.is_map_allow; 45 // 46 var flyToCond = false; 47 var fadresVal = _this.parents('form').find('input[name=jobsearch_field_location_address]').val(); 48 49 //console.log(jQuery('#cityId').val()); 50 if (_this.attr('id') == 'countryId') { 51 _this.parents('form').find('#stateId').val(''); 52 _this.parents('form').find('#cityId').val(''); 53 } 54 if (_this.attr('id') == 'stateId') { 55 _this.parents('form').find('#cityId').val(''); 56 } 57 //console.log(_this.attr('id')); 58 if (fadresVal != '') { 59 flyToCond = false; 60 } else { 61 flyToCond = true; 62 } 63 var contryVal = _this.parents('form').find('#countryId').val(); 64 var stateVal = _this.parents('form').find('#stateId').val(); 65 var cityVal = _this.parents('form').find('#cityId').val(); 66 // 67 var locAddr = _this.val(); 68 if (locAddr != '' && is_map_allow != 'no' && flyToCond === true) { 69 var newAddr = ''; 70 //console.log(cityVal); 71 if (cityVal != '' && cityVal != null) { 72 var comaDelb = ''; 73 if (stateVal != '' || contryVal != '') { 74 comaDelb = ', '; 75 } 76 newAddr += cityVal + comaDelb; 77 } 78 if (stateVal != '' && stateVal != null && newAddr == '') { 79 var comaDelb = ''; 80 if (contryVal != '') { 81 comaDelb = ', '; 82 } 83 newAddr += stateVal + comaDelb; 84 } 85 if (contryVal != '') { 86 newAddr += contryVal; 87 } 88 console.log(newAddr); 89 90 if (locMapType == 'mapbox') { 91 if (mapbox_access_token != '') { 92 var cords_url = 'https://api.mapbox.com/geocoding/v5/mapbox.places/' + encodeURI(newAddr) + '.json?access_token='
92+ mapbox_access_token; 93 console.log(cords_url); 94 jobsearch_common_getJSON(cords_url, function (status, response) { 95 //console.log(response); 96 if (typeof response.features[0].geometry.coordinates !== 'undefined') { 97 var mapCords = response.features[0].geometry.coordinates; 98 if (mapCords.length > 0) { 99 if (jobsearch_plugin_vars.is_rtl) { 100 mapboxgl.setRTLTextPlugin( 101 'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js', 102 null, 103 true // Lazy load the plugin 104 ); 105 } 106 mapboxgl.accessToken = mapbox_access_token; 107 var mapLng = mapCords[0]; 108 var mapLat = mapCords[1]; 109 document.getElementById("jobsearch_location_lat_" + rand_num).value = mapLat; 110 document.getElementById("jobsearch_location_lng_" + rand_num).value = mapLng; 111 if(map !== undefined){ 112 map.flyTo({ 113 center: mapCords, 114 }); 115 } 116 // remove markers 117 if (currentMarkers !== undefined && currentMarkers !== null) { 118 for (var i = currentMarkers.length - 1; i >= 0; i--) { 119 currentMarkers[i].remove(); 120 } 121 } 122 // 123 if(map !== undefined){ 124 var new_marker = new mapboxgl.Marker({ 125 draggable: true 126 }).setLngLat(mapCords).addTo(map); 127 128 } 129 130 if (currentMarkers !== undefined) { 131 currentMarkers.push(new_marker); 132 } 133 if (new_marker !== undefined) { 134 new_marker.on('dragend', function () { 135 var lngLat = new_marker.getLngLat(); 136 document.getElementById("jobsearch_location_lat_" + rand_num).value = lngLat.lat; 137 document.getElementById("jobsearch_location_lng_" + rand_num).value = lngLat.lng; 138 }); 139 } 140 } 141 } 142 }); 143 } 144 } else { 145 146 var geocoder = new google.maps.Geocoder(); 147 geocoder.geocode({address: newAddr}, function (results, status) { 148 149 //alert(addres); 150 if (status == google.maps.GeocoderStatus.OK) { 151 var new_latitude = results[0].geometry.location.lat(); 152 var new_longitude = results[0].geometry.location.lng(); 153 document.getElementById("jobsearch_location_lat_" + rand_num).value = new_latitude; 154 document.getElementById("jobsearch_location_lng_" + rand_num).value = new_longitude; 155 // 156 map.setCenter(results[0].geometry.location);//center the map over the result 157 158 // clear markers 159 for (var i = 0; i < markers.length; i++) { 160 markers[i].setMap(null); 161 } 162 163 //place a marker at the location 164 var marker = new google.maps.Marker({ 165 map: map, 166 position: results[0].geometry.location, 167 draggable: true, 168 title: '', 169 }); 170 171 markers.push(marker); 172 173 google.maps.event.addListener(marker, 'dragend', function (event) { 174 document.getElementById("jobsearch_location_lat_" + rand_num).value = this.getPosition().lat(); 175 document.getElementById("jobsearch_location_lng_" + rand_num).value = this.getPosition().lng(); 176 }); 177 } 178 }); 179 } 180 } 181 // 182} 183 184jQuery(document).on('change', '#countryId,#stateId,#cityId,select[name^=jobsearch_field_location_location]', function () { 185 var _this = jQuery(this); 186 var this_rand = _this.attr('data-randid'); 187 if (typeof this_rand === 'undefined') { 188 this_rand = _this.parents('li').attr('data-randid'); 189 } 190 if (_this.attr('id') == 'cityId') { 191 var chngeCityLocIntrvl = setInterval(function () { 192 jobsearch_loc_levels_to_mapcords(_this, this_rand); 193 clearInterval(chngeCityLocIntrvl); 194 }, 1000); 195 } else { 196 jobsearch_loc_levels_to_mapcords(_this, this_rand); 197 } 198}); 199 200jQuery(document).ready(function () { 201 if (jQuery('#jobsearch-gdapilocs-statecon').length > 0) { 202 var stateChngeSelTime = setInterval(function () { 203 var gdapilocs_state_con = jQuery('#jobsearch-gdapilocs-statecon'); 204 var gdapilocs_state_val = gdapilocs_state_con.attr('data-val'); 205 if (gdapilocs_state_val != '' && gdapilocs_state_val != '0') { 206 var gdapilocs_state_opts = gdapilocs_state_con.find('select').find('option'); 207 if (gdapilocs_state_opts.length > 1) { 208 var new_states_opthtml = ''; 209 gdapilocs_state_opts.each(function (state_elem, state_index) { 210 var this_apistate = jQuery(this); 211 var this_apistate_val = this_apistate.val(); 212 var this_apistate_label = this_apistate.html(); 213 var this_apistate_id = this_apistate.attr('stateid'); 214 if (this_apistate_label != '') { 215 new_states_opthtml += '<option value="' + this_apistate_val + '" ' + (typeof this_apistate_id !== 'undefined' ? 'stateid=' + this_apistate_id : '') + ' ' + (this_apistate_val == gdapilocs_state_val ? 'selected="selected"' : '') + '>
215' + this_apistate_label + '</option>' + "\n"; 216 } 217 }); 218 gdapilocs_state_con.find('select').html(new_states_opthtml); 219 jQuery('#jobsearch-gdapilocs-statecon').find('select').trigger('change'); 220 221 // For city 222 if (jQuery('#jobsearch-gdapilocs-citycon').length > 0) { 223 var cityChngeSelTime = setInterval(function () { 224 var gdapilocs_city_con = jQuery('#jobsearch-gdapilocs-citycon'); 225 var gdapilocs_city_val = gdapilocs_city_con.attr('data-val'); 226 if (gdapilocs_city_val != '' && gdapilocs_city_val != '0') { 227 var gdapilocs_city_opts = gdapilocs_city_con.find('select').find('option'); 228 if (gdapilocs_city_opts.length > 1) { 229 var new_citys_opthtml = ''; 230 gdapilocs_city_opts.each(function (city_elem, city_index) { 231 var this_apicity = jQuery(this); 232 var this_apicity_val = this_apicity.val(); 233 var this_apicity_label = this_apicity.html(); 234 if (this_apicity_label != '') { 235 new_citys_opthtml += '<option value="' + this_apicity_val + '" ' + (this_apicity_val == gdapilocs_city_val ? 'selected="selected"' : '') + '>' + this_apicity_label + '</option>' + "\n"; 236 } 237 }); 238 gdapilocs_city_con.find('select').html(new_citys_opthtml); 239 } 240 } 241 clearInterval(cityChngeSelTime); 242 }, 1500); 243 } 244 // 245 } 246 } 247 clearInterval(stateChngeSelTime); 248 }, 2500); 249 } 250}); 251 252jQuery('.location_location1').on('change', function (e) { 253 e.preventDefault(); 254 var this_id = jQuery(this).data('randid'), 255 nextfieldelement = jQuery(this).data('nextfieldelement'), 256 nextfieldval = jQuery(this).data('nextfieldval'), 257 ajax_url = jobsearch_location_common_vars.ajax_url, 258 location_location1 = jQuery('#location_location1_' + this_id), 259 location_location2 = jQuery('#location_location2_' + this_id); 260 jQuery('.location_location2_' + this_id).html('<i class="fa fa-refresh fa-spin"></i>'); 261 262 jobsearch_loc_levels_names_to_address(this_id); 263 264 var request = jQuery.ajax({ 265 url: ajax_url, 266 method: "POST", 267 data: { 268 location_location: location_location1.val(), 269 nextfieldelement: nextfieldelement, 270 nextfieldval: nextfieldval, 271 action: 'jobsearch_location_load_location2_data', 272 }, 273 dataType: "json" 274 }); 275 276 request.done(function (response) { 277 if ('undefined' !== typeof response.html) { 278 if (jQuery('.location_location2_selectize').length > 0) { 279 if (jQuery('.location_location2_selectize').hasClass('location2_selectize_ajax')) { 280 jQuery('.location2_selectize_ajax').selectize()[0].selectize.destroy(); 281 } 282 } 283 location_location2.html(response.html); 284 if (typeof location_location2.parent('.jobsearch-profile-select').find('.selectize-control') !== 'undefined') { 285 location_location2.parent('.jobsearch-profile-select').find('.selectize-control').remove(); 286 location_location2.removeAttr('style'); 287 location_location2.removeAttr('tabindex'); 288 location_location2.removeClass('location2_selectize_ajax'); 289 location_location2.removeClass('selectized'); 290 }
291 jQuery('.location_location2_' + this_id).html(''); 292 if (nextfieldval != '') { 293 jQuery('.location_location2').trigger('change'); 294 } 295 // 296 if (jQuery('.location_location2_selectize').length > 0) { 297 if (!jQuery('.location_location2_selectize').hasClass('location2_selectize_ajax')) { 298 jQuery('.location_location2_selectize').addClass('location2_selectize_ajax'); 299 300 jQuery('.location2_selectize_ajax').selectize({ 301 //allowEmptyOption: true, 302 }); 303 } 304 } 305 306 // 307 if (jQuery('.location_location3_selectize').length > 0) { 308 if (jQuery('.location_location2_selectize').val() == '') { 309 jQuery('.location_location2_selectize').trigger('change'); 310 } 311 } 312 } 313 }); 314 315 request.fail(function (jqXHR, textStatus) { 316 }); 317 return false; 318 319}); 320 321jQuery('.location_location2').on('change', function (e) { 322 e.preventDefault(); 323 var this_id = jQuery(this).data('randid'), 324 nextfieldelement = jQuery(this).data('nextfieldelement'), 325 nextfieldval = jQuery(this).data('nextfieldval'), 326 ajax_url = jobsearch_location_common_vars.ajax_url, 327 location_location2 = jQuery('#location_location2_' + this_id), 328 location_location3 = jQuery('#location_location3_' + this_id); 329 jQuery('.location_location3_' + this_id).html('<i class="fa fa-refresh fa-spin"></i>'); 330 331 jobsearch_loc_levels_names_to_address(this_id); 332 333 var request = jQuery.ajax({ 334 url: ajax_url, 335 method: "POST", 336 data: { 337 location_location: location_location2.val(), 338 nextfieldelement: nextfieldelement, 339 nextfieldval: nextfieldval, 340 action: 'jobsearch_location_load_location2_data', 341 }, 342 dataType: "json" 343 }); 344 345 request.done(function (response) { 346 if ('undefined' !== typeof response.html) { 347 if (jQuery('.location_location3_selectize').length > 0) { 348 if (jQuery('.location_location3_selectize').hasClass('location3_selectize_ajax')) { 349 jQuery('.location3_selectize_ajax').selectize()[0].selectize.destroy(); 350 } 351 } 352 location_location3.html(response.html); 353 if (typeof location_location3.parent('.jobsearch-profile-select').find('.selectize-control') !== 'undefined') { 354 location_location3.parent('.jobsearch-profile-select').find('.selectize-control').remove(); 355 location_location3.removeAttr('style'); 356 location_location3.removeAttr('tabindex'); 357 location_location3.removeClass('location3_selectize_ajax'); 358 location_location3.removeClass('selectized'); 359 } 360 jQuery('.location_location3_' + this_id).html(''); 361 if (nextfieldval != '') { 362 jQuery('.location_location3').trigger('change'); 363 } 364 // 365 if (jQuery('.location_location3_selectize').length > 0) { 366 if (!jQuery('.location_location3_selectize').hasClass('location3_selectize_ajax')) { 367 jQuery('.location_location3_selectize').addClass('location3_selectize_ajax'); 368 369 jQuery('.location3_selectize_ajax').selectize({ 370 //allowEmptyOption: true, 371 }); 372 } 373 } 374 375 // 376 if (jQuery('.location_location4_selectize').length > 0) { 377 if (jQuery('.location_location3_selectize').val() == '') { 378 jQuery('.location_location3_selectize').trigger('change'); 379 } 380 } 381 } 382 }); 383 384 request.fail(function (jqXHR, textStatus) { 385 }); 386 return false; 387 388}); 389 390 391 392jQuery('.location_location3').on('change', function (e) { 393 e.preventDefault(); 394 var this_id = jQuery(this).data('randid'), 395 nextfieldelement = jQuery(this).data('nextfieldelement'), 396 nextfieldval = jQuery(this).data('nextfieldval'), 397 ajax_url = jobsearch_location_common_vars.ajax_url, 398 location_location3 = jQuery('#location_location3_' + this_i
398d), 399 location_location4 = jQuery('#location_location4_' + this_id); 400 jQuery('.location_location4_' + this_id).html('<i class="fa fa-refresh fa-spin"></i>'); 401 402 jobsearch_loc_levels_names_to_address(this_id); 403 404 var request = jQuery.ajax({ 405 url: ajax_url, 406 method: "POST", 407 data: { 408 location_location: location_location3.val(), 409 nextfieldelement: nextfieldelement, 410 nextfieldval: nextfieldval, 411 action: 'jobsearch_location_load_location2_data', 412 }, 413 dataType: "json" 414 }); 415 416 request.done(function (response) { 417 if ('undefined' !== typeof response.html) { 418 if (jQuery('.location_location4_selectize').length > 0) { 419 if (jQuery('.location_location4_selectize').hasClass('location4_selectize_ajax')) { 420 jQuery('.location4_selectize_ajax').selectize()[0].selectize.destroy(); 421 } 422 } 423 location_location4.html(response.html); 424 if (typeof location_location4.parent('.jobsearch-profile-select').find('.selectize-control') !== 'undefined') { 425 location_location4.parent('.jobsearch-profile-select').find('.selectize-control').remove(); 426 location_location4.removeAttr('style'); 427 location_location4.removeAttr('tabindex'); 428 location_location4.removeClass('location4_selectize_ajax'); 429 location_location4.removeClass('selectized'); 430 } 431 jQuery('.location_location4_' + this_id).html(''); 432 // 433 if (jQuery('.location_location4_selectize').length > 0) { 434 if (!jQuery('.location_location4_selectize').hasClass('location4_selectize_ajax')) { 435 jQuery('.location_location4_selectize').addClass('location4_selectize_ajax'); 436 437 jQuery('.location4_selectize_ajax').selectize({ 438 //allowEmptyOption: true, 439 }); 440 } 441 } 442 } 443 }); 444 445 request.fail(function (jqXHR, textStatus) { 446 }); 447 return false; 448 449});
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.