-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backports final UI changes to 2.3 (#2293)
* Backports final UI changes to 2.3 Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Removes previous version of script Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
- Loading branch information
1 parent
8b0f4e2
commit b487598
Showing
6 changed files
with
46 additions
and
71 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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,30 @@ | ||
document.addEventListener('click', function(event) { | ||
const { target } = event; | ||
if (target.matches('.feedback-issue')) { | ||
gtag('event', 'submit_issue_click'); | ||
} | ||
else if (target.matches('.feedback-edit')) { | ||
gtag('event', 'edit_page_click'); | ||
} | ||
else if (target.matches('.feedback-button')) { | ||
sendFeedback(target); | ||
} | ||
else if (target.matches('.copy-button')) { | ||
window.navigator.clipboard.writeText(target.getAttribute('data-text')); | ||
} | ||
}); | ||
|
||
function sendFeedback(button) { | ||
gtag('event', 'feedback_click', { | ||
'helpful': button.value | ||
}); | ||
// show the hidden feedback text | ||
const parent = button.parentElement; | ||
const index = [...parent.children].indexOf(button) + 1; | ||
const sibling = parent.querySelector(`:nth-child(${index}) ~ .text-small.hidden`); | ||
sibling?.classList.remove('hidden'); | ||
|
||
// disable the feedback buttons | ||
button.disabled = true; | ||
button[button.id === 'yes' ? 'nextElementSibling' : 'previousElementSibling']?.setAttribute('disabled', true); | ||
} |