Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mjafory committed Nov 6, 2023
1 parent 24079a0 commit 6e71f1f
Show file tree
Hide file tree
Showing 13 changed files with 195 additions and 73 deletions.
8 changes: 6 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<body>
<nav>
<div class="header">
<a href="/index.html" class="logo">CSS</a><br>
<a href="index.html" class="logo">CSS</a><br>
<p>Computer Steering Skills</p>
<div class="header-right">
<a href="#about" onclick="refreshPage()">Refresh</a>
Expand Down Expand Up @@ -42,7 +42,7 @@
</div>

<div class="column" id="keyboard">
<a href="keyboard4/index.html"> Alphabet Sequence</a>
<a href="keyboard4/index.html"> Alphabet Sequence 1</a>
<p class="subtile">Keyboard</p>
</div>
<div class="column" id="mouse">
Expand All @@ -60,6 +60,10 @@
<div class="column" id="mouse">
<a href="mouse4/index.html">Number Sequence</a>
<p class="subtile">Mouse</p>
</div>
<div class="column" id="mouse">
<a href="mouse5/index.html">Alphabet Sequence 2</a>
<p class="subtile">Mouse</p>
</div>
</div>
</center>
Expand Down
2 changes: 1 addition & 1 deletion keyboard1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<body>
<nav>
<div class="header">
<a href="/index.html" class="logo">CSS</a><br>
<a href="../index.html" class="logo">CSS</a><br>
<p>Computer Steering Skills</p>
<div class="header-right">
<a href="#about" onclick="refreshPage()">Refresh</a>
Expand Down
2 changes: 1 addition & 1 deletion keyboard2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<body>
<nav>
<div class="header">
<a href="/index.html" class="logo">CSS</a><br>
<a href="../index.html" class="logo">CSS</a><br>
<p>Computer Steering Skills</p>
<div class="header-right">
<a href="#about" onclick="refreshPage()">Refresh</a>
Expand Down
2 changes: 1 addition & 1 deletion keyboard3/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<body>
<nav>
<div class="header">
<a href="/index.html" class="logo">CSS</a><br>
<a href="../index.html" class="logo">CSS</a><br>
<p>Computer Steering Skills</p>
<div class="header-right">
<a href="#about" onclick="refreshPage()">Refresh</a>
Expand Down
23 changes: 10 additions & 13 deletions keyboard4/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Alphabet Sequence</title>
<title>Alphabet Sequence Game</title>
<link rel="stylesheet" href="../nav.css">
<link rel="stylesheet" href="style.css">
</head>

<body>
<nav>
<div class="header">
<a href="/index.html" class="logo">CSS</a><br>
<a href="../index.html" class="logo">CSS</a><br>
<p>Computer Steering Skills</p>
<div class="header-right">
<a href="#about" onclick="refreshPage()">Refresh</a>
Expand All @@ -26,7 +26,7 @@
<div class="body">
<div class="container">
<h1>Alphabet Sequence</h1>
<p>Press the letters on your keyboard in alphabetical order!</p>
<p>Click the letters in alphabetical order!</p>
<div class="alpha-grid" id="alpha-grid"></div>
</div>
</div>
Expand All @@ -47,20 +47,18 @@ <h1>Alphabet Sequence</h1>
const letterElement = document.createElement('div');
letterElement.classList.add('number');
letterElement.textContent = letter;
letterElement.addEventListener('click', () => handleLetterClick(letterElement));
letterElements.push(letterElement);
letterGrid.appendChild(letterElement);
});
}

