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

26 lines
688 B
JavaScript
Raw Normal View History

2021-03-29 19:40:55 +02:00
const Routing = require('./routing')
2021-06-15 14:26:38 +02:00
const FormPnw = function (w) {
this.window = w
}
2021-06-15 14:26:38 +02:00
FormPnw.prototype.init = function () {
const doc = this.window.document
2021-06-15 14:26:38 +02:00
doc.addEventListener('mousemove', function () {
const forms = doc.querySelectorAll('form[data-form-bot]')
2021-06-15 14:26:38 +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', [], false) + '?page=', '')
action = decodeURIComponent(action)
2021-06-15 14:26:38 +02:00
form.setAttribute('action', action)
form.removeAttribute('data-form-bot')
}
})
}
module.exports = FormPnw