const Routing = require('./routing') class FormPnw { constructor(w) { this.window = w } init() { const doc = this.window.document doc.addEventListener('mousemove', function() { const forms = doc.querySelectorAll('form[data-form-bot]') 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=', '' ) action = decodeURIComponent(action) form.setAttribute('action', action) form.removeAttribute('data-form-bot') } }) } } module.exports = FormPnw