1// featuredWidgets Module Start 2var featuredWidgets = (function($) { 3 // Widget intersection observer 4 var featuredObserver = ''; 5 var intersectionAllowed = (function(){ 6 return ('IntersectionObserver' in window); 7 })(); 8 9 // Keep Track of widgets and common feature settings. 10 var featuredWidgets = []; 11 var settings = { 12 windowSize: parseInt($(window).width()), 13 themeName: '', 14 isMobile: false, 15 imageServer: 'https://storage.sub-us.incomrealestate.com', 16 noImage: '/images/noImage.jpg', 17 }; 18 19 // When content loaded set props 20 document.addEventListener('DOMContentLoaded', function(e){ 21 var themes = ['urban','elegant','bannertheme','corporate']; 22 var classes = document.querySelector('body').className.split(' '); 23 settings.isMobile = document.querySelector('body').className.match(/'mobileVersion'/) ? true : false; 24 var themeRes = document.querySelector('body').className.match(/theme[0-9]*/g); 25 settings.themeName = themeRes ? themeRes[0] : null; 26 if(!settings.themeName){ 27 themes.map(function(theme){ 28 classes.includes(theme) && (settings.themeName = theme); 29 }); 30 } 31 }); 32 33 // Intersection observer to manage starting and stopping of autoscroll based on widget being inside viewport 34 var intersectThreshhold = 0.01; 35 if(intersectionAllowed){ 36 featuredObserver = new IntersectionObserver(function(entries, observer){ 37 entries.forEach(function(entry){ 38 // Change status of carousel based on intersection. 39 var widget = entry.target.id.match(/[1-9][0-9]*/g)[0]; 40 if (entry.intersectionRatio > intersectThreshhold) { 41 featuredWidgets['featuredListing-'+widget].carousel.jcarouselAutoscroll('start'); 42 } else { 43 featuredWidgets['featuredListing-'+widget].carousel.jcarouselAutoscroll('stop'); 44 } 45 }); 46 },{rootMargin: '0px',threshold: intersectThreshhold}); 47 }; 48 49 // FeaturedWidgets methods 50 isCarousel = function(properties, total_record){ 51 var minnumber = 3; 52 if ($('body').hasClass('theme9') || $('body').hasClass('theme23')) { minnumber = 0;} 53 if ($('body').hasClass('theme14') || $('body').hasClass('theme10')){ minnumber = 4;} 54 if ($('body').hasClass('theme30') || $('body').hasClass('theme31')){ minnumber = 1;} 55 if ($('body').hasClass('theme12')) { 56 if (properties.length < 1){ 57 minnumber = 4; 58 }else{ minnumber = 8; 59 } 60 } 61 if (($('body').hasClass('inner') || $('body').hasClass('urban')) && $('body').hasClass('office-detail')) { 62 minnumber = 2; 63 } 64 return total_record > minnumber || properties.length > minnumber; 65 }; 66 67 hideWidget = function(widget){ 68 if($(widget.selector).find('.no_widget_result').length>0){ 69 $(widget.selector).hide(); 70 } 71 } 72 // Add featured Widget to Module return reference to this newly added widget. 73 addWidget = function(wid,properties,settings,listingMode,total_record){
74 if(typeof(settings['property_display']) === 'undefined'){ 75 settings['property_display'] = 2; 76 } 77 78 featuredWidgets['featuredListing-'+wid] = { 79 isCarousel : isCarousel(properties,total_record), 80 scrollClass : settings['property_display'] === '1' ? 'vertical_scroll' : 'horizontal_scroll', 81 hasProperties : properties.length, 82 verticalMode : settings['property_display'] != '2', 83 region: settings['region'], 84 officeCarousel : settings.officeCarousel || false, 85 selector: !settings.officeCarousel ? '#featuredListing-0-' + wid : "#office_agent_listings-0-" + wid, 86 imageWidth: null 87 }; 88 if(!featuredWidgets['featuredListing-'+wid].hasProperties && !featuredWidgets['featuredListing-'+wid].officeCarousel){ 89 hideWidget(featuredWidgets['featuredListing-'+wid]); 90 } 91 if(featuredWidgets['featuredListing-'+wid].isCarousel && !(wid == 'broker-agent-listings')){ 92 featuredObserver.observe($(featuredWidgets['featuredListing-'+wid].selector)[0]); 93 }; 94 return featuredWidgets['featuredListing-'+wid]; 95 }; 96 97 // Load Images Seperatly after carousel is initialized. 98 loadImage = function(el,image,_settings){ 99 var imagDownloaded = new Image(); 100 // Onload swap image of element 101 imagDownloaded.onload = function(){ 102 featuredImageUpdate(this.src,el); 103 } 104 // On fail display noImage picture in case we fail to get picture. 105 imagDownloaded.onerror = function(){ 106 107 var pidSelector = el.split(' ').find(function (item) { 108 return item.indexOf('data-pid') !== -1; 109 }); 110 111 var fullSelector = pidSelector + ' .featured_multi_img_wrapper'; 112 var title = $(fullSelector).attr('title'); 113 114 if (title && title.indexOf('commercial') !== -1) { 115 featuredImageUpdate('/images/noImageCommercial.jpg', el); 116 } else { 117 featuredImageUpdate(settings.noImage, el); 118 } 119 } 120 // Set up common width for all properties of the passed widget. 121 if(!featuredWidgets['featuredListing-'+_settings['widget_id']].imageWidth){ 122 const excludedThemes = ['theme9', 'theme23', 'cpcorp', 'theme28', 'theme29', 'theme30', 'theme31', 'theme32', 'theme33']; 123 let isThemeExcluded = true; 124 excludedThemes.forEach(function(theme) { 125 if($('body').hasClass(theme)) { 126 isThemeExcluded = false; 127 } 128 }); 129 if(isThemeExcluded && _settings['widget_id'] !== 'broker-agent-listings'){ 130 featuredWidgets['featuredListing-'+_settings['widget_id']].imageWidth = $(el).parent('a').width(); 131 } 132 } 133 // Make request to download image. 134 imagDownloaded.src = getImageURL(image,featuredWidgets['featuredListing-'+_settings['widget_id']].imageWidth,0); 135 }; 136 137 // Helper Event Dispatcher 138 triggerEvent = function (event,evData){ 139 var event = new CustomEvent(event); 140 event.details = evData; 141 document.dispatchEvent(event); 142 }; 143 144 // Update Image 145 featuredImageUpdate = function (img,selector){ 146 var els = document.querySelectorAll(selector); 147 for(var i=0; i < els.length ; i++){
148 if(els[i].src != img){ 149 els[i].src = img; 150 els[i].classList.remove('loading'); 151 } 152 } 153 return; 154 } 155 // Helper to get correct image url 156 getImageURL = function(url, width, height) { 157 var returnURL = url; 158 if(url.indexOf('googleapis') != -1) { 159 var fileName = url.substring(url.lastIndexOf('/') + 1); 160 var returnURL = settings.imageServer + '/' + fileName; 161 } 162 var params = [] 163 if(width && width > 0){ 164 params.push(['width', width * window.devicePixelRatio]) 165 } 166 if(height && height > 0){ 167 params.push(['height', height * window.devicePixelRatio]) 168 } 169 if(params.length) { 170 returnURL = returnURL + '?' 171 for(var i in params) { 172 returnURL = returnURL + params[i][0] + '=' + params[i][1] + '&' 173 } 174 returnURL = returnURL.substring(0, returnURL.length - 1); 175 } 176 return returnURL; 177 } 178 179 // Public API 180 return { 181 widgets: featuredWidgets, // Pass Widgets Reference 182 addWidget: addWidget, 183 settings: settings, // Pass Settings Reference 184 triggerEvent: triggerEvent, 185 loadImage: loadImage 186 }; 187 188})(jQuery); 189 190function toggleCarouselFunctionality(semiReference_path) { 191 $(semiReference_path+'#scroll_mode').toggleClass('no_carousel');
192 $(semiReference_path).find('a[class*="jcarousel-control-"]').toggle(); 193 const carouselListElement = $(semiReference_path+'#scroll_mode .jcarousel ul') 194 const carouselListPositionValue = carouselListElement.css('position') === 'static'? 'relative':'static'; 195 $(semiReference_path+'#scroll_mode .jcarousel ul').css('position',carouselListPositionValue) 196} 197 198function checkForCarouselToggle(total_record,semiReference_path) { 199 const mobileThemes = ['theme9','theme23']; 200 const SINGLE_RECORD_BREAKPOINT_PX = 600; 201 const DOUBLE_RECORD_BREAKPOINT_PX = 768; 202 const RECORD_LIMIT = 3; 203 const MINIMUM_RECORD_REQUIRED = 1; 204 205 // leaves carousel activated for anything greater than property limit 206 if (total_record < RECORD_LIMIT) { 207 if (mobileThemes.find(theme =>$('body').hasClass(theme))) { 208 // ========================================== 209 // will be enabled for theme, this turns it off for given conditions at page load. 210 // Required or functionality will not be there on resize 211 const isDesktopAtLoad = $(window).width() >= DOUBLE_RECORD_BREAKPOINT_PX; 212 if (total_record <= MINIMUM_RECORD_REQUIRED) { 213 toggleCarouselFunctionality(semiReference_path); 214 // special case where we do not want responsivity 215 return; 216 } else if (isDesktopAtLoad) { 217 toggleCarouselFunctionality(semiReference_path); 218 } 219 220 // ========================================= 221 // responsively toggle carousel 222 $(window).resize(function() { 223 const containsNoCarouselClass = $(semiReference_path+'#scroll_mode').hasClass('no_carousel'); 224 const isMultiPropBreak = $(window).width() >= DOUBLE_RECORD_BREAKPOINT_PX; 225 const isDoublePropBreak = $(window).width() < DOUBLE_RECORD_BREAKPOINT_PX && $(window).width() >= SINGLE_RECORD_BREAKPOINT_PX; 226 if (isMultiPropBreak && !containsNoCarouselClass) { 227 toggleCarouselFunctionality(semiReference_path) 228 } else if (isDoublePropBreak && containsNoCarouselClass) { 229 toggleCarouselFunctionality(semiReference_path) 230 } 231 }); 232 } 233 } 234 235 }; 236 237function initPropertiesList(scrollClass, widget_id, propertiesList, settings) { 238 var fullReference_path = "#featuredListing-0-" 239 + widget_id + " .jcarousel"; 240 if(propertiesList && propertiesList.length) { 241 for(var i in propertiesList) { 242 $(fullReference_path + " ul").append(generatePropertyView(propertiesList[i], settings)); 243 } 244 } 245} 246 247function initialiseCarousel($scrollClass,$widget_id,$total_record,$region,$listing_mode,$custom_active_li_limit, propertiesList, settings){ 248 var widget = featuredWidgets.addWidget($widget_id,propertiesList,settings,$listing_mode,$total_record); // This Widget Reference 249 var widgetSelector = widget.selector; 250 var deviceSize = featuredWidgets.settings.windowSize; 251 var idleFlag = 1; 252 var scrollClass = widget.scrollClass; 253 $region = widget.region; 254 var fullReference_path = widgetSelector + " ." + scrollClass + " .jcarousel"; 255 var semiReference_path = widgetSelector + " ." + scrollClass; 256 var isBrokerDetailPage = (($('body').hasClass('inner') || $('body').hasClass('urban')) && $('body').hasClass('office-detail')); 257 if(!widget.isCarousel){ 258 $(widgetSelector +' #scroll_mode').addClass('no_carousel'); 259 } else {
260 $(widgetSelector).find('a[class*="jcarousel-control-"]').show(); 261 } 262 if($custom_active_li_limit === undefined) { $custom_active_li_limit = false; } 263 if(propertiesList && propertiesList.length) { 264 if($(fullReference_path + " ul").length === 0){ 265 $(fullReference_path).prepend("<ul></ul>"); 266 } 267 settings["index"] = 0; 268 for(var i in propertiesList) { 269 settings["index"] += 1; 270 $(fullReference_path + ">ul").append(generatePropertyView(propertiesList[i], settings)); 271 } 272 // Add custom event so that we can detect when featured listing has its properties appended. 273 featuredWidgets.triggerEvent("featuredReady",{"widgetId":widget.selector}); 274 } 275 // Workaround for condition. To prevent jcarousel from starting for any theme when there are less than x records. 276 if(featuredWidgets.settings.isMobile){ 277 // any theme which should have a restricted number of records on mobile can go here. We can enhance it later. 278 var restrictRecords = { 279 theme12 : 4, 280 }; 281 if(restrictRecords[featuredWidgets.settings.themeName] !== undefined){ 282 if($total_record <= restrictRecords[featuredWidgets.themeName] ){ 283 $(semiReference_path).addClass('no_carousel'); 284 return; 285 } 286 } 287 } 288 289 checkForCarouselToggle($total_record,semiReference_path); 290 291 var carouselMode=false; 292 var response_end=$("#response_end").attr("value"); 293 294 if(scrollClass=="vertical_scroll") 295 carouselMode=true; 296 297 if($listing_mode == 3){ 298 var fullReference_path="#office_agent_listings-0-"+$widget_id+ " ."+scrollClass+ " .jcarousel"; 299 var semiReference_path="#office_agent_listings-0-"+$widget_id+ " ."+scrollClass; 300 } 301 else{ 302 var fullReference_path="#featuredListing-0-"+$widget_id+ " ."+scrollClass+ " .jcarousel"; 303 var semiReference_path="#featuredListing-0-"+$widget_id+ " ."+scrollClass; 304 } 305 306 if($custom_active_li_limit == false && $listing_mode != 3){ 307 var tt_exp = "1"; //set the exp time in min 308 tt_exp = (parseInt(tt_exp) * 60000); //set the time in microsecond 309 $(document).bind("idle.idleTimer", function(){ 310 $(semiReference_path+" .idleState").attr("value",0); 311 }); 312 $(document).bind("active.idleTimer", function(){ 313 $(semiReference_path+" .idleState").attr("value",1); 314 }); 315 $.idleTimer(tt_exp); 316 } 317 318 var wp1='circular'; 319 320 // for theme 10 only 321 if((check_theme_active_li_exist($listing_mode,$custom_active_li_limit)) 322 && (deviceSize <= 1300) 323 && $custom_active_li_limit == 4 324 && widget.verticalMode === true){ 325 wp1='last'; 326 } 327 if(!widget.isCarousel){ 328 if (($('body').hasClass('theme14') || $('body').hasClass('theme10') || $('body').hasClass('theme12')) && 329 ($('body').hasClass('front') || $('body').is('[class*="buy-homes-for-sale"]'))) { 330 $(widgetSelector +' #scroll_mode.horizontal_scroll.no_carousel .jcarousel li').each(function() { 331 $( this ).addClass( "activeLi" ); 332 }); 333 } 334 return; 335 } 336 $(fullReference_path).jcarousel({ 337 vertical: widget.verticalMode, 338 animation: 2000, 339 wrap: wp1 340 }); 341 342 if(check_theme_active_li_exist($listing_mode,$custom_active_li_limit)){ 343 $active_li_func = "theme_process_active_li_"+$custom_active_li_limit; 344 eval($active_li_func+"(semiReference_path,deviceSize)"); 345 } 346 347 /* custom carousel start position */ 348 var numitems=$(fullReference_path+" ul li").length; 349 var customNum_items = parseInt(numitems-1); 350 var jumpIndex=parseInt(customNum_items)-11; 351 if($custom_active_li_limit == false){ 352 if(numitems>=6 && jumpIndex>=3 ) 353 $(fullReference_path).jcarousel("scroll",jumpIndex,false); 354 } 355 356 if(check_theme_active_li_exist($listing_mode,$custom_active_li_limit)){ 357 $page_load_last_limit = $custom_active_li_limit * 2; 358 if(numitems > $custom_active_li_limit && numitems < $page_load_last_limit){ 359 check_carousel_last_slide(fullReference_path,deviceSize,$custom_active_li_limit); 360 } 361 } 362 363 $(semiReference_path+" .limit_count").attr("value",numitems); 364 /* custom carousel start position end */ 365 366 $(semiReference_path+" .jcarousel-control-prev").click(function(event){ 367 event.preventDefault(); 368 if(widget.scrollClass=="horizontal_scroll"){ 369 if (($('body').hasClass('theme30')||$('body').hasClass('theme31')) && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 370 $(semiReference_path + " .jcarousel").jcarousel("scroll", "-=1"); 371 } 372 if ($('body').hasClass('theme4') && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 373 if(deviceSize <= 885 && deviceSize > 568){ 374 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=2"); 375 } 376 } 377 378 if ($('body').hasClass('theme5') && $('body').hasClass('front')){ 379 if (deviceSize <= 1300 && deviceSize>925) { 380 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=2"); 381 } 382 if (deviceSize <= 925){ 383 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=1"); 384 } 385 } 386 387 if ($('body').hasClass('theme6') && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 388 if (deviceSize <= 1300 && deviceSize>925) { 389 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=2"); 390 } 391 if (deviceSize <= 925){ 392 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=1"); 393 } 394 } 395 396 397 if ($('body').hasClass('theme24') 398 && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 399 if (deviceSize <= 980 && deviceSize>710) { 400 $(semiReference_path + " .jcarousel").jcarousel("scroll", "-=2"); 401 } 402 if (deviceSize <= 710){ 403 $(semiReference_path + " .jcarousel").jcarousel("scroll", "-=1"); 404 } 405 } 406 407 if ($('body').hasClass('theme25') || $('body').hasClass('theme27') 408 && $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings")){ 409 if (deviceSize <= 1095 && deviceSize>680) { 410 $(semiReference_path + " .jcarousel").jcarousel("scroll", "-=2"); 411 } 412 if (deviceSize <= 680){ 413 $(semiReference_path + " .jcarousel").jcarousel("scroll", "-=1"); 414 } 415 } 416 417 if ($('body').hasClass('theme12') && $('[id*="office_agent_listings"]').length === 1 && semiReference_path.indexOf('office_agent_listings') != -1){ 418 if (deviceSize <= 900 && deviceSize>744) { 419 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=2"); 420 } 421 if (deviceSize <= 744){ 422 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=1"); 423 } 424 } 425 426 if (($('body').hasClass('theme7') || $('body').hasClass('theme8')) && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 427 if (deviceSize <= 1136 && deviceSize > 835) { 428 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=2"); 429 } 430 if (deviceSize <= 835){ 431 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=1"); 432 } 433 } 434 435 if (($('body').hasClass('theme9') || $('body').hasClass('theme23')) && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 436 if (deviceSize <= 1050 && deviceSize>720) { 437 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=2"); 438 } 439 if (deviceSize <= 720){ 440 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=1"); 441 } 442 } 443 444 if (($('body').hasClass('theme15') || $('body').hasClass('theme20') || $('body').hasClass('theme21')) && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 445 if (deviceSize <= 1095 && deviceSize>680) { 446 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=2"); 447 } 448 if (deviceSize <= 680){ 449 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=1"); 450 } 451 } 452 453 if (($('body').hasClass('theme17') || $('body').hasClass('theme19')) && $('body').hasClass('front')){ 454 if (deviceSize <= 1140 && deviceSize>600) { 455 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=2"); 456 } 457 if (deviceSize <= 600){ 458 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=1"); 459 } 460 } 461 462 if ($('body').hasClass('theme18') && $('body').hasClass('front')){ 463 if (deviceSize <= 1024 && deviceSize>640) { 464 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=2"); 465 } 466 } 467 468 if ($custom_active_li_limit != 0 && ($('body').hasClass('front') && $listing_mode != 3 || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 469 470 if($custom_active_li_limit > 4){ 471 if (deviceSize <= 770){ 472 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=4"); 473 } 474 else if(deviceSize <= 1070){ 475 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=6"); 476 } 477 else{ 478 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-="+$custom_active_li_limit); 479 } 480 } 481 else{ 482 if (deviceSize <= 1300){ 483 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=2"); 484 } else{ 485 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-="+$custom_active_li_limit); 486 } 487 } 488 } 489 490 if($custom_active_li_limit != '' && $listing_mode == 3 && $region != 'wsidebar_right' ){ 491 if (deviceSize <= 500){ 492 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=1"); 493 }else if (deviceSize <= 900){ 494 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=2"); 495 } 496 } 497 498 if(deviceSize <= 640){ 499 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=1"); 500 } 501 else{ 502 if($region == 'frontpage_center' || $region == 'frontpage_centre' || $region == 'mainColumn' || $region == 'frontpage_main' || $region == 'frontpage_left' || $region == 'frontpage_middle' || $region == 'frontpage_right'){//add regions for 2 column here 503 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=2"); 504 } 505 else if($custom_active_li_limit && $region == 'wsidebar_right' && $listing_mode == 3 ){ 506 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=1"); 507 } 508 else if (isBrokerDetailPage){ 509 $(semiReference_path + " .jcarousel").jcarousel("scroll", "-=1"); 510 } 511 else{ 512 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=3"); 513 } 514 } 515 } 516 else{ 517 $(semiReference_path+" .jcarousel").jcarousel("scroll", "-=3"); 518 } 519 }); 520
521 $(semiReference_path+" .jcarousel-control-next").click(function(event){ 522 event.preventDefault(); 523 if(widget.scrollClass=="horizontal_scroll"){ 524 if (($('body').hasClass('theme30')||$('body').hasClass('theme31')) && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 525 $(semiReference_path + " .jcarousel").jcarousel("scroll", "+=1"); 526 } 527 if ($('body').hasClass('theme4') && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 528 if(deviceSize <= 885 && deviceSize > 568){ 529 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=2"); 530 } 531 } 532 533 if ($('body').hasClass('theme5') && $('body').hasClass('front')){ 534 if (deviceSize <= 1300 && deviceSize>925) { 535 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=2"); 536 } 537 if (deviceSize <= 925){ 538 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=1"); 539 } 540 } 541 542 if ($('body').hasClass('theme6') && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 543 if (deviceSize <= 1300 && deviceSize>925) { 544 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=2"); 545 } 546 if (deviceSize <= 925){ 547 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=1"); 548 } 549 } 550 551 if ($('body').hasClass('theme24') && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 552 if (deviceSize <= 980 && deviceSize>710) { 553 $(semiReference_path + " .jcarousel").jcarousel("scroll", "+=2"); 554 } 555 if (deviceSize <= 710){ 556 $(semiReference_path + " .jcarousel").jcarousel("scroll", "+=1"); 557 } 558 } 559 560 if ($('body').hasClass('theme25') || $('body').hasClass('theme27') 561 && $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings")){ 562 if (deviceSize <= 1095 && deviceSize>680) { 563 $(semiReference_path + " .jcarousel").jcarousel("scroll", "+=2"); 564 } 565 if (deviceSize <= 680){ 566 $(semiReference_path + " .jcarousel").jcarousel("scroll", "+=1"); 567 } 568 } 569 570 if ($('body').hasClass('theme12') && $('[id*="office_agent_listings"]').length === 1 && semiReference_path.indexOf('office_agent_listings') != -1){ 571 if (deviceSize <= 900 && deviceSize > 744) { 572 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=2"); 573 } 574 if (deviceSize <= 744){ 575 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=1"); 576 } 577 } 578 579 if (($('body').hasClass('theme7') || $('body').hasClass('theme8')) && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 580 if (deviceSize <= 1136 && deviceSize>835) { 581 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=2"); 582 } 583 if (deviceSize <= 835){ 584 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=1"); 585 } 586 } 587 588 if (($('body').hasClass('theme9') || $('body').hasClass('theme23')) && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 589 if (deviceSize <= 1050 && deviceSize>720) { 590 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=2"); 591 } 592 if (deviceSize <= 720){ 593 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=1"); 594 } 595 } 596 597 if (($('body').hasClass('theme15') || $('body').hasClass('theme20') || $('body').hasClass('theme21')) && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 598 if (deviceSize <= 1095 && deviceSize>680) { 599 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=2"); 600 } 601 if (deviceSize <= 680){ 602 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=1"); 603 } 604 } 605 606 if (($('body').hasClass('theme17') || $('body').hasClass('theme19')) && $('body').hasClass('front')){ 607 if (deviceSize <= 1140 && deviceSize>600) { 608 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=2"); 609 } 610 if (deviceSize <= 600){ 611 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=1"); 612 } 613 } 614 615 if ($('body').hasClass('theme18') && $('body').hasClass('front')){ 616 if (deviceSize <= 1024 && deviceSize>640) { 617 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=2"); 618 } 619 } 620 621 622 if ($custom_active_li_limit && ($('body').hasClass('front') && $listing_mode != 3 || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 623 if($custom_active_li_limit > 4){ 624 if (deviceSize <= 770){ 625 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=4"); 626 } 627 else if(deviceSize <= 1070){ 628 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=6"); 629 } 630 else{ 631 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+="+$custom_active_li_limit); 632 } 633 } 634 else{ 635 if (deviceSize <= 1300){ 636 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=2"); 637 }else{ 638 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+="+$custom_active_li_limit); 639 } 640 } 641 } 642 643 if($custom_active_li_limit && $listing_mode == 3 && $region != 'wsidebar_right' ){ 644 if (deviceSize <= 500){ 645 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=1"); 646 }else if (deviceSize <= 900){ 647 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=2"); 648 } 649 } 650 651 if(deviceSize <= 640){ 652 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=1"); 653 } 654 else{ 655 if($region == 'frontpage_center' || $region == 'frontpage_centre' || $region == 'mainColumn' || $region == 'frontpage_main' || $region == 'frontpage_left' || $region == 'frontpage_middle' || $region == 'frontpage_right'){//add regions for 2 column here 656 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=2"); 657 } 658 else if($custom_active_li_limit && $region == 'wsidebar_right' && $listing_mode == 3 ){ 659 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=1"); 660 } 661 else if (isBrokerDetailPage){ 662 $(semiReference_path + " .jcarousel").jcarousel("scroll", "+=1"); 663 } 664 else{ 665 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=3"); 666 } 667 } 668 } 669 else{ 670 $(semiReference_path+" .jcarousel").jcarousel("scroll", "+=3"); 671 } 672 }); 673
674 $(fullReference_path).on("jcarousel:animate", function(event, carousel){ 675 if($listing_mode != 2 && $listing_mode != 3 ){ // Properties listing 676 appendNew_carousel_item($total_record,fullReference_path,semiReference_path,$widget_id,carousel,idleFlag,$listing_mode,deviceSize,$custom_active_li_limit, settings); 677 } 678 else if($listing_mode == 2){ // Pre-construction codo listing 679 appendNew_carousel_condo_item($total_record,fullReference_path,semiReference_path,$widget_id,carousel,idleFlag,$listing_mode,deviceSize,$custom_active_li_limit); 680 } 681 else if($listing_mode == 3){ // agents listings 682 appendNew_carousel_agent_listings_item($total_record,fullReference_path,semiReference_path,$widget_id,carousel,idleFlag); 683 } 684 }); 685 if (isBrokerDetailPage){ 686 $(semiReference_path+" .jcarousel li").eq(0).addClass( "activeLi" ); 687 $(fullReference_path).on('jcarousel:targetin', 'li', function(event, carousel) { 688 this.classList.add('activeLi'); 689 let prevButton = $(semiReference_path + " .jcarousel-control-prev")[0]; 690 let firstItem = carousel._items[0] 691 if (this == firstItem) { 692 prevButton.classList.remove('show'); 693 } else { 694 prevButton.classList.add('show'); 695 } 696 }); 697 $('.jcarousel').on('jcarousel:targetout', 'li', function(event, carousel) { 698 this.classList.remove('activeLi'); 699 }); 700 } 701 702 if(widget.scrollClass=="horizontal_scroll"){ //horizontal autoscroll 703 if(deviceSize <= 640 || $region == 'wsidebar_right'){ 704 705 var numScroll='+=1'; 706 var scrollValue=1; 707 } 708 else{ 709 if($region == 'frontpage_center'|| $region == 'frontpage_centre' || $region == 'mainColumn' || $region == 'frontpage_main' || $region == 'frontpage_left' || $region == 'frontpage_middle' || $region == 'frontpage_right'){ //add regions for 2 column here 710 var numScroll='+=2'; 711 var scrollValue=2; 712 } 713 else if($custom_active_li_limit && $region == 'wsidebar_right' && $listing_mode == 3 ){ 714 var numScroll='+=1'; 715 var scrollValue=1; 716 } 717 else{ 718 var numScroll='+=3'; 719 var scrollValue=3; 720 } 721 } 722 723 if (($('body').hasClass('theme30') || $('body').hasClass('theme31')) && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 724 if ($('[id*="office_agent_listings"]').length === 1 && semiReference_path.indexOf('office_agent_listings') != -1 && (($total_record <= 4 && deviceSize >= 1025)||($total_record <= 3 && deviceSize >= 551)||($total_record <= 2))) { 725 var numScroll='+=0'; 726 } else { 727 var numScroll='+=1'; 728 } 729 } 730 731 if ($('body').hasClass('theme4') && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 732 if(deviceSize <= 885){ 733 var numScroll='+=2'; 734 var scrollValue=2; 735 if (deviceSize <= 568){ 736 var numScroll='+=1'; 737 var scrollValue=1; 738 } 739 } 740 } 741 if (isBrokerDetailPage){ 742 var numScroll='+=1'; 743 var scrollValue=1; 744 } 745 746 if ($('body').hasClass('theme5') && $('body').hasClass('front')){ 747 if(deviceSize <= 1300){ 748 var numScroll='+=2'; 749 var scrollValue=2; 750 if (deviceSize <= 925){ 751 var numScroll='+=1'; 752 var scrollValue=1; 753 } 754 } 755 } 756 757 if ($('body').hasClass('theme6') && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 758 if(deviceSize <= 1300){ 759 var numScroll='+=2'; 760 var scrollValue=2; 761 if (deviceSize <= 925){ 762 var numScroll='+=1'; 763 var scrollValue=1; 764 } 765 } 766 } 767 768 if ($('body').hasClass('theme24') && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 769 if(deviceSize <= 980 && deviceSize > 710){ 770 var numScroll='+=2'; 771 var scrollValue=2; 772 if (deviceSize <= 710){ 773 var numScroll='+=1'; 774 var scrollValue=1; 775 } 776 } 777 } 778 779 if ($('body').hasClass('theme25') || $('body').hasClass('theme27') 780 && $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings")){ 781 if(deviceSize <= 1095 && deviceSize > 680){ 782 var numScroll='+=2'; 783 var scrollValue=2; 784 if (deviceSize <= 680){ 785 var numScroll='+=1'; 786 var scrollValue=1; 787 } 788 } 789 } 790 791 if ($('body').hasClass('theme12') && $('[id*="office_agent_listings"]').length === 1 && semiReference_path.indexOf('office_agent_listings') != -1){ 792 if(deviceSize <= 900){ 793 var numScroll='+=2'; 794 var scrollValue=2; 795 if (deviceSize <= 744){ 796 var numScroll='+=1'; 797 var scrollValue=1; 798 } 799 } 800 } 801 802 if (($('body').hasClass('theme7') || $('body').hasClass('theme8')) && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 803 if (deviceSize <= 1136 && deviceSize > 835) { 804 var numScroll='+=2'; 805 var scrollValue=2; 806 } 807 if (deviceSize <= 835){ 808 var numScroll='+=1'; 809 var scrollValue=1; 810 } 811 } 812 813 if (($('body').hasClass('theme9') || $('body').hasClass('theme23')) && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 814 if (deviceSize <= 1050 && deviceSize > 600) { 815 var numScroll='+=2'; 816 var scrollValue=2; 817 } 818 if (deviceSize <= 600){ 819 var numScroll='+=1'; 820 var scrollValue=1; 821 } 822 } 823 824 if ($custom_active_li_limit && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 825 if($custom_active_li_limit > 4){ // for theme12 826 if (deviceSize <= 770){ 827 var numScroll='+=4'; 828 var scrollValue=4; 829 } 830 else if(deviceSize <= 1070){ 831 var numScroll='+=6'; 832 var scrollValue=6; 833 } 834 else{ 835 var numScroll='+='+$custom_active_li_limit; 836 var scrollValue=$custom_active_li_limit; 837 } 838 } 839 else{ 840 if (deviceSize <= 1300){ 841 var numScroll='+=2'; 842 var scrollValue=2; 843 } else{ 844 var numScroll='+='+$custom_active_li_limit; 845 var scrollValue=$custom_active_li_limit; 846 } 847 } 848 } 849 850 if($custom_active_li_limit && $listing_mode == 3 && $region != 'wsidebar_right' ){ 851 if (deviceSize <= 500){ 852 var numScroll='+=1'; 853 var scrollValue=1; 854 } else if (deviceSize <= 900){ 855 var numScroll='+=2'; 856 var scrollValue=2; 857 } 858 } 859 860 if (($('body').hasClass('theme11') || $('body').hasClass('theme13')) && $('body').hasClass('front')){ 861 if(deviceSize <= 768){ 862 var numScroll='+=2'; 863 var scrollValue=2; 864 if (deviceSize <= 568){ 865 var numScroll='+=1'; 866 var scrollValue=1; 867 } 868 } 869 } 870 871 872 if (($('body').hasClass('theme15') || $('body').hasClass('theme20') || $('body').hasClass('theme21')) && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 873 if(deviceSize <= 1095){ 874 var numScroll='+=2'; 875 var scrollValue=2; 876 if (deviceSize <= 680){ 877 var numScroll='+=1'; 878 var scrollValue=1; 879 } 880 } 881 } 882 883 884 if (($('body').hasClass('theme17') || $('body').hasClass('theme19')) && $('body').hasClass('front')){ 885 if (deviceSize <= 1140) { 886 var numScroll='+=2'; 887 var scrollValue=2; 888 if (deviceSize <= 600){ 889 var numScroll='+=1'; 890 var scrollValue=1; 891 } 892 } 893 } 894 895 if ($('body').hasClass('theme18') && $('body').hasClass('front')){ 896 if (deviceSize <= 1024) { 897 var numScroll='+=2'; 898 var scrollValue=2; 899 if (deviceSize <= 640){ 900 var numScroll='+=1'; 901 var scrollValue=1; 902 } 903 } 904 } 905 906 } 907 908 else if(widget.scrollClass=="vertical_scroll"){ //vertical autoscroll 909 if($region == 'frontpage_left_lavish' || $region =='frontpage_middle_lavish' || $region == 'frontpage_right_lavish' ) 910 { 911 var numScroll='+=1'; 912 var scrollValue=1; 913 } 914 else 915 { 916 var numScroll='+=3'; 917 var scrollValue=3; 918 } 919 920 } 921 // Add Carousel Reference into widget for further manipulation.
922 widget.carousel = $(fullReference_path).jcarouselAutoscroll({ 923 interval: 4000, 924 target: numScroll, 925 autostart: true, 926 scroll:scrollValue 927 }).on('mouseover',function(e){ 928 $(this).jcarouselAutoscroll('stop'); 929 }).on('mouseout',function(e){ 930 $(this).jcarouselAutoscroll('start'); 931 }); 932} 933 934function appendNew_carousel_item(no_of_loadProperty,fullReference_path,semiReference_path,carouselId,carouselObj,idleFlag_val,$listing_mode,deviceSize,$custom_active_li_limit, settings){ 935 936 var last_Index=carouselObj.index(carouselObj._last); // total element loaded in loaded index starting from 0 937 var upcoming_visibel_elem= carouselObj.items().length-7; // position of first element in the last index carousel 938 var response_end=$(semiReference_path+" .response_end").attr("value"); 939 var idleFlag_val=$(semiReference_path+" .idleState").attr("value"); 940 if(last_Index >= upcoming_visibel_elem){ 941 if(idleFlag_val==1 && no_of_loadProperty >= 6 && response_end==1){ 942 var source=$(semiReference_path+" .source_fl").attr("value"); 943 var type=$(semiReference_path+" .type_fl").attr("value"); 944 var residential_type_val=$(semiReference_path+" .residential_type_fl").attr("value"); 945 var single_mul=$(semiReference_path+" .single_mul_fl").attr("value"); 946 var property_display=$(semiReference_path+" .property_display_fl").attr("value"); 947 var sale_value=$(semiReference_path+" .sale_fl").attr("value"); 948 var rent_value=$(semiReference_path+" .rent_fl").attr("value"); 949 var sold_value=$(semiReference_path+" .sold_fl").attr("value"); 950 var pending_value=$(semiReference_path+" .pending_fl").attr("value"); 951 var min_price_value = $(semiReference_path+" .min_price_fl").attr("value"); 952 var max_price_value = $(semiReference_path+" .max_price_fl").attr("value"); 953 var city=$(semiReference_path+" .city_fl").attr("value"); 954 var cities_val = $(semiReference_path+" .cities_val_fl").attr("value"); 955 var mls=$(semiReference_path+" .mls_fl").attr("value"); 956 var postal_code=$(semiReference_path+" .zip_fl").attr("value"); 957 var limit_val=$(semiReference_path+" .limit_count").attr("value"); 958 var orderByreference=$(semiReference_path+" .order_by_reference").attr("value"); 959 var total_count=$(semiReference_path+" .total_count").attr("value"); 960 var agentId = $(semiReference_path+" .specId").attr("value"); 961 var new_limit=parseInt(limit_val)+3; 962 var end_limit_diff=0; 963 964 if ($custom_active_li_limit && ($('body').hasClass('front') || $('body').hasClass('_Buy-A-Home') || $('body').hasClass('_Relocation-Concierge') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 965 if($custom_active_li_limit > 4 && limit_val >=24 && deviceSize > 770 && deviceSize <= 1070){ 966 new_limit =parseInt(limit_val) + 6; 967 var end_limit_diff = 6; 968 } 969 else{ 970 $custom_limit = parseInt($custom_active_li_limit); 971 new_limit =parseInt(limit_val) + $custom_limit; 972 } 973 } 974 var host = window.location.host; 975 var http_or_https = window.location.protocol; 976 var purl = http_or_https+"//"+host+"/featured_property_loader"; 977 978 if(settings) { 979 settings['skip'] = limit_val; 980 settings['limit'] = new_limit - limit_val; 981 $.ajax({
982 url: purl, 983 type:"POST", 984 data: JSON.stringify(settings), 985 contentType: "application/json; charset=utf-8", 986 dataType : "json", 987 success: function(response) { 988 if(response.properties && response.properties.message ) { 989 // Stop loading more if reached end of results. 990 $(semiReference_path+" .response_end").attr("value",0); 991 } 992 if(response.properties && response.properties.length) { 993 for(var i in response.properties) { 994 settings["index"] += 1; 995 $(fullReference_path + ">ul").append(generatePropertyView(response.properties[i], settings)); 996 } 997 // Add custom event so that we can detect when featured listing has its properties appended. 998 featuredWidgets.triggerEvent("featuredPropertiesAdded",{"widgetId":"#featuredListing-0-"+settings.widget_id}); 999 $(fullReference_path).jcarousel("reload"); 1000 $(semiReference_path + " .limit_count").attr("value",new_limit); 1001 if(new_limit > 100){ 1002 // Stop loading more if 100 properties loaded. 1003 $(semiReference_path+" .response_end").attr("value",0); 1004 } 1005 if(check_theme_active_li_exist($listing_mode,$custom_active_li_limit)){ 1006 check_carousel_last_slide(fullReference_path,deviceSize,$custom_active_li_limit); 1007 } 1008 return; 1009 } 1010 }, 1011 error: function(data, error) { 1012 } 1013 }); 1014 return; 1015 } 1016 $.ajax({
1017 url: purl, 1018 type:"get", 1019 data:{ 1020 listing_type_val:source, 1021 property_type_val:type, 1022 residential_type:residential_type_val, 1023 single_mul_val:single_mul, 1024 property_display_val:property_display, 1025 sale_val:sale_value, 1026 rent_val:rent_value, 1027 sold_val:sold_value, 1028 pending_val:pending_value, 1029 min_price: min_price_value, 1030 max_price: max_price_value, 1031 orderByreference_val:orderByreference, 1032 city_val:city, 1033 cities_val: cities_val, 1034 mls_val:mls, 1035 zip_val:postal_code, 1036 limit_val_start:limit_val, 1037 end_limit_val:end_limit_diff, 1038 agentId:agentId, 1039 }, 1040 dataType : "json", 1041 success: function(response) { 1042 if(response["html"]!=""){ 1043 $(fullReference_path+" ul").append(response["html"]); 1044 $(fullReference_path).jcarousel("reload"); 1045 $(semiReference_path+" .limit_count").attr("value",new_limit); 1046 //If the type of the listing is All or City based then only 300 properties will load 1047 if((new_limit==300 || new_limit ==304) && (source=='3' || source=='5')){ 1048 $(semiReference_path+" .response_end").attr("value",0); 1049 } 1050 if(check_theme_active_li_exist($listing_mode,$custom_active_li_limit)){ 1051 check_carousel_last_slide(fullReference_path,deviceSize,$custom_active_li_limit); 1052 } 1053 } 1054 else{ 1055 $(semiReference_path+" .response_end").attr("value",0); 1056 if(check_theme_active_li_exist($listing_mode,$custom_active_li_limit)){ 1057 check_carousel_last_slide(fullReference_path,deviceSize,$custom_active_li_limit); 1058 } 1059 } 1060 }, 1061 error: function(data, error) { 1062 } 1063 }); 1064 } 1065 } 1066} 1067 1068function generatePropertyView(property, settings) { 1069 var event = ' onclick="property_view_app(event,' + property.PID + ')"' 1070 1071 var forRequired = ['Lease', 'Sale', 'Rent'] 1072 var listingTypeTitle = ''; 1073 var propertyUrl = encodeURI(property.seoURL); 1074 var isBrokerDetailPage = (($('body').hasClass('inner') || $('body').hasClass('urban')) && $('body').hasClass('office-detail')); 1075 if(forRequired.indexOf(property.listingType) != -1) { 1076 listingTypeTitle = 'for '; 1077 } 1078 listingTypeTitle += property.listingType; 1079 1080 if (settings.agent_name == null){ settings.agent_name = '';} 1081 if (settings.office_name == null){ settings.office_name = '';} 1082 1083 if (settings.partner_agent_name == null){ settings.partner_agent_name = '';} 1084 if (property.Details && property.Details.IsAddressModified === true && property.Details.DisplayAddress) { 1085 property.Address = property.Details.DisplayAddress; 1086 } 1087 1088 var seoTitle = property.Address 1089 + ' ' + property.City 1090 + ' ' + property.State 1091 + ' ' + property.Country 1092 + ' ' + listingTypeTitle 1093 + ' ' + property.searchType 1094 + ' ' + settings.agent_name; 1095 if(settings.partner_agent_name) { 1096 seoTitle += ' ' + settings.partner_agent_name; 1097 } 1098 seoTitle += ' ' + settings.office_name; 1099 var seoAlt = buildImageAltText(property, settings); 1100 1101 var isCommercialProperty = property.searchType === 'commercial'; 1102 1103 if(property.isVOW) { 1104 seoTitle = ''; 1105 seoAlt = 'Exclusive Listing'; 1106 } 1107 1108 var propertyBody = '<li>' 1109 1110 if(settings.hiddenVOWCLass && property.isVOW) { 1111 var isVOW = 1; 1112 var domID = parseInt(settings.currentDomainID); 1113 if(typeof property.domainIDs != 'undefined' && property.domainIDs.indexOf(domID) !== -1){ 1114 isVOW = 0; 1115 } 1116 if(isVOW == 1){ 1117 propertyBody = '<li class= "cls_hidden">' 1118 propertyBody += '<div class="cls_hidden">' 1119 + '<p class="cls_hidden_message">' 1120 + '<a href="' + propertyUrl + '" ' 1121 + event 1122 + ' data-op="register"><strong>SEE WHAT REALTORS® SEE</strong></a>' 1123 + '<span class="vow_locker">' 1124 + '<span class="bg-locker">' 1125 + '<span>***</span>' 1126 + '</span>' 1127 + '<strong>Free</strong> VIP Account Required' 1128 + '</span>' 1129 + '</p>' 1130 + '</div>' 1131 } 1132 } 1133 1134 propertyBody += '<div class="property_div clearfix for' + (property.listingType ? property.listingType.toLowerCase() : '') + '" data-pid="'+property.PID+'">'
1135 propertyBody += '<a href="' + property.seoURL + '"' 1136 + 'class="featured_multi_img_wrapper" ' 1137 + 'alt="' + seoAlt + '" title="' + seoTitle + '"' 1138 + event + '>'; 1139 1140 // For ccs based For Sale, For rent, Sold label 1141 propertyBody += '<span class="listingType"></span>' 1142 1143 // if isVow and User is not logged in. 1144 if(property.isVOW) { 1145 propertyBody += '<img src="" class="feature_ribbon lock locked-prop" alt="" />'; 1146 } else { 1147 propertyBody += '<img src="/modules/widgets/featured_listing/images/ribbon.png" class="feature_ribbon" alt="Featured Listing" />'; 1148 } 1149 var noImage = '/images/noImage.jpg'; 1150 var imgUrl = noImage; 1151 if (isCommercialProperty) { 1152 imgUrl = '/images/noImageCommercial.jpg'; 1153 } 1154 var loadClass = ''; 1155 if(property.images && property.images.length) { 1156 // If property has images use loader and preload images. 1157 loadClass = 'loading'; 1158 imgUrl = '/modules/widgets/featured_listing/images/loader.svg'; 1159 var imageEl = '#featuredListing-0-'+settings.widget_id+' .property_div[data-pid="'+property.PID+'"] img.featured'; 1160 var events = ['featuredReady','featuredPropertiesAdded']; 1161 for(i in events){ 1162 var loadEvent = document.addEventListener(events[i], function(e){ 1163 featuredWidgets.loadImage(imageEl, property.images[0], settings); 1164 document.removeEventListener(events[i],loadEvent); // cleanup after firing 1165 }); 1166 }; 1167 } 1168 1169 propertyBody += '<img src="' + imgUrl + '" class="featured '+loadClass+'" alt="' + seoAlt + '" title="' + seoTitle + '"/>'; 1170 1171 propertyBody += '</a>' 1172 var showWidgetBrokered = false; 1173 var wrapperClass = "wrapperFeature"; 1174 var commission = ''; 1175 if($('body.broker').length > 0 && property.Brokers.find(function(item){return item == settings.bid})) { 1176 // get broker individual commission 1177 if(property.brokerBuyerCommission && property.brokerBuyerCommission.length > 0) { 1178 for (var i in property.brokerBuyerCommission) { 1179 if(settings.bid == property.brokerBuyerCommission[i].bid) { 1180 commission = property.brokerBuyerCommission[i].commission; 1181 break; 1182 } 1183 } 1184 } 1185 // get broker all commission 1186 else if(settings.brokerCommission && settings.brokerCommission.length > 0) { 1187 commission = settings.brokerCommission; 1188 } 1189 // get agent individual commission 1190 else if (property.agentBuyerCommission && property.agentBuyerCommission.length > 0) { 1191 commission = property.agentBuyerCommission[0].commission; 1192 } 1193 // get agent all commission 1194 else if (settings.agentCommission) { 1195 var key = property.Agents.find(function(item){return settings.agentCommission[item]}); 1196 if (key) { 1197 commission = settings.agentCommission[key]; 1198 } 1199 } 1200 } else if (property.Agents.find(function(item){return item == settings.aid || item == settings.aidp})) { 1201 // get agent individual commission 1202 if (property.agentBuyerCommission && property.agentBuyerCommission.length > 0) { 1203 for (var i in property.agentBuyerCommission) { 1204 if(settings.aid == property.agentBuyerCommission[i].aid || settings.aidp == property.agentBuyerCommission[i].aid) { 1205 commission = property.agentBuyerCommission[i].commission; 1206 break; 1207 } 1208 } 1209 } 1210 // get agent all commission 1211 else if(settings.agentCommission && settings.agentCommission.length > 0) { 1212 commission = settings.agentCommission; 1213 } 1214 // get broker individual commission 1215 else if(property.brokerBuyerCommission && property.brokerBuyerCommission.length > 0) { 1216 for (var i in property.brokerBuyerCommission) { 1217 if(settings.bid == property.brokerBuyerCommission[i].bid) { 1218 commission = property.brokerBuyerCommission[i].commission; 1219 break; 1220 } 1221 } 1222 } 1223 // get broker all commission 1224 else if(settings.brokerCommission && settings.brokerCommission.length > 0) { 1225 commission = settings.brokerCommission; 1226 } 1227 } 1228 if (commission.length > 0) { 1229 wrapperClass += ' commission'; 1230 } 1231 if (settings.widgetBrokered && property.BrokeredBy && property.BrokeredBy.length) { 1232 showWidgetBrokered = true; 1233 wrapperClass += " brokeredwrapper"; 1234 }
1235 propertyBody += '<div class="'+ wrapperClass +'">' 1236 propertyBody += '<div class="item bookmark"></div>' 1237 1238 if ($('body').hasClass('cpcorp') && $('body').hasClass('front') && property.Address && property.City){ //cpcorp theme 1239 property.Address = property.Address + ', ' + property.City; 1240 } 1241 1242 if (($('body').hasClass('theme28') || $('body').hasClass('theme29') || $('body').hasClass('theme30') || $('body').hasClass('theme31') || $('body').hasClass('theme32') || $('body').hasClass('theme33')) && ($('body').hasClass('front') || ($('body').attr('class').indexOf('buy-homes-for-sale') > -1) || ($('body').attr('class').indexOf('buy-commercial-for-sale') > -1)) && property.Address && property.City){ 1243 property.Address = property.Address + ', ' + property.City; 1244 } 1245 if(($('body').hasClass('buying-tips') && property.Address && property.City)){ 1246 property.Address = property.Address + ', ' + property.City; 1247 } 1248 1249 if (($('body').hasClass('theme30')||$('body').hasClass('theme31')) && ($('body').hasClass('front') || ($('body').attr('class').indexOf('buy-homes-for-sale') > -1)) && property.Address){ 1250 if (property.Address.match(/(\d+)/ig) && property.Address.match(/(\d+)/ig).length > 1) { 1251 property.Address = property.Address.replaceAll(/(\d+)/ig, "<span>$&</span>"); 1252 } else if (property.Address.match(/(\d+)/ig)){ 1253 property.Address = property.Address.replace(/(\d+)/ig, "<span>$&</span>"); 1254 } 1255 } 1256 1257 if(property.Address && property.Address.length > 29 && !$('body').hasClass('theme30') && !$('body').hasClass('theme31')) { 1258 propertyBody += '<div class="featuredListingAddress">' 1259 + '<a class="tooltip" href="javascript:void(0)">' 1260 + '<span>' + property.Address.substring(0, 25) + ' ...</span>' 1261 + '<span class="fulltip">' + property.Address + '</span>' 1262 + '</a>' 1263 + '</div>' 1264 } else { 1265 propertyBody += '<div class="featuredListingAddress">' + property.Address + '</div>' 1266 } 1267 1268 if(settings['property_extra'] === 1 && property.MarketingRemarks){ 1269 propertyBody += '<div class="property_extra"><p>' 1270 +property.MarketingRemarks.split(" ").splice(0,15).join(" ") 1271 +'...</p></div>'; 1272 } else if (isBrokerDetailPage) { 1273 if (property.MarketingRemarks) { 1274 propertyBody += '<div class="property_extra"><p>' 1275 +property.MarketingRemarks 1276 +'</p></div>'; 1277 } 1278 propertyBody += '<a href="' + propertyUrl + '" class="featured-view-details" ' + event + '>' + 'view details</a>'; 1279 } 1280 1281 var Bedrooms = property.Details.Bedrooms; 1282 if( property.Details.BedroomsAboveGround && property.Details.BedroomsAboveGround > 0) { 1283 if( property.Details.BedroomsBelowGround && property.Details.BedroomsBelowGround > 0) { 1284 Bedrooms = property.Details.BedroomsAboveGround + ' + ' + property.Details.BedroomsBelowGround; 1285 } 1286 } 1287 1288 if(Bedrooms == 0) { 1289 Bedrooms = ''; 1290 } 1291 1292 propertyBody += '<div class="price_bedroom_bathroom">'; 1293 1294 if (settings.widget_id==34748){ //homelife.ca 1295 propertyBody += '<div class="featuredListingPrice">'; 1296 if(property.Price) { 1297 var PropertyPriceUnit = ''; 1298 if(property.listingType == 'Lease' || property.listingType == 'Rent'){ // For lease/rent property only 1299 var actual_price_unit = '/MO'; 1300 if(typeof property.PriceUnits !== 'undefined' && property.PriceUnits != ''){ 1301 var actual_price_unit = _get_actual_price_unit(property.PriceUnits); 1302 } 1303 if(actual_price_unit != ''){ 1304 PropertyPriceUnit = '<span class="price_unit">'+actual_price_unit+'</span>'; 1305 } 1306 } 1307 propertyBody += '<span>' 1308 + '$' 1309 + property.Price.toLocaleString('us', {minimumFractionDigits: 0, maximumFractionDigits: 0}) 1310 + PropertyPriceUnit 1311 + '</span>' 1312 } 1313 propertyBody +='</div>'; 1314 } 1315 1316 //check commercial land type 1317 const isLand = property && property.propertyTypeMain === "Land"; 1318 const details = property.Details; 1319 const isAcre = isLand && details && details.Acres; 1320 //measurement unit for manual listings only 1321 var measurementUnit = (property && property.MeasurementUnit && property.BoardID === 0) 1322 ? property.MeasurementUnit : (isAcre ? 'acres' : 'sqft'); 1323 var propertyLotSquareFootage = isAcre ? details.Acres : property.LotSquareFootage; 1324 if (isCommercialProperty) { 1325 if ( propertyLotSquareFootage && propertyLotSquareFootage > 0) {
1326 propertyBody += '<span class="featuredListingSquareFootage">' + propertyLotSquareFootage + '<span> '+ measurementUnit +'</span></span>' 1327 } 1328 } else { 1329 if(Bedrooms != '') { 1330 propertyBody += '<span class="featuredListingBedroom">' + Bedrooms + '</span>' 1331 } 1332 if(property.Details.Bathrooms && property.Details.Bathrooms > 0) { 1333 propertyBody += '<span class="featuredListingBathroom">' + property.Details.Bathrooms + '</span>' 1334 } 1335 } 1336 1337 if(property.City && property.City.length > 12) { 1338 propertyBody += '<span class="featuredListingCity">' 1339 + '<a class="tooltipcity" href="javascript:void(0)">' 1340 + '<span>' + property.City.substring(0, 10) + ' ...</span>' 1341 + '<span class="fulltipcity">' + property.City + '</span>' 1342 + '</a>' 1343 + '</span>' 1344 } else { 1345 propertyBody += '<span class="featuredListingCity">' + property.City + '</span>' 1346 } 1347 1348 propertyBody += '</div><!--price_bedroom_bathroom-->' 1349 1350 propertyBody += '<div class="featuredListingPrice">'; 1351 if(property.Price) { 1352 var PropertyPriceUnit = ''; 1353 if(property.listingType == 'Lease' || property.listingType == 'Rent'){ // For lease/rent property only 1354 var actual_price_unit = '/MO'; 1355 if(typeof property.PriceUnits !== 'undefined' && property.PriceUnits != ''){ 1356 var actual_price_unit = _get_actual_price_unit(property.PriceUnits); 1357 } 1358 if(actual_price_unit != ''){ 1359 PropertyPriceUnit = '<span class="price_unit">'+actual_price_unit+'</span>'; 1360 } 1361 } 1362 propertyBody += '<span class="featuredPricePlaceholder">' 1363 + '$' 1364 + property.Price.toLocaleString('us', {minimumFractionDigits: 0, maximumFractionDigits: 0}) 1365 + PropertyPriceUnit 1366 + '</span>' 1367 } 1368 propertyBody += '<a href="' + propertyUrl + '" class="featured_readmore" ' + event + '>'; 1369 propertyBody += 'Read More</a>' 1370 propertyBody += '</div><!--featuredListingPrice-->' 1371 if (commission.length > 0) { 1372 propertyBody += '<div class="featuredCommission"><span>Offers of compensation: <span>' + commission+ '</span></span></div>'; 1373 } 1374 if (showWidgetBrokered) { 1375 propertyBody +='<div class="brokerbywidget"><span>Brokered by: <strong>' + property.BrokeredBy[0] + '</strong></span></div>'; 1376 } 1377 propertyBody += '</div><!--wrapper-->' 1378 if (isBrokerDetailPage) { 1379 propertyBody += '<div class="carousel-index">' + ((settings.index < 10 ? '0' : '') + settings.index) +'</div>'; 1380 } 1381 propertyBody += '</div><!--property_div-->' 1382 propertyBody += '</li>' 1383 1384 return propertyBody; 1385} 1386 1387// Pre-construction condo ajax listings function 1388function appendNew_carousel_condo_item(no_of_loadProperty,fullReference_path,semiReference_path,carouselId,carouselObj,idleFlag_val,$listing_mode,deviceSize,$custom_active_li_limit) 1389{ 1390 var last_Index=carouselObj.index(carouselObj._last); // total element loaded in loaded index starting from 0 1391 var upcoming_visibel_elem= carouselObj.items().length-7; // position of first element in the last index carousel 1392 var response_end=$(semiReference_path+" .response_end").attr("value"); 1393 var idleFlag_val=$(semiReference_path+" .idleState").attr("value"); 1394 if(last_Index >= upcoming_visibel_elem){ 1395 if(idleFlag_val==1 && no_of_loadProperty >= 6 && response_end==1){ 1396 var listing_fl=$(semiReference_path+" .listing_fl").attr("value"); 1397 var type_of_condo_listing_val=$(semiReference_path+" .type_of_condo_listing_fl").attr("value"); 1398 var condo_builders_type_val=$(semiReference_path+" .condo_builders_type_fl").attr("value"); 1399 var single_mul=$(semiReference_path+" .single_mul_fl").attr("value"); 1400 var property_display=$(semiReference_path+" .property_display_fl").attr("value"); 1401 var city=$(semiReference_path+" .city_fl").attr("value"); 1402 var limit_val=$(semiReference_path+" .limit_count").attr("value"); 1403 var total_count=$(semiReference_path+" .total_count").attr("value"); 1404 var new_limit=parseInt(limit_val)+3; 1405 var end_limit_diff=0; 1406 var condo_project_nids_val=$(semiReference_path+" .condo_project_nids_fl").attr("value"); 1407 var condo_project_sort_fl_val = $(semiReference_path+" .condo_project_sort_fl").attr("value"); 1408 if ($custom_active_li_limit && ($('body').hasClass('front') || $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 1409 if($custom_active_li_limit > 4 && limit_val >=24 && deviceSize > 770 && deviceSize <= 1070){ 1410 new_limit =parseInt(limit_val) + 6; 1411 var end_limit_diff = 6; 1412 } 1413 else{ 1414 $custom_limit = parseInt($custom_active_li_limit); 1415 new_limit =parseInt(limit_val) + $custom_limit; 1416 } 1417 } 1418 1419 var host = window.location.host; 1420 var http_or_https = window.location.protocol; 1421 $.ajax({
1422 url: http_or_https+'//'+host+"/featured_condo_loader", 1423 type:"get", 1424 data:{ 1425 ajax_mode:'on', 1426 listing_type:listing_fl, 1427 type_of_condo_listing:type_of_condo_listing_val, 1428 condo_builders_type:condo_builders_type_val, 1429 property_single_multiple:single_mul, 1430 property_display_val:property_display, 1431 condo_city:city, 1432 limit_val_start:limit_val, 1433 end_limit_val:end_limit_diff, 1434 condo_project_nids:condo_project_nids_val, 1435 condo_project_sort:condo_project_sort_fl_val 1436 }, 1437 dataType : "json", 1438 success: function(response) { 1439 if(response["html"]!=""){ 1440 $(fullReference_path+" ul").append(response["html"]); 1441 $(fullReference_path).jcarousel("reload"); 1442 $(semiReference_path+" .limit_count").attr("value",new_limit); 1443 //If the type of the listing is All or City based then only 300 properties will load 1444 if((new_limit==300 || new_limit ==304) && (source=='3' || source=='5')){ 1445 $(semiReference_path+" .response_end").attr("value",0); 1446 } 1447 if(check_theme_active_li_exist($listing_mode,$custom_active_li_limit)){ 1448 check_carousel_last_slide(fullReference_path,deviceSize,$custom_active_li_limit); 1449 } 1450 } 1451 else{ 1452 $(semiReference_path+" .response_end").attr("value",0); 1453 if(check_theme_active_li_exist($listing_mode,$custom_active_li_limit)){ 1454 check_carousel_last_slide(fullReference_path,deviceSize,$custom_active_li_limit); 1455 } 1456 } 1457 }, 1458 error: function(data, error) { 1459 } 1460 }); 1461 } 1462 } 1463} 1464 1465// Agents listings ajax callback function 1466function appendNew_carousel_agent_listings_item(no_of_loadProperty,fullReference_path,semiReference_path,carouselId,carouselObj,idleFlag_val) 1467{ 1468 var last_Index=carouselObj.index(carouselObj._last); // total element loaded in loaded index starting from 0 1469 var upcoming_visibel_elem= carouselObj.items().length-7; // position of first element in the last index carousel 1470 var response_end=$(semiReference_path+" .response_end").attr("value"); 1471 var idleFlag_val=$(semiReference_path+" .idleState").attr("value"); 1472 if(last_Index >= upcoming_visibel_elem){ 1473 if(idleFlag_val==1 && no_of_loadProperty >= 6 && response_end==1){ 1474 var sort_by_val = $(semiReference_path+" .sort_by").attr("value"); 1475 var order_by_val = $(semiReference_path+" .order_by").attr("value"); 1476 var limit_val=$(semiReference_path+" .limit_count").attr("value"); 1477 var total_count=$(semiReference_path+" .total_count").attr("value"); 1478 var new_limit=parseInt(limit_val)+3; 1479 var ajax_url = get_https_or_non_https_url('agent_listing_loader'); 1480 var agents_list_string_val = $(fullReference_path+" #broker_agent_list_aids").val(); 1481 $.ajax({ 1482 url: ajax_url, 1483 type:"get", 1484 data:{ 1485 ajax_mode:'on', 1486 agent_listing_sort:sort_by_val, 1487 agent_listing_order:order_by_val, 1488 limit_val_start:limit_val, 1489 agents_list_string:agents_list_string_val, 1490 }, 1491 dataType : "json", 1492 success: function(response) { 1493 if(response["html"]!=""){ 1494 $(fullReference_path+" ul").append(response["html"]); 1495 $(fullReference_path).jcarousel("reload"); 1496 $(semiReference_path+" .limit_count").attr("value",new_limit); 1497 //If the type of the listing is All or City based then only 300 properties will load 1498 if(new_limit==300 && (source=='3' || source=='5')){ 1499 $(semiReference_path+" .response_end").attr("value",0); 1500 } 1501 } 1502 else{ 1503 $(semiReference_path+" .response_end").attr("value",0); 1504 } 1505 }, 1506 error: function(data, error) { 1507 } 1508 }); 1509 } 1510 } 1511} 1512 1513function check_carousel_last_slide(fullReference_path,deviceSize,$group_by) { 1514 var $total_elements = ''; 1515 $total_elements = $(fullReference_path+" ul li").length; // total elements in carousel after ajax processed 1516 1517 if($group_by > 4){ // for theme12 1518 if (deviceSize <= 770){ 1519 $group_by = 4; 1520 } 1521 else if(deviceSize <= 1070){ 1522 $group_by = 6; 1523 } 1524 else{ 1525 $group_by = $group_by; 1526 } 1527 }else{ // for theme10
1528 if(deviceSize > 1300) $group_by = $group_by; else $group_by = 2; 1529 } 1530 1531 1532 $currentIndex = Math.ceil($total_elements / $group_by); // Last slide number of carousel 1533 $expected_elements = $currentIndex * $group_by; // what should be the elements on last slide (group of 4 or 2(Responsive slider)) 1534 $element_diff = $expected_elements - $total_elements; // how many element need more on last slide as a group of 4 1535 1536 if($element_diff != 0){ 1537 for(var i = 1; i <= $element_diff; i++) { 1538 $(fullReference_path+" ul").append('<li class="emptyLi"><div class="property_div clearfix"><a href="#" class="featured_multi_img_wrapper"></a></div></li>'); 1539 } 1540 $(fullReference_path).jcarousel('reload'); 1541 } 1542} 1543 1544function check_theme_active_li_exist($listing_mode,$custom_active_li_limit){ 1545 var $theme_active_li_flag = 0; 1546 if ($custom_active_li_limit != '' && $listing_mode != 3 && ($('body').hasClass('front') || 1547 $('body[class*="buy-homes-for-sale"] div').hasClass("widgets-featuredListings"))){ 1548 $theme_active_li_flag = 1; 1549 } 1550 return $theme_active_li_flag; 1551} 1552 1553function theme_process_active_li_4(semiReference_path,deviceSize){ 1554 1555 $(semiReference_path+" .jcarousel li").eq(0).addClass( "activeLi" ); 1556 $(semiReference_path+" .jcarousel li").eq(1).addClass( "activeLi"); 1557 1558 if(deviceSize > 1300){ 1559 $(semiReference_path+" .jcarousel li").eq(2).addClass( "activeLi" ); 1560 $(semiReference_path+" .jcarousel li").eq(3).addClass( "activeLi" ); 1561 } 1562 else{ 1563 $(semiReference_path+" a.jcarousel-control-prev").addClass('disable_prev'); 1564 } 1565 $(semiReference_path+" .jcarousel").on('jcarousel:targetin', 'li', function(event, carousel) { 1566 if(deviceSize <= 1300){ 1567 var slide_position_no = $(this).index(); 1568 1569 if(slide_position_no == 0){ // If user is on the first slide then prevent PREV link to click 1570 $(semiReference_path+" a.jcarousel-control-prev").addClass('disable_prev'); 1571 } 1572 else{ 1573 $(semiReference_path+" a.jcarousel-control-prev").removeClass('disable_prev'); 1574 } 1575 } 1576 1577 $(this).addClass('activeLi'); 1578 $(this).next().addClass('activeLi'); 1579 if(deviceSize > 1300){ 1580 $(this).next().next().addClass('activeLi'); 1581 $(this).next().next().next().addClass('activeLi'); 1582 } 1583 }); 1584 1585 $(semiReference_path+" .jcarousel").on('jcarousel:targetout', 'li', function() { 1586 $(this).removeClass('activeLi'); 1587 $(this).next().removeClass('activeLi'); 1588 if(deviceSize > 1300){ 1589 $(this).next().next().removeClass('activeLi'); 1590 $(this).next().next().next().removeClass('activeLi'); 1591 } 1592 }); 1593 1594} 1595 1596function theme_process_active_li_8(semiReference_path,deviceSize){ 1597 1598 $(semiReference_path+" .jcarousel li").eq(0).addClass( "activeLi" ); 1599 $(semiReference_path+" .jcarousel li").eq(1).addClass( "activeLi"); 1600 $(semiReference_path+" .jcarousel li").eq(2).addClass( "activeLi" ); 1601 $(semiReference_path+" .jcarousel li").eq(3).addClass( "activeLi"); 1602 1603 if(deviceSize >= 770 && deviceSize <=1070 ){ // 6 properties 1604 $(semiReference_path+" .jcarousel li").eq(4).addClass( "activeLi" ); 1605 $(semiReference_path+" .jcarousel li").eq(5).addClass( "activeLi"); 1606 } 1607 else if(deviceSize > 1070){ // 8 properties case - default case 1608 $(semiReference_path+" .jcarousel li").eq(4).addClass( "activeLi" ); 1609 $(semiReference_path+" .jcarousel li").eq(5).addClass( "activeLi"); 1610 $(semiReference_path+" .jcarousel li").eq(6).addClass( "activeLi" ); 1611 $(semiReference_path+" .jcarousel li").eq(7).addClass( "activeLi" ); 1612 } 1613 1614 $(semiReference_path+" .jcarousel").on('jcarousel:targetin', 'li', function(event, carousel) { 1615 $(this).addClass('activeLi'); 1616 $(this).next().addClass('activeLi'); 1617 $(this).next().next().addClass('activeLi'); 1618 $(this).next().next().next().addClass('activeLi'); 1619 1620 if(deviceSize >= 770 && deviceSize <=1070 ){ // 6 properties 1621 $(this).next().next().next().next().addClass('activeLi'); 1622 $(this).next().next().next().next().next().addClass('activeLi'); 1623 } 1624 else if(deviceSize > 1070){ // 8 properties 1625 $(this).next().next().next().next().addClass('activeLi'); 1626 $(this).next().next().next().next().next().addClass('activeLi'); 1627 $(this).next().next().next().next().next().next().addClass('activeLi'); 1628 $(this).next().next().next().next().next().next().next().addClass('activeLi'); 1629 } 1630 }); 1631
1632 $(semiReference_path+" .jcarousel").on('jcarousel:targetout', 'li', function() { 1633 $(this).removeClass('activeLi flipY'); 1634 $(this).next().removeClass('activeLi flipY'); 1635 $(this).next().next().removeClass('activeLi flipY'); 1636 $(this).next().next().next().removeClass('activeLi flipY'); 1637 1638 if(deviceSize >= 770 && deviceSize <=1070 ){ // 6 properties 1639 $(this).next().next().next().next().removeClass('activeLi flipY'); 1640 $(this).next().next().next().next().next().removeClass('activeLi flipY'); 1641 } 1642 else if(deviceSize > 1070){ // 8 properties 1643 $(this).next().next().next().next().removeClass('activeLi flipY'); 1644 $(this).next().next().next().next().next().removeClass('activeLi flipY'); 1645 $(this).next().next().next().next().next().next().removeClass('activeLi flipY'); 1646 $(this).next().next().next().next().next().next().next().removeClass('activeLi flipY'); 1647 } 1648 }); 1649} 1650 1651function get_https_or_non_https_url(link){ 1652 var https_or_http = window.location.protocol; 1653 if(https_or_http == 'https:'){ // if the domain registered with https: 1654 var host_url = https_or_http+'//'+location.host+'/'+link; 1655 } 1656 else{ 1657 var host_url = '/'+link+'/'; 1658 } 1659 return host_url; 1660} 1661function buildImageAltText(property, settings) { 1662 var parts = [ 1663 property.Address, 1664 property.City, 1665 property.State, 1666 property.Country, 1667 property.listingType, 1668 property.searchType 1669 ]; 1670 1671 var seoAlt = parts.map(function(val) { 1672 return (typeof val === 'string') ? val.trim() : ''; 1673 }).filter(function(val) { 1674 return val.length > 0; 1675 }).join(' '); 1676 1677 var agentName = settings.agent_name.trim(); 1678 var partnerAgentName = settings.partner_agent_name.trim(); 1679 1680 if (agentName && partnerAgentName) { 1681 seoAlt += ' - ' + agentName + ' and ' + partnerAgentName; 1682 } else if (agentName) { 1683 seoAlt += ' - ' + agentName; 1684 } 1685 seoAlt += ', ' + settings.office_name; 1686 return seoAlt; 1687}
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.