deblan.io-murph/assets/js/app/form-pwn.js

33 lines
903 B
JavaScript
Raw Normal View History

2021-03-29 19:40:55 +02:00
const Routing = require('./routing')
2022-09-08 10:26:58 +02:00
class FormPnw {
constructor(w) {
this.window = w
}
2022-09-08 10:26:58 +02:00
init() {
const doc = this.window.document
2022-09-08 10:26:58 +02:00
doc.addEventListener('mousemove', function() {
const forms = doc.querySelectorAll('form[data-form-bot]')
2022-09-08 10:26:58 +02:00
for (let i = 0, len = forms.length; i < len; i++) {
const form = forms[i]
let action = form.getAttribute('action')
action = action.replace(
Routing.generate('blog_tech_form_without_javascript', {
_domain: window.location.hostname
}, false) + '?page=', ''
)
2022-01-29 22:36:16 +01:00
2022-09-08 10:26:58 +02:00
action = decodeURIComponent(action)
2022-09-08 10:26:58 +02:00
form.setAttribute('action', action)
form.removeAttribute('data-form-bot')
}
})
2021-06-15 14:26:38 +02:00
}
}
module.exports = FormPnw