2021-01-12 17:14:14 +00:00
|
|
|
import { Notifier } from '@airbrake/browser'
|
|
|
|
|
|
|
|
window.airbrake = new Notifier({
|
2021-01-25 19:28:12 +00:00
|
|
|
projectId: window.env.AIRBRAKE_PROJECT_ID,
|
|
|
|
projectKey: window.env.AIRBRAKE_PROJECT_KEY,
|
2021-01-12 17:14:14 +00:00
|
|
|
host: 'https://panel.sutty.nl'
|
|
|
|
})
|
|
|
|
|
2021-09-17 18:27:00 +00:00
|
|
|
console.error = (e) => window.airbrake.notify(e)
|
|
|
|
|
2021-01-12 16:35:23 +00:00
|
|
|
import 'core-js/stable'
|
|
|
|
import 'regenerator-runtime/runtime'
|
|
|
|
|
2021-01-12 16:38:32 +00:00
|
|
|
const Turbolinks = require("turbolinks")
|
|
|
|
Turbolinks.start()
|
|
|
|
|
2020-11-12 16:28:24 +00:00
|
|
|
import { Application } from 'stimulus'
|
|
|
|
import { definitionsFromContext } from "stimulus/webpack-helpers"
|
|
|
|
|
|
|
|
const application = Application.start()
|
|
|
|
const context = require.context("./controllers", true, /\.js$/)
|
|
|
|
application.load(definitionsFromContext(context))
|
2021-01-12 16:38:32 +00:00
|
|
|
|
|
|
|
// Prevenir que Turbolinks interfiera con la navegación por anchors
|
|
|
|
// https://github.com/turbolinks/turbolinks/issues/75#issuecomment-445325162
|
|
|
|
document.addEventListener('turbolinks:click', event => {
|
|
|
|
const anchorElement = event.target
|
|
|
|
const isSamePageAnchor = (
|
|
|
|
anchorElement.hash &&
|
|
|
|
anchorElement.origin === window.location.origin &&
|
|
|
|
anchorElement.pathname === window.location.pathname
|
|
|
|
)
|
|
|
|
|
|
|
|
if (!isSamePageAnchor) return
|
|
|
|
|
|
|
|
Turbolinks.controller.pushHistoryWithLocationAndRestorationIdentifier(event.data.url, Turbolinks.uuid())
|
|
|
|
|
|
|
|
event.preventDefault()
|
|
|
|
})
|
|
|
|
|
2021-02-10 19:32:11 +00:00
|
|
|
try {
|
|
|
|
window.axe = require('axe-core/axe')
|
|
|
|
} catch(e) {}
|
|
|
|
|
|
|
|
if (window.axe) window.axe.configure({ locale: require('axe-core/locales/es.json') })
|
|
|
|
|
2021-01-12 16:38:32 +00:00
|
|
|
// Prevenir que Turbolinks interfiera la navegación a un anchor al
|
|
|
|
// recargar la página
|
|
|
|
document.addEventListener('turbolinks:load', event => {
|
|
|
|
window.location.hash = window.location.hash
|
2021-02-10 19:32:11 +00:00
|
|
|
|
|
|
|
if (!window.axe) return
|
|
|
|
|
|
|
|
window.axe.run().then(results => {
|
|
|
|
results.violations.forEach(violation => {
|
|
|
|
violation.nodes.forEach(node => {
|
|
|
|
node.target.forEach(target => {
|
|
|
|
document.querySelectorAll(target).forEach(element => {
|
|
|
|
element.classList.add('inaccesible')
|
|
|
|
element.ariaLabel = node.failureSummary
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
2021-01-12 16:38:32 +00:00
|
|
|
})
|