Merge pull request 'fix-countjs-import' (#1) from fix-countjs-import into main
Reviewed-on: Schmidii99/CpuHigherLower#1
This commit is contained in:
commit
3d92aaf8c4
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.DS_Store
|
12
game.html
12
game.html
@ -11,8 +11,6 @@
|
|||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="game.js"></script>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<nav class="navbar navbar-expand-sm bg-light navbar-light">
|
<nav class="navbar navbar-expand-sm bg-light navbar-light">
|
||||||
<div class="container-fluid h4">
|
<div class="container-fluid h4">
|
||||||
@ -53,9 +51,9 @@
|
|||||||
<span class="h3">cpu score:</span>
|
<span class="h3">cpu score:</span>
|
||||||
<span class="h3 counter-count" id="nextCpuScore">?</span>
|
<span class="h3 counter-count" id="nextCpuScore">?</span>
|
||||||
<br>
|
<br>
|
||||||
<button class="btn btn-lg bg-info m-3" onclick="btnHigherClick()" id="btnHigher">Higher</button>
|
<button class="btn btn-lg bg-info m-3" id="btnHigher">Higher</button>
|
||||||
<br>
|
<br>
|
||||||
<button class="btn btn-lg bg-info mb-3" onclick="btnLowerClick()" id="btnLower">Lower</button>
|
<button class="btn btn-lg bg-info mb-3" id="btnLower">Lower</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -63,5 +61,11 @@
|
|||||||
<!-- <div class="footer">
|
<!-- <div class="footer">
|
||||||
<a href="https://www.flaticon.com/free-icons/processor" title="processor icons">Processor icons created by kerismaker - Flaticon</a>
|
<a href="https://www.flaticon.com/free-icons/processor" title="processor icons">Processor icons created by kerismaker - Flaticon</a>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
import {btnHigherClick, btnLowerClick} from "./game.js"
|
||||||
|
document.getElementById("btnHigher").onclick = btnHigherClick
|
||||||
|
document.getElementById("btnLower").onclick = btnLowerClick
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
6
game.js
6
game.js
@ -1,3 +1,5 @@
|
|||||||
|
import { CountUp } from "./node_modules/countup.js/dist/countUp.min.js";
|
||||||
|
|
||||||
var cpuList;
|
var cpuList;
|
||||||
var currentCpu;
|
var currentCpu;
|
||||||
var nextCpu;
|
var nextCpu;
|
||||||
@ -18,11 +20,11 @@ function getRandomCpu() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function btnLowerClick() {
|
export function btnLowerClick() {
|
||||||
currentCpu.score < nextCpu.score ? showResult(true) : showResult(false);
|
currentCpu.score < nextCpu.score ? showResult(true) : showResult(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function btnHigherClick() {
|
export function btnHigherClick() {
|
||||||
currentCpu.score > nextCpu.score ? showResult(true) : showResult(false);
|
currentCpu.score > nextCpu.score ? showResult(true) : showResult(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user