1$(document).ready(function () { 2 $('body').addClass('js-loaded'); 3 4 if (window.location.href.indexOf('liberty')) { 5 function hideAutoComplete(container, dropdown) { 6 function hideElement() { 7 $(dropdown).css('display', 'none'); 8 } 9 $(container).on('scroll', hideElement); 10 } 11 hideAutoComplete('.content', '.k-animation-container'); 12 } 13 14if (window.location.href.indexOf('amana-hac') >= 0) { 15 16 // Check if the changes have already been applied 17 if (!$(".navigation li.has-sub a").text().includes("Products & Services")) { 18 19 $(".navigation li.has-sub a").text(function() { 20 return $(this).text().replace("Products", "Products & Services"); 21 }); 22 23 $(".breadcrumb a.rsmLink").text(function() { 24 return $(this).text().replace("Products", "Products & Services"); 25 }); 26 27 $(".page-subheadline h1").html(function() { 28 return $(this).html().replace("Products", "Products & Services"); 29 }); 30 31 // Create the new list item with the link 32 var newLink = '<li><a href="https://r32ready.com" target="_blank">R-32 Ready</a></li>'; 33 34 // Find the "HVAC Learning Center" link using a relative URL 35 var targetLink = $('.sub-menu.mobile-drop ul.col-1 li a[href$="/resources/hvac-learning-center"]'); 36 37 // Insert the new link after the target link's parent <li> 38 targetLink.parent().before(newLink); 39 } 40} 41 if (window.location.href.indexOf('directcomforthvac')) { 42 function hideElement() { 43 $('.k-animation-container').css('display', 'none'); 44 } 45 46 function onCloseBtn(closeIcon) { 47 $(closeIcon).on('click', hideElement); 48 } 49 onCloseBtn('.k-icon'); 50 } 51 52 53 /* To fix height of product tiles */ 54 function fixWrapHeight(elementToFix) { 55 var resolution = $(document).width(); 56 if (resolution > 767) { 57 var fixElements = document.getElementsByClassName(elementToFix); 58 var maxHeight = 0; 59 for (var i = 0; i < fixElements.length; i++) { 60 if (fixElements[i].offsetHeight > maxHeight) { 61 maxHeight = fixElements[i].offsetHeight; 62 } 63 } 64 for (var j = 0; j < fixElements.length; j++) { 65 if (fixElements[j].offsetHeight > 1) { 66 fixElements[j].style.minHeight = maxHeight + 1 + "px"; 67 fixElements[j].style.maxHeight = maxHeight + "px"; 68 } 69 } 70 window.onresize = function () { 71 var fixElements = document.getElementsByClassName(elementToFix); 72 var maxHeight = 0; 73 for (var i = 0; i < fixElements.length; i++) { 74 if (fixElements[i].offsetHeight > maxHeight) { 75 maxHeight = fixElements[i].offsetHeight; 76 } 77 } 78 for (var j = 0; j < fixElements.length; j++) { 79 if (fixElements[j].offsetHeight > 1) { 80 fixElements[j].style.minHeight = maxHeight + 1 + "px"; 81 fixElements[j].style.maxHeight = maxHeight + "px"; 82 } 83 } 84 } 85 } 86 } 87 // fixWrapHeight("gm-product"); 88 /* End To fix height of product tiles */ 89 90 Initialize(); 91 InitializeGoodman(); 92 // LoadHomeBanner(); 93 searchresultorderlist(); 94 SearchInputFocus(); 95 $("#btnfdsearch").click(function () { 96 zipcode_tracking(); 97 }); 98 99 function zipcode_tracking() { 100 zip = $("#txtfdsearch").val(); 101 if (zip != "") { 102 ga('send', 'event', 'findadelear-homepage', 'click', zip); 103 } 104 } 105 $(".popUp-link").click(function () { 106 $("#To").attr("maxlength", "50"); 107 $("#From").attr("maxlength", "50"); 108 $("#Subject").attr("maxlength", "100"); 109 $("#Message").attr("maxlength", "1000"); 110 });
111 112 113 $(".navigation ul li").find("a").each(function () { 114 var $this = $(this); 115 var current = location.pathname; 116 117 if ($this.attr('href').indexOf(current) !== -1 && location.pathname !== "/") { 118 119 if ($(this).parent().hasClass("has-sub")) { 120 $(this).parent().addClass("menuselected"); 121 } 122 123 } 124 }); 125 126 127 $(".navigation ul.sub-menu li").find("a").each(function () { 128 129 var $this = $(this); 130 var current = location.pathname; 131 132 133 134 if ($this.attr('href').indexOf(current) !== -1 && location.pathname !== "/") { 135 136 $(this).parents(".navigation ul li.has-sub").addClass("menuselected"); 137 138 if ($(this).parent().hasClass("has-sub")) { 139 console.log($(this).parents); 140 141 $(this).parent().addClass("sub-menu-selector"); 142 143 144 145 146 } 147 148 } 149 }); 150 151 152 function getParameterByName(name, url) { 153 if (!url) url = window.location.href; 154 name = name.replace(/[\[\]]/g, "\\$&"); 155 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), 156 results = regex.exec(url); 157 if (!results) return null; 158 if (!results[2]) return ''; 159 return decodeURIComponent(results[2].replace(/\+/g, " ")); 160 } 161 if (location.pathname.split("/")[2] == "hvac-learning-center") { 162 var data = getParameterByName('param1'); 163 var data1 = getParameterByName('param2'); 164 if (data != null) { 165 window.history.pushState("", "", "/resources/hvac-learning-center/" + data); 166 $(".top-nav").find("a").each(function () { 167 var link = $(this)[0].href; 168 var changed_link = link.replace("resources/hvac-learning-center/?param1=" + location.pathname.split("/")[3], ""); 169 $(this)[0].href = changed_link; 170 }); 171 } else { 172 if (location.pathname.split("/")[3] != "") { 173 $(".top-nav").find("a").each(function () { 174 var link = $(this)[0].href; 175 var changed_link = link.replace("resources/hvac-learning-center/?param1=" + location.pathname.split("/")[3], ""); 176 $(this)[0].href = changed_link; 177 }); 178 } 179 if (location.pathname.split("/")[3] != "" && location.pathname.split("/")[4] != "") { 180 $(".top-nav").find("a").each(function () { 181 var link = $(this)[0].href; 182 var changed_link = link.replace("¶m2=" + location.pathname.split("/")[4], ""); 183 $(this)[0].href = changed_link; 184 }); 185 } 186 } 187 if (data != null && data1 != null) { 188 $(".top-nav").find("a").each(function () { 189 var link = $(this)[0].href; 190 var changed_link = link.replace("resources/hvac-learning-center/?param1=" + location.pathname.split("/")[3] + "/" + location.pathname.split("/")[4], ""); 191 $(this)[0].href = changed_link; 192 }); 193 } 194 } 195 if (location.pathname.split("/")[1] == "blogs") { 196 var data = getParameterByName('param1'); 197 var data1 = getParameterByName('param2'); 198 if (data != null) { 199 window.history.pushState("", "", "/blogs/" + data); 200 $(".top-nav").find("a").each(function () { 201 var link = $(this)[0].href; 202 var changed_link = link.replace("blogs/?param1=" + location.pathname.split("/")[2], ""); 203 $(this)[0].href = changed_link; 204 }); 205 $(".navigation").find("a").each(function () { 206 var link = $(this)[0].href; 207 var changed_link = link.replace("blogs/?param1=" + location.pathname.split("/")[2], ""); 208 $(this)[0].href = changed_link; 209 }); 210 } else { 211 if (location.pathname.split("/")[2] != "") { 212 $(".top-nav").find("a").each(function () { 213 var link = $(this)[0].href; 214 var changed_link = link.replace("blogs/?param1=" + location.pathname.split("/")[2], ""); 215 $(this)[0].href = changed_link; 216 }); 217 $(".navigation").find("a").each(function () { 218 var link = $(this)[0].href; 219 var changed_link = link.replace("blogs/?param1=" + location.pathname.split("/")[2], ""); 220 $(this)[0].href = changed_link; 221 }); 222 } 223 if (location.pathname.split("/")[2] != "" && location.pathname.split("/")[3] != "") { 224 $(".top-nav").find("a").each(function () { 225 var link = $(this)[0].href; 226 var changed_link = link.replace("¶m2=" + location.pathname.split("/")[3], ""); 227 $(this)[0].href = changed_link; 228 }); 229 $(".navigation").find("a").each(function () { 230 var link = $(this)[0].href; 231 var changed_link = link.replace("¶m2=" + location.pathname.split("/")[3], ""); 232 $(this)[0].href = changed_link; 233 }); 234 } 235 } 236 if (data != null && data1 != null) { 237 $(".top-nav").find("a").each(function () { 238 var link = $(this)[0].href; 239 var changed_link = link.replace("blogs/?param1=" + location.pathname.split("/")[2] + "/" + location.pathname.split("/")[3], ""); 240 $(this)[0].href = changed_link; 241 }); 242 $(".navigation").find("a").each(function () { 243 var link = $(this)[0].href; 244 var changed_link = link.replace("blogs/?param1=" + location.pathname.split("/")[2] + "/" + location.pathname.split("/")[3], ""); 245 $(this)[0].href = changed_link; 246 }); 247 } 248 } 249 if (location.pathname.split("/")[1] == "products") { 250 var data = getParameterByName('param1'); 251 var data2 = getParameterByName('param2'); 252 var data3 = getParameterByName('param3'); 253 if (data != null && data2 == null && data3 == null) { 254 window.history.pushState("", "", "/products/" + data); 255 } else if (data != null && data2 != null && data3 == null) { 256 window.history.pushState("", "", "/products/" + data + "/" + data2); 257 } else if (data != null && data2 != null && data3 != null) { 258 window.history.pushState("", "", "/products/" + data + "/" + data2 + "/" + data3); 259 } else { } 260 } 261 if (location.pathname.split("/")[1] == "faq") { 262 var data = getParameterByName('param1'); 263 var data2 = getParameterByName('param2'); 264 var data3 = getParameterByName('param3'); 265 if (data != null && data2 == null && data3 == null) { 266 window.history.pushState("", "", "/faq/" + data); 267 } else if (data != null && data2 != null && data3 == null) { 268 window.history.pushState("", "", "/faq/" + data + "/" + data2); 269 } else if (data != null && data2 != null && data3 != null) { 270 window.history.pushState("", "", "/faq/" + data + "/" + data2 + "/" + data3); 271 } else { } 272 } 273}); 274//$(window).on('load', function(){ 275// LoadHomeBanner(); 276//}); 277var Initialize = function () { 278 if ($("#copyrightyear").length > 0) { 279 $("#copyrightyear").html(new Date().getFullYear()); 280 } 281 if (navigator.userAgent.indexOf("MSIE") == -1) { 282 if ($("img").length > 0) { 283 $("img").attr("width", "auto"); 284 $("img").attr("height", "auto"); 285 } 286 } 287 $(".navigation ul li a").each(function (i, item) { 288 if (item.text == "Energy Rebates") { 289 $(item).attr("target", "blank"); 290 } 291 });
292 $(".sfsearchTxt").attr("placeholder", "SEARCH"); 293 $(".top-search .search .sfsearchTxt").attr("placeholder", "Search"); 294 $("#body_C009_ctl00_ctl00_ctl02_C016_ctl00_ctl00_textBox_write").attr("placeholder", "Name"); 295 $("#body_C009_ctl00_ctl00_ctl02_C026_ctl00_ctl00_textBox_write").attr("placeholder", "Email Address"); 296 $("#body_C009_ctl00_ctl00_ctl03_C024_ctl00_ctl00_textBox_write").attr("placeholder", "Phone Number"); 297 $("#body_C009_ctl00_ctl00_ctl03_C025_ctl00_ctl00_textBox_write").attr("placeholder", "Mobile Number"); 298 $("#body_C009_ctl00_ctl00_C032_ctl00_ctl00_textBox_write").attr("placeholder", "Message"); 299 var searchurl = window.location.href.toLowerCase(); 300 $('.toggle-icon').on('click', onToggleClick); 301 302 function onToggleClick(e) { 303 $('.top-menu').toggle(); 304 $('.top-nav').toggle(); 305 $('.header').toggleClass("abfix"); 306 var element = $('.search-dealer .sf_2cols_2_50').detach(); 307 $('.mm-panels div:eq(0)').append(element); 308 $('.top-search').removeClass('open'); 309 $("#overlay").remove(); 310 $('.top-search-amana').toggleClass('open'); 311 } 312 $('.review-toggle-icon').on('click', function (e) { 313 $('.product-energy').toggle(); 314 }); 315 var isToggleAdded = false; 316 317 function checkWidth() { 318 var width = $(document).width(); 319 if (width <= 1024) { 320 if (!isToggleAdded) { 321 $('#accordian li.has-sub div').on('click', onSubMenuDropClick); 322 isToggleAdded = true; 323 } 324 } 325 } 326 checkWidth(); 327 $(window).resize(function () { 328 checkWidth(); 329 }); 330 331 function onSubMenuDropClick(e) { 332 var element = $(this).parent('li'); 333 if (element.hasClass('open')) { 334 element.removeClass('open'); 335 element.find('li').removeClass('open'); 336 element.find('ul.mobile-drop').slideUp(); 337 } else { 338 element.addClass('open'); 339 element.children('ul.mobile-drop').slideDown(); 340 element.siblings('li').children('ul.mobile-drop').slideUp(); 341 element.siblings('li').removeClass('open'); 342 element.siblings('li').find('li').removeClass('open'); 343 element.siblings('li').find('ul.mobile-drop').slideUp(); 344 } 345 } 346 var headerHeight = $(".header").height(); 347 $('.alphabet a[href*=\\#]').on("click", function (e) { 348 var target = $(this).attr("href"); 349 var scrollToPosition = $(target).offset().top - headerHeight; 350 $('html,body').animate({ 351 scrollTop: scrollToPosition 352 }, 600, function (target) { 353 window.location.hash = target; 354 }); 355 e.preventDefault(); 356 }); 357 var widthredline = $('.content h1:first-of-type ').width(); 358 var totalwidth = widthredline + 180; 359 $('.red-line-bottom-right').css("width", totalwidth); 360 361 function close_accordion_section() { 362 jQuery('.cf-accordion .cf-accordion-section-title').removeClass('active'); 363 jQuery('.cf-accordion .cf-accordion-section-content').slideUp(300).removeClass('open'); 364 } 365 jQuery('.cf-accordion-section-title').click(function (e) { 366 var currentAttrValue = jQuery(this).attr('href'); 367 if (jQuery(e.target).is('.active')) { 368 close_accordion_section(); 369 } else { 370 close_accordion_section(); 371 var hdheight = $('.header').outerHeight(); 372 var acheight = $(this).outerHeight(); 373 jQuery(this).addClass('active'); 374 jQuery('.cf-accordion ' + currentAttrValue).slideDown(300).addClass('open'); 375 } 376 e.preventDefault(); 377 }); 378} 379var searchresultorderlist = function () { 380 var strurl = window.location.href; 381 if (strurl.indexOf("search") != -1 && strurl.indexOf("indexCatalogue")) { 382 var pageindex = strurl.indexOf("page"); 383 var questionindex = strurl.indexOf("?"); 384 var substr = strurl.substring(pageindex, questionindex); 385 var currentpage = substr.replace("page/", ""); 386 var pagesize = 10; 387 var startnumber = (pagesize * currentpage) - pagesize; 388 if (pageindex != -1) { 389 startnumber = startnumber + 1; 390 } else { 391 startnumber = 1; 392 } 393 $("ol").attr("start", startnumber) 394 } 395} 396// var LoadHomeBanner = function() { 397// if ($('#banner-fade .bjqs-wrapper .bjqs-slide').length > 3) { 398// $('#banner-fade').bjqs({
399// responsive : true, 400// centercontrols : true, 401// showmarkers : true, 402// keyboardnav : true, 403// automatic : true 404// }); 405// } else { 406// $('#banner-fade').bjqs({ 407// responsive : true, 408// centercontrols : false, 409// showmarkers : false, 410// keyboardnav : false, 411// automatic : false 412// }); 413// } 414// if ($('#pbanner-fade').length > 0) { 415// $('#pbanner-fade').bjqs({ 416// responsive: true 417// }); 418// } 419// } 420var SearchInputFocus = function () { 421 $(".search-products-btn .sfsearchTxt").attr("placeholder", "Search Products"); 422 $('.search-products-btn input:text').bind('focus blur', function () { 423 $('.search-products-btn .sfsearchSubmit').toggleClass('inputfocusbg'); 424 }); 425 $('.list-search-products input:text').bind('focus blur', function () { 426 $('.list-search-products input:submit').toggleClass('inputfocusbg'); 427 }); 428 var winwidth = $(document).width(); 429 $(".top-search .sfsearchTxt").attr("placeholder", "Search Goodman"); 430 $("#franklin .top-search .sfsearchTxt").attr("placeholder", "Search Franklin"); 431 $("#cleancomfort .top-search .sfsearchTxt").attr("placeholder", "Search CleanComfort"); 432 $("#liberty .top-search .sfsearchTxt").attr("placeholder", "Search LibertyHVAC"); 433 $(".top-search-amana .sfsearchTxt").attr("placeholder", "Search"); 434 $(".gm-static-body .sfsearchTxt").attr("placeholder", "Search Goodman"); 435 $("#franklin .gm-static-body .sfsearchTxt").attr("placeholder", "Search Franklin"); 436 $('.search-icon').click(function (e) { 437 $('.top-search').toggleClass('open'); 438 $('.top-search-amana').toggleClass('open'); 439 $(this).toggleClass('sicon'); 440 if (winwidth > 1024) { 441 if ($(this).hasClass('sicon')) { 442 e.stopPropagation(); 443 var docHeight = $(document).height(); 444 $("body").append("<div id='overlay'></div>"); 445 $("#overlay").height(docHeight).css({ 446 'opacity': 0.4, 447 'position': 'absolute', 448 'top': 0, 449 'left': 0, 450 'background-color': 'black', 451 'width': '100%', 452 'z-index': 5000 453 }); 454 } else { 455 $("#overlay").remove(); 456 } 457 } 458 }); 459 460 $('body').on('click', '.k-icon', function () { 461 $(this).parents('.top-search').removeClass('open'); 462 $(this).parents('.top-search-amana').removeClass('open'); 463 $("#overlay").remove(); 464 $('.search-icon').toggleClass('sicon'); 465 $('.k-animation-container #header_TA575B027021_ctl00_ctl00_searchTextBox-list').css('display', 'none'); 466 $('.k-animation-container #Header_TDCDFA5FD002_ctl00_ctl00_searchTextBox-list').css('display', 'none'); 467 }); 468 setTimeout(function () { 469 $('.sfsearchBox span.k-icon').on('click', function () { 470 $('.k-animation-container').hide(); 471 }); 472 }, 0); 473 if (winwidth > 1024) { 474 var linkHover = false; 475 $(".top-nav > ul > li").mouseenter(function (e) { 476 if ($('body').find($('#overlay')).height() == null) { 477 e.stopPropagation(); 478 var docHeight = $(document).height(); 479 $("body").append("<div id='overlay'></div>"); 480 $("#overlay").height(docHeight).css({ 481 'opacity': 0.4, 482 'position': 'absolute', 483 'top': 0, 484 'left': 0, 485 'background-color': 'black', 486 'width': '100%', 487 'z-index': 5000 488 }); 489 linkHover = true; 490 } 491 //console.log($(this)); 492 }).mouseleave(function () { 493 if (linkHover == true) { 494 $("#overlay").remove(); 495 linkHover = false; 496 } 497 }); 498 499 } 500} 501 502// document.getElementsByClassName('content')[0].onscroll = function () { 503// $('.k-animation-container').hide(); 504// } 505 506loadJS = function (src) { 507 var jsLink = $("<script type='text/javascript' src='" + src + "'>"); 508 $("head").append(jsLink); 509}; 510var InitializeGoodman = function () { }; 511var productgoodmanmfgsearch = function () { 512 if ($(".list-search-products").length > 0 || $(".search-result-sbox").length > 0) { 513 var searchdata = $("#txtproductsearch").val(); 514 if (searchdata == null || searchdata == "") { 515 searchdata = $("#txtproductsearch2").val(); 516 } 517 if (!window.location.origin) { 518 window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : ''); 519 } 520 if (searchdata.length > 0) { 521 var url = location.origin + "/searchresult?indexCatalogue=productsgoodmanmfg&searchQuery=" + searchdata + "&wordsMode=0"; 522 location.href = url; 523 } 524 } 525}; 526var productsfranklinhvac = function () { 527 if ($(".list-search-products").length > 0) { 528 var searchdata = $("#txtproductsearch").val(); 529 if (!window.location.origin) { 530 window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : ''); 531 } 532 if (searchdata.length > 0) { 533 var url = location.origin + "/searchresult?indexCatalogue=productsfranklinhvac&searchQuery=" + searchdata + "&wordsMode=0"; 534 location.href = url; 535 } 536 } 537}; 538var productscleancomfort = function () { 539 if ($(".list-search-products").length > 0) { 540 var searchdata = $("#txtproductsearch").val(); 541 if (!window.location.origin) { 542 window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : ''); 543 } 544 if (searchdata.length > 0) { 545 var url = location.origin + "/searchresult?indexCatalogue=cctproductsearch&searchQuery=" + searchdata + "&wordsMode=0"; 546 location.href = url; 547 } 548 } 549}; 550var productslibertyhvac = function () { 551 if ($(".list-search-products").length > 0) { 552 var searchdata = $("#txtproductsearch").val(); 553 if (!window.location.origin) { 554 window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : ''); 555 } 556 if (searchdata.length > 0) { 557 var url = location.origin + "/searchresult?indexCatalogue=libertyproductsearch&searchQuery=" + searchdata + "&wordsMode=0"; 558 location.href = url; 559 } 560 } 561}; 562var learninggoodmanmfgsearch = function () { 563 if ($(".list-search-products").length > 0) { 564 var searchdata = $("#txtproductsearch2").val(); 565 if (!window.location.origin) { 566 window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : ''); 567 } 568 if (searchdata.length > 0) { 569 var url = location.origin + "/searchresult?indexCatalogue=learningcentersearch&searchQuery=" + searchdata + "&wordsMode=0"; 570 location.href = url; 571 } 572 } 573}; 574var bloggoodmanmfgsearch = function () { 575 if ($(".search-result-sbox").length > 0) { 576 var searchdata = $("#txtproductsearch2").val(); 577 if (!window.location.origin) { 578 window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : ''); 579 } 580 if (searchdata.length > 0) { 581 var url = location.origin + "/searchresult?indexCatalogue=blogsearch&searchQuery=" + searchdata + "&wordsMode=0"; 582 location.href = url; 583 } 584 } 585}; 586var blogamanasearch = function () { 587 // if ($(".search-result-sbox").length > 0) { 588 var searchdata = $("#txtproductsearch2").val(); 589 if (!window.location.origin) { 590 window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : ''); 591 } 592 if (searchdata.length > 0) { 593 var url = location.origin + "/searchresult?indexCatalogue=amanablogsearch&searchQuery=" + searchdata + "&wordsMode=0"; 594 location.href = url; 595 } 596 // } 597}; 598var faqsearch = function () { 599 if ($(".faq-search-box").length > 0) { 600 var searchdata = $("#txtfaqsearch").val(); 601 if (!window.location.origin) { 602 window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : ''); 603 } 604 if (searchdata.length > 0) { 605 var indexcatalogue = GetFaqSearchIndexcatalogue(); 606 var url = location.origin + "/searchresult?indexCatalogue=" + indexcatalogue + "&searchQuery=" + searchdata + "&wordsMode=0"; 607 location.href = url; 608 } 609 } 610}; 611var GetFaqSearchIndexcatalogue = function () { 612 var site = $("#site").text(); 613 if (site == "amanahac") 614 return ("faqsearch"); 615 if (site == "ptac") 616 return ("faqptacsearch"); 617 if (site == "goodmanmfg") 618 return ("faqgoodmanmfgsearch"); 619 if (site == "franklinhvac") 620 return ("faqfranklinhvacsearch"); 621 if (site == "libertyhvac") 622 return ("libertyfaqsearch"); 623}; 624$(document).ajaxError(function (e, jqXHR, ajaxSettings, thrownError) { 625 if (jqXHR.status === 0 || jqXHR.readyState === 0) { 626 console.log("error"); 627 } 628}); 629 630$(document).ready(function () { 631 // Normalize mmenu links after menu renders (delay for dynamic build) 632 setTimeout(function () { 633 var path = window.location.pathname || ""; 634 if (!(path.indexOf("/resources/hvac-learning-center") === 0 || path.split("/")[2] === "hvac-learning-center")) return; 635 $('a').each(function () { 636 var $a = $(this), href = $a.attr('href'), target = $a.attr('data-target'); 637 if (target && /^#mm-/.test(target)) { 638 $a.attr('href', target); 639 return; 640 } 641 if (href && href.indexOf('#mm-') > -1) { 642 $a.attr('href', href.substring(href.indexOf('#mm-'))); 643 } 644 }); 645 }, 1000); 646}); 647 648function updateHeight() { 649 var headerHeight = $(".header").height(); 650 var footerHeight = $(".footer").height(); 651 var height = window.innerHeight - (headerHeight + footerHeight); 652 $('.content').css('min-height', height); 653} 654updateHeight(); 655$(window).on('resize', updateHeight); 656 657$(document).ready(function () { 658 var offset = 150; // Height of the fixed element 659 // Change color of active link on scroll 660 $(window).on('scroll', function () { 661 var scrollPos = $(document).scrollTop() + offset; // Adjust scroll position for sticky bar 662 $('.inpage-scroll-links a').each(function () { 663 var currLink = $(this); 664 var refElement = $(currLink.attr('href')); 665 666 // Ensure the element exists to avoid errors 667 if (refElement.length) { 668 if (refElement.position().top <= scrollPos && refElement.position().top + refElement.height() > scrollPos) { 669 $('.inpage-scroll-links a').removeClass('active'); 670 currLink.addClass('active'); 671 } else { 672 currLink.removeClass('active'); 673 } 674 } 675 }); 676 });
677 // Smooth scrolling with offset adjustment 678 $('.inpage-scroll-links a').on('click', function (e) { 679 e.preventDefault(); 680 var target = this.hash; 681 var $target = $(target); 682 683 $('html, body').stop().animate({ 684 'scrollTop': $target.offset().top - 120 685 }, 900, 'swing'); 686 }); 687 688 // Make links sticky 86px from the top 689 var offsetTop = 86; 690 var $inpageLinks = $('.inpage-scroll-links'); 691 692 // Check if the element exists 693 if ($inpageLinks.length) { 694 var inpageLinksOffset = $inpageLinks.offset().top; 695 696 $(window).on('scroll', function () { 697 if ($(window).scrollTop() > (inpageLinksOffset - offsetTop)) { 698 $inpageLinks.addClass('fixed'); 699 } else { 700 $inpageLinks.removeClass('fixed'); 701 } 702 }); 703 } else { 704 console.warn('Element .inpage-scroll-links not found.'); 705 } 706 707 708 // Show or hide the button when scrolling 709 $(window).scroll(function () { 710 if ($(this).scrollTop() > 1200) { // Show after scrolling down 500px 711 $('#scrollTopBtn').fadeIn(); 712 } else { 713 $('#scrollTopBtn').fadeOut(); 714 } 715 }); 716 717 // Scroll to top when button is clicked 718 $('#scrollTopBtn').click(function () { 719 $('html, body').animate({ scrollTop: 0 }, 800); // Scroll to top over 800ms 720 return false; 721 }); 722 723 // Check if the element with class 'productfeatured-image' is present 724 if ($('.productfeatured-image').length > 0) { 725 // Add the 'extra-spacing' class to elements with class 'Products-wrap' 726 // Check if the element with class 'productfeatured-image' is present 727if ($('.productfeatured-image').length > 0) { 728 // Add the 'extra-spacing' class 729 $('.product-comparison-button-wrapper').addClass('extra-spacing'); 730 $('.compare-error-container').addClass('extra-spacing'); 731 732 // Check if .product-comparison-button-wrapper is NOT in the DOM 733 if ($('.product-comparison-button-wrapper').length === 0) { 734 $('.Products-wrap').addClass('extraspacing-no-compare-buttons'); 735 $('.products-wrap').addClass('extraspacing-no-compare-buttons'); 736 $('.compare-error-container').addClass('extraspacing-no-compare-buttons'); 737 } 738} 739 } 740 741}); 742 743 744$(document).ready(function () { 745 // Use a timer to check if the menu has been initialized 746 let checkMenu = setInterval(function () { 747 // Ensure the menu items are present 748 if ($('.sfNavHorizontalDropDown li').length > 0) { 749 // Loop through each list item 750 $('.sfNavHorizontalDropDown li').each(function () { 751 // Check if there is a child ul with the 'mobile-drop' class 752 if ($(this).find('ul.mobile-drop').length > 0) { 753 // Add the 'has-sub' class to the anchor tag within the list item 754 $(this).children('a').addClass('has-sub'); 755 } 756 }); 757 // Clear the interval once the operation is complete 758 clearInterval(checkMenu); 759 } 760 }, 100); // Check every 100 milliseconds 761});
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.