1var wdtPortfolioFrontendUtils = { 2 3 wdtPortfolioListingsListingIsotope : function($appended = false) { 4 5 jQuery('.wdt-listings-item-apply-isotope .wdt-listings-item-container').each(function() { 6 7 var this_item = jQuery(this); 8 9 var $grid = this_item.isotope({ 10 itemSelector: '.wdt-column', 11 percentPosition: true, 12 masonry: { 13 columnWidth: '.grid-sizer' 14 } 15 }); 16 17 if($appended) { 18 $grid.isotope('reloadItems'); 19 } 20 21 window.setTimeout(function(){ 22 this_item.isotope(); 23 }, 1400); 24 25 }); 26 27 jQuery('.wdt-listings-item-apply-isotope .wdt-listings-item-container').each(function() { 28 29 var this_item = jQuery(this); 30 31 this_item.isotope(); 32 33 }); 34 35 jQuery('.wdt-listings-item-apply-isotope .wdt-listings-item-isotope-filter').each(function() { 36 37 var isotope_filter = jQuery(this); 38 39 isotope_filter.find('a').on('click', function() { 40 41 isotope_filter.find('a').removeClass('active-sort'); 42 var selector = jQuery(this).attr('data-filter'); 43 jQuery(this).addClass('active-sort'); 44 45 wdtPortfolioFrontendUtils.wdtPortfolioImagePopup(); 46 47 jQuery(this).parents('.wdt-listings-item-apply-isotope').find('.wdt-listings-item-container').isotope({ filter: selector, masonry: { }, animationEngine : 'jquery' }); 48 49 return false; 50 51 }); 52 53 }); 54 55 56 }, 57 58 wdtPortfolioListingCarousel : function($scope, $) { 59 60 const $carouselItem = $scope.find('.wdt-listing-output-data-holder'); 61 const $moduleId = $carouselItem.data('moduleid'); 62 const $carouselresponsive = $carouselItem.data('carouselresponsive'); 63 64 const $carouselcarouseleffect = $scope.data('carouseleffect'); 65 const $carouselcarouselautoplay = $scope.data('carouselautoplay'); 66 const $carouselslidesperview = $scope.data('carouselslidesperview'); 67 const $carouselloopmode = $scope.data('carouselloopmode'); 68 const $carouselmousewheelcontrol = $scope.data('carouselmousewheelcontrol'); 69 const $carouselbulletpagination = $scope.data('carouselbulletpagination'); 70 const $carouselarrowpagination = $scope.data('carouselarrowpagination'); 71 const $carouselspacebetween = $scope.data('carouselspacebetween'); 72 73 const swiperOptions = { 74 initialSlide: 0, 75 simulateTouch: true, 76 // roundLengths: true, 77 spaceBetween: $carouselspacebetween, 78 keyboardControl: true, 79 paginationClickable: true, 80 autoHeight: true, 81 grabCursor: true, 82 83 autoplay: { 84 enabled: autoplay_enable, 85 delay: $carouselcarouselautoplay, 86 }, 87 88 slidesPerView: $carouselslidesperview, 89 loop:$carouselloopmode, 90 mousewheel: $carouselmousewheelcontrol, 91 92 effect: $carouselcarouseleffect, 93 coverflowEffect: { 94 slideShadows: false, 95 rotate: 0, 96 stretch: 0, 97 depth: 200, 98 modifier: 1, 99 }, 100 cubeEffect: { 101 slideShadows: true, 102 shadow: true, 103 shadowOffset: 20, 104 shadowScale: 0.94 105 }, 106 107 } 108 109 // Update breakpoints 110 const $responsiveSettings = $carouselresponsive['responsive']; 111 const $responsiveData = {}; 112 jQuery.each($responsiveSettings, function (index, value) { 113 $responsiveData[value.breakpoint] = { 114 slidesPerView: value.toshow, 115 }; 116 }); 117 swiperOptions['breakpoints'] = $responsiveData; 118 119 // Arrow pagination 120 if ($carouselarrowpagination == true) { 121 swiperOptions.navigation = { 122 prevEl: '.wdt-swiper-arrow-prev-'+$moduleId, 123 nextEl: '.wdt-swiper-arrow-next-'+$moduleId 124 }; 125 } 126 127 // Bullets pagination 128 if ($carouselbulletpagination == true) { 129 swiperOptions.pagination = { 130 el: ".wdt-swiper-bullet-pagination", 131 type: 'bullets', 132 clickable: true, 133 }; 134 } 135 136 //Autoplay 137 var autoplay_enable = ''; 138 if($carouselcarouselautoplay > 0) { 139 autoplay_enable = true; 140 } else { 141 autoplay_enable = false; 142 } 143 144 const swiperGallery = new Swiper('.wdt-portfolio-module-id-'+$moduleId, swiperOptions); 145 146 147 }, 148 149 wdtPortfolioFilterOptions : function() { 150 151 // Keyword 152 var keyword = jQuery('.wdt-sf-keyword').val(); 153 154 // Location 155 var user_latitude = jQuery('.wdt-sf-location-latitude').val(); 156 var user_longitude = jQuery('.wdt-sf-location-longitude').val(); 157
158 var radius = radius_unit = ''; 159 if(user_latitude != '' && user_latitude != '') { 160 if(jQuery('.wdt-sf-radius').length > 0 && jQuery('.wdt-sf-radius-unit').length > 0) { 161 var radius = jQuery('.wdt-sf-radius').val(); 162 var radius_unit = jQuery('.wdt-sf-radius-unit').val(); 163 } else if(jQuery('.wdt-sf-location-max-radius').length > 0 && jQuery('.wdt-sf-location-radius-unit').length > 0) { 164 var radius = jQuery('.wdt-sf-location-max-radius').val(); 165 var radius_unit = jQuery('.wdt-sf-location-radius-unit').val(); 166 } 167 } 168 169 // Categories 170 var categories = jQuery('.wdt-sf-categories option:selected').map(function(){ 171 if(this.value != '') { 172 return this.value; 173 } 174 }).get(); 175 if(categories.length === 0) { 176 var categories = jQuery('.wdt-sf-categories:checked').map(function(){ 177 if(this.value != '') { 178 return this.value; 179 } 180 }).get(); 181 } 182 183 // Tags 184 var tags = jQuery('.wdt-sf-tags option:selected').map(function(){ 185 if(this.value != '') { 186 return this.value; 187 } 188 }).get(); 189 if(tags.length === 0) { 190 var tags = jQuery('.wdt-sf-tags:checked').map(function(){ 191 if(this.value != '') { 192 return this.value; 193 } 194 }).get(); 195 } 196 197 // Start Date 198 var startdate = jQuery('.wdt-sf-startdate').val(); 199 200 // Price Range 201 var pricerange_start = jQuery('.wdt-sf-pricerange-start').val(); 202 var pricerange_end = jQuery('.wdt-sf-pricerange-end').val(); 203 204 // Features 205 var features_query = {}; 206 var features_total_query = 0; 207 jQuery('.wdt-sf-features-field-holder').each(function () { 208 209 var field_type = jQuery(this).find('.wdt-sf-features-field-type').val(); 210 211 var tab_id = jQuery(this).find('.wdt-sf-features-tab-id').val(); 212 213 var features_item_data = {}; 214 215 features_item_data['field_type'] = field_type; 216 217 if(field_type == 'dropdown' || field_type == 'list') { 218 219 var item_values = jQuery(this).find('.wdt-sf-features option:selected').map(function(){ 220 if(this.value != '') { 221 return this.value; 222 } 223 }).get(); 224 if(item_values.length === 0) { 225 var item_values = jQuery(this).find('.wdt-sf-features:checked').map(function(){ 226 if(this.value != '') { 227 return this.value; 228 } 229 }).get(); 230 } 231 232 features_item_data['item_values'] = item_values; 233 234 if(item_values.length != 0) { 235 features_total_query = features_total_query + 1; 236 } 237 238 } else if(field_type == 'range') { 239 240 var start = jQuery(this).find('.wdt-sf-features-start').val(); 241 var end = jQuery(this).find('.wdt-sf-features-end').val(); 242 243 features_item_data['start'] = start; 244 features_item_data['end'] = end; 245 246 features_total_query = features_total_query + 1; 247 248 } 249 250 features_query[tab_id] = features_item_data; 251 252 }); 253 254 255 // Order By 256 var orderby = jQuery('.wdt-sf-orderby option:selected').val(); 257 if(orderby === undefined) { 258 var orderby = jQuery('.wdt-sf-orderby-list a.active').attr('data-itemvalue'); 259 } 260 261 // MLS Number 262 var mls_number = jQuery('.wdt-sf-mls-number').val(); 263 264 // Others 265 var others = jQuery('.wdt-sf-others-list-item.active').map(function(){ 266 if(jQuery(this).attr('data-itemvalue') != '') { 267 return jQuery(this).attr('data-itemvalue'); 268 } 269 }).get(); 270 271 272 // Radius 273 274 if(jQuery.inArray( 'nearby', others ) > -1) { 275 276 if((radius == '' && radius_unit == '') || (radius == undefined && radius_unit == undefined)) { 277 var radius = jQuery('.wdt-sf-location-max-radius').val(); 278 var radius_unit = jQuery('.wdt-sf-location-radius-unit').val(); 279 } 280 281 if(radius == undefined && radius_unit == undefined) { 282 var radius = 100; 283 var radius_unit = 'km'; 284 } 285 286 } 287 288 var use_radius = ''; 289 if((radius != '' && radius_unit != '') && (radius != undefined && radius_unit != undefined)) { 290 var use_radius = 'true'; 291 } 292 293 294 // Create array 295 var filter_data = {}; 296 filter_data['keyword'] = keyword; 297 filter_data['user_latitude'] = user_latitude; 298 filter_data['user_longitude'] = user_longitude; 299 filter_data['use_radius'] = use_radius;
300 filter_data['radius'] = radius; 301 filter_data['radius_unit'] = radius_unit; 302 filter_data['categories'] = categories; 303 filter_data['tags'] = tags; 304 filter_data['startdate'] = startdate; 305 filter_data['pricerange_start'] = pricerange_start; 306 filter_data['pricerange_end'] = pricerange_end; 307 filter_data['features_query'] = features_query; 308 filter_data['features_total_query'] = features_total_query; 309 filter_data['orderby'] = orderby; 310 filter_data['mls_number'] = mls_number; 311 filter_data['others'] = others; 312 313 return filter_data; 314 315 }, 316 317 wdtPortfolioImagePopup : function() { 318 319 var enable_gallery_popup = jQuery('.wdt-listings-item-image-gallery-popup-enable'); 320 var repeater_items = enable_gallery_popup.find('.wdt-listings-item-container .wdt-listings-item-wrapper'); 321 322 jQuery(repeater_items).each(function() { 323 var $this_item = jQuery(this); 324 var $image_gallery = $this_item.find('.wdt-listings-item-image-gallery').attr('data-media-gallery'); 325 // var $image_src = $this_item.find('img'); 326 var $image_click = $this_item.find('.wdt-listings-hover-image-icon'); 327 var $image_type = 'image'; 328 329 if( $image_gallery !== undefined ) { 330 $image_gallery = jQuery.parseJSON($image_gallery); 331 332 var $gallery_data = []; 333 jQuery.each( $image_gallery, function( key, value ) { 334 335 var $gallery_fields = {}; 336 $gallery_fields['src'] = value; 337 $gallery_fields['type'] = $image_type; 338 339 $gallery_data.push($gallery_fields); 340 341 } ); 342 } 343 wdtPortfolioFrontendUtils.wdtPortfolioLoadPopup($gallery_data, $image_type, $image_click); 344 }); 345 346 }, 347 348 wdtPortfolioLoadPopup : function($gallery_data, $image_type, $image_click) { 349 350 $image_click.magnificPopup({ 351 items: $gallery_data, 352 gallery: { 353 enabled: true 354 }, 355 removalDelay: 500, 356 showCloseBtn: true, 357 enableEscapeKey: true, 358 closeOnBgClick: true, 359 mainClass: 'wdt-portfolio-listing-image-box-popup wdt-portfolio-image-popup-window', 360 type: $image_type // this is default type 361 }); 362 }, 363 364 wdtPortfolioLoadDataOutput : function(output_container) { 365 366 var load_data = load_map = 'false'; 367 368 if(output_container == undefined) { 369 370 var output_container = map_output_container = ''; 371 if(jQuery('.wdt-listing-output-data-container.wdt-search-list-items').length) { 372 var output_container = jQuery('.wdt-listing-output-data-container.wdt-search-list-items'); 373 load_data = 'true'; 374 } 375 376 if(jQuery('.wdt-listing-output-map-container.wdt-search-list-items').length) { 377 var map_output_container = jQuery('.wdt-listing-output-map-container.wdt-search-list-items'); 378 load_map = 'true'; 379 } 380 381 if(load_data == 'false' && load_map == 'false') { 382 alert(wdtfrontendobject.outputDivAlert); 383 return; 384 } 385 386 } else { 387 388 if(output_container.hasClass('wdt-listing-output-data-container')) { 389 load_data = 'true'; 390 } else if(output_container.hasClass('wdt-listing-output-map-container')) { 391 var map_output_container = output_container; 392 output_container = ''; 393 load_map = 'true'; 394 } 395 396 } 397 398 if(load_data == 'true') { 399 var parent_item = output_container; 400 } else if(load_map == 'true') { 401 var parent_item = map_output_container; 402 } 403 404 // Default options 405 406 var enable_carousel = keyword = user_latitude = user_longitude = use_radius = radius = radius_unit = list_items = categories = tags = startdate = pricerange_start = pricerange_end = features_query = features_total_query = orderby = mls_number = others = module_id = ''; 407 408 var type = gallery = post_per_page = columns = apply_isotope = excerpt_length = features_image_or_icon = features_include = no_of_cat_to_display = apply_equal_height = ''; 409 410 var isotope_filter = apply_child_of = show_isotope_filter_count = featured_items = custom_options = show_image_popup = ''; 411 412 var masonary_one_items = masonary_one_half_items = masonary_one_third_items = masonary_two_third_items = masonary_one_fourth_items = masonary_three_fourth_items = ''; 413 414 if(load_data == 'true') { 415 416 type = output_container.find('.wdt-listing-output-data-
416holder').attr('data-type'); 417 gallery = output_container.find('.wdt-listing-output-data-holder').attr('data-gallery'); 418 post_per_page = output_container.find('.wdt-listing-output-data-holder').attr('data-postperpage'); 419 columns = output_container.find('.wdt-listing-output-data-holder').attr('data-columns'); 420 apply_isotope = output_container.find('.wdt-listing-output-data-holder').attr('data-applyisotope'); 421 excerpt_length = output_container.find('.wdt-listing-output-data-holder').attr('data-excerptlength'); 422 features_image_or_icon = output_container.find('.wdt-listing-output-data-holder').attr('data-featuresimageoricon'); 423 features_include = output_container.find('.wdt-listing-output-data-holder').attr('data-featuresinclude'); 424 no_of_cat_to_display = output_container.find('.wdt-listing-output-data-holder').attr('data-noofcattodisplay'); 425 apply_equal_height = output_container.find('.wdt-listing-output-data-holder').attr('data-applyequalheight'); 426 pagination_type = output_container.find('.wdt-listing-output-data-holder').attr('data-paginationtype'); 427 428 isotope_filter = output_container.find('.wdt-listing-output-data-holder').attr('data-isotopefilter'); 429 show_isotope_filter_count = output_container.find('.wdt-listing-output-data-holder').attr('data-showisotopefiltercount'); 430 apply_child_of = output_container.find('.wdt-listing-output-data-holder').attr('data-applychildof'); 431 featured_items = output_container.find('.wdt-listing-output-data-holder').attr('data-featureditems'); 432 custom_options = output_container.find('.wdt-listing-output-data-holder').attr('data-customoptions'); 433 434 show_image_popup = output_container.find('.wdt-listing-output-data-holder').attr('data-showimagepopup'); 435 436 } 437 438 // Direct item listings 439 440 if((load_data == 'true' && output_container.hasClass('wdt-direct-list-items')) || (load_map == 'true' && map_output_container.hasClass('wdt-direct-list-items'))) { 441 442 var item_type = output_holder_type = ''; 443 if(load_data == 'true') { 444 item_type = 'data'; 445 output_holder_type = output_container; 446 } else if(load_map == 'true') { 447 item_type = 'map'; 448 output_holder_type = map_output_container; 449 } 450 451 // Filters 452 453 var list_item_ids = output_holder_type.find('.wdt-listing-output-'+item_type+'-holder').attr('data-listitemids'); 454 if(list_item_ids != undefined && list_item_ids != '') { 455 list_items = list_item_ids.split(','); 456 } 457 458 var category_ids = output_holder_type.find('.wdt-listing-output-'+item_type+'-holder').attr('data-categoryids'); 459 if(category_ids != undefined && category_ids != '') { 460 categories = category_ids.split(','); 461 } 462 463 var tag_ids = output_holder_type.find('.wdt-listing-output-'+item_type+'-holder').attr('data-tagids'); 464 if(tag_ids != undefined && tag_ids != '') { 465 tags = tag_ids.split(','); 466 } 467 468 // Masonary 469 470 var masonary_one_item_ids = output_holder_type.find('.wdt-listing-output-'+item_type+'-holder').attr('data-masonaryoneitems'); 471 if(masonary_one_item_ids != undefined && masonary_one_item_ids != '') { 472 masonary_one_items = masonary_one_item_ids.split(','); 473 } 474 475 var masonary_one_half_item_ids = output_holder_type.find('.wdt-listing-output-'+item_type+'-holder').attr('data-masonaryonehalfitems'); 476 if(masonary_one_half_item_ids != undefined && masonary_one_half_item_ids != '') { 477 masonary_one_half_items = masonary_one_half_item_ids.split(','); 478 } 479 480 var masonary_one_third_item_ids = output_holder_type.find('.wdt-listing-output-'+item_type+'-holder').attr('data-masonaryonethirditems'); 481 if(masonary_one_third_item_ids != undefined && masonary_one_third_item_ids != '') { 482 masonary_one_third_items = masonary_one_third_item_ids.split(','); 483 } 484 485 var masonary_two_third_item_ids = output_holder_type.find('.wdt-listing-output-'+item_type+'-holder').attr('data-masonarytwothirditems'); 486 if(masonary_two_third_item_ids != undefined && masonary_two_third_item_ids != '') { 487 masonary_two_third_items = masonary_two_third_item_ids.split(','); 488 } 489 490 var masonary_one_fourth_item_ids = output_holder_type.find('.wdt-listing-output-'+item_type+'-holder').attr('data-masonaryonefourthitems'); 491 if(masonary_one_fourth_item_ids != undefined && masonary_one_fourth_item_ids != '') { 492 masonary_one_fourth_items = masonary_one_fourth_item_ids.split(','); 493 } 494 495 var masonary_three_fourth_item_ids = output_holder_type.find('.wdt-listing-output-'+item_type+'-holder').attr('data-masonarythreefourthitems'); 496 if(masonary_three_fourth_item_ids != undefined && masonary_three_fourth_item_ids != '') { 497 masonary_three_fourth_items = masonary_three_fourth_item_ids.split(','); 498 } 499 500 // Carousel 501 502 var enable_carousel = output_holder_type.attr('data-enablecarousel'); 503 var module_id = output_holder_type.attr('data-moduleid'); 504 505 506 } else { 507 508 // Filter options 509 510 var filter_data = wdtPortfolioFrontendUtils.wdtPortfolioFilterOptions(); 511 keyword = filter_data.keyword; 512 user_latitude = filter_data.user_latitude; 513 user_longitude = filter_data.user_longitude; 514 use_radius = filter_data.use_radius; 515 radius = filter_data.radius; 516 radius_unit = filter_data.radius_unit; 517 categories = filter_data.categories; 518 tags = filter_data.tags; 519 startdate = filter_data.startdate; 520 pricerange_start = filter_data.pricerange_start; 521 pricerange_end = filter_data.pricerange_end; 522 features_query = filter_data.features_query; 523 features_total_query = filter_data.features_total_query; 524 orderby = filter_data.orderby; 525 mls_number = filter_data.mls_number; 526 others = filter_data.others; 527 528 // Filter Option in Output Data Container 529 if(categories == '') { 530 if(load_data == 'true') { 531 var category_ids = output_container.find('.wdt-listing-output-data-
531holder').attr('data-categoryids'); 532 } else if(load_map == 'true') { 533 var category_ids = map_output_container.find('.wdt-listing-output-map-holder').attr('data-categoryids'); 534 } 535 if(category_ids != undefined && category_ids != '') { 536 categories = category_ids.split(','); 537 } 538 } 539 540 } 541 542 var data_apply_isotope = apply_isotope; 543 var data_load_map = load_map; 544 545 jQuery.ajax({ 546 type: "POST", 547 url: wdtfrontendobject.ajaxurl, 548 dataType: "JSON", 549 data: 550 { 551 action : 'wdt_generate_load_search_data_ouput', 552 current_page : 1, 553 offset : 0, 554 type : type, 555 gallery : gallery, 556 post_per_page : post_per_page, 557 columns : columns, 558 apply_isotope : apply_isotope, 559 isotope_filter : isotope_filter, 560 show_isotope_filter_count : show_isotope_filter_count, 561 apply_child_of : apply_child_of, 562 featured_items : featured_items, 563 excerpt_length : excerpt_length, 564 features_image_or_icon : features_image_or_icon, 565 features_include : features_include, 566 no_of_cat_to_display : no_of_cat_to_display, 567 apply_equal_height : apply_equal_height, 568 pagination_type : pagination_type, 569 570 custom_options : custom_options, 571 572 keyword : keyword, 573 user_latitude : user_latitude, 574 user_longitude : user_longitude, 575 use_radius : use_radius, 576 radius : radius, 577 radius_unit : radius_unit, 578 list_items : list_items, 579 categories : categories, 580 tags : tags, 581 582 show_image_popup : show_image_popup, 583 584 masonary_one_items : masonary_one_items, 585 masonary_one_half_items : masonary_one_half_items, 586 masonary_one_third_items : masonary_one_third_items, 587 masonary_two_third_items : masonary_two_third_items, 588 masonary_one_fourth_items : masonary_one_fourth_items, 589 masonary_three_fourth_items: masonary_three_fourth_items, 590 591 startdate : startdate, 592 pricerange_start : pricerange_start, 593 pricerange_end : pricerange_end, 594 features_query : features_query, 595 features_total_query : features_total_query, 596 orderby : orderby, 597 mls_number : mls_number, 598 others : others, 599 module_id : module_id, 600 601 enable_carousel : enable_carousel, 602 load_data : load_data, 603 load_map : load_map 604 }, 605 beforeSend: function(){ 606 wdtPortfolioCommonUtils.wdtPortfolioAjaxBeforeSend(parent_item); 607 }, 608 success: function (response) { 609 610 // Load data 611 if(load_data == 'true') { 612 613 output_container.find('.wdt-listing-output-data-holder').html(response.data); 614 615 if(data_apply_isotope == 'true') { 616 // Isotope 617 wdtPortfolioFrontendUtils.wdtPortfolioListingsListingIsotope(false); 618 } else if(enable_carousel == 'true') { 619 // Carousel 620 wdtPortfolioFrontendUtils.wdtPortfolioListingCarousel(output_container); 621 } else if(apply_equal_height == 'true') { 622 //Equal Height 623 output_container.find('.wdt-listings-item-wrapper').matchHeight({ property:"min-height" }); 624 } 625 626 setTimeout(function(){ 627 wdtPortfolioFrontendUtils.wdtPortfolioListingImageSwiperGallery(); 628 if(jQuery.fn.niceScroll !== undefined) { 629 jQuery('html').getNiceScroll().resize(); 630 } 631 632 wdtPortfolioFrontendUtils.wdtPortfolioImagePopup(); 633 wdtPortfolioFrontendUtils.wdtPortfolioImageHoverContent(); 634 },1000); 635 636 } 637 638 // Load map 639 if(data_load_map == 'true' && map_output_container != undefined) { 640 wdtPortfolioFrontendLocationUtils.wdtPortfolioLoadMapOutput(response.dataids, map_output_container); 641 } 642 643 }, 644 complete: function(){ 645 wdtPortfolioCommonUtils.wdtPortfolioAjaxAfterSend(parent_item); 646 } 647 }); 648 649 650 }, 651 652 wdtPortfolioImageHoverContent : function() { 653 jQuery('.wdt-listings-item-wrapper').mousemove(function(event) { 654 x = event.offsetX; 655 y = event.offsetY; 656 jQuery(this).find('.wdt-listings-item-hover-section').css('transform', 'translate3d(' + x + 'px, '+ y +'px, 0)'); 657 }); 658 }, 659 660 wdtPortfolioAjaxPagination : function() { 661 662 jQuery( 'body' ).delegate( '.wdt-listing-pagination a:not(.disabled)', 'click', function(e) { 663 664 e.preventDefault(); 665 666 var this_item = jQuery(this); 667 668 if(this_item.parents('.wdt-listing-pagination').hasClass('wdt-loadmore-pagination loaded')){ 669 return false; 670 } 671 672 var listing_options = this_item.parents('.wdt-pagination').attr('data-listing-options'); 673 listing_options = jQuery.parseJSON(listing_options); 674 675 var pagination_type = listing_options['pagination_type']; 676 677 // Pagination Data 678 var current_page; 679 if(pagination_type == 'numbered') { 680 var dynamic_pagination = false; 681 if(this_item.parent().hasClass('prev-post')) { 682 current_page = parseInt(this_item.attr('data-currentpage'), 10)-1; 683 } else if(this_item.parent().hasClass('next-post')) { 684 current_page = parseInt(this_item.attr('data-currentpage'), 10)+1; 685 } else { 686 current_page = this_item.text(); 687 } 688 } else if(pagination_type == 'loadmore' || pagination_type == 'infinity') { 689 var dynamic_pagination = true; 690 current_page = parseInt(this_item.attr('data-currentpage'), 10) + 1; 691 } 692 693 var post_per_page = listing_options['post_per_page']; 694 695 if(current_page == 1) { 696 var offset = 0; 697 } else if(current_page > 1) { 698 var offset = ((current_page-1)*post_per_page); 699 } 700 701 var function_call = this_item.parents('.wdt-pagination').attr('data-functioncall'); 702 var output_div = this_item.parents('.wdt-pagination').attr('data-outputdiv'); 703 704 var apply_isotope = listing_options['apply_isotope']; 705 var show_isotope_filter_count = listing_options['show_isotope_filter_count']; 706 var enable_carousel = listing_options['enable_carousel']; 707 var loader = listing_options['loader']; 708 var loader_parent = listing_options['loader_parent']; 709 var apply_equal_height = listing_options['apply_equal_height']; 710 var parent_item = this_item.parents(loader_parent); 711 712 var default_options = 713 { 714 dynamic_pagination: dynamic_pagination, 715 action : function_call, 716 current_page : current_page, 717 offset : offset 718 }; 719 720 var list_items = categories = tags = keyword = user_latitude = user_longitude = use_radius = radiu
720s = radius_unit = startdate = pricerange_start = pricerange_end = features_query = features_total_query = orderby = mls_number = others = ''; 721 722 723 if(this_item.parents().hasClass('wdt-direct-list-items')) { 724 725 var item_type = ''; 726 var map_output_container = ''; 727 if(this_item.parents('.wdt-direct-list-items').hasClass('wdt-listing-output-data-container')) { 728 var output_container = this_item.parents('.wdt-direct-list-items'); 729 item_type = 'data'; 730 } else if(this_item.parents('.wdt-direct-list-items').hasClass('wdt-listing-output-map-container')) { 731 var map_output_container = this_item.parents('.wdt-direct-list-items'); 732 item_type = 'map'; 733 } 734 735 // Filters 736 737 var list_item_ids = output_container.find('.wdt-listing-output-'+item_type+'-holder').attr('data-listitemids'); 738 if(list_item_ids != undefined && list_item_ids != '') { 739 list_items = list_item_ids.split(','); 740 } 741 742 var category_ids = output_container.find('.wdt-listing-output-'+item_type+'-holder').attr('data-categoryids'); 743 if(category_ids != undefined && category_ids != '') { 744 categories = category_ids.split(','); 745 } 746 747 var tag_ids = output_container.find('.wdt-listing-output-'+item_type+'-holder').attr('data-tagids'); 748 if(tag_ids != undefined && tag_ids != '') { 749 tags = tag_ids.split(','); 750 } 751 752 var unique_options = 753 { 754 list_items : list_items, 755 categories : categories, 756 tags : tags 757 }; 758 759 } else { 760 761 var output_container = jQuery('.wdt-listing-output-data-container'); 762 var map_output_container = jQuery('.wdt-listing-output-map-container'); 763 764 765 // Filter options 766 767 var filter_data = wdtPortfolioFrontendUtils.wdtPortfolioFilterOptions(); 768 keyword = filter_data.keyword; 769 user_latitude = filter_data.user_latitude; 770 user_longitude = filter_data.user_longitude; 771 use_radius = filter_data.use_radius; 772 radius = filter_data.radius; 773 radius_unit = filter_data.radius_unit; 774 categories = filter_data.categories; 775 tags = filter_data.tags; 776 startdate = filter_data.startdate; 777 pricerange_start = filter_data.pricerange_start; 778 pricerange_end = filter_data.pricerange_end; 779 features_query = filter_data.features_query; 780 features_total_query = filter_data.features_total_query; 781 orderby = filter_data.orderby; 782 mls_number = filter_data.mls_number; 783 others = filter_data.others; 784 785 // Filter Option in Output Data Container 786 if(categories == '') { 787 var category_ids = output_container.find('.wdt-listing-output-data-holder').attr('data-categoryids'); 788 if(category_ids != undefined && category_ids != '') { 789 categories = category_ids.split(','); 790 } 791 } 792 793 var unique_options = 794 { 795 keyword : keyword, 796 user_latitude : user_latitude, 797 user_longitude : user_longitude, 798 use_radius : use_radius, 799 radius : radius, 800 radius_unit : radius_unit, 801 categories : categories, 802 tags : tags, 803 startdate : startdate, 804 pricerange_start : pricerange_start, 805 pricerange_end : pricerange_end, 806 features_query : features_query, 807 features_total_query: features_total_query, 808 orderby : orderby, 809 mls_number : mls_number, 810 others : others, 811 }; 812 813 } 814 815 var consolidated_options = Object.assign(default_options, listing_options, unique_options); 816 consolidated_options['custom_options'] = consolidated_options['custom_options'] ? JSON.stringify(consolidated_options['custom_options']) : ''; 817 818 // ajax call 819 jQuery.ajax({ 820 type: "POST", 821 url: wdtcommonobject.ajaxurl, 822 dataType: "JSON", 823 data: consolidated_options, 824 beforeSend: function() { 825 if(loader == 'true') { 826 wdtPortfolioCommonUtils.wdtPortfolioAjaxBeforeSend(parent_item); 827 } 828 if(pagination_type == 'loadmore') { 829 this_item.prepend( '<span><i class="fa fa-spinner fa-spin"></i></span>' ); 830 } 831 }, 832 success: function (response) { 833 834 if(pagination_type == 'numbered') { 835 836 var offset_top = this_item.parents('.'+output_div).offset().top; 837 838 this_item.parents('.'+output_div).html(response.data); 839 840 if(apply_isotope == 'true') { 841 // Isotope 842 wdtPortfolioFrontendUtils.wdtPortfolioListingsListingIsotope(false); 843 } else if(enable_carousel == 'true') { 844 // Carousel 845 wdtPortfolioFrontendUtils.wdtPortfolioListingCarousel(output_container); 846 } else if(apply_equal_height == 'true') { 847 //Equal Height 848 output_container.find('.wdt-listings-item-wrapper').matchHeight({ property:"min-height" }); 849 } 850 851 setTimeout(function(){ 852 wdtPortfolioFrontendUtils.wdtPortfolioListingImageSwiperGallery(); 853 if(jQuery.fn.niceScroll !== undefined) { 854 jQuery('html').getNiceScroll().resize(); 855 } 856 },1000); 857 858 // Load map 859 if(map_output_container.length) { 860 wdtPortfolioFrontendLocationUtils.wdtPortfolioLoadMapOutput(response.dataids, map_output_container); 861 } 862 863 // Scroll to top 864 jQuery('html, body').animate({ 865 scrollTop: parseInt(offset_top, 10)-60 866 }, 600); 867 868 wdtPortfolioFrontendUtils.wdtPortfolioImagePopup(); 869 870 } else if(pagination_type == 'loadmore' || pagination_type == 'infinity') { 871 872 if(response.dataids.length) { 873 874 this_item.parents('.'+output_div).find('.wdt-listings-item-container').append(response.data); 875 this_item.attr('data-currentpage', current_page); 876 877 if(apply_isotope == 'true') { 878 // Isotope 879 wdtPortfolioFrontendUtils.wdtPortfolioListingsListingIsotope(true); 880 881 if(show_isotope_filter_count) { 882 var taxcounts = response.taxcounts; 883 jQuery('.wdt-listings-item-isotope-filter a').each(function () {
884 var cat_id = parseInt(jQuery(this).data('catid'), 10); 885 var existing_count = parseInt(jQuery(this).find('span').html(), 10); 886 var current_page_count = 0; 887 var total_count = 0; 888 if(cat_id == -1) { 889 total_count = jQuery('.wdt-listings-item-container .wdt-column:not(.grid-sizer)').length; 890 } else { 891 if(typeof(taxcounts[cat_id]) != "undefined" && taxcounts[cat_id] !== null) { 892 current_page_count = taxcounts[cat_id]; 893 } 894 total_count = current_page_count + existing_count; 895 } 896 jQuery(this).find('span').html(total_count); 897 }); 898 } 899 900 } else if(enable_carousel == 'true') { 901 // Carousel 902 wdtPortfolioFrontendUtils.wdtPortfolioListingCarousel(output_container); 903 } else if(apply_equal_height == 'true') { 904 //Equal Height 905 output_container.find('.wdt-listings-item-wrapper').matchHeight({ property:"min-height" }); 906 } 907 908 setTimeout(function(){ 909 wdtPortfolioFrontendUtils.wdtPortfolioListingImageSwiperGallery(); 910 if(jQuery.fn.niceScroll !== undefined) { 911 jQuery('html').getNiceScroll().resize(); 912 } 913 },1000); 914 915 // Load map 916 if(map_output_container.length) { 917 wdtPortfolioFrontendLocationUtils.wdtPortfolioLoadMapOutput(response.dataids, map_output_container); 918 } 919 920 wdtPortfolioFrontendUtils.wdtPortfolioImagePopup(); 921 922 } else { 923 this_item.html(wdtfrontendobject.noMorePosts); 924 this_item.parents('.wdt-loadmore-pagination').addClass('loaded'); 925 } 926 927 } 928 929 }, 930 complete: function() { 931 if(loader == 'true') { 932 wdtPortfolioCommonUtils.wdtPortfolioAjaxAfterSend(parent_item); 933 } 934 if(pagination_type == 'loadmore') { 935 this_item.find('span').remove(); 936 } 937 } 938 }); 939 940 }); 941 942 window.addEventListener('scroll', () => { 943 944 let infinityItem = jQuery('.wdt-infinity-pagination'); 945 946 if(infinityItem.length) { 947 948 const scrollTop = document.documentElement.scrollTop; 949 950 let infinityItemOffset = infinityItem.offset(); 951 let infinityItemOffsetTop = Math.floor(infinityItemOffset.top - 400); 952 953 if(scrollTop >= infinityItemOffsetTop) { 954 jQuery('.wdt-listing-pagination a').trigger('click'); 955 jQuery('.wdt-listing-pagination a').addClass('disabled'); 956 } else { 957 jQuery('.wdt-listing-pagination a').removeClass('disabled'); 958 } 959 960 } 961 962 }); 963 964 }, 965 966 wdtPortfolioListingImageSwiperGallery : function() { 967 968 jQuery('.wdt-listings-image-gallery-container').each(function() { 969 970 var $swiperItem = jQuery(this); 971 972 const $mediamoduleId = $swiperItem.data('moduleid'); 973 const $mediaenablecarousel = $swiperItem.data('enablecarousel'); 974 const $mediacarouseleffect = $swiperItem.data('carouseleffect'); 975 const $mediacarouselautoplay = $swiperItem.data('carouselautoplay');
976 const $mediacarouselslidesperview = $swiperItem.data('carouselslidesperview'); 977 const $mediacarouselloopmode = $swiperItem.data('carouselloopmode'); 978 const $mediacarouselmousewheelcontrol = $swiperItem.data('carouselmousewheelcontrol'); 979 const $mediacarouselverticaldirection = $swiperItem.data('carouselverticaldirection'); 980 const $mediacarouselpaginationtype = $swiperItem.data('carouselpaginationtype'); 981 const $mediacarouselnumberofthumbnails = $swiperItem.data('carouselnumberofthumbnails'); 982 const $mediacarouselarrowpagination = $swiperItem.data('carouselarrowpagination'); 983 const $mediacarouselspacebetween = $swiperItem.data('carouselspacebetween'); 984 const $mediacarouselnoofimages = $swiperItem.data('carouselnoofimages'); 985 const $carouselresponsive = $swiperItem.data('carouselresponsive'); 986 987 988 const mediathumbswiperOptions = { 989 initialSlide: initialSlide, 990 simulateTouch: true, 991 // roundLengths: true, 992 spaceBetween: 10, 993 keyboardControl: true, 994 paginationClickable: true, 995 996 grabCursor: true, 997 998 slidesPerView: $mediacarouselnumberofthumbnails, 999 loop: true, 1000 mousewheel: true, 1001 1002 } 1003 1004 const swiperThumbGallery = new Swiper('.wdt-media-thumb-carousel-module-id', mediathumbswiperOptions); 1005 1006 1007 // Get swiper options 1008 var autoheight = false; 1009 1010 //Autoplay 1011 if($mediacarouselautoplay > 0) { 1012 autoplay_enable = true; 1013 } else { 1014 autoplay_enable = false; 1015 } 1016 1017 var initialSlide = 1; 1018 1019 var direction = 'horizontal'; 1020 if($mediacarouselverticaldirection == true) { 1021 direction = 'vertical'; 1022 } 1023 1024 var pagination_class = ''; 1025 var pagination_type = ''; 1026 var watch_state = false; 1027 1028 // Bullets pagination 1029 if($mediacarouselpaginationtype == 'bullets') { 1030 var pagination_class = '.wdt-swiper-bullet-pagination'; 1031 var pagination_type = 'bullets'; 1032 var watch_state = true; 1033 } 1034 1035 // fraction pagination 1036 if($mediacarouselpaginationtype == 'fraction') { 1037 var pagination_class = '.wdt-swiper-fraction-pagination'; 1038 var pagination_type = 'fraction'; 1039 } 1040 1041 // Progressbar pagination 1042 if($mediacarouselpaginationtype == 'progressbar') { 1043 var pagination_class = '.wdt-swiper-progress-pagination'; 1044 var pagination_type = 'progressbar'; 1045 } 1046 1047 // scrollbar pagination 1048 var scrollbar_class = ''; 1049 1050 var scrollbar_hide = true; 1051 if($mediacarouselpaginationtype == 'scrollbar') { 1052 scrollbar_class = ".wdt-swiper-scrollbar"; 1053 scrollbar_hide = false; 1054 1055 } 1056 1057 const mediaswiperOptions = { 1058 initialSlide: initialSlide, 1059 simulateTouch: true, 1060 // roundLengths: true, 1061 spaceBetween: $mediacarouselspacebetween, 1062 keyboardControl: true, 1063 paginationClickable: true, 1064 autoHeight: autoheight, 1065 1066 grabCursor: false, 1067 autoplay: { 1068 enabled: autoplay_enable, 1069 delay: $mediacarouselautoplay, 1070 }, 1071 slidesPerView: $mediacarouselslidesperview, 1072 loop:$mediacarouselloopmode, 1073 mousewheel: $mediacarouselmousewheelcontrol, 1074 direction: direction, 1075 1076 pagination: { 1077 el: pagination_class, 1078 type: pagination_type, 1079 clickable: true, 1080 }, 1081 1082 scrollbar: { 1083 el: scrollbar_class, 1084 hide: scrollbar_hide, 1085 draggable: true, 1086 dragSize: 30, 1087 }, 1088 1089 effect: $mediacarouseleffect, 1090 coverflowEffect: { 1091 slideShadows: false, 1092 rotate: 0, 1093 stretch: 0, 1094 depth: 200, 1095 modifier: 1, 1096 }, 1097 cubeEffect: { 1098 slideShadows: true, 1099 shadow: true, 1100 shadowOffset: 20, 1101 shadowScale: 0.94 1102 }, 1103 1104 } 1105 1106 // Update breakpoints 1107 const $responsiveSettings = $carouselresponsive['responsive']; 1108 const $responsiveData = {}; 1109 jQuery.each($responsiveSettings, function (index, value) { 1110 $responsiveData[value.breakpoint] = { 1111 slidesPerView: value.toshow, 1112 }; 1113 }); 1114 mediaswiperOptions['breakpoints'] = $responsiveData; 1115 1116 // Arrow pagination
1117 if ($mediacarouselarrowpagination == true) { 1118 mediaswiperOptions.navigation = { 1119 prevEl: '.wdt-swiper-arrow-prev-'+$mediamoduleId, 1120 nextEl: '.wdt-swiper-arrow-next-'+$mediamoduleId 1121 }; 1122 } 1123 1124 // thumbnail pagination 1125 if ($mediacarouselpaginationtype == 'thumbnail') { 1126 mediaswiperOptions.thumbs = { 1127 swiper: swiperThumbGallery, 1128 }; 1129 } 1130 1131 const mediaswiperGallery = new Swiper('.wdt-media-carousel-module-id-'+$mediamoduleId, mediaswiperOptions); 1132 1133 }); 1134 }, 1135 1136 wdtPortfolioContentScroll : function() { 1137 1138 if(jQuery('.wdt-content-scroll').length) { 1139 1140 var head = document.getElementsByTagName('head')[0]; 1141 var script = document.createElement('script'); 1142 script.src = wdtfrontendobject.pluginPath+'assets/js/jquery.nicescroll.js'; 1143 script.type = 'text/javascript'; 1144 head.appendChild(script); 1145 1146 jQuery('.wdt-content-scroll').niceScroll({ cursorcolor:wdtfrontendobject.primaryColor, cursorwidth: '5px', background:wdtfrontendobject.tertiaryColor, cursorborder:'none' }); 1147 1148 } 1149 1150 }, 1151 1152 wdtPortfolioResponsiveMortageCalculator : function() { 1153 1154 if(jQuery('.lidd_mc_form').length) { 1155 1156 jQuery('.lidd_mc_input input[type="text"]').each(function() { 1157 jQuery( this ).wrap( '<div class="wdt-rmc-field-wrap"></div>' ); 1158 jQuery( '<span></span>' ).insertAfter( jQuery(this) ); 1159 }); 1160 1161 } 1162 1163 } 1164 1165}; 1166 1167var wdtPortfolioFrontend = { 1168 1169 dtInit : function() { 1170 1171 var isMobile = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)) || (navigator.userAgent.match(/Android/i)) || (navigator.userAgent.match(/Blackberry/i)) || (navigator.userAgent.match(/Windows Phone/i)) ? true : false; 1172 var currentWidth = window.innerWidth || document.documentElement.clientWidth; 1173 1174 wdtPortfolioFrontend.wdtPortfolio(isMobile, currentWidth); 1175 wdtPortfolioFrontend.dtLoadData(); 1176 1177 }, 1178 1179 wdtPortfolio : function(isMobile, currentWidth) { 1180 1181 jQuery(window).on('resize', function() { 1182 wdtPortfolioFrontendUtils.wdtPortfolioListingsListingIsotope(false); 1183 wdtPortfolioFrontendUtils.wdtPortfolioContentScroll(); 1184 }); 1185 1186 wdtPortfolioFrontendUtils.wdtPortfolioListingsListingIsotope(false); 1187 1188 wdtPortfolioFrontendUtils.wdtPortfolioAjaxPagination(); 1189 1190 // Image Swiper Gallery for Listings & Single Page 1191 wdtPortfolioFrontendUtils.wdtPortfolioListingImageSwiperGallery(); 1192 1193 wdtPortfolioFrontendUtils.wdtPortfolioContentScroll(); 1194 1195 wdtPortfolioFrontendUtils.wdtPortfolioResponsiveMortageCalculator(); 1196 1197 }, 1198 1199 dtLoadData : function() { 1200 1201 jQuery('.wdt-direct-list-items').each(function() { 1202 wdtPortfolioFrontendUtils.wdtPortfolioLoadDataOutput(jQuery(this)); 1203 }); 1204 1205 }, 1206 1207}; 1208 1209jQuery(document).ready(function() { 1210 1211 if(!wdtfrontendobject.elementorPreviewMode) { 1212 wdtPortfolioFrontend.dtInit(); 1213 } 1214 1215}); 1216 1217( function( $ ) { 1218 1219 var wdtPortfolioFrontendJs = function($scope, $){ 1220 wdtPortfolioFrontend.dtInit(); 1221 }; 1222 1223 $(window).on('elementor/frontend/init', function(){ 1224 if(wdtfrontendobject.elementorPreviewMode) { 1225 elementorFrontend.hooks.addAction('frontend/element_ready/wdt-widget-df-listings-listing.default', wdtPortfolioFrontendJs); 1226 } 1227 }); 1228 1229} )( 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.