2022-04-29 10:17:23 -04:00
|
|
|
var feedback = document.forms.feedback
|
2022-04-29 11:21:37 -04:00
|
|
|
/* Show feedback */
|
|
|
|
feedback.hidden = false
|
2022-04-29 10:17:23 -04:00
|
|
|
feedback.addEventListener("submit", function(ev) {
|
|
|
|
ev.preventDefault()
|
|
|
|
|
|
|
|
/* Retrieve page and feedback value */
|
|
|
|
var page = document.location.pathname
|
|
|
|
var data = ev.submitter.getAttribute("data-md-value")
|
|
|
|
|
|
|
|
/* Send feedback value */
|
|
|
|
console.log(page, data)
|
|
|
|
plausible(data)
|
2022-04-29 11:21:37 -04:00
|
|
|
|
|
|
|
/* Disable form and show note, if given */
|
|
|
|
feedback.firstElementChild.disabled = true
|
|
|
|
var note = feedback.querySelector(
|
|
|
|
".md-feedback__note [data-md-value='" + data + "']"
|
|
|
|
)
|
|
|
|
|
|
|
|
if (note)
|
|
|
|
note.hidden = false
|
2022-04-29 10:17:23 -04:00
|
|
|
})
|