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

29 lines
836 B
JavaScript
Raw Normal View History

2021-03-29 19:40:55 +02:00
const Routing = require('./routing')
const FormPnw = function(w) {
this.window = w
}
FormPnw.prototype.init = function() {
2021-03-29 19:40:55 +02:00
var doc = this.window.document
doc.addEventListener('mousemove', function() {
2021-03-29 19:40:55 +02:00
var forms = doc.querySelectorAll('form[data-form-bot]')
for (var i = 0, len = forms.length; i < len; i++) {
2021-03-29 19:40:55 +02:00
var form = forms[i]
var action = form.getAttribute('action')
console.log([action, Routing.generate('blog_tech_form_without_javascript', [], true)])
action = action.replace(Routing.generate('blog_tech_form_without_javascript', [], false) + '?page=', '')
action = decodeURIComponent(action)
2021-03-29 19:40:55 +02:00
form.setAttribute('action', action)
form.removeAttribute('data-form-bot')
}
2021-03-29 19:40:55 +02:00
})
}
module.exports = FormPnw