PageSourceSearch

https://bikeindex.org/assets/application-9f135af3f45044e129592ab00d49dc2a3a947714516939328ed5cdae1ba87058.js

js bikeindex.org collected 2026-09-24 08:53:31 UTC 2,598 bytes, 65 lines download raw bytes

1import '@hotwired/turbo-rails'
2
3// Import stimulus controllers
4import { Application } from '@hotwired/stimulus'
5// Lazy load all controllers
6import { lazyLoadControllersFrom } from '@hotwired/stimulus-loading'
7
8import TimeLocalizer from '@bikeindex/time-localizer'
9
10// Fixes for hotwire_combobox 0.4.1's option lookup, Enter handling and typing over a selection
11import 'utils/hw_combobox_patch'
12
13/* global Turbo */
14// Disable Turbo by default, only enable on case-by-case
15// You must include data-turbo="true" on the elements you want to enable turbo on
16Turbo.session.drive = false
17const application = Application.start()
18
19// Configure Stimulus development experience
20application.debug = false
21window.Stimulus = application
22lazyLoadControllersFrom('controllers', application)
23
24function localizeTime () {
25  if (!window.timeLocalizer) window.timeLocalizer = new TimeLocalizer()
26  window.timeLocalizer.localize()
27}
28
29// A fetch still in flight when the page goes away rejects with a generic network
30// error, not an AbortError, so the message alone can't separate it from real
31// breakage - only treat these phrasings as noise while we're actually leaving.
32const NAVIGATION_FETCH_ERROR = /Failed to fetch|Load failed|Fetch is aborted|aborted a request/
33let navigatingAway = false
34
35// Load honeybadger dynamically so ad blockers don't break the entire app
36const honeybadgerApiKey = document.querySelector('meta[name="honeybadger-api-key"]')?.content
37if (honeybadgerApiKey) {
38  // pagehide rather than beforeunload, which costs the page its bfcache entry
39  window.addEventListener('pagehide', () => { navigatingAway = true })
40  window.addEventListener('pageshow', () => { navigatingAway = false })
41  import('@honeybadger-io/js')
42    .then(({ default: Honeybadger }) => {
43      Honeybadger.configure({
44        apiKey: honeybadgerApiKey,
45        environment: document.querySelector('meta[name="honeybadger-environment"]')?.content
46      })
47      Honeybadger.beforeNotify((notice) => {
48        // Filter out browser extension errors
49        if (notice.backtrace?.some((frame) => /^(chrome|moz|safari)-extension:\/\//.test(frame.file))) {
50          return false
51        }
52        // Filter out ResizeObserver loop noise (benign browser warning)
53        if (notice.message?.includes('ResizeObserver loop')) {
54          return false
55        }
56        if (navigatingAway && NAVIGATION_FETCH_ERROR.test(notice.message)) {
57          return false
58        }
59      })
60    })
61    .catch(() => {})
62}
63
64document.addEventListener('DOMContentLoaded', localizeTime)
65document.addEventListener('turbo:render', localizeTime);

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.