mirror of
https://github.com/jbowdre/runtimeterror.git
synced 2024-11-22 06:52:18 +00:00
Merge branch 'main' into drafts
This commit is contained in:
commit
8d45cad212
1 changed files with 15 additions and 14 deletions
|
@ -1,24 +1,25 @@
|
||||||
// disables kudos button after click
|
// manipulates the post upvote "kudos" button behavior
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
window.onload = function() {
|
||||||
const kudosButton = document.querySelector('.kudos-button');
|
// get the button and text elements
|
||||||
const kudosText = document.querySelector('.kudos-text');
|
var kudosButton = document.querySelector('.kudos-button');
|
||||||
const emojiSpan = kudosButton.querySelector('.emoji');
|
var kudosText = document.querySelector('.kudos-text');
|
||||||
|
var emojiSpan = kudosButton.querySelector('.emoji');
|
||||||
|
|
||||||
kudosButton.addEventListener('click', () => {
|
kudosButton.addEventListener('click', function(event) {
|
||||||
|
// send the event to Cabin
|
||||||
cabin.event('kudos')
|
cabin.event('kudos')
|
||||||
|
// disable the button
|
||||||
kudosButton.disabled = true;
|
kudosButton.disabled = true;
|
||||||
kudosButton.classList.add('clicked');
|
kudosButton.classList.add('clicked');
|
||||||
|
// change the displayed text
|
||||||
kudosText.textContent = 'Thanks!';
|
kudosText.textContent = 'Thanks!';
|
||||||
kudosText.classList.add('thanks');
|
kudosText.classList.add('thanks');
|
||||||
|
// spin the emoji
|
||||||
// Rotate the emoji
|
|
||||||
emojiSpan.style.transform = 'rotate(360deg)';
|
emojiSpan.style.transform = 'rotate(360deg)';
|
||||||
|
// change the emoji to celebrate
|
||||||
// Change the emoji after rotation
|
setTimeout(function() {
|
||||||
setTimeout(() => {
|
|
||||||
emojiSpan.textContent = '🎉';
|
emojiSpan.textContent = '🎉';
|
||||||
}, 150); // Half of the transition time for a smooth mid-rotation change
|
}, 150); // half of the css transition time for a smooth mid-rotation change
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
Loading…
Reference in a new issue