Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrewjh271/root-boot-glute
Root Boot Glute
https://github.com/andrewjh271/root-boot-glute
Last synced: about 1 month ago
JSON representation
Root Boot Glute
- Host: GitHub
- URL: https://github.com/andrewjh271/root-boot-glute
- Owner: andrewjh271
- Created: 2020-04-18T06:01:00.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-11T21:02:43.000Z (over 4 years ago)
- Last Synced: 2024-12-09T09:54:21.346Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://andrewjh271.github.io/root-boot-glute/
- Size: 3.76 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Root Boot Glute
[Live Page](https://andrewjh271.github.io/root-boot-glute/)This project is an adaption for a friend of my [Rock Paper Scissors](https://andrewjh271.github.io/RockPaperScissors/) project.
### Thoughts
The major Javascript change was replacing
```javascript
rockButton.onclick = function(){playRound(0, computerPlay())};
paperButton.onclick = function(){playRound(1, computerPlay())};
scissorsButton.onclick = function(){playRound(2, computerPlay())};
```
with
```javascript
window.addEventListener('click', respondToClick);
function respondToClick(e) {
const playerSelection = e.target.dataset.choice;
const computerSelection = computerPlay();
if(!playerSelection) return;
playRound(playerSelection, computerSelection);
}
window.removeEventListener('click', respondToClick);
```
This allowed me to remove button responsiveness after the last game of the match. I also changed computerPlay to return strings instead of numbers, which made the code more readable.I also needed to give the buttons a specific class that contained the effects with :hover and :active. This was so that I could temporarily remove that class from these buttons so they looked inactive to the user.
-Andrew Hayhurst