1/* ----------------- Start Document ----------------- */ 2(function($){ 3"use strict"; 4 5$(document).ready(function(){ 6 7 8 var url; 9 var infoBox_ratingType = 'star-rating'; 10 var text; 11 var marker_color; 12 13 // Touch Gestures 14 if ( $('#search_map').attr('data-map-scroll') == 'true' || $(window).width() < 992 ) { 15 var scrollEnabled = false; 16 } else { 17 var scrollEnabled = true; 18 } 19 if ( $(window).width() < 992 ) { 20 var scrollEnabled = false; 21 } 22 23 var mapOptions = { 24 gestureHandling: scrollEnabled, 25 } 26 $(".geoLocation,.input-with-icon.location a,.sidebar-search_location-container a").on("click", function (e) { 27 e.preventDefault(); 28 29 geolocate(); 30 }); 31 32 // Map Init 33 34 $('#scrollEnabling').hide(); 35 36 37 38 function jobLocationData(jobURL,jobImg,jobTitle, jobAddress, companyName, jobType, rate, salary) { 39 var output; 40 var output_image; 41 if(jobImg){ 42 output_image = '<div class="job-listing-company-logo"><img src="'+jobImg+'" alt=""></div>'; 43 } 44 output = '<a href="'+jobURL+'" class="job-listing">'+ 45 '<div class="job-listing-details">'+output_image + 46 '<div class="job-listing-description">'+ 47 '<h4 class="job-listing-company">'+companyName+'</h4>'+ 48 '<h3 class="job-listing-title">'+jobTitle+'</h3>'+ 49 ''+jobType; 50 if(rate || salary ) { 51 output += '<ul>'+rate+''+ 52 ''+salary+'</ul>'; 53 54 } 55 56 output += '</div>'+ 57 '</div>'+ 58 '</a>'; 59 return output; 60 } 61 // $(this).find('a').attr('href') ? $(this).find('a').attr('href') : $(this).attr('href'), 62 // $(this).data('image'), 63 // $(this).data('title'), 64 // $(this).data('profession'), 65 // $(this).data('location'), 66 // $(this).data('rate'), 67 // $(this).data('skills'), 68 function resumeLocationData(resumeURL,resumeImg,candidateTitle, profession, location, rate, skills) { 69 var output; 70 var output_image; 71 if(resumeImg){ 72 output_image = '<div class="job-listing-company-logo"><img src="'+resumeImg+'" alt=""></div>'; 73 } 74 output = '<a href="'+resumeURL+'" class="job-listing">'+ 75 '<div class="job-listing-details">'+output_image + 76 '<div class="job-listing-description">'+ 77 '<h4 class="job-listing-company">'+profession+'</h4>'+ 78 '<h3 class="job-listing-title">'+candidateTitle+'</h3>'+ 79 ''+skills; 80 if(rate){ 81 output += '<ul>'+rate+'</ul>'; 82 } 83 84 output += '</div>'+ 85 '</div>'+ 86 '</a>' 87 return output; 88 } 89 90 91 92 93 function getJobMarkers() { 94 var arrMarkers = []; 95 $('ul.job_listings li').each(function(index) { 96 var point_address; 97 98 99 // if( $( this ).is('a') ){ 100 // url = $(this).find('a').attr('href'); 101 // } else { 102 // url = $(this).find('a').attr('href'); 103 // } 104 105 if( $( this ).data('longitude') && $( this ).data('latitude') ) { 106 // text = $( this ).html() + '<div class="infoBox-close"><i class="fa fa-times"></i></div>'; 107 marker_color = $( this ).data('color'); 108 if(marker_color == null) { marker_color = wsmap.marker_color; } 109 // arrMarkers.push( [parseFloat($( this ).data('latitude')), parseFloat($( this ).data('longitude')), text, marker_color ] ); 110 // 111 var latitude = $( this ).data('longitude'); 112 var reg = new RegExp("^-?([1-8]?[1-9]|[1-9]0)\.{1}\d{1,6}"); 113 114 arrMarkers.push([ 115 jobLocationData( 116 $(this).find('a').attr('href') ? $(this).find('a').attr('href') : $(this).attr('href'), 117 $(this).data('image'), 118 $(this).data('title'), 119 $(this).data('address'), 120 $(this).data('company'), 121 $(this).data('job_type'), 122 $(this).data('rate'), 123 $(this).data('salary'), 124 $(this).data('marker_color'), 125 126 127 ), 128 $( this ).data('latitude'), $( this ).data('longitude'), 1, $(this).data('job_type_class'), 129 ]); 130 131 132 } 133 }); 134 135 return arrMarkers; 136 } 137 138 function getResumeMarkers() { 139 var arrMarkers = []; 140 $('.resumes li.resume').each(function(index) { 141 var point_address; 142 143 144 // if( $( this ).is('a') ){ 145 // url = $(this).find('a').attr('href'); 146 // } else { 147 // url = $(this).find('a').attr('href'); 148 // } 149 150 if( $( this ).data('longitude') && $( this ).data('latitude') ) { 151 // text = $( this ).html() + '<div class="infoBox-close"><i class="fa fa-times"></i></div>'; 152 // marker_color = $( this ).data('color'); 153 // if(marker_color == null) { marker_color = wsmap.marker_color; } 154 // arrMarkers.push( [parseFloat($( this ).data('latitude')), parseFloat($( this ).data('longitude')), text, marker_color ] ); 155 arrMarkers.push([ 156 resumeLocationData( 157 $(this).find('a').attr('href') ? $(this).find('a').attr('href') : $(this).attr('href'), 158 $(this).data('image'), 159 $(this).data('title'), 160 $(this).data('profession'), 161 $(this).data('location'), 162 $(this).data('rate'), 163 $(this).data('skills'), 164 ), 165 $( this ).data('latitude'), $( this ).data('longitude'), 1, $(this).data('icon'), 166 ]); 167 168 } 169 }); 170 171 return arrMarkers; 172 } 173 174 175 function iconColor(color) { 176 177 return { 178 path: 'M19.9,0c-0.2,0-1.6,0-1.8,0C8.8,0.6,1.4,8.2,1.4,17.8c0,1.4,0.2,3.1,0.5,4.2c-0.1-0.1,0.5,1.9,0.8,2.6c0.4,1,0.7,2.1,1.2,3 c2,3.6,6.2,9.7,14.6,18.5c0.2,0.2,0.4,0.5,0.6,0.7c0,0,0,0,0,0c0,0,0,0,0,0c0.2-0.2,0.4-0.5,0.6-0.7c8.4-8.7,12.5-14.8,14.6-18.5 c0.5-0.9,0.9-2,1.3-3c0.3-0.7,0.9-2.6,0.8-2.5c0.3-1.1,0.5-2.7,0.5-4.1C36.7,8.4,29.3,0.6,19.9,0z M2.2,22.9 C2.2,22.9,2.2,22.9,2.2,22.9C2.2,22.9,2.2,22.9,2.2,22.9C2.2,22.9,3,25.2,2.2,22.9z M19.1,26.8c-5.2,0-9.4
178-4.2-9.4-9.4 s4.2-9.4,9.4-9.4c5.2,0,9.4,4.2,9.4,9.4S24.3,26.8,19.1,26.8z M36,22.9C35.2,25.2,36,22.9,36,22.9C36,22.9,36,22.9,36,22.9 C36,22.9,36,22.9,36,22.9z M13.8,17.3a5.3,5.3 0 1,0 10.6,0a5.3,5.3 0 1,0 -10.6,0', 179 strokeOpacity: 0, 180 strokeWeight: 1, 181 fillColor: color, 182 fillOpacity: 1, 183 rotation: 0, 184 scale: 1, 185 anchor: new google.maps.Point(19,52) 186 }; 187 } 188 189 190 191 window.L_DISABLE_3D = true 192 193 194 // console.log(locations); 195 var group; 196 var marker; 197 var locations; 198 var markerArray = []; 199 200 var markers; 201 202 var latlngStr = wsmap.centerPoint.split(",",2); 203 204 var lat = parseFloat(latlngStr[0]); 205 var lng = parseFloat(latlngStr[1]); 206 207 var mapOptions = { 208 center: [lat,lng], 209 zoom: wsmap.default_zoom, 210 zoomControl: false, 211 gestureHandling: scrollEnabled 212 } 213 214 var _map = document.getElementById('search_map'); 215 216 if (typeof(_map) != 'undefined' && _map != null) { 217 window.map = L.map('search_map',mapOptions) 218 219 switch(workscout_core.map_provider) { 220 case 'osm': 221 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 222 attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' 223 }).addTo(map); 224 225 226 break; 227 case 'google': 228 229 var roads = L.gridLayer 230 .googleMutant({ 231 type: wsmap.map_type.toLowerCase(), // valid values are 'roadmap', 'satellite', 'terrain' and 'hybrid' 232 }) 233 .addTo(map); 234 235 break; 236 237 case 'mapbox': 238 var accessToken = workscout_core.mapbox_access_token; 239 if(workscout_core.mapbox_retina){ 240 241 L.tileLayer('https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}
241@2x?access_token=' + accessToken, { 242 attribution: " © <a href='https://www.mapbox.com/about/maps/'>Mapbox</a> © <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a> <strong><a href='https://www.mapbox.com/map-feedback/' target='_blank'>Improve this map</a></strong>", 243 tileSize: 512, 244 maxZoom: 18, 245 zoomOffset: -1, 246 id: 'mapbox.streets', 247 248 accessToken: workscout_core.mapbox_access_token 249 }).addTo(map); 250 } else { 251 252 L.tileLayer('https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token=' + accessToken, { 253 attribution: " © <a href='https://www.mapbox.com/about/maps/'>Mapbox</a> © <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a> <strong><a href='https://www.mapbox.com/map-feedback/' target='_blank'>Improve this map</a></strong>", 254 maxZoom: 18, 255 //detectRetina: true, 256 id: 'mapbox.streets', 257 accessToken: workscout_core.mapbox_access_token 258 }).addTo(map); 259 } 260 261 break; 262 263 264 265 266 case 'bing': 267 L.tileLayer.bing(workscout_core.bing_maps_key).addTo(map) 268 break; 269 270 case 'thunderforest': 271 var tileUrl = 'https://tile.thunderforest.com/cycle/{z}/{x}/{y}{r}.png?apikey='+workscout_core.thunderforest_api_key, 272 layer = new L.TileLayer(tileUrl, {maxZoom: 18}); 273 map.addLayer(layer); 274 break; 275 276 case 'here': 277 L.tileLayer.here({appId: workscout_core.here_app_id, appCode: workscout_core.here_app_code}).addTo(map); 278 break; 279 } 280 281 if ( $('#search_map').attr('data-map-scroll') == 'true') { 282 map.scrollWheelZoom.enable(); 283 console.log('scrol-enable'); 284 } 285 if( $(window).width() < 992 ){ 286 map.scrollWheelZoom.disable(); 287 console.log('scrol-disable'); 288 } 289 290 var zoomOptions = { 291 zoomInText: '<i class="fa fa-plus" aria-hidden="true"></i>', 292 zoomOutText: '<i class="fa fa-minus" aria-hidden="true"></i>', 293 }; 294 // Creating zoom control 295 var zoom = L.control.zoom(zoomOptions); 296 zoom.addTo(map); 297 298 299 } 300 301 if($('#search_map').length) { 302 $( '.job_listings,.resumes' ).on( 'updated_results', function ( ) { 303 map.removeLayer(markers); 304 listingsMap(map); 305 // addMarkers(); 306 //codeAddress() 307 }); 308 } 309 310 function listingsMap(map){ 311 markerArray = []; 312 var current_zoom = map.getZoom() 313 markers = L.markerClusterGroup({ 314 spiderfyOnMaxZoom: true, 315 showCoverageOnHover: false, 316 }); 317 if($('#search_map').hasClass('jobs_map')){ 318 319 locations = getJobMarkers(); 320 321 322 } else { 323 324 locations = getResumeMarkers(); 325 326 } 327 console.log(locations); 328 for (var i = 0; i < locations.length; i++) { 329 330 var listeoIcon = L.divIcon({ 331 iconAnchor: [0, 0], // point of the icon which will correspond to marker's location 332 popupAnchor: [0, 0], 333 className: 'listeo-marker-icon', 334 html: '<div class="marker-container '+locations[i][4]+'" style="background-color: '+locations[i][8]+'">'+ 335 '<div class="marker-card">'+ 336 '<div class="front face"></div>'+ 337 '<div class="back face"></div>'+ 338 '<div class="marker-arrow"></div>'+ 339 '</div>'+ 340 '</div>' 341 342 } 343 ); 344 var popupOptions = 345 { 346 'maxWidth': '320', 347 'minWidth': '320', 348 'className' : 'leaflet-infoBox' 349 } 350 351 marker = new L.marker([locations[i][1],locations[i][2]], { 352 icon: listeoIcon, 353 354 }) 355 .bindPopup(locations[i][0],popupOptions ); 356 //.addTo(map); 357 marker.on('click', function(e){ 358 359 });
360 if(wsmap.use_clusters){ 361 markers.addLayer(marker); 362 } else { 363 marker.addTo(map); 364 } 365 366 // 367 368 markerArray.push(L.marker([locations[i][1], locations[i][2]])); 369 } 370 if(wsmap.use_clusters){ 371 map.addLayer(markers); 372 } 373 374 if(wsmap.autofit && markerArray.length > 0 ){ 375 console.log(markerArray); 376 group = L.featureGroup(markerArray); 377 console.log(group.getBounds()); 378 map.fitBounds(group.getBounds()); 379 map.setView(group.getBounds().getCenter()); 380 } 381 } 382 383 var map_id = document.getElementById('search_map'); 384 385 if (typeof(map_id) != 'undefined' && map_id != null) { 386 listingsMap(map); 387 388 } 389 390 if(wsmap.address_provider == 'osm'){ 391 if(wsmap.country){ 392 var geocoder = new L.Control.Geocoder.Nominatim( { 393 geocodingQueryParams: {countrycodes: wsmap.country} 394 }); 395 } else { 396 var geocoder = new L.Control.Geocoder.Nominatim(); 397 } 398 399 var output = []; 400 $("#search_location,#job_location,#candidate_location").attr('autocomplete', 'off').after('<div id="leaflet-geocode-cont"><ul></ul></div>') 401 var liSelected; 402 var next; 403 // OSM TIP 404 $("#search_location,#job_location,#candidate_location") 405 .on("mouseover",function() { 406 if ( $(this).val().length < 10 ) { 407 $('.type-and-hit-enter').addClass('tip-visible'); 408 } 409 }).on("mouseout",function(e) { 410 setTimeout(function(){ 411 $('.type-and-hit-enter').removeClass('tip-visible'); 412 }, 350); 413 }).on("keyup",function(e) { 414 415 if ( $(this).val().length < 10 ) { 416 $('.type-and-hit-enter').addClass('tip-visible'); 417 } 418 if ( $(this).val().length > 10 ) { 419 $('.type-and-hit-enter').removeClass('tip-visible tip-visible-focusin'); 420 } 421 422 if(e.which === 40 || e.which === 38 ) { 423 424 425 } else { 426 $('#leaflet-geocode-cont ul li.selected').removeClass('selected'); 427 } 428 // if(e.which !== 38 ) { 429 // console.log(e.which); 430 // //$('#leaflet-geocode-cont ul li.selected').removeClass('selected'); 431 // } 432 433 }).on("keydown",function(e) { 434 var li = $('#leaflet-geocode-cont ul li'); 435 if(e.which === 40){ 436 437 if(liSelected){ 438 liSelected.removeClass('selected'); 439 next = liSelected.next(); 440 if(next.length > 0){ 441 liSelected = next.addClass('selected'); 442 }else{ 443 liSelected = li.eq(0).addClass('selected'); 444 } 445 }else{ 446 liSelected = li.eq(0).addClass('selected'); 447 } 448 }else if(e.which === 38){ 449 if(liSelected){ 450 liSelected.removeClass('selected'); 451 next = liSelected.prev(); 452 if(next.length > 0){ 453 liSelected = next.addClass('selected'); 454 }else{ 455 liSelected = li.last().addClass('selected'); 456 } 457 }else{ 458 liSelected = li.last().addClass('selected'); 459 } 460 } 461 462 }); 463 464 $("#search_location,#job_location,#candidate_location,#company_location").on("focusin",function() { 465 if ( $(this).val().length < 10 ) { 466 $('.type-and-hit-enter').addClass('tip-visible-focusin'); 467 } 468 if ( $(this).val().length > 10 ) { 469 $('.type-and-hit-enter').removeClass('tip-visible-focusin'); 470 } 471 }).on("focusout",function() { 472 setTimeout(function(){ 473 $('.type-and-hit-enter').removeClass('tip-visible tip-visible-focusin'); 474 }, 350); 475 if( $(this).val() == 0 ) { 476 $('.job_listings,.resumes' ).triggerHandler( 'update_results', [ 1, false ] ); 477 } 478 }); 479 480 $(".location .la-map-marked-alt").on("mouseover",function() { 481 $('.type-and-hit-enter').removeClass('tip-visible-focusin tip-visible'); 482 }) 483 484 $('.type-and-click-btn').on("click",function search(e) { 485 486 var query = $('#_address').val(); 487 if(query){ 488 geocoder.geocode(query, function(results) { 489 490 for (var i = 0; i < results.length; i++) { 491 492 output.push('<li data-latitude="'+results[i].center.lat+'" data-longitude="'+results[i].center.lng+'" >'+results[i].name+'</li>'); 493 } 494 output.push('<li class="powered-by-osm">Powered by <strong>OpenStreetMap</strong></li>');
495 $("#leaflet-geocode-cont").addClass('active'); 496 $('#autocomplete-container').addClass("osm-dropdown-active"); 497 $('#leaflet-geocode-cont ul').html(output); 498 var txt_to_hl = query.split(' '); 499 txt_to_hl.forEach(function (item) { 500 $('#leaflet-geocode-cont ul').highlight(item); 501 }); 502 output = []; 503 }); 504 } 505 }); 506 507 $("#search_location,#job_location,#candidate_location,#company_location").on("keydown",function search(e) { 508 509 510 if(e.keyCode == 13) { 511 if($('#leaflet-geocode-cont ul li.selected').length>0){ 512 $('#leaflet-geocode-cont ul li.selected').trigger('click').removeClass('selected'); 513 514 return; 515 516 } 517 518 var query = $.trim($(this).val()); 519 if(query){ 520 geocoder.geocode(query, function(results) { 521 522 for (var i = 0; i < results.length; i++) { 523 524 output.push('<li data-latitude="'+results[i].center.lat+'" data-longitude="'+results[i].center.lng+'" >'+results[i].name+'</li>'); 525 } 526 output.push('<li class="powered-by-osm">Powered by <strong>OpenStreetMap</strong></li>'); 527 $('#leaflet-geocode-cont ul').html(output); 528 var txt_to_hl = query.split(' '); 529 txt_to_hl.forEach(function (item) { 530 $('#leaflet-geocode-cont ul').highlight(item); 531 }); 532 $('#autocomplete-container').addClass("osm-dropdown-active"); 533 $("#leaflet-geocode-cont").addClass('active'); 534 output = []; 535 }); 536 } 537 } 538 }); 539 $(".workscout_main_search_form,.job-manager-form,.job_filters,.resume_filters").on( "click", "#leaflet-geocode-cont ul li", function(e) { 540 541 $("#search_location").val($(this).text()); 542 $("#job_location").val($(this).text()); 543 $("#candidate_location").val($(this).text()); 544 $("#leaflet-geocode-cont").removeClass('active'); 545 $('#autocomplete-container').removeClass("osm-dropdown-active"); 546 547 var newLatLng = new L.LatLng($(this).data('latitude'), $(this).data('longitude')); 548 if(window.map){ 549 map.flyTo(newLatLng, 10); 550 } 551 var target = $('div.job_listings,div.resumes' ); 552 target.triggerHandler( 'update_results', [ 1, false ] ); 553 }); 554 555 $('.workscout_main_search_form,.job-manager-form,.job_filters').on('submit', function(){ 556 557 if ($('#search_location:focus').length){ return false;} 558 if ($('#job_location:focus').length){ return false;} 559 if ($('#candidate_location:focus').length){ return false;} 560 }); 561 562 if($("#search_location,#job_location,#candidate_location").val()) { 563 var query = $("#search_location,#job_location,#candidate_location").val() 564 geocoder.geocode(query, function(results) { 565 566 if(map){ 567 map.flyTo(results[0].center, 10); 568 } 569 570 571 }); 572 } 573 574 var mouse_is_inside = false;
575 576 $( "#search_location,#_address,#leaflet-geocode-cont" ).on( "mouseenter", function() { 577 mouse_is_inside=true; 578 }); 579 $( "#search_location,#_address,#leaflet-geocode-cont" ).on( "mouseleave", function() { 580 mouse_is_inside=false; 581 }); 582 583 $("body").mouseup(function(){ 584 if(! mouse_is_inside) $("#leaflet-geocode-cont").removeClass('active'); 585 }); 586 587 } //eof if addressprovider 588 589 590 591 592 593 function singleListingMap() { 594 595 var lng = parseFloat($( '#job_map' ).data('longitude')); 596 var lat = parseFloat($( '#job_map' ).data('latitude')); 597 var singleMapIco = "<i class='"+$('#job_map').data('map-icon')+"'></i>"; 598 var map_single; 599 var listeoIcon = L.divIcon({ 600 iconAnchor: [0, 0], // point of the icon which will correspond to marker's location 601 popupAnchor: [0, 0], 602 className: 'listeo-marker-icon', 603 html: '<div class="marker-container no-marker-icon ">'+ 604 '<div class="marker-card">'+ 605 '<div class="front face">' + singleMapIco + '</div>'+ 606 '<div class="back face">' + singleMapIco + '</div>'+ 607 '<div class="marker-arrow"></div>'+ 608 '</div>'+ 609 '</div>' 610 611 } 612 ); 613 var mapOptions = { 614 center: [lat,lng], 615 zoom: 13, 616 zoomControl: false, 617 gestureHandling: true 618 } 619 620 map_single = L.map('job_map',mapOptions); 621 var zoomOptions = { 622 zoomInText: '<i class="fa fa-plus" aria-hidden="true"></i>', 623 zoomOutText: '<i class="fa fa-minus" aria-hidden="true"></i>', 624 }; 625 // Creating zoom control 626 var zoom = L.control.zoom(zoomOptions); 627 zoom.addTo(map_single); 628 629 map_single.scrollWheelZoom.disable(); 630 631 marker = new L.marker([lat,lng], { 632 icon: listeoIcon, 633 634 }).addTo(map_single); 635 636 switch(workscout_core.map_provider) { 637 case 'osm': 638 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 639 attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' 640 }).addTo(map_single); 641 break; 642 case 'google': 643 644 var roads = L.gridLayer.googleMutant({ 645 type: wsmap.map_type.toLowerCase()// valid values are 'roadmap', 'satellite', 'terrain' and 'hybrid' 646 }).addTo(map_single); 647 648 break; 649 case 'mapbox': 650 var accessToken = workscout_core.mapbox_access_token; 651 if(workscout_core.mapbox_retina){ 652 653 L.tileLayer('https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}
653@2x?access_token=' + accessToken, { 654 attribution: " © <a href='https://www.mapbox.com/about/maps/'>Mapbox</a> © <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a> <strong><a href='https://www.mapbox.com/map-feedback/' target='_blank'>Improve this map</a></strong>", 655 tileSize: 512, 656 maxZoom: 18, 657 zoomOffset: -1, 658 id: 'mapbox.streets', 659 660 accessToken: workscout_core.mapbox_access_token 661 }).addTo(map_single); 662 } else { 663 664 L.tileLayer('https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token=' + accessToken, { 665 attribution: " © <a href='https://www.mapbox.com/about/maps/'>Mapbox</a> © <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a> <strong><a href='https://www.mapbox.com/map-feedback/' target='_blank'>Improve this map</a></strong>", 666 maxZoom: 18, 667 //detectRetina: true, 668 id: 'mapbox.streets', 669 accessToken: workscout_core.mapbox_access_token 670 }).addTo(map_single); 671 } 672 673 break; 674 // L.tileLayer('https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token={accessToken}', { 675 // attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', 676 // maxZoom: 18, 677 // detectRetina: true, 678 // id: 'mapbox.streets', 679 // accessToken: workscout_core.mapbox_access_token 680 // }).addTo(map_single); 681 // break; 682 683 case 'bing': 684 L.tileLayer.bing(workscout_core.bing_maps_key).addTo(map_single) 685 break; 686 687 case 'thunderforest': 688 var tileUrl = 'https://tile.thunderforest.com/cycle/{z}/{x}/{y}{r}.png?apikey='+workscout_core.thunderforest_api_key, 689 layer = new L.TileLayer(tileUrl, {maxZoom: 18}); 690 map_single.addLayer(layer); 691 break; 692 693 case 'here': 694 L.tileLayer.here({appId: workscout_core.here_app_id, appCode: workscout_core.here_app_code}).addTo(map_single); 695 break; 696 } 697 } 698 699 $( '.full-page-job-container' ).on( 'load_job_view', function ( ) { 700 701 var single_map_cont = document.getElementById('job_map'); 702 703 if (typeof(single_map_cont) != 'undefined' && single_map_cont != null) { 704 705 singleListingMap(); 706 } 707 }); 708 709 710 $(window).on('load', function() { 711 // Single Listing Map Init 712 var single_map_cont = document.getElementById('job_map'); 713 714 if (typeof(single_map_cont) != 'undefined' && single_map_cont != null) { 715 716 singleListingMap(); 717 } 718 719 if(wsmap.maps_autolocate){ 720 721 $(".geoLocation,.input-with-icon.location a,.sidebar-search_location-container a").trigger('click') 722 } 723 }); 724 725 726 }); 727 728 729// Map height on Half Map Page 730$(window).on('load resize', function() { 731 var headerHeight = $(".new-header #header-container").height(); 732 var windowHeight = $(window).height(); 733 734 $(".full-page-map-container #search_map").css({ 735 height: windowHeight - headerHeight 736 }); 737 738}); 739 740 741 742 743 // function geolocate() { 744 745 // if (navigator.geolocation) { 746 // navigator.geolocation.getCurrentPosition(function (position) { 747 748 // var latitude = position.coords.latitude; 749 // var longitude = position.coords.longitude; 750 // var latlng = L.latLng(latitude, longitude); 751 // if(window.map){ 752 // map.flyTo([latitude,longitude],10); 753 // var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); 754 // var geocoder = new google.maps.Geocoder(); 755 // geocoder.geocode( { 'latLng': pos}, function(results, status) { 756 // if (status == google.maps.GeocoderStatus.OK) { 757 // if (results[1]) { 758 // if($('#search_location').val().length === 0 ) { 759 // $('#search_location').val(results[1].formatted_address); 760 // $('#_address').val(results[1].formatted_address); 761 // } 762 // } 763 // $('#_geolocation_lat').val(latitude); 764 // $('#_geolocation_long').val(longitude); 765 // var listing_results = $('.job_listings,div.resumes:not(:parent.sidebar)'); 766 // listing_results.triggerHandler( 'update_results', [ 1, false ] ); 767 768 // } 769 // }); 770 771 // } else { 772 // var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); 773 // var geocoder = new google.maps.Geocoder(); 774 // geocoder.geocode( { 'latLng': pos}, function(results, status) { 775 // if (status == google.maps.GeocoderStatus.OK) { 776 // if (results[1]) { 777 // if($('#search_location').val().length === 0 ) { 778 // $('#search_location').val(results[1].formatted_address); 779 // $('#_address').val(results[1].formatted_address); 780 // } 781 // } 782 // $('#_geolocation_lat').val(latitude); 783 // $('#_geolocation_long').val(longitude); 784 // var listing_results = $('.job_listings,div.resumes:not(:parent.sidebar)'); 785 // listing_results.triggerHandler( 'update_results', [ 1, false ] ); 786 787 // } 788 // }); 789 790 // } 791 792 793 // }); 794 // } 795 // } 796 797 798 function geolocate() { 799 800 if (navigator.geolocation) { 801 navigator.geolocation.getCurrentPosition(function (position) { 802 803 var latitude = position.coords.latitude; 804 var longitude = position.coords.longitude; 805 var latlng = L.latLng(latitude, longitude); 806 807 if(wsmap.address_provider == 'google'){ 808 if(window.map){ 809 map.flyTo([latitude,longitude],10); 810 } 811 var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); 812 var geocoder = new google.maps.Geocoder(); 813 geocoder.geocode( { 'latLng': pos}, function(results, status) { 814 if (status == google.maps.GeocoderStatus.OK) { 815 if (results[1]) { 816 if($('#search_location').val().length === 0 ) { 817 $('#search_location').val(results[1].formatted_address); 818 $('#_address').val(results[1].formatted_address); 819 } 820 } 821 $('#_geolocation_lat').val(latitude); 822 $('#_geolocation_long').val(longitude); 823 var listing_results = $('.job_listings,div.resumes:not(:parent.sidebar)'); 824 listing_results.triggerHandler( 'update_results', [ 1, false ] ); 825 826 } 827 }); 828 829 } else { 830 if(wsmap.address_provider == 'osm'){ 831 if(wsmap.country){ 832 var geocoder = new L.Control.Geocoder.Nominatim( { 833 geocodingQueryParams: {countrycodes: wsmap.country} //accept-language: 'en' 834 }); 835 } else { 836 var geocoder = new L.Control.Geocoder.Nominatim(); 837 } 838 } 839 if(window.map){ 840 map.flyTo([latitude,longitude],10); 841 geocoder.reverse(latlng, map.options.crs.scale(map.getZoom()), function(results) { 842 if($('#search_location').val().length === 0 ) { 843 $("#search_location").val(results[0].name); 844 } 845 $("#_address").val(results[0].name); 846 $('#_geolocation_lat').val(latitude); 847 $('#_geolocation_long').val(longitude); 848 var newLatLng = new L.LatLng(latitude, longitude); 849 marker.setLatLng(newLatLng).update(); 850 map.panTo(newLatLng); 851 var listing_results = $('.job_listings,div.resumes:not(:parent.sidebar)'); 852 listing_results.triggerHandler( 'update_results', [ 1, false ] ); 853 }); 854 } else { 855 geocoder.reverse(latlng, 4, function(results) { 856 if($('#search_location').val().length === 0 ) { 857 $("#search_location").val(results[0].name); 858 } 859 $("#_address").val(results[0].name); 860 $('#_geolocation_lat').val(latitude); 861 $('#_geolocation_long').val(longitude); 862 var listing_results = $('.job_listings,div.resumes:not(:parent.sidebar)'); 863 listing_results.triggerHandler( 'update_results', [ 1, false ] ); 864 }); 865 866 } 867 868 } 869 870 }); 871 } 872 } 873 874 875 876})(this.jQuery); 877 878 879 880jQuery.fn.highlight = function(pat) { 881 function innerHighlight(node, pat) { 882 var skip = 0; 883 if (node.nodeType == 3) { 884 var pos = node.data.toUpperCase().indexOf(pat); 885 if (pos >= 0) { 886 var spannode = document.createElement('span'); 887 spannode.className = 'highlight';
888 var middlebit = node.splitText(pos); 889 var endbit = middlebit.splitText(pat.length); 890 var middleclone = middlebit.cloneNode(true); 891 spannode.appendChild(middleclone); 892 middlebit.parentNode.replaceChild(spannode, middlebit); 893 skip = 1; 894 } 895 } 896 else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) { 897 for (var i = 0; i < node.childNodes.length; ++i) { 898 i += innerHighlight(node.childNodes[i], pat); 899 } 900 } 901 return skip; 902 } 903 return this.each(function() { 904 innerHighlight(this, pat.toUpperCase()); 905 }); 906}; 907 908jQuery.fn.removeHighlight = function() { 909 function newNormalize(node) { 910 for (var i = 0, children = node.childNodes, nodeCount = children.length; i < nodeCount; i++) { 911 var child = children[i]; 912 if (child.nodeType == 1) { 913 newNormalize(child); 914 continue; 915 } 916 if (child.nodeType != 3) { continue; } 917 var next = child.nextSibling; 918 if (next == null || next.nodeType != 3) { continue; } 919 var combined_text = child.nodeValue + next.nodeValue; 920 new_node = node.ownerDocument.createTextNode(combined_text); 921 node.insertBefore(new_node, child); 922 node.removeChild(child); 923 node.removeChild(next); 924 i--; 925 nodeCount--; 926 } 927 } 928 929 return this.find("span.highlight").each(function() { 930 var thisParent = this.parentNode; 931 thisParent.replaceChild(this.firstChild, this); 932 newNormalize(thisParent); 933 }).end(); 934};
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.