1(function ($) { 2 3 var sb_options = get_strings; 4 var ajax_url = sb_options.ajax_url; 5 var adforest_ajax_url = ajax_url; 6 var autoplay = parseInt(sb_options.auto_slide_time); 7 var is_rtl_check = sb_options.is_rtl; 8 9 is_rtl = false; 10 var navTextAngle = ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"]; 11 if (is_rtl_check == "1") { 12 is_rtl = true; 13 var navTextAngle = ["<i class='fa fa-angle-right'></i>", "<i class='fa fa-angle-left'></i>"]; 14 } 15 if (is_rtl) { 16 $("select").select2({dir: "rtl", placeholder: sb_options.select_place_holder, allowClear: true, width: '100%'}); 17 } 18 setTimeout(function () { 19 $('body').addClass('loaded'); 20 }, 3000); 21 22 /* open and close nav bar*/ 23 $('#opennav').on('click', function () { 24 $('#mySidenav').toggleClass("navigationOpen"); 25 }); 26 27 $('.closebtn').on('click', function () { 28 $('#mySidenav').toggleClass("navigationOpen"); 29 }); 30 /*Search suggestion for product categories*/ 31 if ($('#product_text').length > 0) { 32 $('#product_text').typeahead({ 33 minLength: 1, 34 delay: 250, 35 scrollBar: true, 36 autoSelect: true, 37 fitToElement: true, 38 highlight: false, 39 hint: true, 40 source: function (query, process) { 41 return $.get(ajax_url, {query: query, action: 'product_suggestions'}, function (data) { 42 jQuery('.adforest-search-spinner').remove(); 43 data = $.parseJSON(data); 44 return process(data); 45 }); 46 } 47 }); 48 } 49 50 51 $(document).ready(function () { 52 $(".account-my").click(function () { 53 $(".dropd").slideToggle("slow"); 54 }); 55 }); 56 if ($(".carousel-team-style-1").length > 0) { 57 $(".carousel-team-style-1").owlCarousel({ 58 items: 5, 59 autoplay: autoplay, 60 autoplayTimeout: 225000, 61 margin: 10, 62 loop: false, 63 nav: true, 64 responsiveClass: true, 65 rtl: is_rtl, 66 responsive: { 67 0: { 68 items: 1 69 70 }, 71 600: { 72 items: 1 73 74 }, 75 767: { 76 items: 2 77 }, 78 768: { 79 items: 3 80 }, 81 992: { 82 items: 3 83 }, 84 1000: { 85 items: 3, 86 loop: false 87 }, 88 1200: { 89 items: 5, 90 loop: false 91 }, 92 1300: { 93 items: 5, 94 loop: $('.carousel-team-style-1 .wrapper-latest-product').length > 5 ? true : false, 95 } 96 97 }, 98 navText: ["<i class='fa fa-chevron-left arrow1'></i>", "<i class='fa fa-chevron-right arrow'></i>"] 99 }); 100 } 101 /*------------------------------------ 102 SUB MENU 103 --------------------------------------*/ 104 $('.sub-menu ul').hide(); 105 $(".sub-menu a").click(function () { 106 $(this).parent(".sub-menu").children("ul").slideToggle("100"); 107 $(this).find(".right").toggleClass("fa-caret-up fa-caret-down"); 108 }); 109 110 /*submit product search in header*/ 111 $("select").select2({placeholder: sb_options.select_place_holder, allowClear: true, width: '100%'}); 112 /*product archive change 4 /3 col*/ 113 $('#four-col').on('click', function () { 114 elem = $('.listing-list-items'); 115 container = $('.change_archive_col'); 116 if (elem.hasClass('listing-list-items')) { 117 elem.removeClass('listing-list-items'); 118 container.removeClass('col-lg-3'); 119 } 120 elem.addClass('listing-list-items-1'); 121 container.addClass('col-lg-4'); 122 }); 123 124 $('#three-col').on('click', function () { 125 elem = $('.listing-list-items-1'); 126 container = $('.change_archive_col'); 127 if (elem.hasClass('listing-list-items-1')) { 128 elem.removeClass('listing-list-items-1'); 129 container.removeClass('col-lg-4'); 130 } 131 elem.addClass('listing-list-items'); 132 container.addClass('col-lg-3'); 133 });
134 135 136 if ($('#carousel-product').length > 0) { 137 $('#carousel-product').flexslider({ 138 animation: "slide", 139 controlNav: false, 140 animationLoop: false, 141 slideshow: true, 142 itemWidth: 105, 143 itemMargin: 10, 144 asNavFor: '#slider-product', 145 rtl: is_rtl, 146 }); 147 } 148 149 if ($('#slider-product').length > 0) { 150 $('#slider-product').flexslider({ 151 animation: "slide", 152 controlNav: false, 153 animationLoop: true, 154 slideshow: true, 155 sync: "#carousel-product", 156 rtl: is_rtl 157 }); 158 } 159 160 /* Contact to Vendor on Vendor detail Page. */ 161 if ($('#vendro-owner-contact').length > 0) { 162 $('#vendro-owner-contact').parsley().on('field:validated', function () { 163 var ok = $('.parsley-error').length === 0; 164 }).on('form:submit', function () { 165 166 $('#sb_loading').show(); 167 $.post(ajax_url, { 168 action: 'sb_send_email_to_store_vendor', 169 sb_data: $("form.vendro-owner-contact").serialize(), 170 vendor_id: $('#vendor_id').val(), 171 }).done(function (response) { 172 $('#sb_loading').hide(); 173 var res_arr = response.split("|"); 174 175 if ($.trim(res_arr[0]) != "0") { 176 toastr.success(res_arr[1], '', { 177 timeOut: 4000, 178 "closeButton": true, 179 "positionClass": "toast-top-right" 180 }); 181 } else { 182 toastr.error(res_arr[1], '', { 183 timeOut: 4000, 184 "closeButton": true, 185 "positionClass": "toast-top-right" 186 }); 187 } 188 }); 189 return false; 190 }); 191 } 192 193 if (jQuery('[data-fancybox]').length > 0) { 194 jQuery('[data-fancybox]').fancybox(); 195 } 196 197 198 199 if ($('#hero_product_slider').length > 0) { 200 $('#hero_product_slider').owlCarousel({ 201 autoplay: 2500, 202 autoplayHoverPause: true, 203 autoplayTimeout: autoplay, 204 items: 4, 205 loop: true, 206 margin: 15, 207 nav: true, 208 rt: is_rtl, 209 responsive: { 210 0: { 211 items: 1 212 }, 213 600: { 214 items: 1 215 }, 216 768: { 217 items: 2 218 }, 219 1000: { 220 items: 3 221 }, 222 1200: { 223 items: 4 224 }, 225 }, 226 navText: ["<i class='fa fa-angle-left left-angle' data-inline='false' aria-hidden='true'></i>", "<i class='fa fa-angle-right right-angle' data-inline='false' aria-hidden='true'></i>"] 227 }); 228 } 229 230 231 $(".products_tabs_slider").each(function (i, obj) { 232 233 var $this = $(this); 234 var items = $this.find('.wrapper-latest-product').length; 235 $this.owlCarousel({ 236 items: 4, 237 autoplayHoverPause: true, 238 autoplay: 2500, 239 autoplayTimeout: autoplay, 240 margin: 5, 241 rtl: is_rtl, 242 loop: $(".active .products_tabs_slider .wrapper-latest-product").length > 1 ? true : false, 243 nav: true, 244 responsiveClass: true, 245 responsive: {0: {items: 1, nav: true}, 600: {items: 2, nav: true}, 1000: {items: 3, nav: true, loop: (items > 3) ? true : false}, 1200: {items: 4, nav: true, loop: (items > 4) ? true : false, }}, 246 navText: ["<i class='fa fa-chevron-left arrow1'></i>", "<i class='fa fa-chevron-right arrow'></i>"] 247 }); 248 //test 249 }); 250 251 252 $(".products_tabs_slider_full").each(function (i, obj) { 253 254 var $this = $(this); 255 var items = $this.find('.wrapper-latest-product').length; 256 $this.owlCarousel({ 257 items: 5, 258 autoplay: 2500, 259 autoplayTimeout: autoplay, 260 autoplayHoverPause: true, 261 margin: 5, 262 rtl: is_rtl, 263 loop: $(".active .products_tabs_slider_full .wrapper-latest-product").length > 1 ? true : false, 264 nav: true, 265 responsiveClass: true, 266 responsive: {0: {items: 1, nav: true}, 600: {items: 2, nav: true}, 1000: {items: 3, nav: true, loop: (items > 3) ? true : false}, 1200: {items: 5, nav: true, loop: (items > 5) ? true : false, }}, 267 navText: ["<i class='fa fa-chevron-left arrow1'></i>", "<i class='fa fa-chevron-right arrow'></i>"] 268 }); 269 //test 270 });
271 272 273 274 $(".account-cart").click(function () { 275 $(".product-cart-sb").slideToggle("slow"); 276 }); 277 $("#fav_product_btn").click(function () { 278 $(".product-favourite-sb").slideToggle("slow"); 279 }); 280 281 /* ====================== 282 * Product favourites/un-favourites shop layout 5 283 ========================*/ 284 $('.product_to_fav').on('click', function () { 285 $(this).toggleClass("favourited"); 286 var status_class = $(this).hasClass("favourited"); 287 var status_code; 288 if (status_class == true) { 289 status_code = "true"; 290 } else { 291 status_code = "false"; 292 } 293 $('#sb_loading').show(); 294 $.post(ajax_url, { 295 action: 'product_fav_add', 296 product_id: $(this).attr('data-productId'), 297 status_code: status_code, 298 }).done(function (response) { 299 $('#sb_loading').hide(); 300 var get_p = response.split('|'); 301 if ($.trim(get_p[0]) == 1) { 302 toastr.success(get_p[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 303 } else if ($.trim(get_p[0]) == 0) { 304 toastr.error(get_p[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 305 } 306 }); 307 308 }); 309 310 /* ====================== 311 * vendor favourites/un-favourites 312 ========================*/ 313 $('.vendor_to_fav').on('click', function () { 314 $(this).toggleClass("favourited_v"); 315 var status_class = $(this).hasClass("favourited_v"); 316 var status_code; 317 if (status_class == true) { 318 status_code = "true"; 319 } else { 320 status_code = "false"; 321 } 322 $('#sb_loading').show(); 323 $.post(ajax_url, { 324 action: 'vendor_fav_ad', 325 vendor_id: $(this).attr('data-vendorid'), 326 status_code: status_code, 327 }).done(function (response) { 328 $('#sb_loading').hide(); 329 var get_p = response.split('|'); 330 if ($.trim(get_p[0]) == 1) { 331 332 toastr.success(get_p[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 333 } else if ($.trim(get_p[0]) == 0) { 334 toastr.error(get_p[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 335 } 336 }); 337 }); 338 339 if ($(".login-user").length > 0) { 340 $(".login-user").click(function () { 341 $(".dropdown-user-login").slideToggle("slow"); 342 }); 343 } 344 345 346 347 function adforest_disableEmptyInputs(form) { 348 var controls = form.elements; 349 for (var i = 0, iLen = controls.length; i < iLen; i++) { 350 controls[i].disabled = controls[i].value == ""; 351 } 352 } 353 354 /*ad ads to favourite*/ 355 $('.ad_to_fav,.save-ad').on('click', function () 356 { 357 var $this = $(this); 358 $('#sb_loading').show(); 359 $.post(ajax_url, {action: 'sb_fav_ad', ad_id: $(this).attr('data-adid'), }).done(function (response) 360 { 361 $('#sb_loading').hide(); 362 var get_p = response.split('|'); 363 if ($.trim(get_p[0]) == '1') 364 { 365 $this.addClass("ad-favourited"); 366 toastr.success(get_p[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 367 } else 368 { 369 toastr.error(get_p[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 370 } 371 }); 372 }); 373 374 375 if ($('.clients-list').length > 0) { 376 var $clientcarousel = $('.clients-list'); 377 var clients = $clientcarousel.children().length; 378 var clientwidth = (clients * 220); // 140px width for each client item 379 $clientcarousel.css('width', clientwidth); 380 381 var rotating = true; 382 var clientspeed = 0; 383 var seeclients = setInterval(rotateClients, clientspeed); 384 385 $(document).on({ 386 mouseenter: function () { 387 rotating = false; // turn off rotation when hovering 388 }, 389 mouseleave: function () { 390 rotating = true; 391 } 392 }, '.clients'); 393 394 function rotateClients() { 395 if (rotating != false) { 396 var $first = $('.clients-list li:first'); 397 $first.animate({'margin-left': '-220px'}, 4000, function () { 398 $first.remove().css({'margin-left': '0px'}); 399 $('.clients-list li:last').after($first); 400 }); 401 } 402 } 403 } 404 405 /* Add to Cart*/ 406 $('body').on('click', '.sb_add_cart', function () 407 { 408 $('#sb_loading').show(); 409 $.post(ajax_url, {action: 'sb_add_cart', product_id: $(this).attr('data-product-id'), qty: $(this).attr('data-product-qty'), }).done(function (response) 410 { 411 $('#sb_loading').hide(); 412 var get_r = response.split('|'); 413 if ($.trim(get_r[0]) == '1') 414 { 415 toastr.success(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 416 window.location = get_r[2]; 417 } else 418 { 419 toastr.error(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 420 window.location = get_r[2]; 421 } 422 }); 423 });
424 425 $('#client-logos').owlCarousel({ 426 loop: true, 427 margin: 15, 428 dots: false, 429 rtl: is_rtl, 430 nav: true, 431 432 responsive: { 433 0: { 434 items: 1 435 }, 436 450:{ 437 items:2 438 }, 439 600: { 440 items: 2 441 }, 442 1000: { 443 items: 3 444 }, 445 1200: { 446 items: 3 447 }, 448 1300: { 449 items: 5 450 } 451 }, 452 navText: ["<i class='fa fa-angle-left left-arrow' aria-hidden='true'></i>", "<i class='fa fa-angle-right right-arrow' aria-hidden='true'></i>"] 453 }); 454 455 $('.location-ad-carousel').owlCarousel({ 456 loop: true, 457 margin: 15, 458 dots: false, 459 rtl: is_rtl, 460 nav: true, 461 responsive: { 462 0: { 463 items: 1 464 }, 465 600: { 466 items: 1 467 }, 468 768: { 469 470 items: 2 471 }, 472 1000: { 473 items: 3 474 }, 475 1200: { 476 items: 3 477 }, 478 1300: { 479 items: 4 480 } 481 }, 482 navText: ["<i class='fa fa-angle-left chevron-1' aria-hidden='true'></i>", "<i class='fa fa-angle-right chevron-2' aria-hidden='true'></i>"] 483 }); 484 485 if ($('.circle-1').length > 0) { 486 var circle1 = anime({ 487 targets: '.circle-1', 488 translateX: 50, 489 translateY: 30, 490 direction: 'alternate', 491 duration: 4000, 492 loop: true, 493 easing: 'linear' 494 }); 495 496 var circle2 = anime({ 497 targets: '.circle-2', 498 translateX: 50, 499 translateY: 30, 500 direction: 'alternate', 501 duration: 2000, 502 loop: true, 503 easing: 'linear' 504 }); 505 506 507 var popular1 = anime({ 508 targets: '.popular-1', 509 translateX: -50, 510 translateY: 70, 511 direction: 'alternate', 512 duration: 3000, 513 loop: true, 514 easing: 'linear' 515 }); 516 517 } 518 519 if ($('#play-video').length > 0) { 520 $('#play-video').YouTubePopUp(); 521 } 522 523 if ($('.play-video').length > 0) { 524 $('.play-video').YouTubePopUp(); 525 } 526 527 if ($('#slider').length > 0) { 528 $('#carousel').flexslider({ 529 animation: "slide", 530 controlNav: false, 531 animationLoop: false, 532 slideshow: false, 533 itemWidth: 120, 534 itemMargin: 5, 535 asNavFor: '#slider', 536 rtl: is_rtl, 537 538 }); 539 540 $('#slider').flexslider({ 541 controlNav: false, 542 animationLoop: false, 543 slideshow: false, 544 sync: "#carousel", 545 animation: "slide", 546 rtl: is_rtl, 547 548 }); 549 } 550 551 /* Ad Location */ 552 if ($('#lat').length > 0) 553 { 554 var lat = $('#lat').val(); 555 var lon = $('#lon').val(); 556 var map_type = sb_options.adforest_map_type; 557 if (map_type == 'leafletjs_map') 558 { 559 /*For leafletjs map*/ 560 var map = L.map('itemMap').setView([lat, lon], 7); 561 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {attribution: ''}).addTo(map); 562 L.marker([lat, lon]).addTo(map); 563 } else if (map_type == 'google_map') 564 { 565 /*For Google Map*/ 566 var map = ""; 567 var latlng = new google.maps.LatLng(lat, lon); 568 var myOptions = {zoom: 13, center: latlng, scrollwheel: false, mapTypeId: google.maps.MapTypeId.ROADMAP, size: new google.maps.Size(480, 240)} 569 map = new google.maps.Map(document.getElementById("itemMap"), myOptions); 570 var marker = new google.maps.Marker({ 571 map: map, 572 position: latlng 573 }); 574 } 575 } 576 577 578 /* Bidding System */ 579 if ($('#sb_bid_ad').length > 0) 580 { 581 $('#sb_bid_ad').parsley().on('field:validated', function () { 582 var ok = $('.parsley-error').length === 0; 583 }).on('form:submit', function () { 584 $('#sb_loading').show(); 585 $.post(ajax_url, {action: 'sb_submit_bid', security: $('#sb-bidding-token').val(), sb_data: $("form#sb_bid_ad").seri
585alize(), }).done(function (response) 586 { 587 $('#sb_loading').hide(); 588 var res_arr = response.split("|"); 589 if ($.trim(res_arr[0]) != "0") 590 { 591 toastr.success(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 592 location.reload(); 593 } else 594 { 595 toastr.error(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 596 } 597 }).fail(function () { 598 $('#sb_loading').hide(); 599 toastr.error($('#_nonce_error').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 600 } 601 ); 602 return false; 603 }); 604 } 605 606 607 if ($('#input-21b').length > 0) 608 { 609 var star_rtl = false; 610 if ($('#is_rtl').val() != "" && $('#is_rtl').val() == "1") { 611 star_rtl = true; 612 } 613 $('#input-21b').rating({filledStar: '<i class="fa fa-star"></i>', 614 emptyStar: '<i class="fa fa-star-o"></i>', starCaptions: {1: sb_options.one, 2: sb_options.two, 3: sb_options.three, 4: sb_options.four, 5: sb_options.five}}); 615 } 616 617 /* Ad rating Logic */ 618 if ($('#ad_rating_form').length > 0) 619 { 620 $('#ad_rating_form').parsley().on('field:validated', function () { 621 }).on('form:submit', function () { 622 $('#sb_loading').show(); 623 $.post(ajax_url, {action: 'sb_ad_rating', security: $('#sb-review-token').val(), sb_data: $("form#ad_rating_form").serialize(), }).done(function (response) 624 { 625 $('#sb_loading').hide(); 626 var get_r = response.split('|'); 627 if ($.trim(get_r[0]) == '1') 628 { 629 toastr.success(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 630 location.reload(); 631 } else 632 { 633 toastr.error(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 634 } 635 }).fail(function () { 636 $('#sb_loading').hide(); 637 toastr.error($('#_nonce_error').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 638 }); 639 return false; 640 }); 641 } 642 $('.reply_ad_rating').on('click', function () 643 { 644 var p_comment_id = $(this).attr('data-comment_id'); 645 $('#reply_to_rating').html($(this).attr('data-commenter-name')); 646 $('#parent_comment_id').val(p_comment_id); 647 }); 648 /*Send message to ad owner*/ 649 if ($('#rating_reply_form').length > 0) 650 { 651 $('#rating_reply_form').parsley().on('field:validated', function () { 652 }).on('form:submit', function () { 653 $('#sb_loading').show(); 654 $.post(ajax_url, {action: 'sb_ad_rating_reply', security: $('#sb-review-reply-token').val(), sb_data: $("form#rating_reply_form").serialize(), }).done(function (response) 655 { 656 $('#sb_loading').hide(); 657 var get_r = response.split('|'); 658 if ($.trim(get_r[0]) == '1') 659 { 660 toastr.success(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 661 location.reload(); 662 } else 663 { 664 toastr.error(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 665 } 666 }).fail(function () { 667 668 $('#sb_loading').hide(); 669 toastr.error($('#_nonce_error').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 670 }); 671 return false; 672 }); 673 } 674 675 $('.sb-click-num').click(function () { 676 var ad_id = jQuery(this).data('ad-id'); 677 var spinner_html = '<span><i class="fa fa-spinner spin"></i></span>'; 678 jQuery('.sb-phonenumber').html(spinner_html); 679 $.post(adforest_ajax_url, {action: 'sb_display_phone_num', ad_id: ad_id}).done(function (response) 680 { 681 var get_r = response.split('|'); 682 if ($.trim(get_r[0]) == '1') 683 { 684 jQuery('.sb-phonenumber').html(get_r[1]); 685 } else 686 { 687 toastr.error(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 688 jQuery('.sb-phonenumber').html(sb_options.click_to_view); 689 } 690 }); 691 });
692 693 if ($('#file_attacher').length > 0) { 694 adforest_ajax_url = adforest_ajax_url; 695 var attachmentsDropzone = new Dropzone(document.getElementById('file_attacher'), {// Make the whole body a dropzone 696 url: adforest_ajax_url, 697 autoProcessQueue: true, 698 previewsContainer: "#attachment-wrapper", // Define the container to display the previews 699 previewTemplate: '<span class="dz-preview dz-file-preview"><span class="dz-details"><span class="dz-filename"><i class="fa fa-link"></i> <span data-dz-name></span></span> <span class="dz-size" data-dz-size></span> <i class="fa fa-times" style="cursor:pointer;font-size:15px;" data-dz-remove></i></span><span class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></span><i class="ti ti-refresh ti-spin"></i></span>', 700 clickable: "a.msgAttachFile", 701 acceptedFiles: $('#provided_format').val(), 702 maxFilesize: 15, 703 maxFiles: 4 704 }); 705 706 707 attachmentsDropzone.on("sending", function () { 708 $("#send_msg ,#send_ad_message").attr("disabled", true); 709 }); 710 attachmentsDropzone.on("queuecomplete", function () { 711 $("#send_msg, #send_ad_message").attr("disabled", false); 712 }); 713 714 } 715 716 /*Send message to ad owner*/ 717 if ($('#send_message_pop').length > 0) 718 { 719 $('#send_message_pop').parsley().on('field:validated', function () { }).on('form:submit', function () { 720 $('#sb_loading').show(); 721 var fd = new FormData(); 722 723 if ($('#file_attacher').length > 0) { 724 var fileUpload = $('#file_attacher').get(0).dropzone; 725 726 var files = fileUpload.files; 727 728// Looping over all files and add it to FormData object 729 for (var i = 0; i < files.length; i++) { 730 fd.append("message_file[]", files[i]); 731 } 732 733 } 734 var sb_data = $("form#send_message_pop").serialize() 735 var security = $('#sb-msg-token').val(); 736 fd.append('action', 'sb_send_message'); 737 fd.append('sb_data', sb_data); 738 fd.append('security', security) 739 $('#sb_loading').show(); 740 $.ajax({
741 type: 'POST', 742 url: adforest_ajax_url, 743 data: fd, 744 contentType: false, 745 processData: false, 746 success: function (response) { 747 $('#sb_loading').hide(); 748 var get_r = response.split('|'); 749 if ($.trim(get_r[0]) == "1") 750 { 751 toastr.success(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 752 $('#sb_forest_message').val(''); 753 754 if ($('.dz-preview').length > 0) { 755 Dropzone.forElement('#file_attacher').removeAllFiles(true); 756 $('.dz-preview').remove(); 757 $('.dz-success').fadeOut('slow'); 758 } 759 $(".close").trigger("click"); 760 } else 761 { 762 toastr.error(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 763 $(".close").trigger("click"); 764 } 765 }, 766 error: function () { 767 $('#sb_loading').hide(); 768 toastr.error($('#_nonce_error').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 769 } 770 }); 771 772 return false; 773 }); 774 } 775 776 777 /*image sortable for ad detail page*/ 778 if ($("#sortable").length > 0) 779 { 780 $("#sortable").sortable({ 781 stop: function (event, ui) { 782 $('#post_img_ids').val(''); 783 var current_img = ''; 784 $(".ui-state-default img").each(function (index) { 785 current_img = current_img + $(this).attr('data-img-id') + ","; 786 }); 787 $('#post_img_ids').val(current_img.replace(/,\s*$/, "")); 788 } 789 }); 790 $("#sortable").disableSelection(); 791 } 792 $('#sb_sort_images').on('click', function () 793 { 794 $('#sb_loading').show(); 795 $.post(adforest_ajax_url, {action: 'sb_sort_images', ids: $('#post_img_ids').val(), ad_id: $('#current_pid').val(), }).done(function (response) 796 { 797 toastr.success($('#re-arrange-msg').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 798 location.reload(); 799 $('#sb_loading').hide(); 800 }); 801 }); 802 803 $('.skin-minimal .list li input').iCheck({checkboxClass: 'icheckbox_minimal', radioClass: 'iradio_minimal', increaseArea: '20%'}); 804 $('.custom-checkbox').iCheck({checkboxClass: 'icheckbox_minimal', radioClass: 'iradio_minimal', increaseArea: '20%'}); 805 806 if ($('#sb-login-form').length > 0) 807 { 808 809 $('#sb_login_msg').hide(); 810 $('#sb_login_redirect').hide(); 811 $('#sb-login-form').parsley().on('field:validated', function () { 812 var ok = $('.parsley-error').length === 0; 813 }) 814 .on('form:submit', function () { 815 $('#sb_loading').show(); 816 $('#sb_login_submit').hide(); 817 $('#sb_login_msg').show(); 818 $.post(adforest_ajax_url, {action: 'sb_login_user', security: $('#sb-login-token').val(), sb_data: $("form#sb-login-form").serialize(), }).done(function (response) 819 { 820 821 $('#sb_loading').hide(); 822 $('#sb_login_msg').hide(); 823 if ($.trim(response) == '1') 824 { 825 $('#sb_login_redirect').show(); 826 window.location = sb_options.profile_page; 827 } else 828 { 829 $('#sb_login_submit').show(); 830 toastr.error(response, '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 831 } 832 }).fail(function () { 833 $('#sb_login_submit').show(); 834 $('#sb_loading').hide(); 835 $('#sb_login_msg').hide(); 836 toastr.error($('#_nonce_error').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 837 }); 838 return false; 839 }); 840 } 841 /* Forgot Password*/ 842 if ($('#sb-forgot-form').length > 0) 843 { 844 $('#sb_forgot_msg').hide(); 845 $('#sb-forgot-form').parsley().on('field:validated', function () { 846 var ok = $('.parsley-error').length === 0; 847 }).on('form:submit', function () { 848 $('#sb_forgot_submit').hide(); 849 $('#sb_forgot_msg').show(); 850 $('#sb_loading').show(); 851 $.post(adforest_ajax_url, {action: 'sb_forgot_password', security: $('#sb-forgot-pass-token').val(), sb_data: $("form#sb-forgot-form").serialize(), }).done(function (response) 852 { 853 $('#sb_loading').hide(); 854 $('#sb_forgot_msg').hide(); 855 if ($.trim(response) == '1') 856 { 857 $('#sb_forgot_submit').show(); 858 $('#sb_forgot_email').val(''); 859 toastr.success($('#adforest_forgot_msg').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"});
860 $('#myModal').modal('hide'); 861 } else 862 { 863 $('#sb_forgot_submit').show(); 864 toastr.error(response, '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 865 } 866 }).fail(function () { 867 $('#sb_forgot_submit').show(); 868 $('#sb_forgot_email').val(''); 869 toastr.error($('#_nonce_error').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 870 }); 871 return false; 872 }); 873 } 874 875 876 /*Register user*/ 877 if ($('#sb-sign-form').length > 0) 878 { 879 $('#sb_register_msg').hide(); 880 $('#sb_register_redirect').hide(); 881 $('#sb-sign-form').parsley().on('field:validated', function () { 882 var ok = $('.parsley-error').length === 0; 883 }).on('form:submit', function () { 884 $('#sb_loading').show(); 885 var google_recaptcha_type = jQuery("#google_recaptcha_type").val(); 886 google_recaptcha_type = typeof google_recaptcha_type !== 'undefined' ? google_recaptcha_type : 'v2'; 887 var google_recaptcha_site_key = jQuery("#google_recaptcha_site_key").val(); 888 if (google_recaptcha_type == 'v3' && google_recaptcha_site_key !== 'undefined' && google_recaptcha_site_key != '') { 889 grecaptcha.ready(function () { 890 var adforest_ajax_url = jQuery("#adforest_ajax_url").val(); 891 try { 892 grecaptcha.execute(google_recaptcha_site_key, {action: "register_form"}).then(function (token) { 893 jQuery("#sb-sign-form").prepend('<input type="hidden" name="g-recaptcha-response" value="' + token + '">'); 894 jQuery.post(adforest_ajax_url, {action: "sb_goggle_captcha3_verification", token: token}, function (result) { 895 result = JSON.parse(result); 896 if (result.success) { 897 $('#sb_register_submit').hide(); 898 $('#sb_register_msg').show(); 899 $.post(adforest_ajax_url, {action: 'sb_register_user', security: $('#sb-register-token').val(), sb_data: $("form#sb-sign-form").serialize(), }).done(function (response) 900 { 901 $('#sb_loading').hide(); 902 $('#sb_register_msg').hide(); 903 if ($.trim(response) == '1') 904 { 905 $('#sb_register_redirect').show(); 906 window.location = $('#profile_page').val(); 907 } else if ($.trim(response) == '2') 908 { 909 $('.resend_email').show(); 910 toastr.success($('#verify_account_msg').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 911 } else if ($.trim(response) == '3') 912 { 913 toastr.success($('#admin_verify_account').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 914 } else 915 { 916 $('#sb_register_submit').show(); 917 toastr.error(response, '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 918 } 919 }).fail(function () { 920 $('#sb_loading').hide(); 921 $('#sb_register_msg').hide(); 922 $('#sb_register_submit').show(); 923 toastr.error($('#_nonce_error').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 924 }); 925 } else { 926 $('#sb_loading').hide(); 927 $('#sb_register_submit').show(); 928 toastr.error(result.msg, '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 929 } 930 }); 931 }); 932 } catch (err) { 933 var google_recaptcha_error_text = jQuery("#google_recaptcha_error_text").val(); 934 google_recaptcha_error_text = typeof google_recaptcha_error_text !== 'undefined' ? google_recaptcha_error_text : err; 935 jQuery('#sb_loading').hide(); 936 toastr.error(google_recaptcha_error_text, '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 937 } 938 }); 939 940 } else { 941 $('#sb_register_submit').hide(); 942 $('#sb_register_msg').show(); 943 $.post(adforest_ajax_url, {action: 'sb_register_user', security: $('#sb-register-token').val(), sb_data: $("form#sb-sign-form").serialize(), }).done(function (response) 944 { 945 $('#sb_loading').hide(); 946 $('#sb_register_msg').hide(); 947 948 if ($.trim(response) == '1') 949 { 950 $('#sb_register_redirect').show(); 951 window.location = $('#profile_page').val(); 952 } else if ($.trim(response) == '2') 953 { 954 $('.resend_email').show(); 955 toastr.success($('#verify_account_msg').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 956 } else if ($.trim(response) == '3') 957 { 958 toastr.success($('#admin_verify_account').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 959 } else 960 { 961 $('#sb_register_submit').show(); 962 toastr.error(response, '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 963 } 964 }).fail(function () { 965 $('#sb_loading').hide(); 966 $('#sb_register_msg').hide(); 967 $('#sb_register_submit').show(); 968 toastr.error($('#_nonce_error').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 969 }); 970 } 971 return false; 972 }); 973 } 974 /*Resend Email*/ 975 $('#resend_email').on('click', function () 976 { 977 var usr_email = $('#sb_reg_email').val(); 978 $.post(adforest_ajax_url, {action: 'sb_resend_email', usr_email: usr_email, }).done(function (response) 979 { 980 toastr.success($('#verify_account_msg').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 981 $('.resend_email').hide(); 982 $('.contact_admin').show(); 983 }); 984 });
985 if (sb_options.facebook_key != "" && sb_options.google_key != "") 986 { 987 hello.init({facebook: sb_options.facebook_key, google: sb_options.google_key, }, {redirect_uri: sb_options.redirect_uri}); 988 } else if (sb_options.facebook_key != "" && sb_options.google_key == "") 989 { 990 hello.init({facebook: sb_options.facebook_key, }, {redirect_uri: sb_options.redirect_uri}); 991 } else if (sb_options.google_key != "" && sb_options.facebook_key == "") 992 { 993 hello.init({google: sb_options.google_key, }, {redirect_uri: sb_options.redirect_uri}); 994 } 995 $('.social-item a.btn-social').on('click', function () 996 { 997 hello.on('auth.login', function (auth) { 998 $('#sb_loading').show(); 999 hello(auth.network).api('me').then(function (r) { 1000 1001 if ($('#get_action').val() == 'login' || $('#get_action').val() == 'register') 1002 { 1003 var access_token = hello(auth.network).getAuthResponse().access_token; 1004 var sb_network = hello(auth.network).getAuthResponse().network; 1005 $.post(adforest_ajax_url, {action: 'sb_social_login', access_token: access_token, sb_network: sb_network, security: $('#sb-social-login-nonce').val(), email: r.email, key_code: $('#nonce').val()}).done(function (response) 1006 { 1007 var get_r = response.split('|'); 1008 if ($.trim(get_r[0]) == '1') 1009 { 1010 $('#nonce').val(get_r[1]); 1011 if ($.trim(get_r[2]) == '1') 1012 { 1013 toastr.success(get_r[3], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1014 window.location = $('#profile_page').val(); 1015 } else 1016 { 1017 toastr.error(get_r[3], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1018 } 1019 } else { 1020 toastr.error(get_r[3], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1021 } 1022 }).fail(function () { 1023 $('#sb_loading').hide(); 1024 toastr.error($('#_nonce_error').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1025 } 1026 ); 1027 1028 } else 1029 { 1030 $('#sb_reg_name').val(r.name); 1031 $('#sb_reg_email').val(r.email); 1032 } 1033 $('#sb_loading').hide(); 1034 }); 1035 }); 1036 }); 1037 1038 var column2inmobile = sb_options.sb_2_column; 1039 var column_count = (column2inmobile == true) ? 2 : 1; 1040 1041 if (column2inmobile == true && $(".featured-slider-1 .item .col-6").length > 0) { 1042 $(".featured-slider-1 .item .col-6").removeClass('col-6 col-sm-6').addClass('col-12 col-sm-12'); 1043 1044 } 1045 1046 1047 if ($(".featured-slider-1 .item .col-md-4").length > 0) { 1048 $(".featured-slider-1 .item .col-md-4").removeClass('col-md-4 col-lg-4').addClass('col-md-12 col-lg-12'); 1049 } 1050 1051 if ($(".featured-slider .item .col-lg-4").length > 0) { 1052 $(".featured-slider .item .col-lg-4").removeClass('col-md-6 col-lg-4 col-md-4').addClass('col-md-12 col-lg-12'); 1053 } 1054 if (column2inmobile == true && $(".featured-slider .item .col-6").length > 0) { 1055 $(".featured-slider .item .col-6").removeClass('col-6 col-sm-6').addClass('col-12 col-sm-12'); 1056 1057 } 1058 1059 $('.featured-slider').owlCarousel({ 1060 rtl: is_rtl, 1061 dots: false, 1062 loop: ($(".featured-slider .item").length > 1) ? true : false, 1063 autoplay: true, 1064 autoplayHoverPause: true, 1065 autoplayTimeout: autoplay, 1066 margin: 10, 1067 responsiveClass: true, // Optional helper class. Add 'owl-reponsive-' + 'breakpoint' class to main element. 1068 navText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"], 1069 responsive: {0: {items: column_count, nav: true}, 600: {items: 2, nav: true}, 768: {items: ipad_item, nav: true}, 1000: {items: 3, nav: true}, 1200: {items: $('#slider_item').val(), nav: true, loop: ($(".featured-slider .item").length > 1) ? true : false, }} 1070 });
1071 1072 1073 /* Featured Carousel 2 */ 1074 1075 var searchLayout = $('#search_layout').val(); 1076 1077 1078 var ipad_item = 3; 1079 var ipadpro_item = 3; 1080 if (searchLayout == 'topbar') { 1081 ipad_item = 2; 1082 } 1083 if (searchLayout == 'map') { 1084 ipadpro_item = 2; 1085 } 1086 1087 $('.featured-slider-1').owlCarousel({ 1088 rtl: is_rtl, 1089 dots: ($(".featured-slider-1 .item").length > 1) ? false : false, 1090 loop: ($(".featured-slider-1 .item").length > 1) ? true : true, 1091 autoplay: true, 1092 autoplayHoverPause: true, 1093 autoplayTimeout: autoplay, 1094 margin: 10, 1095 responsiveClass: true, // Optional helper class. Add 'owl-reponsive-' + 'breakpoint' class to main element. 1096 navText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"], 1097 responsive: {0: {items: column_count, nav: true}, 600: {items: 2, nav: true}, 768: {items: ipad_item, nav: true}, 1000: {items: ipadpro_item, nav: true}, 1200: {items: $('#slider_item').val(), nav: true, loop: ($(".featured-slider-1 .item").length > $('#slider_item').val()) ? true : false, }} 1098 }); 1099 1100 /* Featured Carousel 3 */ 1101 1102 1103 1104 /* 1105 if ($('.promotionalslider_wrapper_4').length > 0) { 1106 var slideItem = $('.promotionalslider_wrapper_4 .found-listing-item').length; 1107 if (slideItem > 4) { 1108 slideItem = 4; 1109 } 1110 var searchLayout = $('#search_layout').val(); 1111 if (searchLayout == "map" && slideItem > 2) { 1112 slideItem = 2; 1113 } else if (searchLayout == "topbar" && slideItem > 3) { 1114 slideItem = 3; 1115 } 1116 var sb_2_column = sb_options.sb_2_column; 1117 mobilItem = 1; 1118 if (sb_2_column) { 1119 mobilItem = 2; 1120 } 1121 $('.promotionalslider_wrapper_4').slick({ 1122 dots: false, 1123 infinite: true, 1124 speed: 300, 1125 slidesToShow: slideItem, 1126 slidesToScroll: 1, 1127 rtl: is_rtl, 1128 responsive: [ 1129 { 1130 breakpoint: 1024, 1131 settings: { 1132 slidesToShow: 2, 1133 slidesToScroll: 2, 1134 infinite: true, 1135 dots: false 1136 } 1137 }, 1138 { 1139 breakpoint: 1200, 1140 settings: { 1141 slidesToShow: 2, 1142 slidesToScroll: 2, 1143 infinite: true, 1144 dots: false 1145 } 1146 }, 1147 { 1148 breakpoint: 600, 1149 settings: { 1150 slidesToShow: mobilItem, 1151 slidesToScroll: 2 1152 } 1153 }, 1154 { 1155 breakpoint: 480, 1156 settings: { 1157 slidesToShow: mobilItem, 1158 slidesToScroll: 1 1159 } 1160 } 1161 ] 1162 }); 1163 } 1164 */ 1165 1166 1167 1168 1169 if ($('.feature-ads-carousel').length > 0) { 1170 $('.feature-ads-carousel').slick({ 1171 loop: false, 1172 stagePadding: 15, 1173 autoplaySpeed: autoplay, 1174 slidesToShow: 1, 1175 slidesToScroll: 1, 1176 autoplay: true, 1177 nav: true, 1178 rtl: is_rtl, 1179 prevArrow: '<span class="slick-prev prev-ads"><i class="fa fa-angle-left"></i></span>', 1180 nextArrow: '<span class="slick-next next-ads"><i class="fa fa-angle-right"></i></span>', 1181 responsive: [ 1182 { 1183 breakpoint: 1024, 1184 settings: { 1185 slidesToShow: 1, 1186 slidesToScroll: 1, 1187 infinite: true, 1188 dots: false 1189 } 1190 }, 1191 1192 { 1193 breakpoint: 992, 1194 settings: { 1195 slidesToShow: 3, 1196 slidesToScroll: 1 1197 } 1198 }, 1199 { 1200 breakpoint: 768, 1201 settings: { 1202 slidesToShow: 2, 1203 slidesToScroll: 1 1204 } 1205 }, 1206 { 1207 breakpoint: 600, 1208 settings: { 1209 slidesToShow: 2, 1210 slidesToScroll: 1 1211 } 1212 }, 1213 1214 { 1215 breakpoint: 480, 1216 settings: { 1217 slidesToShow: 1, 1218 slidesToScroll: 1 1219 } 1220 } 1221 ] 1222 }); 1223 } 1224 1225 $('select.submit_on_select').on("select2:select", function (e) { 1226 $('#sb_loading').show(); 1227 $(this).closest("form").submit(); 1228 });
1229 $('.fa_cursor').on("click", function (e) { 1230 $('#sb_loading').show(); 1231 $(this).closest("form").submit(); 1232 }); 1233 $('.submit_on_select').on('click', function () { 1234 $('#sb_loading').show(); 1235 $(this).closest("form").submit(); 1236 }); 1237 1238 1239 if ($('.custom-select').length > 0) { 1240 $('.custom-select').select2('destroy'); 1241 } 1242 $("#you_current_location_text").click(function () { 1243 1244 $('#sb_loading').show(); 1245 $.ajax({ 1246 url: "https://geolocation-db.com/jsonp", 1247 jsonpCallback: "callback", 1248 dataType: "jsonp", 1249 success: function (location) { 1250 $('#sb_loading').hide(); 1251 $('#sb-radius-form #sb_user_address').val(location.city + ", " + location.state + ", " + location.country_name); 1252 var map_type = sb_options.adforest_map_type; 1253 if (map_type == 'leafletjs_map') 1254 { 1255 $('#sb_user_address_lat').val(location.latitude); 1256 $('#sb_user_address_long').val(location.longitude); 1257 } 1258 } 1259 }); 1260 }); 1261 1262 1263 /*Location while ad posting*/ 1264 1265 1266 $('#sb_user_address').on('focus', function () { 1267 1268 console.log("ssss"); 1269 var map_type = sb_options.adforest_map_type; 1270 if (map_type == 'google_map') { 1271 adforest_location(); 1272 } 1273 }); 1274 1275 1276 /*More Js Added On Descmber 5*/ 1277 $(".mobile-filters-btn a, a.filter-close-btn").on("click", function () { 1278 $('.mobile-filters').toggleClass("active"); 1279 }); 1280 /*Scroll to top when arrow up clicked BEGIN*/ 1281 $(window).scroll(function () { 1282 var height = $(window).scrollTop(); 1283 if (height > 120) { 1284 /*$('.mobile-filters-btn a').fadeOut();*/ 1285 } else { 1286 $('.mobile-filters-btn a').fadeIn(); 1287 } 1288 }); 1289 $(document).ready(function () { 1290 $(".mobile-filters-btn a").click(function (event) { 1291 event.preventDefault(); 1292 $("html, body").animate({scrollTop: 0}, "slow"); 1293 return false; 1294 }); 1295 }); 1296 /*Scroll to top when arrow up clicked END*/ 1297 1298 1299 function adforest_disableEmptyInputs(form) { 1300 var controls = form.elements; 1301 for (var i = 0, iLen = controls.length; i < iLen; i++) { 1302 controls[i].disabled = controls[i].value == ""; 1303 } 1304 } 1305 1306 1307 1308 /* Show Number */ 1309 /* improvement for crawler **/ 1310 $('.sb-click-num-user').click(function () { 1311 var user_id = jQuery(this).data('user_id'); 1312 1313 1314 var spinner_html = '<span><i class="fa fa-spinner spin"></i></span>'; 1315 jQuery('.sb-phonenumber').html(spinner_html); 1316 $.post(adforest_ajax_url, {action: 'sb_display_phone_num_user', user_id: user_id}).done(function (response) 1317 { 1318 1319 var get_r = response.split('|'); 1320 if ($.trim(get_r[0]) == '1') 1321 { 1322 jQuery('.sb-phonenumber').html(get_r[1]); 1323 } else 1324 { 1325 toastr.error(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1326 jQuery('.sb-phonenumber').html(sb_options.click_to_view); 1327 } 1328 }); 1329 }); 1330 1331 1332 /* Contact from profile */ 1333 if ($('#user_contact_form').length > 0) 1334 { 1335 $('#user_contact_form').parsley().on('field:validated', function () { 1336 var ok = $('.parsley-error').length === 0; 1337 }).on('form:submit', function () { 1338 $('#sb_loading').show(); 1339 1340 var google_recaptcha_type = sb_options.google_recaptcha_type; 1341 1342 google_recaptcha_type = typeof google_recaptcha_type !== 'undefined' ? google_recaptcha_type : 'v2'; 1343 var google_recaptcha_site_key = jQuery("#google_recaptcha_site_key").val(); 1344 1345 1346 if (google_recaptcha_type == 'v3' && google_recaptcha_site_key !== 'undefined' && google_recaptcha_site_key != '') { 1347 grecaptcha.ready(function () { 1348 try { 1349 1350 1351 1352 grecaptcha.execute(google_recaptcha_site_key, {action: "contact_form"}).then(function (token) { 1353 jQuery("#user_contact_form").prepend('<input type="hidden" name="g-recaptcha-response" value="' + token + '">'); 1354 1355 jQuery.post(adforest_ajax_url, { 1356 action: "sb_goggle_captcha3_verification", 1357 token: token, 1358 }, function (result) { 1359 result = JSON.parse(result); 1360 if (result.success) { 1361 $.post(adforest_ajax_url, {action: 'sb_user_contact_form', receiver_id: $('#receiver_id').val(), sb_data: $("form#user_contact_form").serialize(), }).done(function (response) 1362 1363 { 1364 $('#sb_loading').hide(); 1365 var res_arr = response.split("|"); 1366 if ($.trim(res_arr[0]) != "0") 1367 { 1368 toastr.success(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1369 location.reload(); 1370 } else 1371 { 1372 toastr.error(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1373 } 1374 }); 1375 } else { 1376 $('#sb_loading').hide(); 1377 $('#sb_register_submit').show(); 1378 toastr.error(result.msg, '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1379 } 1380 }); 1381 }); 1382 } catch (err) { 1383 var google_recaptcha_error_text = jQuery("#google_recaptcha_error_text").val(); 1384 google_recaptcha_error_text = typeof google_recaptcha_error_text !== 'undefined' ? google_recaptcha_error_text : err; 1385 jQuery('#sb_loading').hide(); 1386 toastr.error(google_recaptcha_error_text, '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1387 } 1388 }); 1389 } else { 1390 $.post(adforest_ajax_url, {action: 'sb_user_contact_form', receiver_id: $('#receiver_id').val(), sb_data: $("form#user_contact_form").serialize(), }).done(function (response) 1391 { 1392 $('#sb_loading').hide(); 1393 var res_arr = response.split("|"); 1394 if ($.trim(res_arr[0]) != "0") 1395 { 1396 toastr.success(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1397 location.reload(); 1398 } else 1399 { 1400 toastr.error(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1401 } 1402 }); 1403 } 1404 return false; 1405 }); 1406 } 1407 1408 if ($('#user_ratting_form').length > 0) 1409 { 1410 $('#user_ratting_form').parsley().on('field:validated', function () { 1411 var ok = $('.parsley-error').length === 0; 1412 }).on('form:submit', function () { 1413 // Ajax for Registration 1414 $('#sb_loading').show(); 1415 $.post(adforest_ajax_url, {action: 'sb_post_user_ratting', security: $('#sb-user-rating-token').val(), sb_data: $("form#user_ratting_form").serialize(), }).done(function (response) 1416 { 1417 $('#sb_loading').hide(); 1418 var res_arr = response.split("|"); 1419 if ($.trim(res_arr[0]) != "0") 1420 { 1421 toastr.success(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1422 location.reload(); 1423 } else 1424 { 1425 toastr.error(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1426 } 1427 }).fail(function () { 1428 $('#sb_loading').hide(); 1429 toastr.error($('#_nonce_error').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1430 } 1431 ); 1432 return false; 1433 }); 1434 } 1435 1436 $('.clikc_reply').on('click', function () 1437 { 1438 $('#rator_name').html($(this).attr('data-rator-name')); 1439 $('#rator_reply').val($(this).attr('data-rator-id')); 1440 });
1441 1442 /* Replay to Rator */ 1443 if ($('#sb-reply-rating-form').length > 0) 1444 { 1445 $('#sb-reply-rating-form').parsley().on('field:validated', function () { 1446 var ok = $('.parsley-error').length === 0; 1447 }).on('form:submit', function () { 1448 $('#sb_loading').show(); 1449 $.post(adforest_ajax_url, {action: 'sb_reply_user_rating', security: $('#sb-user-rate-reply-token').val(), sb_data: $("form#sb-reply-rating-form").serialize(), }).done(function (response) 1450 { 1451 $('#sb_loading').hide(); 1452 var res_arr = response.split("|"); 1453 if ($.trim(res_arr[0]) != "0") 1454 { 1455 toastr.success(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1456 location.reload(); 1457 } else 1458 { 1459 toastr.error(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1460 } 1461 }).fail(function () { 1462 $('#sb_loading').hide(); 1463 toastr.error($('#_nonce_error').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1464 } 1465 ); 1466 return false; 1467 }); 1468 } 1469 1470 1471 1472 $(".client-item").owlCarousel({ 1473 items: 1, 1474 autoplay: true, 1475 autoplayTimeout: autoplay, 1476 margin: 30, 1477 speed: 500, 1478 dots: false, 1479 singleItem: true, 1480 height: 100, 1481 direction: 'alternate', 1482 duration: 4000, 1483 loop: true, 1484 nav: true, 1485 rtl: is_rtl, 1486 responsiveClass: true, 1487 responsive: { 1488 0: { 1489 1490 items: 1 1491 }, 1492 600: { 1493 1494 items: 1 1495 }, 1496 767: { 1497 items: 1 1498 }, 1499 768: { 1500 items: 1 1501 }, 1502 992: { 1503 items: 1 1504 }, 1505 1000: { 1506 items: 1, 1507 1508 loop: true 1509 }, 1510 1200: { 1511 items: 1, 1512 loop: true 1513 }, 1514 1300: { 1515 items: 1, 1516 loop: true 1517 } 1518 }, 1519 navText: ["<img src =" + $('#testimonial_img').val() + ">"] 1520 }); 1521 1522 1523 adforest_timerCounter_function(); 1524 1525 1526 /* Add Post*/ 1527 if ($('#ad_post_form').length > 0) 1528 { 1529 $('#ad_cat_sub_div').hide(); 1530 $('#ad_cat_sub_sub_div').hide(); 1531 $('#ad_cat_sub_sub_sub_div').hide(); 1532 $('#ad_country_sub_div').hide(); 1533 $('#ad_country_sub_sub_div').hide(); 1534 $('#ad_country_sub_sub_sub_div').hide(); 1535 if ($('#is_update').val() != "") 1536 { 1537 var level = $('#is_level').val(); 1538 if (level >= 2) { 1539 $('#ad_cat_sub_div').show(); 1540 } 1541 if (level >= 3) { 1542 $('#ad_cat_sub_sub_div').show(); 1543 } 1544 if (level >= 4) { 1545 $('#ad_cat_sub_sub_sub_div').show(); 1546 } 1547 1548 var country_level = $('#country_level').val(); 1549 if (country_level >= 2) { 1550 $('#ad_country_sub_div').show(); 1551 } 1552 if (country_level >= 3) { 1553 $('#ad_country_sub_sub_div').show(); 1554 } 1555 if (country_level >= 4) { 1556 $('#ad_country_sub_sub_sub_div').show(); 1557 } 1558 } 1559 1560 $('#ad_post_form').parsley().on('field:validated', function () { 1561 }).on('form:error', function () { 1562 $('.ad_errors').show(); 1563 $('.parsley-errors-list').show(); 1564 }).on('form:submit', function () { 1565 $('#sb_loading').show(); 1566 $.post(adforest_ajax_url, {action: 'sb_ad_posting', security: $('#sb-post-token').val(), sb_data: $("form#ad_post_form").serialize(), is_update: $('#is_update').val(), }).done(function (response) 1567 { 1568 $('#sb_loading').hide(); 1569 if ($.trim(response) == "0") 1570 { 1571 toastr.error($('#not_logged_in').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1572 } else if ($.trim(response) == "1") 1573 { 1574 toastr.error($('#ad_limit_msg').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1575 // window.location = $('#sb_packages_page').val(); 1576 } else if ($.trim(response) == "img_req") 1577 { 1578 toastr.error(sb_options.required_images, '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1579 } else if ($.trim(response) == "2") { 1580 toastr.error('Not allowed in demo mode', '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1581 } else 1582 { 1583 if ($('#is_update').val() != 'undefined' && $('#is_update').val() != '') { 1584 toastr.success($('#ad_updated').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1585 } else { 1586 toastr.success($('#ad_posted').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1587 } 1588 window.location = response; 1589 } 1590 1591 1592 }).fail(function () { 1593 $('#sb_loading').hide(); 1594 toastr.error($('#_nonce_error').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1595 }); 1596 return false; 1597 }); 1598 } 1599 1600 /*initilize jquery text editor */ 1601 var ad_html_switch = $('#adforest_ad_html').val(); 1602 ad_html_switch = typeof ad_html_switch !== 'undefined' && ad_html_switch == '1' ? true : false; 1603 if ($('#ad_description').length > 0) 1604 { 1605 if (ad_html_switch) { 1606 $('#ad_description').jqte({color: false}); 1607 } else { 1608 $('#ad_description').jqte({link: false, unlink: false, formats: false, format: false, funit: false, fsize: false, fsizes: false, color: false, strike: false, source: false, sub: false, sup: false, indent: false, outdent: false, right: true, left: true, center: true, remove: false, rule: false, title: false, }); 1609 } 1610 } 1611 1612 /* ad post on bluring ad title */ 1613 $('#ad_title').on('blur', function () 1614 { 1615 if ($('#is_update').val() == "") 1616 { 1617 $.post(adforest_ajax_url, {action: 'post_ad', title: $('#ad_title').val(), is_update: $('#
1617is_update').val(), }).done(function (response) { }); 1618 } 1619 }); 1620 1621 1622 if (jQuery('input[name=ad_title]').length > 0) { 1623 jQuery('input[name=ad_title]').keypress(function () { 1624 var spinner_html = '<span class="adforest-search-spinner"><i class="fa fa-spinner spin"></i></span>'; 1625 if (jQuery(this).after(spinner_html)) { 1626 jQuery('.adforest-search-spinner').remove(); 1627 } 1628 jQuery(this).after(spinner_html); 1629 }); 1630 } 1631 1632 1633 1634 $('input[name=ad_title]').typeahead({ 1635 minLength: 1, 1636 delay: 250, 1637 scrollBar: true, 1638 autoSelect: true, 1639 fitToElement: true, 1640 highlight: false, 1641 hint: true, 1642 source: function (query, process) { 1643 return $.get(ajax_url, {query: query, action: 'fetch_suggestions'}, function (data) { 1644 jQuery('.adforest-search-spinner').remove(); 1645 1646 1647 data = $.parseJSON(data); 1648 return process(data); 1649 }); 1650 } 1651 }); 1652 1653 if ($('#is_sub_active').val() == "1") { /*images uplaod*/ 1654 sbDropzone_image(); 1655 } 1656 if ($('#is_sub_active').val() == "1") { /*images uplaod*/ 1657 sbDropzone_video(); 1658 } 1659 1660 function sbDropzone_video() 1661 { 1662 if ($('#dropzone_video').length) { 1663 let videoLogoUrl = $('#video_logo_url').val(); 1664 Dropzone.autoDiscover = false; 1665 var video_ajax_callback = adforest_ajax_url + "?action=upload_ad_videos&is_update=" + $('#is_update').val(); 1666 if (adforest_ajax_url.indexOf('?lang=') !== -1) { 1667 video_ajax_callback = adforest_ajax_url + "&action=upload_ad_videos&is_update=" + $('#is_update').val(); 1668 } 1669 var fileList = new Array; 1670 var acceptedFileTypes = "video/mp4,video/ogg,video/webm"; 1671 var i = 0; 1672 var sb_max_files = typeof $('#sb_upload_video_limit').val() !== 'undefined' && $('#sb_upload_video_limit').val() == 'null' ? null : $('#sb_upload_video_limit').val(); 1673 $("#dropzone_video").dropzone({ 1674 timeout: 5000000, 1675 maxFilesize: 50000000, 1676 addRemoveLinks: true, 1677 paramName: "my_single_video_upload", 1678 maxFiles: sb_max_files, //change limit as per your requirements 1679 acceptedFiles: acceptedFileTypes, 1680 dictMaxFilesExceeded: $('#adforest_max_upload_reach').val(), 1681 url: video_ajax_callback, 1682 parallelUploads: 1, 1683 dictDefaultMessage: $('#dictDefaultMessage').val(), 1684 dictFallbackMessage: $('#dictFallbackMessage').val(), 1685 dictFallbackText: $('#dictFallbackText').val(), 1686 dictFileTooBig: $('#dictFileTooBig').val(), 1687 dictInvalidFileType: $('#dictInvalidFileType').val(), 1688 dictResponseError: $('#dictResponseError').val(), 1689 dictCancelUpload: $('#dictCancelUpload').val(), 1690 dictCancelUploadConfirmation: $('#dictCancelUploadConfirmation').val(), 1691 dictRemoveFile: $('#dictRemoveFile').val(), 1692 dictRemoveFileConfirmation: null, 1693 init: function () { 1694 var thisDropzone = this; 1695 $.post(adforest_ajax_url, {action: 'get_uploaded_video', is_update: $('#is_update').val()}).done(function (data) 1696 { 1697 1698 if (typeof data !== 'undefined' && data != 0) { 1699 $.each(data, function (key, value) { 1700 var mockFile = { 1701 name: value.video_name, 1702 size: value.video_size, 1703 }; 1704 thisDropzone.options.addedfile.call(thisDropzone, mockFile); 1705 thisDropzone.options.thumbnail.call(thisDropzone, mockFile, videoLogoUrl); 1706 $('a.dz-remove:eq(' + i + ')').attr("data-dz-remove", value.video_id); 1707 i++; 1708 $(".dz-progress").remove(); 1709 }); 1710 } 1711 if (i > 0) 1712 $('.dz-message').hide(); 1713 else 1714 $('.dz-message').show(); 1715 }); 1716 1717 this.on("addedfile", function (file) { 1718 $('.dz-message').hide(); 1719 1720 }); 1721 this.on("success", function (file, responseText) { 1722 1723 var res_arr = responseText.split("|"); 1724 if ($.trim(res_arr[0]) != "0") 1725 { 1726 $('a.dz-remove:eq(' + i + ')').attr("data-dz-remove", responseText); 1727 i++; 1728 $('.dz-message').hide(); 1729 } else 1730 { 1731 if (i == 0) 1732 $('.dz-message').show(); 1733 this.removeFile(file); 1734 toastr.error(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1735 } 1736 }); 1737 this.on("removedfile", function (file) { 1738 var img_id = file._removeLink.attributes[2].value; 1739 if (img_id != "") 1740 { 1741 i--; 1742 if (i == 0) 1743 $('.dz-message').show(); 1744 $.post(adforest_ajax_url, {action: 'delete_upload_video', video: img_id, is_update: $('#
1744is_update').val(), }).done(function (response) 1745 { 1746 if ($.trim(response) == "1") { /*this.removeFile(file);*/ 1747 } 1748 }); 1749 } 1750 }); 1751 this.on("maxfilesexceeded", function (file) { 1752 toastr.error($('#adforest_max_upload_reach').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1753 this.removeFile(file); 1754 }); 1755 1756 1757 }, 1758 }); 1759 } 1760 } 1761 1762 function sbDropzone_image() 1763 { 1764 if ($('#dropzone').length) { 1765 Dropzone.autoDiscover = false; 1766 var images_ajax_callback = adforest_ajax_url + "?action=upload_ad_images&is_update=" + $('#is_update').val(); 1767 if (adforest_ajax_url.indexOf('?lang=') !== -1) { 1768 images_ajax_callback = adforest_ajax_url + "&action=upload_ad_images&is_update=" + $('#is_update').val(); 1769 } 1770 var fileList = new Array; 1771 var acceptedFileTypes = "image/jpeg,image/png,image/jpg"; 1772 var i = 0; 1773 var sb_max_files = typeof $('#sb_upload_limit').val() !== 'undefined' && $('#sb_upload_limit').val() == 'null' ? null : $('#sb_upload_limit').val(); 1774 $("#dropzone").dropzone({ 1775 timeout: 5000000, 1776 maxFilesize: 50000000, 1777 addRemoveLinks: true, 1778 paramName: "my_file_upload", 1779 maxFiles: sb_max_files, //change limit as per your requirements 1780 acceptedFiles: acceptedFileTypes, 1781 dictMaxFilesExceeded: $('#adforest_max_upload_reach').val(), 1782 url: images_ajax_callback, 1783 parallelUploads: 1, 1784 dictDefaultMessage: $('#dictDefaultMessage').val(), 1785 dictFallbackMessage: $('#dictFallbackMessage').val(), 1786 dictFallbackText: $('#dictFallbackText').val(), 1787 dictFileTooBig: $('#dictFileTooBig').val(), 1788 dictInvalidFileType: $('#dictInvalidFileType').val(), 1789 dictResponseError: $('#dictResponseError').val(), 1790 dictCancelUpload: $('#dictCancelUpload').val(), 1791 dictCancelUploadConfirmation: $('#dictCancelUploadConfirmation').val(), 1792 dictRemoveFile: $('#dictRemoveFile').val(), 1793 dictRemoveFileConfirmation: null, 1794 init: function () { 1795 var thisDropzone = this; 1796 $.post(adforest_ajax_url, {action: 'get_uploaded_ad_images', is_update: $('#is_update').val()}).done(function (data) 1797 { 1798 if (typeof data !== 'undefined' && data != 0) { 1799 $.each(data, function (key, value) { 1800 var mockFile = {name: value.dispaly_name, size: value.size}; 1801 thisDropzone.options.addedfile.call(thisDropzone, mockFile); 1802 thisDropzone.options.thumbnail.call(thisDropzone, mockFile, value.name); 1803 $('a.dz-remove:eq(' + i + ')').attr("data-dz-remove", value.id); 1804 i++; 1805 $(".dz-progress").remove(); 1806 }); 1807 } 1808 if (i > 0) 1809 $('.dz-message').hide(); 1810 else 1811 $('.dz-message').show(); 1812 }); 1813 1814 this.on("addedfile", function (file) { 1815 $('.dz-message').hide(); 1816 1817 }); 1818 this.on("success", function (file, responseText) { 1819 1820 var res_arr = responseText.split("|"); 1821 if ($.trim(res_arr[0]) != "0") 1822 { 1823 $('a.dz-remove:eq(' + i + ')').attr("data-dz-remove", responseText); 1824 i++; 1825 $('.dz-message').hide(); 1826 } else 1827 { 1828 if (i == 0) 1829 $('.dz-message').show(); 1830 this.removeFile(file); 1831 toastr.error(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1832 } 1833 }); 1834 this.on("removedfile", function (file) { 1835 var img_id = file._removeLink.attributes[2].value; 1836 if (img_id != "") 1837 { 1838 i--; 1839 if (i == 0) 1840 $('.dz-message').show(); 1841 $.post(adforest_ajax_url, {action: 'delete_ad_image', img: img_id, is_update: $('#
1841is_update').val(), }).done(function (response) 1842 { 1843 if ($.trim(response) == "1") { /*this.removeFile(file);*/ 1844 } 1845 }); 1846 } 1847 }); 1848 this.on("maxfilesexceeded", function (file) { 1849 toastr.error(sb_options.max_upload_images, '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1850 this.removeFile(file); 1851 }); 1852 1853 1854 }, 1855 }); 1856 } 1857 } 1858 1859 $('#ad_country').on('change', function () 1860 { 1861 $('#sb_loading').show(); 1862 $.post(adforest_ajax_url, {action: 'sb_get_sub_states', country_id: $("#ad_country").val(), }).done(function (response) 1863 { 1864 $('#sb_loading').hide(); 1865 $("#ad_country_states").val(''); 1866 $("#ad_country_cities").val(''); 1867 $("#ad_country_towns").val(''); 1868 if ($.trim(response) != "") 1869 { 1870 $('#ad_country_id').val($("#ad_cat").val()); 1871 $('#ad_country_sub_div').show(); 1872 $('#ad_country_states').html(response); 1873 $('#ad_country_sub_sub_sub_div').hide(); 1874 $('#ad_country_sub_sub_div').hide(); 1875 } else 1876 { 1877 $('#ad_country_sub_div').hide(); 1878 $('#ad_cat_sub_sub_div').hide(); 1879 $('#ad_country_sub_sub_div').hide(); 1880 $('#ad_country_sub_sub_sub_div').hide(); 1881 } 1882 }); 1883 }); 1884 /* Level 2 */ 1885 $('#ad_country_states').on('change', function () 1886 { 1887 $('#sb_loading').show(); 1888 $.post(adforest_ajax_url, {action: 'sb_get_sub_states', country_id: $("#ad_country_states").val(), }).done(function (response) 1889 { 1890 $('#sb_loading').hide(); 1891 $("#ad_country_cities").val(''); 1892 $("#ad_country_towns").val(''); 1893 if ($.trim(response) != "") 1894 { 1895 $('#ad_country_id').val($("#ad_country_states").val()); 1896 $('#ad_country_sub_sub_div').show(); 1897 $('#ad_country_cities').html(response); 1898 $('#ad_country_sub_sub_sub_div').hide(); 1899 } else 1900 { 1901 $('#ad_country_sub_sub_div').hide(); 1902 $('#ad_country_sub_sub_sub_div').hide(); 1903 } 1904 }); 1905 }); 1906 /* Level 3 */ 1907 $('#ad_country_cities').on('change', function () 1908 { 1909 $('#sb_loading').show(); 1910 $.post(adforest_ajax_url, {action: 'sb_get_sub_states', country_id: $("#ad_country_cities").val(), }).done(function (response) 1911 { 1912 $('#sb_loading').hide(); 1913 $("#ad_country_towns").val(''); 1914 if ($.trim(response) != "") 1915 { 1916 $('#ad_country_id').val($("#ad_country_cities").val()); 1917 $('#ad_country_sub_sub_sub_div').show(); 1918 $('#ad_country_towns').html(response); 1919 } else 1920 { 1921 $('#ad_country_sub_sub_sub_div').hide(); 1922 } 1923 }); 1924 }); 1925 1926 1927 $('.btn-condition').on('click', function () { 1928 1929 1930 $('.btn-condition').removeClass('btn-selected'); 1931 $(this).addClass('btn-selected'); 1932 $('#condition').val(($(this).data('id'))); 1933 }); 1934 1935 $('.btn-type').on('click', function () { 1936 $('.btn-type').removeClass('btn-selected'); 1937 $(this).addClass('btn-selected'); 1938 $('#type').val(($(this).data('id'))); 1939 }); 1940 1941 $('.btn-warranty').on('click', function () { 1942 $('.btn-warranty').removeClass('btn-selected'); 1943 $(this).addClass('btn-selected'); 1944 $('#warranty').val(($(this).data('id'))); 1945 }); 1946 1947 1948 1949 sub_cat_req = false; 1950 if($('#is_sub_cat_required').length > 0 && $('#is_sub_cat_required').val() != ""){ 1951 sub_cat_req = true; 1952 } 1953 1954 $('#ad_cat').on('change', function () 1955 { 1956 if ($("#ad_cat").val()) 1957 { 1958 $('#sb_loading').show(); 1959 term_label = $(this).find(':selected').data('name'); 1960 if ($('#alert_category').length > 0) { 1961 $('#alert_category').val($("#ad_cat").val()); 1962 } 1963 if ($('.sb-selected-cats-header').length > 0 && term_label != "" && term_label != undefined) { 1964 jQuery('.sb-selected-cats-header').css("display", "block"); 1965 jQuery('.sb-selected-cats-header2').css("display", "block"); 1966 jQuery('.sb-selected-cats').html(''); 1967 jQuery('.sb-selected-cats').append(' <li> ' + term_label + ' </li> '); 1968 jQuery('.sb-selected-cats2').html(''); 1969 jQuery('.sb-selected-cats2').append(' <li> ' + term_label + ' </li> '); 1970 1971 } 1972 $.post(adforest_ajax_url, {action: 'sb_get_sub_cat', cat_id: $("#ad_cat").val(), }).done(function (response) 1973 { 1974 $('#sb_loading').hide(); 1975 if ($.trim(response) == 'cat_error') { 1976 $("#ad_cat").val(''); 1977 $("#select2-ad_cat-container").html($("#select_place_holder").val()); 1978 toastr.error((sb_options.cat_pkg_error), '', {timeOut: 5000, "closeButton": true, "positionClass": "toast-top-right"}); 1979 } else { 1980 $("#ad_cat_sub").val(''); 1981 $("#ad_cat_sub_sub").val(''); 1982 $("#ad_cat_sub_sub_sub").val(''); 1983 if ($.trim(response) != "") 1984 { 1985 $('#ad_cat_id').val($("#ad_cat").val()); 1986 $('#ad_cat_sub_div').show(); 1987 $('#ad_cat_sub').html(response); 1988 $('#ad_cat_sub_sub_div').hide(); 1989 $('#ad_cat_sub_sub_sub_div').hide(); 1990 if(sub_cat_req == true){ 1991 $('#ad_cat_sub').attr("data-parsley-required","true"); 1992 $('#ad_cat_sub_sub').attr("data-parsley-required","false"); 1993 $('#ad_cat_sub_sub_sub').attr("data-parsley-required","false"); 1994 } 1995 } else 1996 { 1997 $('#ad_cat_sub_div').hide(); 1998 $('#ad_cat_sub_sub_div').hide(); 1999 $('#ad_cat_sub_sub_sub_div').hide(); 2000 2001 if(sub_cat_req == true){ 2002 $('#ad_cat_sub').attr("data-parsley-required","false"); 2003 $('#ad_cat_sub_sub').attr("data-parsley-required","false"); 2004 $('#ad_cat_sub_sub_sub').attr("data-parsley-required","false"); 2005 } 2006 } 2007 getCustomTemplate(adforest_ajax_url, $("#ad_cat").val(), $("#is_update").val()); 2008 adforest_make_bidding_catbase(adforest_ajax_url, $("#ad_cat").val(), $("#bid_ad_id").val()); 2009 } 2010 /*For Category Templates*/ 2011 }); 2012 } else 2013 { 2014 $('#ad_cat_sub_div').hide(); 2015 $('#ad_cat_sub_sub_div').hide(); 2016 $('#ad_cat_sub_sub_sub_div').hide(); 2017 } 2018 });
2019 2020 2021 /* Level 2 */ 2022 $('#ad_cat_sub').on('change', function () 2023 { 2024 if ($("#ad_cat_sub").val()) 2025 { 2026 2027 term_label = $(this).find(':selected').data('name'); 2028 2029 if ($('#alert_category').length > 0) { 2030 $('#alert_category').val($("#ad_cat_sub").val()); 2031 } 2032 if ($('.sb-selected-cats-header').length > 0 && term_label != "" && term_label != undefined) { 2033 jQuery('.sb-selected-cats-header').css("display", "block"); 2034 jQuery('.sb-selected-cats-header2').css("display", "block"); 2035 2036 $('.level1_cat').length > 0 ? $('.level1_cat').remove() : ""; 2037 $('.level2_cat').length > 0 ? $('.level2_cat').remove() : ""; 2038 $('.level3_cat').length > 0 ? $('.level3_cat').remove() : ""; 2039 2040 jQuery('.sb-selected-cats').append(' <li class="level1_cat"> ' + term_label + ' </li> '); 2041 jQuery('.sb-selected-cats2').append(' <li class = "level1_cat"> ' + term_label + ' </li> '); 2042 2043 } 2044 $('#sb_loading').show(); 2045 $.post(adforest_ajax_url, {action: 'sb_get_sub_cat', cat_id: $("#ad_cat_sub").val(), }).done(function (response) 2046 { 2047 $('#sb_loading').hide(); 2048 if ($.trim(response) == 'cat_error') { 2049 $("#ad_cat_sub").val(''); 2050 $("#select2-ad_cat_sub-container").html($("#select_place_holder").val()); 2051 toastr.error((sb_options.cat_pkg_error), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 2052 } else { 2053 $("#ad_cat_sub_sub").val(''); 2054 $("#ad_cat_sub_sub_sub").val(''); 2055 if ($.trim(response) != "") 2056 { 2057 $('#ad_cat_id').val($("#ad_cat_sub").val()); 2058 $('#ad_cat_sub_sub_div').show(); 2059 $('#ad_cat_sub_sub').html(response); 2060 $('#ad_cat_sub_sub_sub_div').hide(); 2061 2062 if(sub_cat_req == true){ 2063 $('#ad_cat_sub_sub').attr("data-parsley-required","true"); 2064 $('#ad_cat_sub_sub_sub').attr("data-parsley-required","false"); 2065 } 2066 2067 2068 } else 2069 { 2070 $('#ad_cat_sub_sub_div').hide(); 2071 $('#ad_cat_sub_sub_sub_div').hide(); 2072 if(sub_cat_req == true){ 2073 $('#ad_cat_sub_sub').attr("data-parsley-required","false"); 2074 $('#ad_cat_sub_sub_sub').attr("data-parsley-required","false"); 2075 } 2076 } 2077 getCustomTemplate(adforest_ajax_url, $("#ad_cat_sub").val(), $("#is_update").val()); 2078 adforest_make_bidding_catbase(adforest_ajax_url, $("#ad_cat_sub").val(), $("#bid_ad_id").val()); 2079 } 2080 }); 2081 } else 2082 { 2083 $('#ad_cat_sub_sub_div').hide(); 2084 $('#ad_cat_sub_sub_sub_div').hide(); 2085 } 2086 }); 2087 /* Level 3 */ 2088 $('#ad_cat_sub_sub').on('change', function () 2089 { 2090 if ($("#ad_cat_sub_sub").val()) 2091 { 2092 2093 2094 if ($('#alert_category').length > 0) { 2095 $('#alert_category').val($("#ad_cat_sub_sub").val()); 2096 } 2097 2098 term_label = $(this).find(':selected').data('name'); 2099 if ($('.sb-selected-cats-header').length > 0 && term_label != "" && term_label != undefined) { 2100 jQuery('.sb-selected-cats-header').css("display", "block"); 2101 jQuery('.sb-selected-cats-header2').css("display", "block"); 2102 2103 $('.level2_cat').length > 0 ? $('.level2_cat').remove() : ""; 2104 $('.level3_cat').length > 0 ? $('.level3_cat').remove() : ""; 2105 jQuery('.sb-selected-cats').append(' <li class="level2_cat"> ' + term_label + ' </li> '); 2106 jQuery('.sb-selected-cats2').append(' <li class="level2_cat"> ' + term_label + ' </li> '); 2107 2108 } 2109 $('#sb_loading').show(); 2110 $.post(adforest_ajax_url, {action: 'sb_get_sub_cat', cat_id: $("#ad_cat_sub_sub").val(), }).done(function (response) 2111 { 2112 $('#sb_loading').hide(); 2113 if ($.trim(response) == 'cat_error') { 2114 $("#ad_cat_sub_sub").val(''); 2115 $("#select2-ad_cat_sub_sub-container").html($("#select_place_holder").val()); 2116 toastr.error((sb_options.cat_pkg_error), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 2117 } else { 2118 $("#ad_cat_sub_sub_sub").val(''); 2119 if ($.trim(response) != "") 2120 { 2121 $('#ad_cat_id').val($("#ad_cat_sub_sub").val()); 2122 $('#ad_cat_sub_sub_sub_div').show(); 2123 $('#ad_cat_sub_sub_sub').html(response); 2124 2125 if(sub_cat_req == true){ 2126 $('#ad_cat_sub_sub_sub').attr("data-parsley-required","true"); 2127 } 2128 } else 2129 { 2130 $('#ad_cat_sub_sub_sub').attr("data-parsley-required","false"); 2131 } 2132 getCustomTemplate(adforest_ajax_url, $("#ad_cat_sub_sub").val(), $("#is_update").val()); 2133 adforest_make_bidding_catbase(adforest_ajax_url, $("#ad_cat_sub_sub").val(), $("#bid_ad_id").val()); 2134 } 2135 }); 2136 } else 2137 { 2138 $('#ad_cat_sub_sub_sub_div').hide(); 2139 } 2140 });
2141 /* Level 4 */ 2142 $('#ad_cat_sub_sub_sub').on('change', function () 2143 { 2144 $('#sb_loading').show(); 2145 2146 2147 if ($('#alert_category').length > 0) { 2148 $('#alert_category').val($("#ad_cat_sub_sub_sub").val()); 2149 } 2150 $.post(adforest_ajax_url, {action: 'sb_get_sub_cat', cat_id: $("#ad_cat_sub_sub_sub").val(), }).done(function (response) 2151 { 2152 term_label = $(this).find(':selected').data('name'); 2153 if ($('.sb-selected-cats-header').length > 0 && term_label != "" && term_label != undefined) { 2154 jQuery('.sb-selected-cats-header').css("display", "block"); 2155 jQuery('.sb-selected-cats-header2').css("display", "block"); 2156 $('.level3_cat').length > 0 ? $('.level3_cat').remove() : ""; 2157 jQuery('.sb-selected-cats').append(' <li class="level3_cat"> ' + term_label + ' </li> '); 2158 jQuery('.sb-selected-cats2').append(' <li class="level3_cat"> ' + term_label + ' </li> '); 2159 } 2160 $('#sb_loading').hide(); 2161 if ($.trim(response) == 'cat_error') { 2162 $("#ad_cat_sub_sub_sub").val(''); 2163 $("#select2-ad_cat_sub_sub_sub-container").html($("#select_place_holder").val()); 2164 toastr.error((sb_options.cat_pkg_error), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 2165 } else { 2166 getCustomTemplate(adforest_ajax_url, $("#ad_cat_sub_sub_sub").val(), $("#is_update").val()); 2167 adforest_make_bidding_catbase(adforest_ajax_url, $("#ad_cat_sub_sub_sub").val(), $("#bid_ad_id").val()); 2168 } 2169 }); 2170 }); 2171 2172 $('form.custom-search-form select').on("select2:select", function (e) { 2173 $('#sb_loading').show(); 2174 $(this).closest("form").submit(); 2175 }); 2176 2177 2178 function getCustomTemplate(ajax_url, catId, updateId) 2179 { 2180 /*For Category Templates*/ 2181 $('#sb_loading').hide(); 2182 $.post(ajax_url, {action: 'sb_get_sub_template', 'cat_id': catId, 'is_update': updateId, }).done(function (response) 2183 { 2184 $('#sb_loading').hide(); 2185 if ($.trim(response) != "") 2186 { 2187 $("#dynamic-fields").html(response); 2188 $('#dynamic-fields select').select2({placeholder: sb_options.select_place_holder, allowClear: true, width: '100%'}); 2189 sbDropzone_image(); 2190 adforest_inputTags(); 2191 sbDropzone_video(); 2192 $('.skin-minimal .list li input').iCheck({checkboxClass: 'icheckbox_minimal', radioClass: 'iradio_minimal', increaseArea: '20%'}); 2193 } 2194 if ($('#theme_type').val() == 1 && updateId == "") { 2195 } 2196 }); 2197 /*For Category Templates*/ 2198 } 2199 function adforest_make_bidding_catbase(ajax_url, catId, bid_ad_id) { 2200 /*For Category Templates*/ 2201 $('#sb_loading').hide(); 2202 bid_ad_id = typeof bid_ad_id !== 'undefined' && bid_ad_id != '' ? bid_ad_id : ''; 2203 $.post(ajax_url, {action: 'sb_display_bidding_section', 'cat_id': catId, 'bid_ad_id': bid_ad_id}).done(function (response) 2204 { 2205 $('#sb_loading').hide(); 2206 if (response == '1') { 2207 $('.bidding-content').show(); 2208 } else { 2209 $('.bidding-content').hide(); 2210 } 2211 }); 2212 /*For Category Templates*/ 2213 } 2214 2215 $(document).on('change', '#ad_price_type', function () 2216 { 2217 if (this.value == "on_call" || this.value == "free" || this.value == "no_price") 2218 { 2219 $('#ad_price').attr("data-parsley-required", "false"); 2220 $('#ad_currency').attr("data-parsley-required", "false"); 2221 $('#ad_price').val(''); 2222 $('#ad_price').parent('div').hide(); 2223 $('#ad_currency').parent('div').hide(); 2224 } else 2225 { 2226 $('#ad_price').attr("data-parsley-required", "true"); 2227 $('#ad_currency').attr("data-parsley-required", "true"); 2228 $('#ad_price').parent('div').show(); 2229 $('#ad_currency').parent('div').show(); 2230 } 2231 });
2232 2233 if ($('#is_sub_active').val() == "1") { /* Tags*/ 2234 adforest_inputTags(); 2235 } 2236 2237 2238 2239 if ($('.dynamic-form-date-fields').length > 0) { 2240 jQuery('.dynamic-form-date-fields').datepicker({ 2241 timepicker: false, 2242 dateFormat: 'yyyy-mm-dd', 2243 language: { 2244 days: [sb_options.Sunday, sb_options.Monday, sb_options.Tuesday, sb_options.Wednesday, sb_options.Thursday, sb_options.Friday, sb_options.Saturday], 2245 daysShort: [sb_options.Sun, sb_options.Mon, sb_options.Tue, sb_options.Wed, sb_options.Thu, sb_options.Fri, sb_options.Sat], 2246 daysMin: [sb_options.Su, sb_options.Mo, sb_options.Tu, sb_options.We, sb_options.Th, sb_options.Fr, sb_options.Sa], 2247 months: [sb_options.January, sb_options.February, sb_options.March, sb_options.April, sb_options.May, sb_options.June, sb_options.July, sb_options.August, sb_options.September, sb_options.October, sb_options.November, sb_options.December], 2248 monthsShort: [sb_options.Jan, sb_options.Feb, sb_options.Mar, sb_options.Apr, sb_options.May, sb_options.Jun, sb_options.Jul, sb_options.Aug, sb_options.Sep, sb_options.Oct, sb_options.Nov, sb_options.Dec], 2249 today: sb_options.Today, 2250 clear: sb_options.Clear, 2251 dateFormat: 'mm/dd/yyyy', 2252 }, 2253 }); 2254 } 2255 2256 function adforest_inputTags() 2257 { 2258 var total_tags = $("#tags_count").val(); 2259 if (typeof total_tags === 'undefined' || total_tags == '') { 2260 total_tags = 0; 2261 } 2262 if ($('#tags').length !== 'undefined' && $('#tags').length > 0) { 2263 $('#tags').tagsInput({ 2264 'width': '100%', 2265 'height': '5px;', 2266 'defaultText': '', 2267 onAddTag: function (elem, elem_tags) { 2268 total_tags = parseInt(total_tags) + 1; 2269 if (total_tags > sb_options.adforest_tags_limit_val) { 2270 alert(sb_options.adforest_tags_limit); 2271 $(this).removeTag(elem); 2272 } 2273 if ($.sanitize(elem) == '') { 2274 $(this).removeTag(elem); 2275 } 2276 }, 2277 onRemoveTag: function () { 2278 total_tags = parseInt(total_tags) - 1; 2279 } 2280 }); 2281 } 2282 if ($("#is_update").val() == "" && $('.dynamic-form-date-fields').length > 0) { 2283 if ($('.dynamic-form-date-fields').length > 0) { 2284 $('.dynamic-form-date-fields').datepicker({ 2285 timepicker: false, 2286 dateFormat: 'yyyy-mm-dd', 2287 language: { 2288 days: [get_strings.Sunday, get_strings.Monday, get_strings.Tuesday, get_strings.Wednesday, get_strings.Thursday, get_strings.Friday, get_strings.Saturday], 2289 daysShort: [get_strings.Sun, get_strings.Mon, get_strings.Tue, get_strings.Wed, get_strings.Thu, get_strings.Fri, get_strings.Sat], 2290 daysMin: [get_strings.Su, get_strings.Mo, get_strings.Tu, get_strings.We, get_strings.Th, get_strings.Fr, get_strings.Sa], 2291 months: [get_strings.January, get_strings.February, get_strings.March, get_strings.April, get_strings.May, get_strings.June, get_strings.July, get_strings.August, get_strings.September, get_strings.October, get_strings.November, get_strings.December], 2292 monthsShort: [get_strings.Jan, get_strings.Feb, get_strings.Mar, get_strings.Apr, get_strings.May, get_strings.Jun, get_strings.Jul, get_strings.Aug, get_strings.Sep, get_strings.Oct, get_strings.Nov, get_strings.Dec], 2293 today: get_strings.Today, 2294 clear: get_strings.Clear, 2295 dateFormat: 'mm/dd/yyyy', 2296 }, 2297 }); 2298 } 2299 } 2300 2301 } 2302 $('#ad_bidding').on('change', function () 2303 { 2304 if ($('#ad_bidding').val() == "1") { 2305 $('.biddind_div').show(); 2306 } else { 2307 $('.biddind_div').hide(); 2308 } 2309 });
2310 $('#ad_bidding_date').datepicker({ 2311 timepicker: true, 2312 dateFormat: 'yyyy-mm-dd', 2313 timeFormat: 'hh:ii:00', 2314 language: { 2315 days: [sb_options.Sunday, sb_options.Monday, sb_options.Tuesday, sb_options.Wednesday, sb_options.Thursday, sb_options.Friday, sb_options.Saturday], 2316 daysShort: [sb_options.Sun, sb_options.Mon, sb_options.Tue, sb_options.Wed, sb_options.Thu, sb_options.Fri, sb_options.Sat], 2317 daysMin: [sb_options.Su, sb_options.Mo, sb_options.Tu, sb_options.We, sb_options.Th, sb_options.Fr, sb_options.Sa], 2318 months: [sb_options.January, sb_options.February, sb_options.March, sb_options.April, sb_options.May, sb_options.June, sb_options.July, sb_options.August, sb_options.September, sb_options.October, sb_options.November, sb_options.December], 2319 monthsShort: [sb_options.Jan, sb_options.Feb, sb_options.Mar, sb_options.Apr, sb_options.May, sb_options.Jun, sb_options.Jul, sb_options.Aug, sb_options.Sep, sb_options.Oct, sb_options.Nov, sb_options.Dec], 2320 today: sb_options.Today, 2321 clear: sb_options.Clear, 2322 dateFormat: 'mm/dd/yyyy', 2323 timeFormat: 'hh:ii aa', 2324 firstDay: 0 2325 }, 2326 minDate: new Date() 2327 }); 2328 (function ($) { 2329 $.sanitize = function (input) { 2330 var output = input.replace(/<script[^>]*?>.*?<\/script>/gi, '').replace(/<[\/\!]*?[^<>]*?>/gi, '').replace(/<style[^>]*?>.*?<\/style>/gi, '').replace(/<![\s\S]*?--[ \t\n\r]*>/gi, ''); 2331 return output; 2332 }; 2333 })(jQuery); 2334 if ($('.posts-masonry').length > 0) { 2335 $('.posts-masonry').imagesLoaded(function () { 2336 $('.posts-masonry').isotope({layoutMode: 'masonry', transitionDuration: '0.3s', }); 2337 }); 2338 } 2339 if ($('.sb_rating_input').length > 0) 2340 { 2341 var star_rtl = false; 2342 if ($('#is_rtl').val() != "" && $('#is_rtl').val() == "1") { 2343 star_rtl = true; 2344 } 2345 $('.user_ratting_input .fa-star').on('click', function (event) { 2346 setTimeout(function () { 2347 $('#user_search_rating').submit(); 2348 }, 2349 1000); 2350 jQuery('#sb_loading').show(); 2351 }); 2352 } 2353 function adforest_validateEmail(sEmail) 2354 { 2355 var filter = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; 2356 if (filter.test(sEmail)) { 2357 return true; 2358 } else { 2359 return false; 2360 } 2361 } 2362 if ($('.listing-list-salesman').length > 0) { 2363 $('.dt-detaial-page').remove(); 2364 } 2365 2366 if (sb_options.msg_notification_on != "" && sb_options.msg_notification_on != 0 && sb_options.msg_notification_time != "") 2367 { 2368 if (sb_options.is_logged_in == '1') 2369 { 2370 setInterval(function () 2371 { 2372 $.post(adforest_ajax_url, {action: 'sb_check_messages', new_msgs: $('#is_unread_msgs').val(), }).done(function (response) 2373 { 2374 2375 var get_r = response.split('|'); 2376 if ($.trim(get_r[0]) == '1') 2377 { 2378 toastr.success(get_r[1], '', {timeOut: 5000, "closeButton": true, "positionClass": "toast-top-right"}); 2379 2380 } 2381 }); 2382 }, sb_options.msg_notification_time); 2383 } 2384 } 2385 /*Report Ad*/ 2386 $('#sb_mark_it').on('click', function () 2387 { 2388 $('#sb_loading').show(); 2389 $.post(adforest_ajax_url, {action: 'sb_report_ad', option: $('#report_option').val(), comments: $('#report_comments').val(), ad_id: $('#ad_id').val(), }).done(function (response) 2390 { 2391 $('#sb_loading').hide(); 2392 var get_r = response.split('|'); 2393 if ($.trim(get_r[0]) == '1') 2394 { 2395 toastr.success(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 2396 $('.report-quote').modal('hide'); 2397 } else 2398 { 2399 toastr.error(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 2400 } 2401 }); 2402 });
2403 /* Emoji Reaction Against Reviews */ 2404 $(".Emoji").on("click", function () 2405 { 2406 var reaction_id = $(this).data("reaction"); 2407 var c_id = $(this).data("cid"); 2408 $("#reaction-loader-" + c_id).show(); 2409 $.post(adforest_ajax_url, {action: 'adforest_ads_rating_reaction', r_id: reaction_id, c_id: c_id}).done(function (response) 2410 { 2411 $("#reaction-loader-" + c_id).hide(); 2412 2413 var get_r = response.split('|'); 2414 if ($.trim(get_r[0]) == '0') 2415 { 2416 alert($.trim(get_r[1])); 2417 return false; 2418 } else 2419 { 2420 if (reaction_id === 1) { 2421 $('.emoji-count.likes-' + c_id).text(response); 2422 } 2423 if (reaction_id === 2) 2424 { 2425 $('.emoji-count.loves-' + c_id).text(response) 2426 } 2427 if (reaction_id === 3) { 2428 $('.emoji-count.wows-' + c_id).text(response); 2429 } 2430 if (reaction_id === 4) { 2431 $('.emoji-count.angrys-' + c_id).text(response); 2432 } 2433 } 2434 }); 2435 return false; 2436 }); 2437 /* Back To Top */ 2438 $(window).scroll(function () { 2439 var offset = 300, 2440 offset_opacity = 1200, 2441 scroll_top_duration = 700, 2442 $back_to_top = $('.cd-top'); 2443 var ad_post_btn = $('.sticky-post-button'); 2444 ($(this).scrollTop() > offset) ? ad_post_btn.addClass('sticky-post-button-visible') : ad_post_btn.removeClass('sticky-post-button-visible').removeClass('sticky-post-button-fadeout'); 2445 ($(this).scrollTop() > offset) ? $back_to_top.addClass('cd-is-visible') : $back_to_top.removeClass('cd-is-visible cd-fade-out'); 2446 if ($(this).scrollTop() > offset_opacity) { 2447 $back_to_top.addClass('cd-fade-out'); 2448 ad_post_btn.addClass('sticky-post-button-fadeout'); 2449 } 2450 }); 2451 $back_to_top = $('.cd-top'); 2452 $(document).on('click', '.cd-top', function (event) { 2453 event.preventDefault(); 2454 $('body,html').animate({scrollTop: 0, }, 700); 2455 2456 }); 2457 /* Counter FunFacts */ 2458 var timer = $('.timer'); 2459 if (timer.length) {
2460 timer.appear(function () { 2461 timer.countTo(); 2462 }); 2463 } 2464 $('.top-loc-selection').on('click', function () { 2465 var loc_id = $(this).attr("data-loc-id"); 2466 $('#sb_loading').show(); 2467 jQuery.post(adforest_ajax_url, {action: 'sb_set_site_location', location_id: loc_id}).done(function (response) 2468 { 2469 $('#sb_loading').hide(); 2470 if (typeof response !== undefined && response == 1) { 2471 window.location.reload(); 2472 } else { 2473 alert(get_strings.adforest_location_error); 2474 } 2475 }); 2476 return false; 2477 }); 2478 2479 if ($(".cat-hero-slider").length > 0) { 2480 $(".cat-hero-slider").slick({ 2481 slidesToShow: 9, 2482 slidesToScroll: 1, 2483 autoplay: true, 2484 autoplayTimeout: 5000, 2485 rtl: is_rtl, 2486 arrows: true, 2487 dots: false, 2488 margin: 10, 2489 autoplaySpeed: autoplay, 2490 pauseOnHover: false, 2491 prevArrow: '<i class="slick-prev fa fa-angle-left"></i>', 2492 nextArrow: '<i class="slick-next fa fa-angle-right"></i>', 2493 responsive: [{ 2494 breakpoint: 768, 2495 settings: { 2496 slidesToShow: 3 2497 } 2498 }, 2499 { 2500 breakpoint: 900, 2501 settings: { 2502 slidesToShow: 3 2503 } 2504 }, 2505 { 2506 breakpoint: 1000, 2507 settings: { 2508 slidesToShow: 3 2509 } 2510 }, 2511 { 2512 breakpoint: 1200, 2513 settings: { 2514 slidesToShow: 5 2515 } 2516 }, 2517 { 2518 breakpoint: 520, 2519 settings: { 2520 slidesToShow: 2 2521 } 2522 }] 2523 }); 2524 } 2525 var dd_bottoms = $('.sb-top-loc'); 2526 if ($('.sb-top-loc').length > 0) { 2527 const pss = new PerfectScrollbar(".sb-top-loc"); 2528 } 2529 if ($(".map-sidebar").length > 0) { 2530 // $(".map-sidebar").niceScroll(); 2531 } 2532 2533 function adforest_save_adpost_cat_val(term_id, term_level) { 2534 if (term_level == '1') { 2535 jQuery('#ad_cat').val(term_id); 2536 jQuery('#ad_cat_sub').val(''); 2537 jQuery('#ad_cat_sub_sub').val(''); 2538 jQuery('#ad_cat_sub_sub_sub').val(''); 2539 } else if (term_level == '2') { 2540 jQuery('#ad_cat_sub').val(term_id); 2541 } else if (term_level == '3') { 2542 jQuery('#ad_cat_sub_sub').val(term_id); 2543 } else if (term_level == '4') { 2544 jQuery('#ad_cat_sub_sub_sub').val(term_id); 2545 } 2546 } 2547 jQuery(document).on('click', '.sb-adpost-cats ul li a', function () 2548 { 2549 var cat_s_id = jQuery(this).attr('data-cat-id'); 2550 var term_level = jQuery(this).attr('data-term-level'); 2551 jQuery('.sb-selected-cats').html(''); 2552 adforest_save_adpost_cat_val(cat_s_id, term_level); 2553 jQuery(".sb-cat-box").removeClass("sb-cat-active"); 2554 jQuery(this).parent().addClass("sb-cat-active"); 2555 2556 var term_label = jQuery(this).attr('data-term-name'); 2557 if (cat_s_id != "") 2558 { 2559 jQuery('#cat_id').val(cat_s_id); 2560 jQuery('#sb_loading').show(); 2561 jQuery('#cats_response').html(''); 2562 jQuery.post(jQuery('#adforest_ajax_url').val(), {action: 'sb_get_sub_cat_search', cat_id: cat_s_id, type: 'ad_post'}).done(function (response) 2563 { 2564 jQuery('#sb_loading').hide(); 2565 jQuery('.sb-selected-cats-header').css("display", "block"); 2566 jQuery('.sb-selected-cats-header2').css("display", "block"); 2567 jQuery('.sb-selected-cats').append(' <li> ' + term_label + ' </li> '); 2568 jQuery('.sb-selected-cats2').html(''); 2569 jQuery('.sb-selected-cats2').append(' <li> ' + term_label + ' </li> '); 2570 getCustomTemplate(jQuery('#adforest_ajax_url').val(), $("#ad_cat").val(), $("#is_update").val()); 2571 adforest_make_bidding_catbase(jQuery('#adforest_ajax_url').val(), $("#ad_cat").val(), $("#bid_ad_id").val()); 2572 if (jQuery.trim(response) == 'submit') 2573 { 2574 2575 2576 } else 2577 { 2578 jQuery('#cat_modal').modal('show'); 2579 jQuery('#cats_response').html(response); 2580 } 2581 }); 2582 } 2583 });
2584 2585 if ($('#ad_post_form').length > 0) { 2586 jQuery(document).on('click', '#ajax_cat', function () 2587 { 2588 jQuery('#sb_loading').show(); 2589 var cat_s_id = jQuery(this).attr('data-cat-id'); 2590 var term_level = jQuery(this).attr('data-term-level'); 2591 adforest_save_adpost_cat_val(cat_s_id, term_level); 2592 var cat_slc_val = $("#ad_cat").val(); 2593 if (term_level == '1') { 2594 cat_slc_val = jQuery('#ad_cat').val(); 2595 } else if (term_level == '2') { 2596 cat_slc_val = jQuery('#ad_cat_sub').val(); 2597 } else if (term_level == '3') { 2598 cat_slc_val = jQuery('#ad_cat_sub_sub').val(); 2599 } else if (term_level == '4') { 2600 cat_slc_val = jQuery('#ad_cat_sub_sub_sub').val(); 2601 } 2602 var term_label = jQuery(this).html(); 2603 jQuery('#cat_id').val(cat_s_id); 2604 jQuery.post(jQuery('#adforest_ajax_url').val(), {action: 'sb_get_sub_cat_search', cat_id: cat_s_id, type: 'ad_post'}).done(function (response) 2605 { 2606 2607 jQuery('.sb-selected-cats').append(' <li> ' + term_label + ' </li> '); 2608 jQuery('.sb-selected-cats2').append(' <li> ' + term_label + ' </li> '); 2609 2610 getCustomTemplate(jQuery('#adforest_ajax_url').val(), cat_slc_val, $("#is_update").val()); 2611 adforest_make_bidding_catbase(jQuery('#adforest_ajax_url').val(), $("#ad_cat").val(), $("#bid_ad_id").val()); 2612 2613 if (jQuery.trim(response) == 'submit') 2614 { 2615 jQuery('#cat_modal').modal('toggle'); 2616 } else 2617 { 2618 2619 jQuery('#cats_response').html(response); 2620 jQuery('#cat_modal').modal('show'); 2621 jQuery('#sb_loading').hide(); 2622 } 2623 }); 2624 }); 2625 } 2626 2627 $('.no-display-custom').hide(); 2628 $('.sw-btn-next').on('click', function () { 2629 2630 console.log($('#ad_cat_sub').val()); 2631 if ($('#ad_cat').length > 0 && $('#ad_cat').val() == "") { 2632 2633 console.log("sss"); 2634 toastr.error($('#select_cat_first').val(), '', { 2635 timeOut: 4000, 2636 "closeButton": true, 2637 "positionClass": "toast-top-right" 2638 }); 2639 } else if(sub_cat_req && $('#ad_cat_sub').val() == "" && $('#ad_cat_sub').attr('data-parsley-required') == "true" ){ 2640 toastr.error($('#select_cat_first').val(), '', { 2641 timeOut: 4000, 2642 "closeButton": true, 2643 "positionClass": "toast-top-right" 2644 }); 2645 } 2646 else if(sub_cat_req && $('#ad_cat_sub_sub').val() == "" && $('#ad_cat_sub_sub').attr('data-parsley-required') == "true" ){ 2647 toastr.error($('#select_cat_first').val(), '', { 2648 timeOut: 4000, 2649 "closeButton": true, 2650 "positionClass": "toast-top-right" 2651 }); 2652 } 2653 else if(sub_cat_req && $('#ad_cat_sub_sub_sub').val() == "" && $('#ad_cat_sub_sub_sub').attr('data-parsley-required') == "true" ){ 2654 toastr.error($('#select_cat_first').val(), '', { 2655 timeOut: 4000, 2656 "closeButton": true, 2657 "positionClass": "toast-top-right" 2658 }); 2659 } 2660 else { 2661 $('.step-0').hide(); 2662 $('.step-1').show(); 2663 } 2664 }); 2665 2666 $('#change-cat').on('click', function () { 2667 $('.step-0').show(); 2668 $('.step-1').hide(); 2669 2670 }); 2671 2672 2673 $('.search-cat-submit').on('click', function (e) 2674 { 2675 2676 $('#sb_loading').show(); 2677 $.post(adforest_ajax_url, {action: 'search_cat_grid', title: $('.search-cat-input').val()}).done(function (response) { 2678 if (response != "") { 2679 2680 2681 $('#sb_loading').hide(); 2682 $('.category-grid-ist').html(response); 2683 } 2684 2685 }); 2686 });
2687 2688 $('.search-cat-input').on('input', function (e) 2689 { 2690 2691 2692 if (e.target.value == "") { 2693 $('#sb_loading').show(); 2694 $.post(adforest_ajax_url, {action: 'search_cat_grid', title: e.target.value}).done(function (response) { 2695 if (response != "") { 2696 2697 $('#sb_loading').hide(); 2698 2699 $('.category-grid-ist').html(response); 2700 } 2701 2702 }); 2703 } 2704 }); 2705 2706 if ($("#ad_price_type").length > 0) { 2707 $("#ad_price_type").trigger("change"); 2708 } 2709 2710 2711 2712 2713 if ($('.send-message-to-author').length > 0) 2714 { 2715 $('.send-message-to-author').parsley().on('field:validated', function () { 2716 var ok = $('.parsley-error').length === 0; 2717 }).on('form:submit', function () { 2718 $('#sb_loading').show(); 2719 var google_recaptcha_type = get_strings.google_recaptcha_type; 2720 google_recaptcha_type = typeof google_recaptcha_type !== 'undefined' ? google_recaptcha_type : 'v2'; 2721 var google_recaptcha_site_key = get_strings.google_recaptcha_site_key; 2722 2723 2724 2725 if (google_recaptcha_type == 'v3' && google_recaptcha_site_key !== 'undefined' && google_recaptcha_site_key != '') { 2726 grecaptcha.ready(function () { 2727 try { 2728 var adforest_ajax_url = jQuery("#adforest_ajax_url").val(); 2729 grecaptcha.execute(google_recaptcha_site_key, {action: "contact_form"}).then(function (token) { 2730 jQuery("#user_contact_form").prepend('<input type="hidden" name="g-recaptcha-response" value="' + token + '">'); 2731 jQuery.post(adforest_ajax_url, { 2732 action: "sb_goggle_captcha3_verification", 2733 token: token, 2734 }, function (result) { 2735 result = JSON.parse(result); 2736 if (result.success) { 2737 $.post(adforest_ajax_url, {action: 'sb_send_message_to_author', ad_id: $('#ad_id').val(), sb_data: $("form.send-message-to-author").serialize(), }).done(function (response) 2738 { 2739 $('#sb_loading').hide(); 2740 var res_arr = response.split("|"); 2741 if ($.trim(res_arr[0]) != "0") 2742 { 2743 toastr.success(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 2744 } else 2745 { 2746 toastr.error(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 2747 } 2748 }); 2749 } else { 2750 $('#sb_loading').hide(); 2751 $('#sb_register_submit').show(); 2752 toastr.error(result.msg, '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 2753 } 2754 }); 2755 }); 2756 } catch (err) { 2757 var google_recaptcha_error_text = jQuery("#google_recaptcha_error_text").val(); 2758 google_recaptcha_error_text = typeof google_recaptcha_error_text !== 'undefined' ? google_recaptcha_error_text : err; 2759 jQuery('#sb_loading').hide(); 2760 toastr.error(google_recaptcha_error_text, '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 2761 } 2762 }); 2763 } else { 2764 $.post(adforest_ajax_url, {action: 'sb_send_message_to_author', ad_id: $('#ad_id').val(), sb_data: $("form.send-message-to-author").serialize(), }).done(function (response) 2765 { 2766 $('#sb_loading').hide(); 2767 var res_arr = response.split("|"); 2768 if ($.trim(res_arr[0]) != "0") 2769 { 2770 toastr.success(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 2771 } else 2772 { 2773 toastr.error(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 2774 } 2775 }); 2776 } 2777 return false; 2778 }); 2779 } 2780 2781 2782 $('.ads-with-sidebar-section a.ajax-anchor').on('click', function () 2783 { 2784 var cat_id = $(this).data('sidebar-term-id'); 2785 var unique_id = $(this).data('unique-id'); 2786 $(".ads-sidebar-loader").show(); 2787 $('#sb_loading').show(); 2788 var no_of_ads = $("#no_of_ads_" + unique_id).val(); 2789 var layout_type = $("#layout_type_" + unique_id).val(); 2790 var ad_order = $("#ad_order_" + unique_id).val(); 2791 var ad_type = $("#ad_type_" + unique_id).val(); 2792 var cat_link_page = $("#cat_link_page_" + unique_id).val();
2793 var wpnonce = $("#ads_with_sidebar_ajax_" + unique_id).val(); 2794 var view_all = $("#view_all_" + unique_id).val(); 2795 $("#ads-with-sidebar-section-" + unique_id).html(''); 2796 $.post(adforest_ajax_url, {action: 'get_ads_with_sidebar_section', cat_id: cat_id, unique_id: unique_id, no_of_ads: no_of_ads, layout_type: layout_type, ad_order: ad_order, ad_type: ad_type, cat_link_page: cat_link_page, view_all: view_all, wpnonce: wpnonce}).done(function (response) 2797 { 2798 $("#ads-with-sidebar-section-" + unique_id).html(response); 2799 adforest_timerCounter_function(); 2800 $(".ads-sidebar-loader").hide(); 2801 $('#sb_loading').hide(); 2802 }); 2803 }); 2804 if (jQuery('.dec-latest-products-s').length > 0) { 2805 jQuery('.dec-latest-products-s').owlCarousel({ 2806 loop: true, 2807 margin: 10, 2808 nav: true, 2809 rtl: is_rtl, 2810 smartSpeed: 550, 2811 autoplay: false, 2812 //dots: false, 2813 navText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"], 2814 responsive: {0: {items: 1, }, 600: {items: 4, }, 768: {items: 6, }, 1000: {items: 6, }} 2815 }); 2816 } 2817 2818 if (jQuery('.dec-location').length > 0) { 2819 jQuery('.dec-location').owlCarousel({ 2820 loop: true, 2821 margin: 15, 2822 dots: false, 2823 rtl: is_rtl, 2824 autoplay: true, 2825 responsiveClass: true, 2826 navText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"], 2827 nav: true, 2828 responsive: {0: {items: 1, }, 600: {items: 3, }, 1000: {items: 3, } 2829 } 2830 }); 2831 } 2832 2833 2834 $('.success-stories-2').owlCarousel({ 2835 loop: true, 2836 margin: 10, 2837 navText: navTextAngle, 2838 nav: true, 2839 dots: false, 2840 rtl: is_rtl, 2841 smartSpeed: 600, 2842 autoplay: true, 2843 responsive: {0: {items: 1}, 600: {items: 3, }, 1000: {items: 1, }} 2844 }); 2845 2846 /* slider js for adforest app homepage */ 2847 if (jQuery('.mobile-hero').length > 0) { 2848 jQuery('.mobile-hero').owlCarousel({ 2849 loop: true, 2850 margin: 10, 2851 dots: false, 2852 center: true, 2853 rtl: is_rtl, 2854 smartSpeed: 750, 2855 autoplay: false, 2856 responsive: {0: {items: 1}, 768: {items: 1, stagePadding: 200, }} 2857 }); 2858 } 2859 2860 if (jQuery('.toys-new-accessories').length > 0) { 2861 jQuery('.toys-new-accessories').owlCarousel({ 2862 loop: true, 2863 margin: 10, 2864 nav: false, 2865 rtl: is_rtl, 2866 smartSpeed: 550, 2867 autoplay: true, 2868 dots: true, 2869 navText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"], 2870 responsive: {0: {items: 1, }, 600: {items: 2, }, 768: {items: 1, }, 1000: {items: 1, }} 2871 }); 2872 } 2873 2874 2875 2876 var dd_bottoms = $('#scrolable-ads-real'); 2877 if ($('#scrolable-ads-real').length > 0) { 2878 2879 2880 const ps = new PerfectScrollbar("#scrolable-ads-real"); 2881 } 2882 2883 2884 $('.app-shots-carousal').owlCarousel({ 2885 autoplayHoverPause: true, 2886 rtl: is_rtl, 2887 loop: true, 2888 margin: 20, 2889 dots: false, 2890 autoplay: false, 2891 responsiveClass: true, 2892 navText: navTextAngle, 2893 nav: true, 2894 center: true, 2895 responsive: {0: {items: 1, }, 600: {items: 3, }, 1000: {items: 5, }} 2896 }); 2897 2898 $('.land-one-slider-2').owlCarousel({ 2899 rtl: is_rtl, 2900 loop: true, 2901 margin: 10, 2902 autoplay: true, 2903 smartSpeed: 700, 2904 nav: false, 2905 dots: true, 2906 responsive: {0: {items: 1}, 600: {items: 3}, 1000: {items: 1}} 2907 }); 2908 2909 /* Category Carousel */ 2910 $('.category-slider').owlCarousel({ 2911 loop: true, 2912 rtl: is_rtl, 2913 dots: false, 2914 autoplay: true, 2915 autoplayHoverPause: true, 2916 margin: 0, 2917 responsiveClass: true, // Optional helper class. Add 'owl-reponsive-' + 'breakpoint'
2917class to main element. 2918 navText: ["<i class='fa fa-angle-right'></i>", "<i class='fa fa-angle-left'></i>"], 2919 responsive: { 2920 0: {items: 1, nav: false}, 2921 600: {items: 2, nav: false}, 2922 1000: {items: 4, nav: false, loop: true} 2923 } 2924 }); 2925 2926 /* Background Image Rotator Carousel */ 2927 $('.background-rotator-slider').owlCarousel({ 2928 loop: false, 2929 rtl: is_rtl, 2930 dots: false, 2931 margin: 0, 2932 autoplay: true, 2933 autoplayHoverPause: true, 2934 mouseDrag: true, 2935 touchDrag: true, 2936 responsiveClass: true, // Optional helper class. Add 'owl-reponsive-' + 'breakpoint' class to main element. 2937 nav: false, 2938 responsive: { 2939 0: {items: 1, }, 2940 600: {items: 1, }, 2941 1000: {items: 1, } 2942 } 2943 }); 2944 2945 2946 2947 if ($('.play-video-new').length > 0) { 2948 $("a.play-video-new").YouTubePopUp(); 2949 } 2950 2951 2952 2953 $(document).on('click', '#sb_feature_ad', function () 2954 { 2955 adID = $(this).attr('aaa_id'); 2956 confirm_btn = $(this).attr('data-btn-ok-label'); 2957 cancel_btn = $(this).attr('data-btn-cancel-label'); 2958 title = $(this).attr('data-title'); 2959 2960 $.confirm({ 2961 title: title, 2962 content: '', 2963 theme: 'modern', 2964 closeIcon: true, 2965 animation: 'scale', 2966 type: 'blue', 2967 buttons: { 2968 confirm: { 2969 text: confirm_btn, 2970 action: function () { 2971 $('#sb_loading').show(); 2972 $.post(adforest_ajax_url, {action: 'sb_make_featured', ad_id: adID, }).done(function (response) 2973 { 2974 $('#sb_loading').hide(); 2975 var get_r = response.split('|'); 2976 if ($.trim(get_r[0]) == '1') 2977 { 2978 toastr.success(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 2979 } else 2980 { 2981 toastr.success(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 2982 } 2983 }); 2984 }, }, 2985 cancel: { 2986 text: cancel_btn, 2987 function() { 2988 }, 2989 }} 2990 }); 2991 }); 2992 2993 2994 $(".sb_show_pass").on('click', function (event) { 2995 event.preventDefault(); 2996 2997 var passwordField = $("input[name='sb_reg_password']"); 2998 var iconField = $('.sb_show_pass i'); 2999 if (passwordField.attr("type") == "text") { 3000 3001 passwordField.attr('type', 'password'); 3002 iconField.addClass("fa-eye"); 3003 iconField.removeClass("fa-eye-slash"); 3004 3005 } else if (passwordField.attr("type") == "password") { 3006 3007 passwordField.attr('type', 'text'); 3008 iconField.removeClass("fa-eye"); 3009 iconField.addClass("fa-eye-slash"); 3010 3011 } 3012 }); 3013 3014 3015 3016 $(".sb_show_pass2").on('click', function (event) { 3017 event.preventDefault(); 3018 3019 var passwordField = $("input[name='sb_reg_password_confirm']"); 3020 var iconField = $('.sb_show_pass2 i'); 3021 if (passwordField.attr("type") == "text") { 3022 3023 passwordField.attr('type', 'password'); 3024 iconField.addClass("fa-eye"); 3025 iconField.removeClass("fa-eye-slash"); 3026 3027 } else if (passwordField.attr("type") == "password") { 3028 3029 passwordField.attr('type', 'text'); 3030 iconField.removeClass("fa-eye"); 3031 iconField.addClass("fa-eye-slash"); 3032 3033 } 3034 }); 3035 3036 $(".ad_alerts").click(function () { 3037 $('#sb_loading').show(); 3038 $.post(adforest_ajax_url, { 3039 action: 'job_alert_subscription_check', 3040 }).done(function (response) { 3041 $('#sb_loading').hide(); 3042 var res_arr = response.split("|"); 3043 if ($.trim(res_arr[0]) != "0") { 3044 $('#ad_cat_sub_div').hide(); 3045 $('#ad_cat_sub_sub_div').hide(); 3046 $('#ad_cat_sub_sub_sub_div').hide(); 3047 $("select").select2({placeholder: sb_options.select_place_holder, allowClear: true, width: '100%'});
3048 3049 $('#sb_loading').show(); 3050 $("#ad-alert-subscribtion").modal('show'); 3051 $('#sb_loading').hide(); 3052 } else { 3053 toastr.error(res_arr[1], '', { 3054 timeOut: 4000, 3055 "closeButton": true, 3056 "positionClass": "toast-top-right" 3057 }); 3058 } 3059 }); 3060 }); 3061 3062 3063 3064 $(document).on('click', '#submit_alert', function () { 3065 $('#alert_job_form').parsley().on('field:validated', function () { 3066 var ok = $('.parsley-error').length === 0; 3067 }) 3068 .on('form:submit', function () { 3069 $('#sb_loading').show(); 3070 // Ajax Submitting Resume 3071 $.post(adforest_ajax_url, { 3072 action: 'job_alert_subscription', 3073 submit_alert_data: $("form#alert_job_form").serialize(), 3074 }).done(function (response) { 3075 $('#sb_loading').hide(); 3076 var res_arr = response.split("|"); 3077 3078 if ($.trim(res_arr[0]) != "0") { 3079 toastr.success(res_arr[1], '', { 3080 timeOut: 4000, 3081 "closeButton": true, 3082 "positionClass": "toast-top-right" 3083 }); 3084 $("#ad-alert-subscribtion").modal('hide'); 3085 3086 } else { 3087 toastr.error(res_arr[1], '', { 3088 timeOut: 4000, 3089 "closeButton": true, 3090 "positionClass": "toast-top-right" 3091 }); 3092 } 3093 }); 3094 return false; 3095 }); 3096 }); 3097 3098 3099 jQuery(document).ready(function ($) { 3100 /* Reset Password*/ 3101 if ($('#sb-reset-password-form').length > 0) 3102 { 3103 $('#sb_reset_password_modal').modal('show'); 3104 $('#sb_reset_password_msg').hide(); 3105 $('#sb-reset-password-form').parsley().on('field:validated', function () { 3106 var ok = $('.parsley-error').length === 0; 3107 }).on('form:submit', function () { 3108 if ($('#sb_new_password').val() != $('#sb_confirm_new_password').val()) 3109 { 3110 toastr.error($('#adforest_password_mismatch_msg').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 3111 return false; 3112 } 3113 $('#sb_reset_password_submit').hide(); 3114 $('#sb_reset_password_msg').show(); 3115 $('#sb_loading').show(); 3116 $.post(adforest_ajax_url, {action: 'sb_reset_password', security: $('#sb-reset-pass-token').val(), sb_data: $("form#sb-reset-password-form").serialize(), }).done(function (response) 3117 { 3118 $('#sb_loading').hide(); 3119 $('#sb_reset_password_msg').hide(); 3120 3121 var get_r = response.split('|'); 3122 if ($.trim(get_r[0]) == '1') 3123 { 3124 toastr.success(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 3125 $('#sb_reset_password_modal').modal('hide'); 3126 $('#sb_reset_password_submit').show(); 3127 window.location = $('#login_page').val(); 3128 } else 3129 { 3130 $('#sb_reset_password_submit').show(); 3131 toastr.error(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 3132 } 3133 }).fail(function () { 3134 $('#sb_loading').hide(); 3135 $('#sb_reset_password_msg').hide(); 3136 $('#sb_reset_password_submit').show(); 3137 toastr.error($('#_nonce_error').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 3138 }); 3139 return false; 3140 }); 3141 } 3142 });
3143 3144 3145 if ($('.claim_ad').length > 0) { 3146 $('.claim_ad').on('click', function () { 3147 $('#sb_loading').show(); 3148 $.post(adforest_ajax_url, {action: 'check_user_claim'}).done(function (response) 3149 { 3150 $('#sb_loading').hide(); 3151 $('#sb_reset_password_msg').hide(); 3152 var get_r = response.split('|'); 3153 if ($.trim(get_r[0]) == '1') 3154 { 3155 // toastr.success(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 3156 $('.claim-ad-model').modal('show'); 3157 3158 } else 3159 { 3160 toastr.error(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 3161 } 3162 }).fail(function () { 3163 $('#sb_loading').hide(); 3164 toastr.error($('#_nonce_error').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 3165 }); 3166 }); 3167 } 3168 3169 3170 3171 if ($('#claim-form').length > 0) { 3172 if ($('#claim-form').length > 0) 3173 { 3174 $('#claim-form').parsley().on('field:validated', function () { 3175 var ok = $('.parsley-error').length === 0; 3176 }).on('form:submit', function () { 3177 3178 $('#sb_loading').show(); 3179 $.post(adforest_ajax_url, {action: 'for_claim_listing', collect_data: $("form#claim-form").serialize(), }).done(function (response) 3180 { 3181 $('#sb_loading').hide(); 3182 var get_r = response.split('|'); 3183 if ($.trim(get_r[0]) == '1') 3184 { 3185 toastr.success(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 3186 $('.claim-ad-model').modal('hide'); 3187 } else 3188 { 3189 $('#sb_reset_password_submit').show(); 3190 toastr.error(get_r[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 3191 } 3192 }).fail(function () { 3193 $('#sb_loading').hide(); 3194 toastr.error($('#_nonce_error').val(), '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 3195 }); 3196 return false; 3197 }); 3198 } 3199 } 3200 3201 $(document).on('click', '#map-hide-search', function () { 3202 if ($(this).prop('checked')) { 3203 $(this).closest("form").submit(); 3204 } else { 3205 $(this).closest("form").submit(); 3206 3207 } 3208 }); 3209 $(document).on('click', '#filter-hide-search', function () { 3210 if ($(this).prop('checked')) { 3211 $(this).closest("form").submit(); 3212 } else { 3213 $(this).closest("form").submit(); 3214 } 3215 }); 3216 if ($('.no-filters').length > 0) { 3217 $('.map-sidebar').hide(); 3218 } 3219 if ($('.no-filters').length > 0) { 3220 $('.col-lg-4').addClass('col-lg-6').removeClass('col-lg-4'); 3221 } 3222 3223 3224 $('#show_more').on('click',function(){ 3225 3226 3227 $('#cat-half-text').hide(); 3228 $('#cat-full-text').show(); 3229 3230 3231 }); 3232 3233 $('#show_less').on('click',function(){ 3234 $('#cat-half-text').show(); 3235 $('#cat-full-text').hide(); 3236 3237 }); 3238 3239}(jQuery));
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.