https://www.weyerhaeuser.com/packages/weyerhaeuser_theme_2017/themes/weyerhaeuser_theme/js/script.js
1var prowess = { 2 Common: null, 3 Home: null, 4 5 init: function() { 6 // js based on URI segment 7 var uri = document.location.pathname.split('/'); 8 9 /*if (uri[1] == '' || uri[1] == null) { 10 // fire if homepage 11 //prowess.Home.init(); 12 }*/ 13 // global scripts 14 prowess.Common.init(); 15 } 16 17}; 18 19prowess.Common = { 20 21 // instantiate scripts 22 init: function() { 23 // only trigger if not mobile device 24 /*if (!(/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent))) { 25 26 }*/ 27 // // prowess.Common.prowessFancybox(); 28 29 prowess.Common.prowessAnimateNav(); 30 31 // // prowess.Common.prowessPopUpFooter(); 32 33 prowess.Common.prowessRelocateMenu(); 34 prowess.Common.prowessAutoNavProOverrides(); 35 prowess.Common.prowessRepositionElements(); 36 prowess.Common.prowessBusinessNav(); 37 38 // // prowess.Common.prowessBackToTop(); 39 40 prowess.Common.prowessContentMargin(); 41 prowess.Common.prowessMainNavOverflow(); 42 prowess.Common.prowessSmoothScroll(); 43 prowess.Common.prowessHoneypot(); 44 prowess.Common.prowessScrollingSidebar(); 45 prowess.Common.prowessCenterModals(); 46 prowess.Common.prowessFullScreenModal(); 47 prowess.Common.prowessPageTitles(); 48 prowess.Common.prowessContainLayouts(); 49 prowess.Common.prowessMapSectorLegend(); 50 prowess.Common.searchAutosuggest(); 51 prowess.Common.prowessDisableSpellcheck(); 52 prowess.Common.prowessStickyButtom(); 53 }, 54 55 // Fancybox 56 // prowessFancybox: function() { 57 58 // // adding fancybox functionality to links using class 59 // $(".fancybox a").fancybox(); 60 // $("a.fancybox").fancybox(); 61 62 // $("a#inline").fancybox({ 63 // 'hideOnContentClick': true 64 // }); 65 66 // // Apply fancybox to multiple items 67 // $("a.group").fancybox({ 68 // 'transitionIn': 'elastic', 69 // 'transitionOut': 'elastic', 70 // 'speedIn': 600, 71 // 'speedOut': 200, 72 // 'overlayShow': false 73 // }); 74 75 // }, // End Fancybox 76 77 // Animates main mobile navigation in from right to left 78 prowessAnimateNav: function() { 79 80 var action = 1; // Start button click counter at one 81 82 $('.pronav_btn_navbar').on("click", animateNav); // Fire animateNav function when mobile nav button is clicked 83 84 function animateNav() { 85 86 var currentPath = $('.mobile-inner').find('.nav-path-selected'), 87 currentPage = $(currentPath).find('.nav-selected'), 88 pageParentIcon = $(currentPage).parents('ol.sublvl').siblings('i.activate-dropdown'); 89 90 if (action == 1) { // Everytime menu opens, animate width to 2/3 width of screen 91 92 $('.mobile-inner').animate({ 93 width: '75%' 94 }, 250, function() { 95 // Animation complete. 96 }); 97 action = 2; 98 99 $(currentPath).addClass('open'); // Open mobile nav to current page when nav is opened 100 $(pageParentIcon).removeClass('fa-plus').addClass('fa-minus'); // Toggle parent dropdown plus/minus icon 101 102 // Check to see if currentPage has a dropdown. If it does, remove open class 103 if ($(currentPage).hasClass('nav-dropdown')) { 104 $(currentPage).removeClass('open'); 105 } 106 107 } else { // Everytime menu closes, animate width back to 0 108 109 $('.mobile-inner').animate({ 110 width: 0 111 }, 250, function() { 112 // Animation complete. 113 }); 114 action = 1; 115 116 $(pageParentIcon).removeClass('fa-minus').addClass('fa-plus'); // Toggle parent dropdown plus/minus icon 117 118 } 119 120 } 121 122 }, 123 124 // Pop Up Footer 125 // prowessPopUpFooter: function() { 126 127 // var menuBottom = document.getElementById('pop-menu-footer'), 128 // showBottom = document.getElementById('showBottom'), 129 // body = document.body; 130
131 // showBottom.onclick = function() { 132 // classie.toggle(this, 'active'); 133 // classie.toggle(menuBottom, 'pop-menu-open'); 134 135 // // Fix sitemap button to top of Footer */ 136 // $(this).toggleClass('fix'); 137 138 // // Change direction of arrow by adding arrow-down class */ 139 // $('#showBottom').toggleClass('arrow-down'); 140 141 // // Toggle button text on click 142 // $(this).text(function(i, v) { 143 // return v === 'View Sitemap' ? 'Minimize Sitemap' : 'View Sitemap' 144 // }); 145 146 // disableOther('showBottom'); 147 // }; 148 149 // function disableOther(button) { 150 // if (button !== 'showBottom') { 151 // classie.toggle(showBottom, 'disabled'); 152 // } 153 // } 154 155 // }, // End Pop Up Footer 156 157 // Sticky Business Nav 158 prowessBusinessNav: function() { 159 160 function stickBusinessNav() { 161 162 if ($('#sticky-anchor').length) { // if a company nav is found on the page... 163 164 var windowTop = $(window).scrollTop(), 165 navHeight = $('#company-nav-row').outerHeight(), // height of navbar 166 stickyAnchor = $('#sticky-anchor'), 167 anchorTop = $(stickyAnchor).offset().top; 168 169 // Stick company nav to top of page once top of company nav hits top of page 170 if (windowTop > anchorTop) { 171 $('#company-nav-row').addClass('stick'); // fix header
172 $(stickyAnchor).css('height', navHeight); // prevent content from jumping under nav 173 } else { 174 $('#company-nav-row').removeClass('stick'); 175 $(stickyAnchor).css('height', 'auto'); 176 } 177 178 } 179 180 } 181 $(window).scroll(stickBusinessNav); // Fire function when page is scrolled 182 183 // Shorten text of button in Business nav when screen is smaller than 1200px 184 $(document).ready(function() { 185 186 var $window = $(window); 187 var searchButton = $('.property-search-modal>button'); 188 189 function buttonText() { 190 var windowsize = $window.width(); 191 if (windowsize <= 1200) { 192 $(searchButton).html('More Properties'); 193 } else { 194 $(searchButton).html('Search More Properties'); 195 } 196 } 197 // Execute on load 198 buttonText(); 199 // Bind event listener 200 $(window).resize(buttonText); 201 }); 202 203 204 }, // End Sticky Business Nav 205 206 // Relocate main nav and button for mobile 207 prowessRelocateMenu: function() { 208 209 $(document).ready(relocate); // Ensure relocate fires on page load 210 $(window).resize(relocate); // Ensure relocate fires when window is resized 211 212 function relocate() { 213 214 var mobileBtn = $('.anp_bootstrap_nav .pronav_btn_navbar'), // Mobile nav button 215 btnHolder = $('#nav-btn-holder'), // Empty div on desktop, created to wrap mobile nav button on small screens 216 mobileNav = $('.anp_bootstrap_nav .pronav_collapse'), // Mobile nav menu 217 navHolder = $('#mobile-nav-wrapper .col-sm-12'), // Empty div on desktop, created to wrap mobile nav on small screens 218 mobileSearch = $('#header-search-mobile'); // Mobile header search box 219 220 /* 221 Relocating nav and button based on a media query change, instead of using jquery to check 222 for window width because media queries are more accurate. 223 */ 224 if ($(mobileSearch).css('text-align') == 'left') { 225 226 $(btnHolder).prepend(mobileBtn); // Move button 227 $(navHolder).prepend(mobileNav); // Move nav 228 229 } 230 231 } 232 233 }, // End Relocate Menu 234 235 /* 236 AutoNav Pro overrides 237 */ 238 prowessAutoNavProOverrides: function() { 239 240 $('.activate-dropdown').click(function(e) { 241 242 e.preventDefault(); 243 244 var iconButton = $(this), 245 otherDrops = $('.activate-dropdown'), 246 dropParent = $(this).parent(), 247 dropSiblings = $(dropParent).siblings(), 248 dropSiblingChildren = $(dropSiblings).find(otherDrops); 249 250 $(dropParent).toggleClass('open'); // Toggle parent class to open 251 $(dropSiblings).removeClass('open'); // Remove open class from all siblings 252 $(dropSiblingChildren).removeClass('fa-minus').addClass('fa-plus'); // Remove open class from all siblings 253 $(iconButton).toggleClass('fa-plus fa-minus'); // Toggle icon class - replace plus icon with minus, or vice versa 254 255 }); 256 257 $('li.link-removed>a').click(function(e) { 258 259 e.preventDefault(); 260 261 var iconButton = $(this).next('.activate-dropdown'), 262 otherDrops = $('.activate-dropdown'), 263 dropParent = $(this).parent(), 264 dropSiblings = $(dropParent).siblings(), 265 dropSiblingChildren = $(dropSiblings).find(otherDrops); 266 267 $(this).parent().toggleClass('open'); 268 $(dropSiblings).removeClass('open'); // Remove open class from all siblings 269 $(dropSiblingChildren).removeClass('fa-minus').addClass('fa-plus'); // Remove open class from all siblings 270 $(iconButton).toggleClass('fa-plus fa-minus'); // Toggle icon class - replace plus icon with minus, or vice versa 271 272 }); 273 274 // Mobile Nav Button functions 275 var mobileNavBtn = $('.pronav_btn_navbar'); 276 277 $(mobileNavBtn).click(function(e) { 278 279 e.preventDefault(); 280 281 var pronavCollapseMenu = $('.pronav_collapse'); 282 283 $(pronavCollapseMenu).toggle('fast'); 284 e.stopPropagation(); 285 286 }); 287 288 }, // End Auto Nav Pro Overrides 289 290 /* 291 Repositions elements with .move-tablet class to empty container with .new-position-container class @ 991 and below 292 Repositions elements with .move-mobile class to empty container with .new-position-container class @ 767 and below 293 294 .new-position-container should have all the same classes as original container to ensure styles match 295 */ 296 prowessRepositionElements: function() { 297 298 var win = $(window), 299 newPosContainer = $('.new-position-container'), 300 originalContainer = $('.original-container'), 301 moveMobile = $('.move-mobile'), 302 moveTablet = $('.move-tablet'); 303 304 // If .move-tablet class is found 305 function repositionTablet() { 306 307 // Move elements @ 991 breakpoint if element with .move-tablet class exists 308 if (win.width() <= 991) { 309 310 $(newPosContainer).prepend(moveTablet); 311 $(moveTablet).addClass('col-sm-12'); 312 313 } else { 314 315 $(originalContainer).prepend(moveTablet); 316 $(moveTablet).removeClass('col-sm-12'); 317 } 318 319 } 320 321 // If .move-mobile class is found 322 function repositionMobile() { 323 324 // Move elements @ 767 breakpoint if element with .move-tablet class exists 325 if (win.width() <= 767) { 326 327 $(newPosContainer).prepend(moveMobile); 328 $(moveMobile).addClass('col-sm-12'); 329 330 } else { 331 332 $(originalContainer).prepend(moveMobile); 333 $(moveMobile).removeClass('col-sm-12'); 334 } 335 336 } 337 338 if (moveTablet.length) { // Ensure .move-tablet class exists 339 $(document).ready(repositionTablet); // Fire repositionTablet on page load 340 $(window).resize(repositionTablet); // Fire repositionTablet when window is resized 341 } 342 343 if (moveMobile.length) { // Ensure .move-mobile class exists 344 $(document).ready(repositionMobile); // Fire repositionMobile on page load 345 $(window).resize(repositionMobile); // Fire repositionMobile when window is resized 346 } 347 348 }, // End Reposition Elements 349 350 /* 351 Back to Top Button 352 prowessBackToTop: function() { 353
354 var offset = 300, // browser window scroll (in pixels) after which the "back to top" link is shown 355 offsetOpacity = 1200, // browser window scroll (in pixels) after which the "back to top" link opacity is reduced 356 scrollTopDuration = 700, // duration of the top scrolling animation (in ms) 357 $backToTop = $('.to-top'); // grab the "back to top" link 358 359 // Hide or show the "back to top" link 360 $(window).scroll(function() { 361 362 ($(this).scrollTop() > offset) ? $backToTop.addClass('to-top-visible'): $backToTop.removeClass('to-top-visible to-top-fade'); 363 364 if ($(this).scrollTop() > offsetOpacity) { 365 $backToTop.addClass('to-top-fade'); 366 } 367 368 }); 369 370 // Smooth scroll to top 371 $backToTop.on('click', function(event) { 372 373 event.preventDefault(); 374 $('body,html').animate({ 375 scrollTop: 0, 376 }, scrollTopDuration); 377 378 }); 379 380 }, // End Back to Top */ 381 382 /* 383 Offsets top of hero image to a height equal to the second-level nav bar 384 */ 385 prowessContentMargin: function() { 386 387 388 var $secondLevelNav = $('.pronav_list li.nav-path-selected > .sublvl.dropdown-menu'), // Second-level nav 389 $mainContainer = $('#main-container'), // Main content area 390 $dropdownActive = $('.pronav_list li'), // To be used in function to determine if first-level has dropdown menu 391 $navHeight = $secondLevelNav.outerHeight(true); // Get outerheight (+ margin) of second-level nav 392 393 //If the page has second-level nav offset content area to a height equal to second-level nav 394 if ($dropdownActive.hasClass('nav-path-selected')) { 395 // $mainContainer.css('margin-top', $navHeight); // Add a top margin to the content section equal to the second-level nav 396 } 397 398 399 }, // End Content Margin 400 401 /* 402 Ensures 3rd level dropdown menus do not go offscreen to the right when parent li is hovered. 403 */ 404 prowessMainNavOverflow: function() { 405 406 $('.pronav_list ul.sublvl.dropdown-menu>li.nav-dropdown').hover(function() { // hover on 407 408 var elm = $('ul:first-of-type', this), // 3rd level dropdown menu 409 off = $(this).offset(), // offset of 3rd level parent 410 l = off.left, // how far from left is 3rd level 411 w = elm.outerWidth(), // width of 3rd leveL 412 navW = $('#navigation').width(), // entire width of nav bar 413 shortNavW = navW - 15, // 15px less the nav width 414 entirelyVisible = (l + w <= navW); // distance from left plus width of 3rd level is greater than the entire navigation 415 416 if (!entirelyVisible) { 417 // if 3rd level goes OFF screen, add the .edge class, which sets right to 0 418 $(this).addClass('edge'); 419 } else { 420 // if 3rd level fits entirely on screen, remove .edge class. 421 $(this).removeClass('edge'); 422 } 423 424 // if dropdown menu doesn't span full width of parent line item, force it to with the following 425 if (w < $(this).outerWidth()) { 426 427 $(this).css('position', 'relative'); // set position of parent line item to relative 428 $(elm).css('width', '100%'); // make sure dropdown spans full width of parent line item 429 430 } 431 432 }, function() { // hover off 433 434 var elm = $('ul:first-of-type', this), // 3rd level dropdown menu 435 off = $(this).offset(), // offset of 3rd level parent 436 l = off.left, // how far from left is 3rd level 437 w = elm.outerWidth(), // width of 3rd level 438 navW = $('#navigation').width(), // entire width of nav bar 439 shortNavW = navW - 15, // 15px less the nav width 440 entirelyVisible = (l + w <= shortNavW); // distance from left plus width of 3rd level is greater than the entire navigation 441 442 if (!entirelyVisible) { 443 // if 3rd level goes OFF screen, add the .edge class, which sets right to 0 444 $(this).addClass('edge'); 445 } else { 446 // if 3rd level fits entirely on screen, remove .edge class. 447 $(this).removeClass('edge'); 448 } 449 450 }); 451 452 453 }, // End Main Nav Overflow 454 455 /* 456 Produces smooth scroll effect on interior anchor links 457 */ 458 prowessSmoothScroll: function() { 459 460 $(function() { 461 462 $('a[href*="#"]:not([href^="#jl_magic_tabs"]):not([href="#"])').click(function() { // When anchor link is clicked... 463
464 if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { 465 466 var scrollTopDuration = 500, // set scroll duration 467 target = $(this.hash), 468 target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 469 470 if (target.length) { // If anchor link is found on page... 471 472 $('html,body').animate({ 473 scrollTop: target.offset().top 474 }, scrollTopDuration); 475 return false; 476 } 477 478 } 479 480 }); 481 482 }); 483 484 }, // End Smooth Scroll 485 486 /* 487 Hides Honeypot fields 488 */ 489 prowessHoneypot: function() { 490 491 $(document).ready(function() { 492 $(".req-honey").hide(); 493 }); 494 495 }, // End Honeypot 496 497 /* 498 Sidebar CTA 'widget' that scrolls with the user 499 */ 500 prowessScrollingSidebar: function() { 501 502 if ($('#sidebar-cta').length) { 503 504 $(function() { 505 506 var $sidebar = $('#sidebar-cta'), 507 $window = $(window), 508 offset = $sidebar.offset(), 509 topPadding = 15; 510 511 $window.scroll(function() { 512 513 if ($window.scrollTop() > offset.top) { 514 $sidebar.stop().animate({ 515 top: $window.scrollTop() - offset.top + topPadding 516 }); 517 } else { 518 $sidebar.stop().animate({ 519 top: 0 520 }); 521 } 522 523 var positionOfSidebar = $sidebar.offset().top + $sidebar.height(), 524 topOfFooter = $('#breadcrumb-container').offset().top - 50; 525 526 //console.log(positionOfSidebar, topOfFooter); 527 528 if (positionOfSidebar >= topOfFooter) { 529 530 $sidebar.stop().animate({ 531 top: $window.scrollTop() - offset.top + topPadding 532 }); 533 $sidebar.addClass('stick'); 534 535 } else { 536 537 $sidebar.removeClass('stick'); 538 539 } 540 541 }); 542 }); 543 544 } 545 546 }, 547 548 /* 549 Vertically center Bootstrap modals 550 */ 551 prowessCenterModals: function() { 552 553 // Center Bootstrap modal 554 function centerModal() { 555 556 $(this).css('display', 'block'); 557 558 var $dialog = $(this).find(".modal-dialog"), 559 offset = ($(window).height() - $dialog.height()) / 2; 560 561 // Center modal vertically in window 562 $dialog.css("margin-top", offset); 563 564 } 565 566 $('.modal').on('show.bs.modal', centerModal); 567 568 // Fire function on window resize event 569 $(window).on("resize", function() { 570 $('.modal:visible').each(centerModal); 571 }); 572 573 }, 574 575 /* 576 Full screen modal window, dependent on Velocity.js 577 */ 578 prowessFullScreenModal: function() { 579 580 //trigger the animation - open modal window 581 $('[data-type="modal-trigger"]').on('click', function() { 582 var actionBtn = $(this), 583 scaleValue = retrieveScale(actionBtn.next('.cd-modal-bg')); 584 585 actionBtn.addClass('to-circle'); 586 587 actionBtn.next('.cd-modal-bg').addClass('is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function() { 588 animateLayer(actionBtn.next('.cd-modal-bg'), scaleValue, true); 589 }); 590 591 //if browser doesn't support transitions... 592 if (actionBtn.parents('.no-csstransitions').length > 0) animateLayer(actionBtn.next('.cd-modal-bg'), scaleValue, true); 593 594 }); 595 596 //trigger the animation - close modal window 597 $('.cd-section .cd-modal-close').on('click', function() { 598 var section = $(this).parents('.cd-section'); 599 section.removeClass('modal-is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function() { 600 animateLayer(section.find('.cd-modal-bg'), 1, false); 601 }); 602 603 //if browser doesn't support transitions... 604 if (section.parents('.no-csstransitions').length > 0) animateLayer(section.find('.cd-modal-bg'), 1, false); 605 }); 606 607 $(window).on('resize', function() { 608 //on window resize - update cover layer dimention and position 609 if ($('.cd-section.modal-is-visible').length > 0) window.requestAnimationFrame(updateLayer); 610 }); 611 612 function retrieveScale(btn) { 613 var btnRadius = btn.width() / 2, 614 left = btn.offset().left + btnRadius, 615 top = btn.offset().top + btnRadius - $(window).scrollTop(), 616 scale = scaleValue(top, left, btnRadius, $(window).height(), $(window).width()); 617 618 btn.css('position', 'fixed').velocity({ 619 top: top - btnRadius, 620 left: left - btnRadius, 621 translateX: 0, 622 }, 0); 623 624 return scale; 625 } 626 627 function scaleValue(topValue, leftValue, radiusValue, windowW, windowH) { 628 var maxDistHor = (leftValue > windowW / 2) ? leftValue : (windowW - leftValue), 629 maxDistVert = (topValue > windowH / 2) ? topValue : (windowH - topValue); 630 return Math.ceil(Math.sqrt(Math.pow(maxDistHor, 2) + Math.pow(maxDistVert, 2)) / radiusValue); 631 } 632 633 function animateLayer(layer, scaleVal, bool) { 634 layer.velocity({ 635 scale: scaleVal 636 }, 400, function() { 637 $('body').toggleClass('overflow-hidden', bool); 638 (bool) ? layer.parents('.cd-section').addClass('modal-is-visible').end().off('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend'): layer.removeClass('is-visible').removeAttr('style').siblings('[data-type="modal-trigger"]').removeClass('to-circle'); 639 }); 640 } 641 642 function updateLayer() { 643 var layer = $('.cd-section.modal-is-visible').find('.cd-modal-bg'), 644 layerRadius = layer.width() / 2, 645 layerTop = layer.siblings('.btn').offset().top + layerRadius - $(window).scrollTop(), 646 layerLeft = layer.siblings('.btn').offset().left + layerRadius, 647 scale = scaleValue(layerTop, layerLeft, layerRadius, $(window).height(), $(window).width()); 648 649 layer.velocity({ 650 top: layerTop - layerRadius, 651 left: layerLeft - layerRadius, 652 scale: scale, 653 }, 0); 654 } 655 656 }, 657 658 /* 659 Page Titles checks and adjustments 660 */ 661 prowessPageTitles: function() { 662 663 var pageTitleSection = $('#page-title'), 664 pageDescText = $('#page-title p'),
665 pageName = $('#page-title .page-name'), 666 nameInner = $('#page-title .page-name .name-inner'), 667 titleCharCount = $(pageName).text().length, 668 descCharCount = $('#page-title .description-wrapper p').text().length, 669 pageTitleWrapper = $('#page-title .title-wrapper'), 670 pageDescription = $('#page-title .description-wrapper'), 671 pageIcon = $('.header-icon'), 672 pageIconWidth = $(pageIcon).outerWidth(), 673 pageIconHeight = $(pageIcon).outerHeight(), 674 negativeIconHeight = -(pageIconHeight / 2); 675 676 // Vertically center icon with page title 677 $(pageIcon).css({ 678 'marginTop': negativeIconHeight + 'px' 679 }); 680 681 // If a page description is found, apply a border between the page title and description 682 if (pageDescription.length && $('#page-meta-full').hasClass('has-image')) { 683 $(pageTitleWrapper).css('border-right', '1px solid #ffffff'); 684 } else if (pageDescription.length && $('#page-meta-full').hasClass('no-image')) { 685 $(pageTitleWrapper).css('border-right', '1px solid #4d4d4d'); 686 } 687 688 /* 689 If a page icon is being used, offset page title section by the width of the icon 690 so that page title remains centered also, ensure icon stays stuck to the left side of the page name 691 */ 692 if (pageIcon.length) { 693 694 // Stick icon to left of page name 695 function stickyTitleIcon() { 696 697 var nameWidth = $(nameInner).width() + 30; // Adding 30 to provide a little padding between icon and page name 698 699 $(pageTitleSection).css('padding-left', pageIconWidth); 700 $(pageIcon).css('right', nameWidth); 701 702 } 703 $(window).on('load', stickyTitleIcon); // Fire function when window is finished loading 704 $(window).resize(stickyTitleIcon); // Fire function on window resize 705 706 } 707 708 /* 709 If the combination of page title AND description OR the title itself or description 710 itself are really long, make sure they wrap 711 */ 712 if (titleCharCount >= 50 && descCharCount >= 125 || titleCharCount >= 70 || descCharCount >= 150) { 713 $(pageTitleSection).addClass('wrap-word'); 714 } else { 715 //console.log('Page Title wrap NOT ACTIVE - Page Title characters: ' + titleCharCount + ', Page Description chars: ' + descCharCount); 716 } 717 718 // If page description is insanely long, reduce font size 719 if (descCharCount >= 200) { 720 $(pageDescText).css({ 721 'font-size': '22px', 722 'line-height': '24px' 723 }); 724 } 725 726 }, 727 728 /* 729 If any layout block is found with a class of layout-container, 730 add a container class and bootstrap markup to it's parent wrapper. 731 Also insert bootstrap rows and columns inside any div with a class of 732 container that doesn't already have a row inside. 733 */ 734 prowessContainLayouts: function() { 735 736 var layoutContainer = $('.ccm-layout-wrapper .layout-container'), 737 containerParent = $(layoutContainer).closest('.ccm-layout-wrapper'); 738 739 // Wrap parent layout with bootstrap class and apply container class 740 if ($(layoutContainer).length) { 741 $(containerParent).addClass('container'); 742 $(containerParent).wrapInner('<div class="row"><div class="col-sm-12"></div></div>'); 743 } 744 745 var contentContainer = $('#content .container'), 746 contentContainerParent = $(contentContainer).closest('.container'); 747 748 // Check if container contains a div with a class of row 749 if ($('#content .container').find('.row').length) { 750 751 $(contentContainerParent).wrapInner('<div class="row"><div class="col-sm-12"></div></div>'); 752 $(contentContainerParent).css({ 753 'padding-left': 15, 754 'padding-right': 15 755 }); 756 } 757 758 }, 759 760 /* 761 Map Sector Legend 762 */ 763 prowessMapSectorLegend: function() { 764 765 function adjustHeight() { 766 767 var mapSidebar = $('.map-sidebar'), 768 mapLegend = $('#map-sector-legend'), 769 scrollGradient = $('.scroll-gradient'), 770 mapSidebarHeight = mapSidebar.outerHeight(), 771 mapLegendHeight = mapLegend.outerHeight(), 772 diffHeight = mapLegendHeight - mapSidebarHeight; 773 774 if (mapLegendHeight > mapSidebarHeight) { 775 scrollGradient.addClass('active-gradient'); 776 } else { 777 scrollGradient.removeClass('active-gradient'); 778 } 779 780 } 781 $(document).ready(adjustHeight); 782 $(window).resize(adjustHeight); 783 784 }, 785 786 searchAutosuggest: function() { 787 var $field = $('input[name="term"]'); 788 if ($field.length) { 789 $.widget("custom.weyercomplete", $.ui.autocomplete, { 790 _renderItem: function(ul, item) { 791 return $("<li>") 792 .attr("data-value", item.value) 793 .addClass('searchResult') 794 .append(item.label) 795 .appendTo(ul) 796 .bind('click', function() { 797 window.location = item.url; 798 return false;
799 }); 800 } 801 }); 802 803 804 $field.weyercomplete({ 805 minLength: 2, 806 appendTo: ".ccm-page", 807 source: function(request, response) { 808 $.ajax({ 809 url: CCM_DISPATCHER_FILENAME + "/weyerhaeuser/ajaxsearch", 810 type: "POST", 811 dataType: "json", 812 data: { 813 'term': request.term 814 }, 815 success: function(data) { 816 response($.map(data.terms, function(item) { 817 var title = item.highlight.title ? item.highlight.title : item.title; 818 var subTitle = item.highlight.sections; 819 820 item.label = $('<div />'); 821 item.label.append($('<span />').html(title)); 822 item.id = item.url; 823 824 if (subTitle) { 825 item.label.append($('<p />').html(subTitle)); 826 } 827 828 item.label = item.label.get(0).innerHTML; 829 return item; 830 })); 831 } 832 }); 833 } 834 }); 835 } 836 837 }, 838 839 // Disable all spellchecking on user input fields 840 prowessDisableSpellcheck: function() { 841 $('input, textarea').each(function() { $(this).attr('spellcheck', false); }); 842 }, 843 844 prowessStickyButtom: function() { 845 if ($('#wp-sticky-bottom').length) { 846 var offset = 200; // browser window scroll (in pixels) after which the wood product sticky bottom shows up 847 $sitckyBottom = $('#wp-sticky-bottom'); //select the element 848 $element_below = $('#breadcrumb-container').offset(); 849 850 // Hide or show sticky nav 851 var stickyBottomLinks = function() { 852 scrollBottom = $(this).scrollTop() + $(this).innerHeight(); 853 if (($(this).scrollTop() > offset) || ($element_below.top - offset <= $(this).innerHeight())) { 854 $sitckyBottom.addClass('is-visible') 855 } else { 856 $sitckyBottom.removeClass('is-visible'); 857 } 858 if ((scrollBottom <= $element_below.top) && ($element_below.top > $(this).innerHeight() + offset)) { 859 $sitckyBottom.addClass('is-sticky'); 860 } else { 861 $sitckyBottom.removeClass('is-sticky'); 862 } 863 864 } 865 $(window).on('load scroll', stickyBottomLinks); 866 $(window).resize(function() { 867 $element_below = $('#breadcrumb-container').offset(); 868 stickyBottomLinks; 869 }); 870 } 871 } 872}; 873 874 875// homepage scripts 876prowess.Home = { 877 878 879}; 880 881// load js on document load 882jQuery(document).ready(function() { 883 prowess.init(); 884 /* portlandlabs nav stuff */ 885 $('ul.wy-header-nav > li > ul > li').hover(function(){ 886 $targetList = $(this).find('ul'); 887 if($targetList.length > 0 && !($targetList.hasClass('offset-correct'))) { 888 var rt = ($(window).width() - ($targetList.offset().left + $targetList.outerWidth())); 889 if(rt < 0) { // it's off screen 890 $targetList.css('left', rt); 891 $targetList.addClass('offset-correct') 892 } 893 } 894 }) 895 $('#navigation li[role="menuitem"]').mouseenter( 896 function (e) { 897 var timeout = window.setTimeout( 898 function () { 899 var display = 'flex'; 900 $(e.target).next('div.submenu').css('display', display); 901 }, 902 100 903 ); 904 $(e.delegateTarget).mouseleave( 905 {timeout: timeout}, 906 function () { 907 window.clearTimeout(timeout); 908 $('div.submenu', this).css('display','none'); 909 $(e.delegateTarget).off('mouseleave'); 910 }); 911 }); 912}); 913$(window).resize(function(){ 914 $('.offset-correct').removeClass('offset-correct').css('left', 'auto'); 915})
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.