Created
January 2, 2019 21:24
-
-
Save hellobrian/d17b5de37feda2b6afc954a74c7d7f1e to your computer and use it in GitHub Desktop.
Prettier: Badly Formatted Code for Demo
This file contains hidden or 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
html { | |
box-sizing: border-box; | |
font-size: 16px ; | |
} | |
*, *:before, *:after { | |
box-sizing: inherit ; | |
} | |
.banana > span:after { | |
content: attr(data-points) "pts" ; | |
font-size: 0.875rem; | |
position: absolute; | |
top: 50% ; | |
left: -40%; | |
background-color: var(--white-50) ; | |
padding: 2px 10px; | |
color: rgba(1, 1, 1, 1); | |
border-radius: 4px; | |
} |
This file contains hidden or 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
$("#speedPercent").on("input", event => { | |
$(".output").value = event.target.value + "%" ; | |
}) | |
$("#grid").on("click", event => { | |
if (event.target && event.target.matches("button.banana")) { | |
const points = parseInt( event.target.dataset.points, 10 ) ; | |
state = { ...state, score: state.score + points }; | |
setScoreInnerHTML(state); | |
const span = event.target.querySelector("span"); | |
span.classList.add("exit-animation"); | |
span.on('animationend', () => { | |
event.target.parentNode.removeChild(event.target)}) | |
} | |
}) | |
const mutationObserver = observer(state) | |
mutationObserver.observe($("#grid"), {attributes: false,childList: true,subtree: true}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment