1+(($) => { 2 // This isn't actually a redactor plug in. I'm not sure why it's here -- FRG 2022-1-22 3 "use strict"; 4 5 6class LinkToSection { 7 constructor($el) { 8 this.$el = $el; 9 this.init(); 10 } 11 12 init() { 13 this.bindToOffsetToAnchors(); 14 } 15 16 bindToOffsetToAnchors() { 17 this.$el.on('click', 'a[href^="#"]', (event) => { 18 const target = event.target; 19 if (!target) return; 20 const hash = decodeURI(target.hash).slice(1); 21 if (!hash) return; 22 const targetEl = document.getElementById(hash); 23 if (!targetEl) return; 24 this.animateToAnchor($(targetEl)); 25 }); 26 } 27 28 animateToAnchor($linkEl, stickyHeight) { 29 stickyHeight ??= this.getStickySectionsHeight(); 30 $('html, body').animate({ 31 scrollTop: $linkEl.offset().top - stickyHeight 32 }, 'slow'); 33 } 34 35 getStickySectionsHeight() { 36 return PLEStickyState?.getStickySectionsHeight() ?? 0; 37 } 38 39 static dataAttribute = 'linkToSection'; 40} 41 42 $(() => { 43 for (const el of document.querySelectorAll('.editable__container')) { 44 const el$ref = $(el); 45 el$ref.data(LinkToSection.dataAttribute, new LinkToSection(el$ref)); 46 } 47 }); 48})(window.jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.