-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: add feedback widget to docs with flarelytics integration (#9129)
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
- Loading branch information
1 parent
3ad2018
commit b900fe2
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var feedback = document.forms.feedback | ||
feedback.hidden = false | ||
|
||
feedback.addEventListener("submit", function(ev) { | ||
ev.preventDefault() | ||
|
||
var data = ev.submitter.getAttribute("data-md-value") | ||
feedback.firstElementChild.disabled = true | ||
|
||
var note = feedback.querySelector( | ||
`.md-feedback__note [data-md-value='${data}']` | ||
) | ||
if (note) | ||
note.hidden = false | ||
|
||
if (data == 1) { | ||
window.flarelytics_event('thumbsUp'); | ||
} else if (data == 0) { | ||
window.flarelytics_event('thumbsDown'); | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters