1// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails 2import * as Vue from "vue" 3import ScrollTop from "components/ScrollTop"; 4import "@hotwired/turbo-rails" 5 6// It'd be nice to have Turbo drive working, but it's broken on location pages where the map is loaded 7// so disable it for now. 8Turbo.session.drive = false 9 10// Initialise Vue 11document.addEventListener("turbo:load", () => { 12 const element = document.querySelector("#app"); 13 if (element !== null) { 14 const app = Vue.createApp({}); 15 16 // register your components 17 app.component('scroll-top', ScrollTop) 18 19 app.mount("#app"); 20 } 21}); 22 23// Add custom turbo:after-stream-render event, see https://discuss.hotwired.dev/t/event-to-know-a-turbo-stream-has-been-rendered/1554/25 24const afterRenderEvent = new Event("turbo:after-stream-render"); 25addEventListener("turbo:before-stream-render", (event) => { 26 const originalRender = event.detail.render 27 28 event.detail.render = function (streamElement) { 29 originalRender(streamElement) 30 document.dispatchEvent(afterRenderEvent); 31 } 32}) 33 34// Custom Turbo Stream Action for scrolling to a target element on a page 35Turbo.StreamActions.scroll_to = function () { 36 const target = this.targetElements[0]; 37 target.scrollIntoView({behavior: "auto"}); 38};
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.