Merge pull request #560 from art0007i/master

remove jquery from EmoteApp.html
This commit is contained in:
ksuprynowicz 2023-08-18 12:57:34 +02:00 committed by GitHub
commit fc7d12a61e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
<!-- <!--
// EmoteApp.html // EmoteApp.html
// //
// Created by Brad Hefta-Gaub on 7 Jan 2018 // Created by Brad Hefta-Gaub on 7 Jan 2018
@ -110,7 +110,6 @@
<input type="button" class="emote-button white" value="Love"></p> <input type="button" class="emote-button white" value="Love"></p>
</div> </div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script> <script>
function main() { function main() {
// Send an event to emote.js when the page loads and is ready to get things rolling // Send an event to emote.js when the page loads and is ready to get things rolling
@ -122,17 +121,19 @@
EventBridge.emitWebEvent(JSON.stringify(readyEvent)); EventBridge.emitWebEvent(JSON.stringify(readyEvent));
// Send an event when user click on each of the emote buttons // Send an event when user click on each of the emote buttons
$(".emote-button").click(function(){ document.querySelectorAll(".emote-button").forEach((btn)=>{
console.log(this.value + " button click"); btn.addEventListener("click", (e)=>{
console.log(e.target.value + " button click");
var clickEvent = { var clickEvent = {
"type": "click", "type": "click",
"data": this.value "data": e.target.value
}; };
EventBridge.emitWebEvent(JSON.stringify(clickEvent)); EventBridge.emitWebEvent(JSON.stringify(clickEvent));
}); });
});
} }
$(document).ready(main); document.addEventListener("DOMContentLoaded", main);
</script> </script>
</body> </body>
</html> </html>