29 lines
836 B
JavaScript
29 lines
836 B
JavaScript
const Routing = require('./routing')
|
|
|
|
const FormPnw = function(w) {
|
|
this.window = w
|
|
}
|
|
|
|
FormPnw.prototype.init = function() {
|
|
var doc = this.window.document
|
|
|
|
doc.addEventListener('mousemove', function() {
|
|
var forms = doc.querySelectorAll('form[data-form-bot]')
|
|
|
|
for (var i = 0, len = forms.length; i < len; i++) {
|
|
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)
|
|
|
|
form.setAttribute('action', action)
|
|
form.removeAttribute('data-form-bot')
|
|
}
|
|
})
|
|
}
|
|
|
|
module.exports = FormPnw
|