1var scroll_sections = { 2 3 init: function() { 4 5 $('.record-page-content-combined').each(function(i) { 6 7 if (!$('#container.record-page-content-combined-container').length) { 8 $('#container').addClass('record-page-content-combined-container'); 9 10 // Due to timing issues (mainly with mode theme), we need to simulate a resize for flowgrid due to the sidebar getting hidden 11 window.galleries.responsive.flow_list_init(); 12 window.galleries.responsive.flow_list_after_resize(); 13 } 14 var subnav = $(this).find('#sub_nav > ul > li:not(#sub-item-share):not(#sub-item-cv):not(#sub-item-artist-website):not(#artists-browser) > a, #sticky_sub_nav > ul > li:not(#sub-item-share-page_header):not(#sub-item-cv-page_header):not(#sub-item-artist-website-page_header):not(#artists-browser-page_header) > a'); 15 16 var artist_subnav = $('#sub_nav > ul > li:not(#sub-item-share):not(#sub-item-cv):not(#sub-item-artist-website):not(#artists-browser) > a'); 17 18 19 if($("#custom-feature-panel-container").length) { 20 var sections = $('#custom-feature-panel-container').find('.feature_panels_inner > ul > li > section'); 21 }else{ 22 var sections = $('.record-page-content-combined').find('.scroll_section_container > section'); 23 } 24 25 subnav.off('click.scroll_sections').on('click.scroll_sections', function() { 26 $('body').addClass('window-forced-scroll-up'); 27 var this_type = $(this).attr('data-subsection-type'); 28 var related_item = sections.filter('[data-subsection-type="' + this_type + '"]'); 29 30 if (related_item.length) { 31 var direction = (related_item.offset().top > $(window).scrollTop() ? 'down' : 'up'); 32 if ($('#header').length > 0 && direction == 'down' && !$('#sticky_sub_nav').is(':visible')) { 33 var offset = -60; 34 var offset = offset + $('#header').outerHeight(); 35 } 36 else if ($('#header').length > 0 && direction == 'up' || $('#sticky_sub_nav').length) { 37 var offset = 20; 38 var offset = offset + $('#header').outerHeight(); 39 } else { 40 var offset = 40; 41 } 42 43 if ($('#cms-frontend-toolbar-container').length > 0) { 44 var offset = offset + $('#cms-frontend-toolbar-container').outerHeight(); 45 } 46 var related_item_offset = related_item.offset().top - offset; 47 related_item_offset = (related_item_offset < 1 ? 0 : related_item_offset); 48 $('html,body').animate( 49 {scrollTop: related_item_offset}, 50 800, 51 'easeInOutQuad', 52 function() { 53 $('body').delay(100).queue(function() { 54 $(this).removeClass('window-forced-scroll-up'); 55 $(this).dequeue(); 56 }); 57 window.galleries.scroll_sections.subnav_active_change(); 58 // Accessibility - set focus on new section 59 $(related_item).get(0).focus({preventScroll:true}); 60 } 61 ); 62 } 63 return false; 64 }); 65 66 artist_subnav.off('click.scroll_sections').on('click.scroll_sections', function() { 67 68 $('body').addClass('window-forced-scroll-up'); 69 var this_type = $(this).attr('data-subsection-type'); 70 var related_item = sections.filter('[data-subsection-type="' + this_type + '"]'); 71 72 if (related_item.length) { 73 var direction = (related_item.offset().top > $(window).scrollTop() ? 'down' : 'up'); 74 if ($('#header').length > 0 && direction == 'down' && !$('#sticky_sub_nav').is(':visible')) { 75 var offset = -60; 76 var offset = offset + $('#header').outerHeight(); 77 } 78 else if ($('#header').length > 0 && direction == 'up' || $('#sticky_sub_nav').length) { 79 var offset = 20; 80 var offset = offset + $('#header').outerHeight(); 81 } else { 82 var offset = 40; 83 } 84 85 if ($('#cms-frontend-toolbar-container').length > 0) { 86 var offset = offset + $('#cms-frontend-toolbar-container').outerHeight(); 87 } 88 var related_item_offset = related_item.offset().top - offset; 89 related_item_offset = (related_item_offset < 1 ? 0 : related_item_offset); 90 $('html,body').animate( 91 {scrollTop: related_item_offset}, 92 800, 93 'easeInOutQuad', 94 function() { 95 $('body').delay(100).queue(function() { 96 $(this).removeClass('window-forced-scroll-up'); 97 $(this).dequeue(); 98 }); 99 window.galleries.scroll_sections.subnav_active_change(); 100 // Accessibility - set focus on new section 101 $(related_item).get(0).focus({preventScroll:true}); 102 } 103 ); 104 } 105 return false;
106 }); 107 108 try { 109 $.pageload.refresh('#sticky_sub_nav'); 110 } catch { 111 112 } 113 }); 114 115 }, 116 117 subnav_active_change: function() { 118 var windowPos = $(window).scrollTop(); // get the offset of the window from the top of page 119 var windowHeight = $(window).height(); // get the height of the window 120 var docHeight = $(document).height(); 121 122 $('.record-page-content-combined #sub_nav ul li a, .record-page-content-combined #sticky_sub_nav ul li a') 123 .each(function() { 124 125 var this_type = $(this).attr('data-subsection-type'); 126 var sections = $('.record-page-content-combined .scroll_section_container > section'); 127 var related_item = sections.filter('[data-subsection-type="' + this_type + '"]'); 128 129 if (related_item.length) { 130 var offset = windowHeight/2; 131 if ($('#cms-frontend-toolbar-container').length > 0) { 132 offset = offset + $('#cms-frontend-toolbar-container').outerHeight(); 133 } 134 var divPos = related_item.offset().top - offset; // get the offset of the div from the top of page 135 var divHeight = related_item.outerHeight(); // get the height of the div in question 136 if (windowPos >= divPos && windowPos < (divPos + divHeight)) { 137 $(".record-page-content-combined #sub_nav ul li a[data-subsection-type='" + this_type + "']").closest('li').addClass("active"); 138 $(".record-page-content-combined #sticky_sub_nav ul li a[data-subsection-type='" + this_type + "']").closest('li').addClass("active"); 139 } else { 140 $(".record-page-content-combined #sub_nav ul li a[data-subsection-type='" + this_type + "']").closest('li').removeClass("active"); 141 $(".record-page-content-combined #sticky_sub_nav ul li a[data-subsection-type='" + this_type + "']").closest('li').removeClass("active"); 142 } 143 } 144 }) 145 .promise() 146 .done(function() { 147 148 }); 149 150 if(windowPos + windowHeight == docHeight) { 151 if (!$("#scroll_section_nav ul li:last-child").closest('li').hasClass("active")) { 152 var navActiveCurrent = $(".active").attr("href"); 153 $("#scroll_section_nav ul li[href='" + navActiveCurrent + "']").closest('li').removeClass("active"); 154 $("#scroll_section_nav ul l li:last-child").closest('li').addClass("active"); 155 } 156 } 157 } 158 159} 160 161window.galleries = window.galleries || {}; 162window.galleries.scroll_sections = scroll_sections; 163export default scroll_sections;
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.