1const marker_icon = [ 2'<?xml version="1.0"?>', 3 '<svg id="pin3" xmlns="http://www.w3.org/2000/svg" width="36.983" height="54.762" viewBox="0 0 36.983 54.762">', 4 '<path id="Path_1" data-name="Path 1" d="M507.3,152.41a18.581,18.581,0,0,0-18.492,18.629c0,6.173,5.649,17.236,8.077,21.705.8,1.477,7.912,14.428,10.415,14.428a.656.656,0,0,0,.081-.013l.013-.01v.009c.6-.07,1.434-.81,2.371-1.916l.018-.014a45.508,45.508,0,0,0,3.2-4.47l.019-.03c.315-.488.625-.98.928-1.47l.026-.041c1.85-2.99,3.406-5.828,3.757-6.474,2.428-4.468,8.077-15.531,8.077-21.7A18.58,18.58,0,0,0,507.3,152.41Z" transform="translate(-488.811 -152.41)" fill="#fff"/>', 5 '<path id="Path_2" data-name="Path 2" d="M512.984,199.276h0a34.87,34.87,0,0,1-4.808,6.575h0c-.03.025-.065.06-.093.081-3.041-2.27-16.575-25.19-16.575-34.11a16.575,16.575,0,1,1,33.149,0C524.655,178.076,518.008,191.2,512.984,199.276Z" transform="translate(-489.59 -153.194)" fill="{{ color }}"/>', 6 '<path id="Path_3" data-name="Path 3" d="M511.87,168.189a7.3,7.3,0,1,0,7.245,7.3A7.281,7.281,0,0,0,511.87,168.189Z" transform="translate(-493.378 -156.967)" fill="#fff"/>', 7 '<path id="Path_4" data-name="Path 4" d="M512.648,181.639a5.368,5.368,0,1,1,5.328-5.367A5.355,5.355,0,0,1,512.648,181.639Z" transform="translate(-494.156 -157.751)" fill="{{ color }}"/>', 8'</svg>'].join('\n'); 9const mapStyleJson = [ 10 { 11 "elementType": "geometry.fill", 12 "stylers": [ 13 { 14 "color": "#eff8f5" 15 } 16 ] 17 }, 18 { 19 "featureType": "administrative.land_parcel", 20 "stylers": [ 21 { 22 "visibility": "off" 23 } 24 ] 25 }, 26 { 27 "featureType": "administrative.neighborhood", 28 "stylers": [ 29 { 30 "visibility": "off" 31 } 32 ] 33 }, 34 { 35 "featureType": "poi", 36 "elementType": "labels.text", 37 "stylers": [ 38 { 39 "visibility": "off" 40 } 41 ] 42 }, 43 { 44 "featureType": "poi.business", 45 "stylers": [ 46 { 47 "visibility": "off" 48 } 49 ] 50 }, 51 { 52 "featureType": "road", 53 "elementType": "labels", 54 "stylers": [ 55 { 56 "visibility": "off" 57 } 58 ] 59 }, 60 { 61 "featureType": "road", 62 "elementType": "labels.icon", 63 "stylers": [ 64 { 65 "visibility": "off" 66 } 67 ] 68 }, 69 { 70 "featureType": "road.arterial", 71 "elementType": "geometry.fill", 72 "stylers": [ 73 { 74 "color": "#77b89c" 75 } 76 ] 77 }, 78 { 79 "featureType": "road.highway", 80 "elementType": "geometry.fill", 81 "stylers": [ 82 { 83 "color": "#146453" 84 } 85 ] 86 }, 87 { 88 "featureType": "road.local", 89 "elementType": "geometry.fill", 90 "stylers": [ 91 { 92 "color": "#c5ecdd" 93 } 94 ] 95 }, 96 { 97 "featureType": "transit", 98 "stylers": [ 99 { 100 "visibility": "off" 101 } 102 ] 103 }, 104 { 105 "featureType": "water", 106 "elementType": "geometry.fill", 107 "stylers": [ 108 { 109 "color": "#6cd2e7" 110 } 111 ] 112 }, 113 { 114 "featureType": "water", 115 "elementType": "labels.text", 116 "stylers": [ 117 { 118 "visibility": "off" 119 } 120 ] 121 } 122 ]; 123//var bigmap = []; 124var calendar2; 125var calendar1; 126( function() { 127//var preinfo = false; 128document.addEventListener('DOMContentLoaded', function() { 129 var calendarEl = document.getElementById('calendar'); 130 if(calendarEl){ 131 var calendar1 = new FullCalendar.Calendar(calendarEl, { 132 selectable: true, 133 locale: document.documentElement.lang, 134 initialView: 'dayGridMonth', 135 // headerToolbar:{ 136 // start: '', // will normally be on the left. if RTL, will be on the right 137 // center: 'title', 138 // end: 'today prev,next' // will normally be on the right. if RTL, will be on the left 139 // }, 140 dateClick: function(info) { 141 get_events_from_calendar(info.dateStr); 142 }, 143 }); 144 calendar1.render(); 145 } 146 147 var calendarEl2 = document.getElementById('event-list-calendar'); 148 if(calendarEl2){ 149 calendar2 = new FullCalendar.Calendar(calendarEl2, { 150 selectable: false, 151 locale: document.documentElement.lang, 152 initialView: 'dayGridMonth', 153 eventSources: [ 154 // your event source 155 { 156 events: event_data_calendar, 157 color: '#F2736F', 158 } 159 ] 160 161 }); 162 calendar2.render(); 163 } 164}); 165 166function get_events_from_calendar(eDate=''){ 167 if(eDate!=''){ 168 var eventsWrap = jQuery('#home-events-wrap'); 169 eventsWrap.addClass('loading'); 170 console.log(eDate); 171 jQuery.ajax({ 172 url: mytzoymerka.ajaxurl, // This variable somewhere 173 method: 'POST', 174 //dataType: "json", 175 data: { 176 action:'get_events_from_calendar', 177 date: eDate, 178 _ajax_nonce: mytzoymerka.nonce 179 }, 180 success: function(data){ 181 eventsWrap.html(data); 182 }, 183 error: function(){ 184 alert("Please try after some Time."); 185 }, 186 complete: function(){ 187 eventsWrap.removeClass('loading'); 188 }, 189 }); 190 } 191 192} 193 194 195//routes-filter 196 197// jQuery('.routes-filter .filter-box a').click(function(e){ 198// e.preventDefault(); 199// jQuery(this).toggleClass('active'); 200// get_routes_trail_post(); 201// }); 202jQuery(document).on('click','#routes-trail-grid-wrap .nav-wrap a', function(e){ 203 e.preventDefault(); 204 var nextPage = 1; 205 if(jQuery(this).hasClass('next')){
206 nextPage = parseInt(jQuery(this).parent().find('span.current').text()) + 1; 207 } 208 else if(jQuery(this).hasClass('prev')){ 209 nextPage = parseInt(jQuery(this).parent().find('span.current').text()) - 1; 210 } 211 else{ 212 nextPage = parseInt(jQuery(this).text()); 213 } 214 get_routes_trail_post(nextPage); 215}); 216 217function get_routes_trail_post(paged = 1){ 218 // var routes_trail_category=[]; 219 // jQuery('#routes_trail_category .filter-box').each(function(){ 220 // if(jQuery(this).find('a').hasClass('active')){ 221 // routes_trail_category.push(jQuery(this).find('a').attr('data-id')); 222 // } 223 // }); 224 // var routes_trail_area=[]; 225 // jQuery('#routes_trail_area .filter-box').each(function(){ 226 // if(jQuery(this).find('a').hasClass('active')){ 227 // routes_trail_area.push(jQuery(this).find('a').attr('data-id')); 228 // } 229 // }); 230 var routesTrailGridWrap = jQuery('#routes-trail-grid-wrap'); 231 routesTrailGridWrap.addClass('loding'); 232 jQuery.ajax({ 233 url: mytzoymerka.ajaxurl, // This variable somewhere 234 method: 'POST', 235 //dataType: "json", 236 data: { 237 action:'get_routes_trail_by_filter', 238 //category: routes_trail_category, 239 //area: routes_trail_area, 240 paged: paged, 241 _ajax_nonce: mytzoymerka.nonce 242 }, 243 success: function(data){ 244 routesTrailGridWrap.html(data); 245 }, 246 error: function(){ 247 alert("Please try after some Time."); 248 }, 249 complete: function(){ 250 routesTrailGridWrap.removeClass('loading'); 251 }, 252 }); 253} 254 255jQuery('#dest-filter-close').click(function(e){ 256 e.preventDefault(); 257 jQuery(this).parent().slideUp(); 258}); 259jQuery('.filter-icon').click(function(e){ 260 e.preventDefault(); 261 jQuery('.additional-filter-data').slideDown(); 262}); 263 264jQuery('.event-filter-row .filter-cat-tab a:not(.filter-event)').click(function(e){ 265 e.preventDefault(); 266 let termId = jQuery(this).attr('data-id'); 267 let term = jQuery(this).attr('data-type'); 268 if(typeof termId != 'undefined' && typeof term != 'undefined' ) { 269 jQuery('.event-filter-row .filter-cat-tab a').removeClass('active'); 270 jQuery(this).addClass('active'); 271 get_events_posts(); 272 } 273}); 274 275jQuery('.event-filter-row .filter-cat-tab a.filter-event').click(function(e){ 276 e.preventDefault(); 277 //alert(); 278 jQuery('.event-filter-row .filter-cat-tab a.filter-event').removeClass('active'); 279 //jQuery('.event-filter-row .filter-cat-tab a.filter-event').parents('.filter-cat-list').find('#daterange').addClass('active'); 280 jQuery(this).addClass('active'); 281 //jQuery(this).parents('.filter-cat-list').find('#daterange').addClass('active'); 282 get_events_posts(); 283 284}); 285 286jQuery(document).on('click','#events-grid-wrap .nav-wrap a', function(e){ 287 e.preventDefault(); 288 var nextPage = 1; 289 if(jQuery(this).hasClass('next')){ 290 nextPage = parseInt(jQuery(this).parent().find('span.current').text()) + 1; 291 } 292 else if(jQuery(this).hasClass('prev')){ 293 nextPage = parseInt(jQuery(this).parent().find('span.current').text()) - 1; 294 } 295 else{ 296 nextPage = parseInt(jQuery(this).text()); 297 } 298 get_events_posts(nextPage); 299}); 300 301function get_events_posts( paged = 1){ 302 let termId,term,sort,sort_daterange; 303 jQuery('.event-filter-row .filter-cat-tab a').each(function(){ 304 //alert(); 305 if(jQuery(this).hasClass('active') && !jQuery(this).hasClass('filter-event')){ 306 termId = jQuery(this).attr('data-id'); 307 term = jQuery(this).attr('data-type'); 308 309 } 310 else if(jQuery(this).hasClass('active') && jQuery(this).hasClass('filter-event')){ 311 sort = jQuery(this).attr('data-sort'); 312 sort_daterange = jQuery('.filter-event.active').parents('.filter-cat-list').find('#daterange').val(); 313 //sort_daterange = jQuery('#daterange.active').val(); 314 } 315 }); 316 317 var eventsGridWrap = jQuery('#events-grid-wrap'); 318 eventsGridWrap.addClass('loding'); 319 jQuery.ajax({ 320 url: mytzoymerka.ajaxurl, // This variable somewhere 321 method: 'POST', 322 //dataType: "json", 323 data: { 324 action:'get_events_by_filter', 325 termId: termId, 326 term: term, 327 sort:sort, 328 sort_daterange:sort_daterange, 329 paged: paged, 330 _ajax_nonce: mytzoymerka.nonce 331 }, 332 beforeSend: function(){ 333 jQuery('.pulse-loader').show(500); 334 }, 335 success: function(data){ 336 eventsGridWrap.html(data.html); 337 console.log(data.events.length);
338 calendar2.getEventSources().forEach(eventSource => { 339 eventSource.remove(); 340 }); 341 if(data.events.length>0){ 342 calendar2.addEventSource({events: data.events,color: '#F2736F'}); 343 } 344 }, 345 error: function(){ 346 alert("Please try after some Time."); 347 }, 348 complete: function(){ 349 eventsGridWrap.removeClass('loading'); 350 jQuery('.pulse-loader').hide(500); 351 }, 352 }); 353} 354 355 356 357}(jQuery) ); 358 359function initCustomRouteMap() { 360 361 const customMap = document.getElementById("custom-map-route"); 362 if(customMap){ 363 var customMapEl; 364 //mapDiv[i].style.backgroundColor = "red"; 365 const directionsService = new google.maps.DirectionsService(); 366 const directionsRenderer = new google.maps.DirectionsRenderer({suppressMarkers: true}); 367 customMapEl = new google.maps.Map(customMap); 368 customMapEl.markers = []; 369 directionsRenderer.setMap(customMapEl); 370 customCalculateAndDisplayRoute(directionsService, directionsRenderer,customMap); 371 customAddRouteMarkers(customMapEl, customMap); 372 } 373 374 function customAddRouteMarkers(bigmap, el){ 375 //var marker_c = 1; 376 var activeinfo = null; 377 const markers = el.dataset.markers; 378 const marker_obj = JSON.parse(markers); 379 const marker_ln = marker_obj.length; 380 marker_obj.forEach(function (item, key) { 381 //var svg = marker_icon.replace(/{{ color }}/g, item.m_color); 382 // Create marker instance. 383 var marker = new google.maps.Marker({ 384 position : { lat: parseFloat(item.lat), lng: parseFloat(item.lng) }, 385 //label: {text: marker_c.toString(), color: marker_color, fontSize: "22px"}, 386 icon: { url: item.icon, Size: new google.maps.Size(63, 80), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(31, 80)}, 387 map: bigmap 388 }); 389 390 // Append to reference for later use. 391 bigmap.markers.push( marker ); 392 393 // Create info window. 394 var infowindow = new google.maps.InfoWindow({ 395 content: '<h5>'+item.title+'</h5>', 396 }); 397 398 // Show info window when marker is clicked. 399 google.maps.event.addListener(marker, 'click', function() { 400 if (activeinfo !== null) { 401 activeinfo.close(); 402 } 403 infowindow.open( bigmap, marker ); 404 activeinfo = infowindow; 405 }); 406 //marker_c++; 407 }); 408 centerMap(bigmap); 409 410 } 411 412 function customCalculateAndDisplayRoute(directionsService, directionsRenderer, el) { 413 const waypts = []; 414 var firstMarker = 0; 415 var lastMarker = 0; 416 const markers = el.dataset.markers; 417 const marker_obj = JSON.parse(markers); 418 const marker_ln = marker_obj.length; 419 marker_obj.forEach(function (item, key) { 420 if(key == 0){ 421 firstMarker = { lat: parseFloat(item.lat), lng: parseFloat(item.lng) }; 422 } 423 else if(key == marker_ln - 1){ 424 lastMarker = { lat: parseFloat(item.lat), lng: parseFloat(item.lng) }; 425 } 426 else{ 427 waypts.push({ 428 location: { lat: parseFloat(item.lat), lng: parseFloat(item.lng) }, 429 stopover: true, 430 }); 431 } 432 433 }); 434 435 directionsService.route( 436 { 437 origin: firstMarker, 438 destination: lastMarker, 439 waypoints: waypts, 440 optimizeWaypoints: false, 441 travelMode: google.maps.TravelMode.DRIVING, 442 }, 443 (response, status) => { 444 if (status === "OK" && response) { 445 directionsRenderer.setDirections(response); 446 } else { 447 window.alert("Directions request failed due to " + status); 448 } 449 }); 450 } 451 452 453} 454 455function initRouteMap() { 456 const mapDiv = document.querySelectorAll(".route_list_map"); 457 if(mapDiv){ 458 for (let i = 0; i < mapDiv.length; i++) { 459 var bigmap; 460 //mapDiv[i].style.backgroundColor = "red"; 461 const directionsService = new google.maps.DirectionsService(); 462 const directionsRenderer = new google.maps.DirectionsRenderer({suppressMarkers: true}); 463 bigmap = new google.maps.Map(mapDiv[i]); 464 bigmap.markers = []; 465 directionsRenderer.setMap(bigmap); 466 calculateAndDisplayRoute(directionsService, directionsRenderer,mapDiv[i]); 467 addDestinationMarkers(bigmap, mapDiv[i]); 468 } 469 470 } 471} 472 473 function addDestinationMarkers(bigmap, el){ 474 //var marker_c = 1; 475 var activeinfo = null; 476 const markers = el.dataset.markers; 477 const marker_obj = JSON.parse(markers); 478 const marker_ln = marker_obj.length;
479 marker_obj.forEach(function (item, key) { 480 //var svg = marker_icon.replace(/{{ color }}/g, item.m_color); 481 // Create marker instance. 482 var marker = new google.maps.Marker({ 483 position : { lat: item.lat, lng: item.lng }, 484 //label: {text: marker_c.toString(), color: marker_color, fontSize: "22px"}, 485 icon: { url: item.m_icon, Size: new google.maps.Size(63, 80), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(32, 80)}, 486 map: bigmap 487 }); 488 489 // Append to reference for later use. 490 bigmap.markers.push( marker ); 491 492 // Create info window. 493 var infowindow = new google.maps.InfoWindow({ 494 content: '<h5><a href="'+item.destURL+'" target="_blank">'+item.title+'</a></h5>', 495 }); 496 497 // Show info window when marker is clicked. 498 google.maps.event.addListener(marker, 'click', function() { 499 if (activeinfo !== null) { 500 activeinfo.close(); 501 } 502 infowindow.open( bigmap, marker ); 503 activeinfo = infowindow; 504 }); 505 //marker_c++; 506 }); 507 centerMap(bigmap); 508 509 } 510 511 function calculateAndDisplayRoute(directionsService, directionsRenderer, el) { 512 const waypts = []; 513 var firstMarker = 0; 514 var lastMarker = 0; 515 const markers = el.dataset.markers; 516 const marker_obj = JSON.parse(markers); 517 const marker_ln = marker_obj.length; 518 marker_obj.forEach(function (item, key) { 519 if(key == 0){ 520 firstMarker = { lat: item.lat, lng: item.lng }; 521 } 522 else if(key == marker_ln - 1){ 523 lastMarker = { lat: item.lat, lng: item.lng }; 524 } 525 else{ 526 waypts.push({ 527 location: { lat: item.lat, lng: item.lng }, 528 stopover: true, 529 }); 530 } 531 532 }); 533 534 directionsService.route( 535 { 536 origin: firstMarker, 537 destination: lastMarker, 538 waypoints: waypts, 539 optimizeWaypoints: false, 540 travelMode: google.maps.TravelMode.DRIVING, 541 }, 542 (response, status) => { 543 if (status === "OK" && response) { 544 directionsRenderer.setDirections(response); 545 } else { 546 window.alert("Directions request failed due to " + status); 547 } 548 }); 549 } 550 551 552function initMap(){ 553 initRouteMap(); 554 initCustomRouteMap(); 555 556 557 // var singleDestinationMapEl = jQuery('#single-destination-map'); 558 // if(singleDestinationMapEl.length){ 559 // const location = { lat: singleDestinationMapEl.data('lat'), lng: singleDestinationMapEl.data('lng') }; 560 // var mapArgs = { 561 // zoom : 12, 562 // mapTypeId : google.maps.MapTypeId.ROADMAP, 563 // //center: { lat: -25.344, lng: 131.031 }, 564 // }; 565 // const singleDestinationMap = new google.maps.Map( document.getElementById("single-destination-map"), mapArgs ); 566 // singleDestinationMap.markers = []; 567 // const marker = new google.maps.Marker({ 568 // position: location, 569 // map: singleDestinationMap, 570 // icon: { url: singleDestinationMapEl.data('icon'), Size: new google.maps.Size(35, 54), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(17, 54)}, 571 // }); 572 // singleDestinationMap.markers.push( marker ); 573 // centerMap(singleDestinationMap); 574 // } 575 576 577 var destinationListMapEl = jQuery('#destination_list_map'); 578 if(destinationListMapEl.length){ 579 var activeinfo = null; 580 const locations = destLocations; 581 var mapArgs = { 582 zoom : 12, 583 mapTypeId : google.maps.MapTypeId.ROADMAP, 584 }; 585 var destinationListMap = new google.maps.Map( document.getElementById("destination_list_map"), mapArgs ); 586 destinationListMap.markers = []; 587 //console.log(locations); 588 locations.map(function(item, index){ 589 //var svg = marker_icon.replace(/{{ color }}/g, item.m_color); 590 const marker = new google.maps.Marker({ 591 position: { lat: item.lat, lng: item.lng }, 592 map: destinationListMap, 593 destId: item.destId, 594 icon: { url: item.m_icon, Size: new google.maps.Size(35, 54), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(17, 54)}, 595 }); 596 destinationListMap.markers.push( marker ); 597 // Create info window. 598 var infowindow = new google.maps.InfoWindow({ 599 content: item.title 600 }); 601 602 // Show info window when marker is clicked. 603 google.maps.event.addListener(marker, 'click', function() { 604 if (activeinfo !== null) { 605 activeinfo.close(); 606 } 607 infowindow.open( destinationListMap, marker ); 608 activeinfo = infowindow; 609 }); 610 }); 611 612 centerMap(destinationListMap); 613 614 615 616 jQuery('.plant-content-wrap #plant-cat-filter a').click(function(e){ 617 e.preventDefault(); 618 if(jQuery(this).hasClass('active') && !jQuery(this).hasClass('all')){ 619 jQuery(this).removeClass('active'); 620 } 621 else{ 622 jQuery(this).addClass('active'); 623 if(jQuery(this).data('id') == 560){ 624 jQuery(this).siblings().removeClass('active'); 625 } 626 else{ 627 jQuery(this).parent().children(":first").removeClass('active'); 628 } 629 } 630 631 get_plant_post(destinationListMap); 632 }); 633 634 jQuery('.plant-content-wrap #plant-area-filter a').click(function(e){ 635 e.preventDefault(); 636 if(jQuery(this).hasClass('active') && !jQuery(this).hasClass('all')){ 637 jQuery(this).removeClass('active'); 638 } 639 else{ 640 jQuery(this).addClass('active'); 641 if(jQuery(this).data('id') == 561){ 642 jQuery(this).siblings().removeClass('active'); 643 } 644 else{ 645 jQuery(this).parent().children(":first").removeClass('active'); 646 } 647 } 648 649 get_plant_post(destinationListMap); 650 }); 651 652 jQuery('.plant-content-wrap a[data-type="sort_by"]').click(function(e){ 653 e.preventDefault(); 654 if(!jQuery(this).hasClass('active')){ 655 jQuery('.plant-content-wrap a[data-type="sort_by"]').removeClass('active'); 656 jQuery(this).addClass('active'); 657 //get_destination_post(); 658 get_plant_post(destinationListMap); 659 } 660 661 }); 662 jQuery(document).on('click','.plant-content-wrap .nav-wrap a', function(e){ 663 e.preventDefault(); 664 var nextPage = 1; 665 if(jQuery(this).hasClass('next')){
666 nextPage = parseInt(jQuery(this).parent().find('span.current').text()) + 1; 667 } 668 else if(jQuery(this).hasClass('prev')){ 669 nextPage = parseInt(jQuery(this).parent().find('span.current').text()) - 1; 670 } 671 else{ 672 nextPage = parseInt(jQuery(this).text()); 673 } 674 get_plant_post(destinationListMap, nextPage); 675 }); 676 677 678 679 jQuery('.destination-content-wrap .filter-cat-tab a').click(function(e){ 680 e.preventDefault(); 681 if(!jQuery(this).hasClass('active')){ 682 jQuery(this).parent().parent().find('a').removeClass('active'); 683 jQuery(this).addClass('active'); 684 //get_destination_post(); 685 get_plant_post(destinationListMap); 686 } 687 else{ 688 jQuery(this).removeClass('active'); 689 get_plant_post(destinationListMap); 690 } 691 692 }); 693 694 695 696 // jQuery('.destination-content-wrap a[data-type="destination_areas"]').click(function(e){ 697 // e.preventDefault(); 698 // if(!jQuery(this).hasClass('active')){ 699 // jQuery('.destination-content-wrap a[data-type="destination_areas"]').removeClass('active'); 700 // jQuery(this).addClass('active'); 701 // //get_destination_post(); 702 // get_destination_post(destinationListMap); 703 // } 704 705 // }); 706 jQuery('.destination-content-wrap a[data-type="sort_by"]').click(function(e){ 707 e.preventDefault(); 708 if(!jQuery(this).hasClass('active')){ 709 jQuery('.destination-content-wrap a[data-type="sort_by"]').removeClass('active'); 710 jQuery(this).addClass('active'); 711 //get_destination_post(); 712 get_plant_post(destinationListMap); 713 } 714 715 }); 716 717 jQuery('.nearby').click(function(e){ 718 e.preventDefault(); 719 if(!jQuery(this).hasClass('active')){ 720 if (navigator.geolocation) { 721 navigator.geolocation.getCurrentPosition(getCurrentPositionss); 722 } else { 723 alert("Geolocation is not supported by this browser."); 724 } 725 } 726 else{ 727 jQuery(this).removeClass('active'); 728 jQuery(this).parent().parent().find('.nearby-range').hide(); 729 get_plant_post(destinationListMap); 730 } 731 732 }); 733 function getCurrentPositionss(position){ 734 jQuery('.nearby').addClass('active'); 735 jQuery('.nearby').parent().parent().find('.nearby-range').show(); 736 jQuery('input[name=lat]').val(position.coords.latitude); 737 jQuery('input[name=lng]').val(position.coords.longitude); 738 get_plant_post(destinationListMap); 739 } 740 var globalTimeout = null; 741 jQuery('#nearrange').change(function(){ 742 jQuery('#rangevalue1').text(jQuery(this).val()); 743 if (globalTimeout != null) { 744 clearTimeout(globalTimeout); 745 } 746 globalTimeout = setTimeout(function() { 747 globalTimeout = null; 748 get_plant_post(destinationListMap); 749 }, 300); 750 751 }); 752 jQuery('.additional-filter-outer .rattimg-main a').click(function(e){ 753 e.preventDefault(); 754 if(!jQuery(this).hasClass('active')){ 755 jQuery('.additional-filter-outer .rattimg-main a').removeClass('active'); 756 jQuery(this).addClass('active'); 757 //get_destination_post(); 758 get_plant_post(destinationListMap); 759 } 760 761 }); 762 763 jQuery(document).on('click','.destination-content-wrap .nav-wrap a', function(e){ 764 e.preventDefault(); 765 var nextPage = 1; 766 if(jQuery(this).hasClass('next')){ 767 nextPage = parseInt(jQuery(this).parent().find('span.current').text()) + 1; 768 } 769 else if(jQuery(this).hasClass('prev')){ 770 nextPage = parseInt(jQuery(this).parent().find('span.current').text()) - 1; 771 } 772 else{ 773 nextPage = parseInt(jQuery(this).text()); 774 } 775 get_plant_post(destinationListMap, nextPage); 776 }); 777 } 778 779 var routedestinationListMapEl = jQuery('#acf-map-route'); 780 if(routedestinationListMapEl.length){ 781 var activeinfo = null; 782 const locations = jQuery('#acf-map-route').data('marker'); 783 var mapArgs = { 784 zoom : 12, 785 mapTypeId : google.maps.MapTypeId.ROADMAP, 786 }; 787 var routedestinationListMap = new google.maps.Map( document.getElementById("acf-map-route"), mapArgs ); 788 routedestinationListMap.markers = []; 789 console.log(locations); 790 locations.map(function(item, index){ 791 //var svg = marker_icon.replace(/{{ color }}/g, item.m_color); 792 const marker = new google.maps.Marker({ 793 position: { lat: item.lat, lng: item.lng }, 794 map: routedestinationListMap, 795 destId: item.destId, 796 icon: { url: item.m_icon, Size: new google.maps.Size(63, 80), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(32, 80)}, 797 }); 798 routedestinationListMap.markers.push( marker );
799 // Create info window. 800 var infowindow = new google.maps.InfoWindow({ 801 content: item.title 802 }); 803 804 // Show info window when marker is clicked. 805 google.maps.event.addListener(marker, 'click', function() { 806 if (activeinfo !== null) { 807 activeinfo.close(); 808 } 809 infowindow.open( routedestinationListMap, marker ); 810 activeinfo = infowindow; 811 }); 812 }); 813 814 centerMap(routedestinationListMap); 815 } 816 817 818 var New_red_svg = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="124.053" height="143.963" viewBox="0 0 124.053 143.963"><defs><filter id="a" x="0" y="0" width="124.053" height="143.963" filterUnits="userSpaceOnUse"><feOffset dx="6" dy="9" input="SourceAlpha"/><feGaussianBlur stdDeviation="9" result="b"/><feFlood flood-opacity="0.161"/><feComposite operator="in" in2="b"/><feComposite in="SourceGraphic"/></filter></defs><g transform="translate(-77 -453.506)"><g transform="matrix(1, 0, 0, 1, 77, 453.51)" filter="url(#a)"><path d="M33.027,0C14.787,0,0,15.023,0,33.555S33.027,85.134,33.027,85.134,66.053,52.09,66.053,33.555,51.267,0,33.027,0Z" transform="translate(23 20)" fill="#f1716c" stroke="#fff" stroke-width="4"/></g><text transform="translate(124.027 522.365)" fill="#fff" font-size="32" font-family="RobotoSlab-Bold, Roboto Slab" font-weight="700"><tspan x="0" y="0">{{ serial }}</tspan></text></g></svg>'; 819 jQuery('.map-slider-card:not(.slick-cloned)').each(function(){ 820 var $this = jQuery(this); 821 var locations = $this.attr('data-dest-ids'); 822 823 if(typeof locations != 'undefined' && locations !=''){ 824 var data = JSON.parse(locations); 825 var polylineOptionsActual = new google.maps.Polyline({ 826 strokeColor: '#2984B9', 827 strokeOpacity: 1.0, 828 strokeWeight: 5 829 }); 830 if(data.length==2){ 831 //console.log(1,data[0]); 832 //console.log(2,data[0]); 833 var routeSlideMap = new google.maps.Map(jQuery(this).find('.route-part-map')[0]); 834 routeSlideMap.markers = []; 835 const directionsRenderer = new google.maps.DirectionsRenderer({suppressMarkers: true, polylineOptions: polylineOptionsActual}); 836 directionsRenderer.setMap(routeSlideMap); 837 var directionsService = new google.maps.DirectionsService(); 838 839 840 841 // Using Latitude and longitude 842 var request = { 843 origin: new google.maps.LatLng(data[0].lat, data[0].lng), 844 destination: new google.maps.LatLng(data[1].lat, data[1].lng), 845 unitSystem: google.maps.UnitSystem.METRIC, 846 travelMode: google.maps.TravelMode.DRIVING 847 }; 848 849 directionsService.route(request, function(response, status) { 850 if (status == google.maps.DirectionsStatus.OK) { 851 directionsRenderer.setDirections(response); 852 var route = response.routes[0]; 853 var leg = response.routes[0].legs[0]; 854 var polyline = route.overview_polyline; 855 var distance = route.legs[0].distance.text; 856 var duration = route.legs[0].duration.text; 857 858 //console.log(route); // Complete route 859 //console.log(distance); // Only distance 860 //console.log(duration); // Only duration 861 //console.log(leg); // Route options/list 862 //console.log(polyline); // Polyline data 863 $this.find('.slide-distance').text(distance); 864 $this.find('.slide-time').text(duration); 865 } 866 // else{ 867 // jQuery(this).find('.route-part-map').hide(); 868 // window.alert("Directions request failed due to " + status); 869 // } 870 }); 871 data.forEach(function (item, key) { 872 var svg = New_red_svg.replace(/{{ serial }}/g, key + 1); 873 // Create marker instance. 874 var marker = new google.maps.Marker({ 875 position : { lat: item.lat, lng: item.lng }, 876 //label: {text: marker_c.toString(), color: marker_color, fontSize: "22px"}, 877 icon: { url: 'data:image/svg+xml;charset=UTF-8;base64,' + btoa(svg), Size: new google.maps.Size(124, 144), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(62, 72)}, 878 map: routeSlideMap, 879 }); 880 881 // Append to reference for later use. 882 routeSlideMap.markers.push( marker ); 883 }); 884 885 } 886 } 887 }); 888 889 890 891} 892window.initMap = initMap; 893 894function centerMap( map ) { 895 896 // Create map boundaries from all map markers. 897 var bounds = new google.maps.LatLngBounds();
898 map.markers.forEach(function( marker ){ 899 //if(marker.getVisible()){ 900 bounds.extend({ 901 lat: marker.position.lat(), 902 lng: marker.position.lng() 903 }); 904 //} 905 906 }); 907 908 // Case: Single marker. 909 if( map.markers.length == 1 ){ 910 map.setCenter( bounds.getCenter() ); 911 912 // Case: Multiple markers. 913 } else{ 914 map.fitBounds( bounds ); 915 } 916} 917 918function get_destination_post(dMap, pageNo = 1){ 919 920 let destCatId; 921 let destAreasId; 922 let destSort; 923 let nblat,nblng,nbdistance; 924 925 let postType = jQuery('#filter-type').val(); 926 927 jQuery('.destination-content-wrap #event-tabs-1 a').each(function(){ 928 if(jQuery(this).hasClass('active')){ 929 destCatId = jQuery(this).attr('data-id'); 930 } 931 }); 932 jQuery('.destination-content-wrap #event-tabs-2 a').each(function(){ 933 if(jQuery(this).hasClass('active')){ 934 destAreasId = jQuery(this).attr('data-id'); 935 } 936 }); 937 jQuery('.destination-content-wrap a[data-type="sort_by"]').each(function(){ 938 if(jQuery(this).hasClass('active')){ 939 destSort = jQuery(this).attr('data-sort'); 940 } 941 }); 942 if(jQuery('.nearby').hasClass('active')){ 943 nblat = jQuery('.nearby-range input[name=lat]').val(); 944 nblng = jQuery('.nearby-range input[name=lng]').val(); 945 nbdistance = jQuery('.nearby-range input[name=nearrange]').val(); 946 } 947 948 949 if(typeof postType != 'undefined'){ 950 var elementWrap = jQuery('.destination-content-wrap .dc-wrap'); 951 952 //jQuery('#rangedistshow').text(nbdistance+'KM'); 953 elementWrap.addClass('loading'); 954 955 jQuery.ajax({ 956 url: mytzoymerka.ajaxurl, // This variable somewhere 957 method: 'POST', 958 dataType: "json", 959 data: { 960 action:'get_'+postType+'_by_filter', 961 category: destCatId, 962 areas: destAreasId, 963 lat: nblat, 964 lng: nblng, 965 distance: nbdistance, 966 destsort: destSort, 967 page: pageNo, 968 //area: routes_trail_area, 969 _ajax_nonce: mytzoymerka.nonce 970 }, 971 success: function(data){ 972 elementWrap.html(data.html); 973 if(!data.next){ 974 var newset = []; 975 dMap.markers.forEach(function( marker ){ 976 marker.setVisible(false); 977 data.ids.forEach(function( marker2 ){ 978 if(marker.destId == marker2){ 979 newset.push(marker); 980 } 981 }); 982 }); 983 newset.forEach(function( marker ){ 984 marker.setVisible(true); 985 }); 986 if(data.c_location !=''){ 987 const c_marker = new google.maps.Marker({ 988 position: { lat: parseFloat(data.c_location.lat), lng: parseFloat(data.c_location.lng) }, 989 map: dMap, 990 icon: { url: data.c_location.m_icon, Size: new google.maps.Size(98, 98), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(49, 98)}, 991 }); 992 dMap.markers.push(c_marker); 993 } 994 centerMap(dMap); 995 } 996 997 }, 998 error: function(){ 999 alert("Please try after some Time."); 1000 }, 1001 complete: function(){ 1002 elementWrap.removeClass('loading'); 1003 }, 1004 }); 1005 } 1006} 1007 1008function get_plant_post(dMap='', pageNo = 1){ 1009 1010 let plantCat = []; 1011 let plantArea = []; 1012 let plantSort; 1013 let nblat,nblng,nbdistance; 1014 1015 jQuery('.plant-content-wrap #plant-cat-filter a').each(function(){ 1016 if(jQuery(this).hasClass('active')){ 1017 plantCat.push(jQuery(this).attr('data-id')); 1018 } 1019 }); 1020 jQuery('.plant-content-wrap #plant-area-filter a').each(function(){ 1021 if(jQuery(this).hasClass('active')){ 1022 plantArea.push(jQuery(this).attr('data-id')); 1023 } 1024 }); 1025 jQuery('.plant-content-wrap a[data-type="sort_by"]').each(function(){ 1026 if(jQuery(this).hasClass('active')){ 1027 plantSort = jQuery(this).attr('data-sort'); 1028 } 1029 }); 1030 console.log(plantSort, plantCat); 1031 1032 if(jQuery('.nearby').hasClass('active')){ 1033 nblat = jQuery('.nearby-range input[name=lat]').val(); 1034 nblng = jQuery('.nearby-range input[name=lng]').val(); 1035 nbdistance = jQuery('.nearby-range input[name=nearrange]').val(); 1036 } 1037 1038 1039 var elementWrap = jQuery('.plant-content-wrap .plant-wrap'); 1040 1041 //jQuery('#rangedistshow').text(nbdistance+'KM'); 1042 elementWrap.addClass('loading'); 1043 1044 jQuery.ajax({ 1045 url: mytzoymerka.ajaxurl, // This variable somewhere 1046 method: 'POST', 1047 dataType: "json", 1048 data: { 1049 action:'get_plant_by_filter', 1050 category: plantCat, 1051 areas: plantArea, 1052 sort: plantSort, 1053 lat: nblat, 1054 lng: nblng, 1055 distance: nbdistance, 1056 page: pageNo, 1057 _ajax_nonce: mytzoymerka.nonce 1058 }, 1059 success: function(data){ 1060 elementWrap.html(data.html); 1061 if(!data.next){ 1062 var newset = [];
1063 dMap.markers.forEach(function( marker ){ 1064 marker.setVisible(false); 1065 data.ids.forEach(function( marker2 ){ 1066 if(marker.destId == marker2){ 1067 newset.push(marker); 1068 } 1069 }); 1070 }); 1071 newset.forEach(function( marker ){ 1072 marker.setVisible(true); 1073 }); 1074 if(data.c_location !=''){ 1075 const c_marker = new google.maps.Marker({ 1076 position: { lat: parseFloat(data.c_location.lat), lng: parseFloat(data.c_location.lng) }, 1077 map: dMap, 1078 icon: { 1079 url: data.c_location.m_icon, 1080 Size: new google.maps.Size(98, 98), 1081 origin: new google.maps.Point(0, 0), 1082 anchor: new google.maps.Point(49, 98) 1083 }, 1084 }); 1085 dMap.markers.push(c_marker); 1086 } 1087 1088 centerMap(dMap); 1089 } 1090 1091 }, 1092 error: function(){ 1093 alert("Please try after some Time."); 1094 }, 1095 complete: function(){ 1096 elementWrap.removeClass('loading'); 1097 }, 1098 }); 1099} 1100 1101 1102 1103 1104jQuery(document).ready(function(){ 1105 jQuery(document).on('click', '.filter-view-wrap li a:not(.active)', function(e){ 1106 e.preventDefault(); 1107 var dType = jQuery(this).data('type'); 1108 //console.log(dType); 1109 if(typeof dType != 'undefined' && dType == 'list'){ 1110 jQuery('.filter-view-wrap li a').removeClass('active'); 1111 jQuery(this).addClass('active'); 1112 jQuery('.event-calender-wrap').hide(); 1113 jQuery('#events-grid-wrap').show(); 1114 1115 } 1116 else if(typeof dType != 'undefined' && dType == 'calendar'){ 1117 jQuery('.filter-view-wrap li a').removeClass('active'); 1118 jQuery(this).addClass('active'); 1119 jQuery('#events-grid-wrap').hide(); 1120 jQuery('.event-calender-wrap').show(); 1121 calendar2.render(); 1122 } 1123 }); 1124 1125 jQuery(document).on('click','#submit-icon', function(e){ 1126 1127 e.preventDefault(); 1128 1129 var tripTitle = jQuery('#tripTitle').val(); 1130 var daterange = jQuery('#daterange').val(); 1131 1132 if(daterange==''){ 1133 jQuery('.form-date-alert').show(500); 1134 return false; 1135 }else{ 1136 jQuery('.form-date-alert').hide(500); 1137 } 1138 1139 if(tripTitle==''){ 1140 jQuery('.form-title-alert').show(500); 1141 return false; 1142 }else{ 1143 jQuery('.form-title-alert').hide(500); 1144 } 1145 jQuery.ajax({ 1146 url: mytzoymerka.ajaxurl, 1147 method: 'POST', 1148 dataType: "json", 1149 data: { 1150 action:'add_new_trip_step_1', 1151 tripTitle: tripTitle, 1152 daterange: daterange, 1153 _ajax_nonce: mytzoymerka.nonce 1154 }, 1155 beforeSend: function(){ 1156 1157 jQuery('#form-trim-loader').show(500); 1158 1159 }, 1160 success: function(data){ 1161 if(data.status=='success'){ 1162 1163 jQuery('.message').html(data.message); 1164 jQuery('.message').addClass('success'); 1165 1166 // ΣÏÏÏÏ setTimeout με function 1167 setTimeout(function(){ 1168 jQuery('#form-trim-loader').hide(500); 1169 }, 5000); 1170 1171 localStorage.setItem('activateLastTrip', 'true'); 1172 1173 setTimeout(function(){ 1174 location.reload(); 1175 }, 10000); 1176 1177 jQuery('.form-date-alert').hide(500); 1178 jQuery('.form-title-alert').hide(500); 1179 } 1180 1181 if(data.status=='failed'){ 1182 jQuery('.message').html(data.message); 1183 jQuery('.message').addClass('error'); 1184 1185 setTimeout(function(){ 1186 jQuery('#form-trim-loader').hide(500); 1187 }, 5000); 1188 1189 jQuery('.form-date-alert').hide(500); 1190 jQuery('.form-title-alert').hide(500); 1191 } 1192 }, 1193 1194 }); 1195 1196 }); 1197 1198 jQuery(document).ready(function() { 1199 if (localStorage.getItem('activateLastTrip') === 'true') { 1200 setTimeout(function() { 1201 const lastTrip = jQuery('.trip-item').first(); 1202 if (lastTrip.length) { 1203 lastTrip.addClass('active editmode'); 1204 1205 jQuery('html, body').animate({ 1206 scrollTop: lastTrip.offset().top - 100 1207 }, 500); 1208 } 1209 1210 // ÎαθαÏÎ¯Î¶Î¿Ï Î¼Îµ Ïο localStorage για να μην ÏÏÎÏει κάθε ÏοÏά 1211 localStorage.removeItem('activateLastTrip'); 1212 }, 500); // ΠεÏιμÎÎ½Î¿Ï Î¼Îµ λίγο να ÏοÏÏÏθεί Ïο DOM 1213 } 1214}); 1215 1216 1217 1218 jQuery(document).on('click','.loadItem', function(){ 1219 1220 var tripId = jQuery(this).parents('.items-loop').attr('trip-id'); 1221 var tripTime = jQuery(this).parents('.items-loop').attr('data-time'); 1222 var rowNumber = jQuery(this).parents('.items-loop').attr('row-number'); 1223 var ID = jQuery(this).attr('id'); 1224 var thisEl = jQuery(this); 1225 1226 jQuery.ajax({ 1227 url: mytzoymerka.ajaxurl, 1228 method: 'POST', 1229 dataType: "json", 1230 data: { 1231 action:'load_activity_destination_items', 1232 tripId: tripId, 1233 tripTime: tripTime, 1234 rowNumber: rowNumber, 1235 ID: ID, 1236 _ajax_nonce: mytzoymerka.nonce 1237 }, 1238 beforeSend: function(){ 1239 1240 thisEl.parents('.load-item').find('.pulse-loader').show(500); 1241 1242 }, 1243 success: function(data){ 1244 1245 if(data.status=='success'){ 1246 thisEl.parents('.load-item').find('.pulse-loader').hide(500); 1247 jQuery('.'+data.ID+'').parents('.items-loop').find('.all-activies-destination').html(data.html); 1248 } 1249 1250 }, 1251 error: function(){ 1252 //alert("Please try after some Time."); 1253 },
1254 complete: function(){ 1255 1256 }, 1257 }); 1258 1259 }); 1260 1261 jQuery(document).on('click','.addItem', function(){ 1262 1263 var item_ID = jQuery(this).parents('.trip-item').attr('data-id'); 1264 var tripId = jQuery(this).parents('.items-loop').attr('trip-id'); 1265 var tripTime = jQuery(this).parents('.items-loop').attr('data-time'); 1266 var rowNumber = jQuery(this).parents('.items-loop').attr('row-number'); 1267 var ID = jQuery(this).attr('data-id'); 1268 var thisEl = jQuery(this); 1269 1270 jQuery.ajax({ 1271 url: mytzoymerka.ajaxurl, 1272 method: 'POST', 1273 dataType: "json", 1274 data: { 1275 action:'update_field_onlick_add_activity_destination', 1276 tripId: tripId, 1277 tripTime: tripTime, 1278 rowNumber: rowNumber, 1279 ID: ID, 1280 item_ID:item_ID, 1281 _ajax_nonce: mytzoymerka.nonce 1282 }, 1283 beforeSend: function(){ 1284 1285 thisEl.parents('.action-area').find('.pulse-loader').show(500); 1286 1287 }, 1288 success: function(data){ 1289 1290 if(data.status=='success'){ 1291 1292 jQuery('#'+data.item_ID+' .map-list-item-group .list-item-loop:nth-child('+data.rowNumber+') .map').html(data.mapData); 1293 jQuery('#'+data.item_ID+' .map-list-item-group .list-item-loop:nth-child('+data.rowNumber+') .mapGroup').html(data.content_data); 1294 initRouteMap(); 1295 thisEl.parents('.action-area').find('.pulse-loader').hide(500); 1296 thisEl.addClass('removeItem'); 1297 thisEl.removeClass('addItem'); 1298 thisEl.parents('.group').removeClass('loadedItem'); 1299 thisEl.parents('.group').addClass('selected'); 1300 thisEl.html(data.x_icon); 1301 thisEl.parents('.group').appendTo(thisEl.parents('.items-loop').find('.selected-activities-destinations')); 1302 1303 } 1304 1305 }, 1306 error: function(){ 1307 //alert("Please try after some Time."); 1308 }, 1309 complete: function(){ 1310 //eventsWrap.removeClass('loading'); 1311 }, 1312 }); 1313 1314 }); 1315 1316 1317 jQuery(document).on('click','.removeItem', function(){ 1318 1319 var item_ID = jQuery(this).parents('.trip-item').attr('data-id'); 1320 var tripId = jQuery(this).parents('.items-loop').attr('trip-id'); 1321 var tripTime = jQuery(this).parents('.items-loop').attr('data-time'); 1322 var rowNumber = jQuery(this).parents('.items-loop').attr('row-number'); 1323 var ID = jQuery(this).attr('data-id'); 1324 var thisEl = jQuery(this); 1325 1326 jQuery.ajax({ 1327 url: mytzoymerka.ajaxurl, 1328 method: 'POST', 1329 dataType: "json", 1330 data: { 1331 action:'remove_on_click_activity_destination', 1332 tripId: tripId, 1333 tripTime: tripTime, 1334 rowNumber: rowNumber, 1335 ID: ID, 1336 item_ID:item_ID, 1337 _ajax_nonce: mytzoymerka.nonce 1338 }, 1339 beforeSend: function(){ 1340 1341 thisEl.parents('.action-area').find('.pulse-loader').show(500); 1342 1343 }, 1344 success: function(data){ 1345 1346 if(data.status=='success'){ 1347 1348 jQuery('#'+data.item_ID+' .map-list-item-group .list-item-loop:nth-child('+data.rowNumber+') .map').html(data.mapData); 1349 jQuery('#'+data.item_ID+' .map-list-item-group .list-item-loop:nth-child('+data.rowNumber+') .mapGroup').html(data.content_data); 1350 initRouteMap(); 1351 1352 thisEl.parents('.action-area').find('.pulse-loader').hide(500); 1353 thisEl.parents('.group').remove(); 1354 // thisEl.addClass('addItem'); 1355 // thisEl.removeClass('removeItem'); 1356 // thisEl.text('â'); 1357 // thisEl.parents('.group.selected').prepend(thisEl.parents('.items-loop').find('.all-activies-destination')); 1358 1359 } 1360 1361 }, 1362 error: function(){ 1363 //alert("Please try after some Time."); 1364 }, 1365 complete: function(){ 1366 //eventsWrap.removeClass('loading'); 1367 }, 1368 }); 1369 1370 }); 1371 1372 1373 1374 jQuery(document).on('click','.removeItemmap', function(){ 1375 1376 var item_ID = jQuery(this).parents('.trip-item').attr('data-id'); 1377 var tripId = jQuery(this).parents('.map-group').attr('trip-id'); 1378 var tripTime = jQuery(this).parents('.map-group').attr('trip-time'); 1379 var rowNumber = jQuery(this).parents('.map-group').attr('row-number'); 1380 var ID = jQuery(this).attr('data-id'); 1381 var thisEl = jQuery(this); 1382 1383 jQuery.ajax({ 1384 url: mytzoymerka.ajaxurl, 1385 method: 'POST', 1386 dataType: "json", 1387 data: { 1388 action:'remove_on_click_activity_destination', 1389 tripId: tripId, 1390 tripTime: tripTime, 1391 rowNumber: rowNumber, 1392 ID: ID, 1393 item_ID:item_ID, 1394 _ajax_nonce: mytzoymerka.nonce 1395 }, 1396 beforeSend: function(){ 1397 1398 thisEl.parents('.action-area').find('.pulse-loader').show(500); 1399 1400 }, 1401 success: function(data){ 1402 1403 if(data.status=='success'){ 1404 1405 jQuery('#'+data.item_ID+' .map-list-item-group .list-item-loop:nth-child('+data.rowNumber+') .map').html(data.mapData); 1406 jQuery('#'+data.item_ID+' .map-list-item-group .list-item-loop:nth-child('+data.rowNumber+') .mapGroup').html(data.content_data); 1407 initRouteMap(); 1408 thisEl.parents('.action-area').find('.pulse-loader').hide(500); 1409 //thisEl.parents('.map-group').remove(); 1410 1411 } 1412 1413 }, 1414 error: function(){ 1415 //alert("Please try after some Time."); 1416 },
1417 complete: function(){ 1418 //eventsWrap.removeClass('loading'); 1419 }, 1420 }); 1421 1422 }); 1423 1424 jQuery(document).on('click','#addToTrip', function(){ 1425 1426 var ID = jQuery(this).attr('data-id'); 1427 var thisEl = jQuery(this); 1428 1429 jQuery.ajax({ 1430 url: mytzoymerka.ajaxurl, 1431 method: 'POST', 1432 dataType: "json", 1433 data: { 1434 action:'add_destination_to_trip', 1435 ID: ID, 1436 _ajax_nonce: mytzoymerka.nonce 1437 }, 1438 beforeSend: function(){ 1439 1440 thisEl.find('.pulse-loader').show(500); 1441 1442 }, 1443 success: function(data){ 1444 1445 if(data.status== true || data.status==false){ 1446 1447 thisEl.find('.pulse-loader').hide(500); 1448 alert(data.message); 1449 1450 } 1451 1452 1453 }, 1454 error: function(){ 1455 //alert("Please try after some Time."); 1456 }, 1457 complete: function(){ 1458 //eventsWrap.removeClass('loading'); 1459 }, 1460 }); 1461 1462 }); 1463 1464 1465}); 1466 1467 1468 1469// added by us 1470 1471 1472//routes-filter 1473 1474jQuery('.routes-filter2 .filter-box a').click(function(e){ 1475 e.preventDefault(); 1476 jQuery(this).toggleClass('active'); 1477 get_routes_trail_post2(); 1478}); 1479jQuery(document).on('click','#routes-trail-grid-wrap .nav-wrap a', function(e){ 1480 e.preventDefault(); 1481 var nextPage = 1; 1482 if(jQuery(this).hasClass('next')){ 1483 nextPage = parseInt(jQuery(this).parent().find('span.current').text()) + 1; 1484 } 1485 else if(jQuery(this).hasClass('prev')){ 1486 nextPage = parseInt(jQuery(this).parent().find('span.current').text()) - 1; 1487 } 1488 else{ 1489 nextPage = parseInt(jQuery(this).text()); 1490 } 1491 get_routes_trail_post2(nextPage); 1492}); 1493 1494function get_routes_trail_post2(paged = 1){ 1495 var routes_trail_category2=[]; 1496 // jQuery('#routes_trail_category2 .filter-box').each(function(){ 1497 // if(jQuery(this).find('a').hasClass('active')){ 1498 // routes_trail_category2.push(jQuery(this).find('a').attr('data-id')); 1499 // } 1500 // }); 1501 1502 var routesTrailGridWrap = jQuery('#routes-trail-grid-wrap'); 1503 routesTrailGridWrap.addClass('loding'); 1504 jQuery.ajax({ 1505 url: mytzoymerka.ajaxurl, // This variable somewhere 1506 method: 'POST', 1507 //dataType: "json", 1508 data: { 1509 action:'get_routes_trail_by_filter2', 1510 category: consulation_tax, 1511 1512 paged: paged, 1513 _ajax_nonce: mytzoymerka.nonce 1514 }, 1515 success: function(data){ 1516 routesTrailGridWrap.html(data); 1517 }, 1518 error: function(){ 1519 alert("Please try after some Time."); 1520 }, 1521 complete: function(){ 1522 routesTrailGridWrap.removeClass('loading'); 1523 }, 1524 }); 1525} 1526 1527 1528 1529jQuery('.route-explore-container.route-slide-one').on('afterChange', function(){ 1530 var next_Title = jQuery('.route-explore-container.route-slide-one').find('.map-slider-card.slick-active').data('next-title'); 1531 jQuery('.slick-next.slick-arrow').html('<span class="slidename">'+next_Title+'</span>'); 1532 1533 // var prev_Title = jQuery('.route-explore-container.route-slide-one').find('.map-slider-card.slick-active').data('previous-title'); 1534 // jQuery('.slick-prev.slick-arrow').html('<span class="slidename">'+prev_Title+'</span>'); 1535 1536}); 1537jQuery('.route-explore-container.route-slide-one').on('init', function(){ 1538 console.log('init'); 1539 var next_Title = jQuery('.route-explore-container.route-slide-one').find('.map-slider-card.slick-active').data('next-title'); 1540 jQuery('.slick-next.slick-arrow').html('<span class="slidename">'+next_Title+'</span>'); 1541 1542 //var prev_Title = jQuery('.route-explore-container.route-slide-one').find('.map-slider-card.slick-active').data('previous-title'); 1543 // jQuery('.slick-prev.slick-arrow').html('<span class="slidename">'+next_Title+'</span>'); 1544}); 1545jQuery('.route-explore-container.route-slide-one').slick({ 1546 infinite: false, 1547 slidesToShow: 1, 1548 slidesToScroll: 1, 1549 adaptiveHeight: true 1550}); 1551 1552 1553jQuery(document).ready(function(){ 1554 1555}); 1556 1557
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.