1import { Controller } from '@hotwired/stimulus' 2 3// Connects to data-controller='org--chart-card-scope-links' 4// The card renders outside the frame a search replaces, so its scope links would keep 5// the search they were rendered with. The address bar has the current one. 6export default class extends Controller { 7 connect () { 8 this.updateLinks() 9 document.addEventListener('turbo:frame-render', this.updateLinks) 10 } 11 12 disconnect () { 13 document.removeEventListener('turbo:frame-render', this.updateLinks) 14 } 15 16 updateLinks = () => { 17 const base = new URL(window.location.href) 18 // The server's scope paths leave page out, so the address bar's goes too 19 base.searchParams.delete('page') 20 21 this.element.querySelectorAll('a').forEach((link) => { 22 const url = new URL(base) 23 url.searchParams.set('chart_scope', new URL(link.href).searchParams.get('chart_scope')) 24 link.href = url.pathname + url.search 25 }) 26 } 27};
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.