function handleKeyboardEvent(event) {
const keyPressed = event.key.toUpperCase();

if (keyPressed === expectedLetter) {
const currentLetterElement = letterElements.find(element => element.textContent === keyPressed);

currentLetterElement.style.backgroundColor = '#27ae60';
currentLetterElement.style.pointerEvents = 'none';
function handleLetterClick(element) {
const clickedLetter = element.textContent;

if (clickedLetter === expectedLetter) {
element.style.backgroundColor = '#27ae60';
element.style.pointerEvents = 'none';
expectedLetter = String.fromCharCode(expectedLetter.charCodeAt(0) + 1);
checkWin();
} else {
Expand All @@ -76,12 +74,11 @@ <h1>Alphabet Sequence</h1>

function checkWin() {
if (expectedLetter > 'Z') {
alert('Congratulations! You pressed all the letters in order!');
alert('Congratulations! You clicked all the letters in order!');
}
}

createGrid();
document.addEventListener('keydown', handleKeyboardEvent);
</script>
</body>

Expand Down
2 changes: 1 addition & 1 deletion mouse1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<body>
<nav>
<div class="header">
<a href="/index.html" class="logo">CSS</a><br>
<a href="../index.html" class="logo">CSS</a><br>
<p>Computer Steering Skills</p>
<div class="header-right">
<a href="#about" onclick="refreshPage()">Refresh</a>
Expand Down
2 changes: 1 addition & 1 deletion mouse2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<body>
<nav>
<div class="header">
<a href="/index.html" class="logo">CSS</a><br>
<a href="../index.html" class="logo">CSS</a><br>
<p>Computer Steering Skills</p>
<div class="header-right">
<a href="#about" onclick="refreshPage()">Refresh</a>
Expand Down
54 changes: 2 additions & 52 deletions mouse3/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,14 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../nav.css">
<link rel="stylesheet" href="style.css">
<title>Catch Me</title>
<style>
*{
/* margin: 0; */
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body {
margin: 0;
padding: 0;
}

.body {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
margin: 0;
}

.details {
position: relative;
top: 0px;
background-color: brown;
display: flex;
padding: 1px;
color: wheat;
}

.details p {
padding: 10px;
font-size: 20px;
text-align: center;
}

#target {
width: 100px;
height: 100px;
background-color: deeppink;
border-radius: 50%;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
font-size: 18px;
padding: 5px;
color: white;
position: absolute;
}
</style>

</head>
<body>
<nav>
<div class="header">
<a href="/index.html" class="logo">CSS</a><br>
<a href="../index.html" class="logo">CSS</a><br>
<p>Computer Steering Skills</p>
<div class="header-right">
<a href="#about" onclick="refreshPage()">Refresh</a>
Expand Down
49 changes: 49 additions & 0 deletions mouse3/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
*{
/* margin: 0; */
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body {
margin: 0;
padding: 0;
}

.body {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
margin: 0;
}

.details {
position: relative;
top: 0px;
background-color: brown;
display: flex;
padding: 1px;
color: wheat;
}

.details p {
padding: 10px;
font-size: 20px;
text-align: center;
}

#target {
width: 100px;
height: 100px;
background-color: deeppink;
border-radius: 50%;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
font-size: 18px;
padding: 5px;
color: white;
position: absolute;
}
2 changes: 1 addition & 1 deletion mouse4/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<body>
<nav>
<div class="header">
<a href="/index.html" class="logo">CSS</a><br>
<a href="../index.html" class="logo">CSS</a><br>
<p>Computer Steering Skills</p>
<div class="header-right">
<a href="#about" onclick="refreshPage()">Refresh</a>
Expand Down
88 changes: 88 additions & 0 deletions mouse5/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Alphabet Sequence</title>
<link rel="stylesheet" href="../nav.css">
<link rel="stylesheet" href="style.css">
</head>

<body>
<nav>
<div class="header">
<a href="../index.html" class="logo">CSS</a><br>
<p>Computer Steering Skills</p>
<div class="header-right">
<a href="#about" onclick="refreshPage()">Refresh</a>
<a href="#about">Log in</a>
<a href="#about">Sign in</a>
</div>
</div>
<script type="application/javascript" src="../nav.js"></script>
</nav>

<div class="body">
<div class="container">
<h1>Alphabet Sequence</h1>
<p>Press the letters on your keyboard in alphabetical order!</p>
<div class="alpha-grid" id="alpha-grid"></div>
</div>
</div>

<audio id="alertSound" src="wrong.mp3"></audio>

<script>
const letters = Array.from({ length: 26 }, (_, i) => String.fromCharCode(65 + i));
let expectedLetter = 'A';

const letterGrid = document.getElementById('alpha-grid');
const letterElements = [];
const alertSound = document.getElementById('alertSound');

function createGrid() {
const shuffledLetters = [...letters].sort(() => Math.random() - 0.5);
shuffledLetters.forEach(letter => {
const letterElement = document.createElement('div');
letterElement.classList.add('number');
letterElement.textContent = letter;
letterElements.push(letterElement);
letterGrid.appendChild(letterElement);
});
}

function handleKeyboardEvent(event) {
const keyPressed = event.key.toUpperCase();

if (keyPressed === expectedLetter) {
const currentLetterElement = letterElements.find(element => element.textContent === keyPressed);

currentLetterElement.style.backgroundColor = '#27ae60';
currentLetterElement.style.pointerEvents = 'none';

expectedLetter = String.fromCharCode(expectedLetter.charCodeAt(0) + 1);
checkWin();
} else {
playAlertSound();
alert('Incorrect letter. Try again!');
}
}

function playAlertSound() {
alertSound.currentTime = 0;
alertSound.play();
}

function checkWin() {
if (expectedLetter > 'Z') {
alert('Congratulations! You pressed all the letters in order!');
}
}

createGrid();
document.addEventListener('keydown', handleKeyboardEvent);
</script>
</body>

</html>
34 changes: 34 additions & 0 deletions mouse5/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.body {
font-family: 'Fira Sans', sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 80vh;
margin: 0;
}

.container {
text-align: center;

}

.alpha-grid {
display: grid;
grid-template-columns: repeat(6, 100px);
grid-gap: 2vh;
margin-top: 20px;
}

.number {
width: 60px;
height: 60px;
background-color: black;
border-radius: 10%;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
color: yellow;
font-size: 30px;
font-weight: bold;
}
Binary file added mouse5/wrong.mp3
Binary file not shown.

0 comments on commit 6e71f1f

Please sign in to comment.