Skip to content

Commit

Permalink
Merge branch 'main' into 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Subhajit-2023-44 authored Nov 7, 2024
2 parents 223352e + 63f6bca commit 13f5ded
Show file tree
Hide file tree
Showing 5 changed files with 281 additions and 131 deletions.
9 changes: 8 additions & 1 deletion Alien.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,14 @@ function gameOver() {
if (score > highScore) {
highScore = score;
highScoreElement.textContent = highScore;

let highScoreHistory =
JSON.parse(localStorage.getItem("highScoreHistory")) || [];
const now = new Date().toLocaleString();
// Add the new score with the timestamp to history
highScoreHistory.push({ score: highScore, date: now });

// Save updated history back to localStorage
localStorage.setItem("highScoreHistory", JSON.stringify(highScoreHistory));
// Update the high score in localStorage
localStorage.setItem("highScore", highScore);
}
Expand Down
4 changes: 2 additions & 2 deletions FAQs.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
display: none;
position: fixed;
bottom: 20px;
left: 20px;
right: 80px;
background-color: #007bff;
color: #fff;
padding: 15px 20px;
Expand Down Expand Up @@ -401,7 +401,7 @@ <h2 onclick="toggleAnswer(this)">
<!-- Copyright -->
</footer>

<button id="scrollUpBtn" onclick="scrollToTop()">Scroll Up</button>
<button id="scrollUpBtn" onclick="scrollToTop()"></button>

<script src="FAQs.js"></script>

Expand Down
51 changes: 51 additions & 0 deletions feedback.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
<input
type="email"
required
id="email"
class="form-input w-full px-4 py-3 rounded-lg text-white"
placeholder="Enter your email"
/>
Expand Down Expand Up @@ -226,14 +227,64 @@
</div>

<script>
const trustedDomains = [
'gmail.com',
'outlook.com',
'yahoo.com',
'protonmail.com',
'icloud.com',
'tutanota.com',
'hotmail.com',
'live.com',
'mail.com',
'zoho.com',
'gmx.com',
'aol.com',
'fastmail.com',
'yandex.com',
'*.edu',
'*.ac.uk',
'*.edu.in',
'*.edu.au',
'examplecompany.com',
'mailfence.com',
'posteo.de',
'runbox.com',
'countermail.com',
'hushmail.com',
'inbox.com',
'mail.ru',
'rediffmail.com',
'seznam.cz'
];

function validateEmail(email) {
const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; // Basic email format validation
const domain = email.split('@')[1];

return (
emailPattern.test(email) &&
trustedDomains.some((trusted) =>
trusted.includes('*') ? domain.endsWith(trusted.slice(1)) : domain === trusted
)
);
}

document
.getElementById("feedbackForm")
.addEventListener("submit", function (e) {
e.preventDefault();

const email = document.getElementById('email').value.trim();

const button = e.target.querySelector("button");
const originalText = button.textContent;

if (!validateEmail(email)) {
alert('Please enter a valid email address from a trusted provider.');
return;
}

button.textContent = "Transmitting...";
button.disabled = true;

Expand Down
24 changes: 12 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,7 @@ <h2 class="uppercase">What power-up do you find most helpful?</h2>
</head>

<body>



<nav class="navbar">
<!-- <img src="assets/images/logo1-.png" alt="logo" height="80px" class="image"> -->
<div class="title5">
Expand Down Expand Up @@ -562,12 +561,14 @@ <h2 class="primary-btn" id="logoutButton" style="display: none;">
Signup/Register
</button>


<div id="faqbtn">
<a href="./contributors.html">
<button class="faq-btn">Contributors</button>
</a>
</div>


<div class="theme-switch-wrapper">
<label class="theme-switch" for="checkbox">
<input type="checkbox" id="checkbox">
Expand All @@ -579,8 +580,6 @@ <h2 class="primary-btn" id="logoutButton" style="display: none;">

</nav>
<div class="gtranslate_wrapper"></div>


<div id="gameControls" class="header">
<img src="./assets/images/alien.png" alt="Game Logo" class="logoImage">
<div class="controlGroup">
Expand All @@ -602,6 +601,14 @@ <h2 class="primary-btn" id="logoutButton" style="display: none;">
<button id="pauseButton" style="display: none"><i class="fas fa-play"></i> Game paused</button>
<button id="restartButton" style="display: none"><i class="fas fa-redo"></i> Play Again </button>
</div>
<div class="theme-switch-wrapper">
<label class="theme-switch" for="checkbox">
<input type="checkbox" id="checkbox">
<div class="slider"></div>
</label>
<span id="mode-label">Light Mode</span>
</div>

</div>
<div id="gameContainer">
<canvas id="gameCanvas"></canvas>
Expand Down Expand Up @@ -763,13 +770,6 @@ <h2 class="primary-btn" id="logoutButton" style="display: none;">
<div id="instructions">

<div>
<!-- <div class="theme-switch-wrapper">
<label class="theme-switch" for="checkbox">
<input type="checkbox" id="checkbox">
<div class="slider"></div>
</label>
<span id="mode-label">Light Mode</span>
</div> -->
<div id="volumeControl">
<div id="muteControl">
<button id="muteButton" class="styled-button"
Expand Down Expand Up @@ -929,7 +929,7 @@ <h2 class="primary-btn" id="logoutButton" style="display: none;">
</div>
<div id="sharescorebtn">
<a href="share_score.html">
<button class="scoresh">Share Your Score</button>
<button class="scoresh">Share High Score</button>
</a>
</div>
</div> -->
Expand Down
Loading

0 comments on commit 13f5ded

Please sign in to comment.