Untitled
Anonymous
Plain Text
09/11/2025 6:08 AM
19.3 KB
19
Indexable
Never
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cambridge O Level Flashcard Master</title>
<style>
:root {
--primary: #3498db;
--secondary: #2c3e50;
--correct: #2ecc71;
--incorrect: #e74c3c;
--easy: #2ecc71;
--medium: #f39c12;
--hard: #e74c3c;
--deadly: #9b59b6;
--light: #ecf0f1;
--dark: #34495e;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background-color: #f5f7fa;
color: var(--dark);
line-height: 1.6;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
header {
text-align: center;
margin-bottom: 30px;
padding: 20px;
background: white;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
h1 {
color: var(--secondary);
margin-bottom: 10px;
}
.subtitle {
color: #7f8c8d;
font-size: 1.1rem;
}
.setup-panel, .flashcard-container, .completion-screen {
background: white;
border-radius: 10px;
padding: 25px;
margin-bottom: 20px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.form-group {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 8px;
font-weight: 600;
}
select, textarea {
width: 100%;
padding: 12px;
border: 1px solid #ddd;
border-radius: 5px;
font-size: 16px;
}
textarea {
min-height: 150px;
resize: vertical;
}
button {
background-color: var(--primary);
color: white;
border: none;
padding: 12px 20px;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
font-weight: 600;
transition: background-color 0.3s;
}
button:hover {
background-color: #2980b9;
}
.btn-start {
background-color: var(--correct);
width: 100%;
margin-top: 15px;
}
.btn-start:hover {
background-color: #27ae60;
}
.difficulty-selector {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
}
.difficulty-btn {
flex: 1;
margin: 0 5px;
padding: 10px;
text-align: center;
border-radius: 5px;
cursor: pointer;
opacity: 0.7;
transition: all 0.3s;
}
.difficulty-btn.active {
opacity: 1;
transform: scale(1.05);
}
.easy-btn { background-color: var(--easy); color: white; }
.medium-btn { background-color: var(--medium); color: white; }
.hard-btn { background-color: var(--hard); color: white; }
.deadly-btn { background-color: var(--deadly); color: white; }
.flashcard {
perspective: 1000px;
height: 300px;
margin-bottom: 30px;
}
.flashcard-inner {
position: relative;
width: 100%;
height: 100%;
transition: transform 0.6s;
transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner {
transform: rotateY(180deg);
}
.flashcard-front, .flashcard-back {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
background: white;
}
.flashcard-back {
transform: rotateY(180deg);
text-align: center;
}
.card-content {
font-size: 18px;
text-align: center;
}
.swipe-buttons {
display: flex;
justify-content: space-around;
margin-top: 20px;
}
.swipe-btn {
width: 70px;
height: 70px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
cursor: pointer;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.incorrect-btn {
background-color: var(--incorrect);
color: white;
}
.correct-btn {
background-color: var(--correct);
color: white;
}
.progress-container {
margin-top: 20px;
}
.progress-bar {
height: 10px;
background-color: #eee;
border-radius: 5px;
overflow: hidden;
}
.progress {
height: 100%;
background-color: var(--primary);
width: 0%;
transition: width 0.3s;
}
.progress-text {
display: flex;
justify-content: space-between;
margin-top: 5px;
font-size: 14px;
}
.hidden {
display: none;
}
.completion-screen {
text-align: center;
}
.completion-icon {
font-size: 60px;
color: var(--correct);
margin-bottom: 20px;
}
.stats {
display: flex;
justify-content: space-around;
margin: 20px 0;
}
.stat-item {
text-align: center;
}
.stat-value {
font-size: 24px;
font-weight: bold;
}
.stat-label {
font-size: 14px;
color: #7f8c8d;
}
@media (max-width: 600px) {
.container {
padding: 10px;
}
.flashcard {
height: 250px;
}
.card-content {
font-size: 16px;
}
.swipe-btn {
width: 60px;
height: 60px;
}
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>Cambridge O Level Flashcard Master</h1>
<p class="subtitle">Master your subjects through targeted practice</p>
</header>
<div id="setupPanel" class="setup-panel">
<div class="form-group">
<label for="subjectSelect">Select Subject</label>
<select id="subjectSelect">
<option value="biology">Biology</option>
<option value="chemistry">Chemistry</option>
<option value="physics">Physics</option>
<option value="math">Mathematics</option>
<option value="history">History</option>
</select>
</div>
<div class="form-group">
<label for="notesInput">Paste Your Notes (Question and Answer pairs separated by | character)</label>
<textarea id="notesInput" placeholder="E.g., What is mitosis?|Cell division process Define osmosis|Movement of water molecules"></textarea>
</div>
<button id="startBtn" class="btn-start">Start Practicing</button>
</div>
<div id="flashcardPanel" class="flashcard-container hidden">
<div class="difficulty-selector">
<div class="difficulty-btn easy-btn active" data-difficulty="easy">Easy</div>
<div class="difficulty-btn medium-btn" data-difficulty="medium">Medium</div>
<div class="difficulty-btn hard-btn" data-difficulty="hard">Hard</div>
<div class="difficulty-btn deadly-btn" data-difficulty="deadly">Deadly</div>
</div>
<div class="flashcard" id="flashcard">
<div class="flashcard-inner">
<div class="flashcard-front">
<div class="card-content" id="questionText">Question will appear here</div>
</div>
<div class="flashcard-back">
<div class="card-content" id="answerText">Answer will appear here</div>
</div>
</div>
</div>
<div class="swipe-buttons">
<div class="swipe-btn incorrect-btn" id="incorrectBtn">✗</div>
<div class="swipe-btn correct-btn" id="correctBtn">✓</div>
</div>
<div class="progress-container">
<div class="progress-bar">
<div class="progress" id="progressBar"></div>
</div>
<div class="progress-text">
<span id="progressText">0/0 cards mastered</span>
<span id="remainingText">0 remaining</span>
</div>
</div>
</div>
<div id="completionPanel" class="completion-screen hidden">
<div class="completion-icon">🎓</div>
<h2>Congratulations!</h2>
<p>You've mastered all your flashcards.</p>
<div class="stats">
<div class="stat-item">
<div class="stat-value" id="totalCards">0</div>
<div class="stat-label">Total Cards</div>
</div>
<div class="stat-item">
<div class="stat-value" id="correctCards">0</div>
<div class="stat-label">Correct Answers</div>
</div>
<div class="stat-item">
<div class="stat-value" id="accuracy">0%</div>
<div class="stat-label">Accuracy</div>
</div>
</div>
<button id="restartBtn">Study Again</button>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// DOM elements
const setupPanel = document.getElementById('setupPanel');
const flashcardPanel = document.getElementById('flashcardPanel');
const completionPanel = document.getElementById('completionPanel');
const startBtn = document.getElementById('startBtn');
const restartBtn = document.getElementById('restartBtn');
const subjectSelect = document.getElementById('subjectSelect');
const notesInput = document.getElementById('notesInput');
const flashcard = document.getElementById('flashcard');
const questionText = document.getElementById('questionText');
const answerText = document.getElementById('answerText');
const incorrectBtn = document.getElementById('incorrectBtn');
const correctBtn = document.getElementById('correctBtn');
const progressBar = document.getElementById('progressBar');
const progressText = document.getElementById('progressText');
const remainingText = document.getElementById('remainingText');
const difficultyButtons = document.querySelectorAll('.difficulty-btn');
const totalCardsEl = document.getElementById('totalCards');
const correctCardsEl = document.getElementById('correctCards');
const accuracyEl = document.getElementById('accuracy');
// App state
let allFlashcards = [];
let currentDifficulty = 'easy';
let currentCardIndex = 0;
let correctCards = 0;
let incorrectCards = [];
// Sample questions for demonstration
const sampleNotes = `What is the main function of the mitochondria?|To produce energy (ATP) through cellular respiration
Define photosynthesis|The process by which plants convert light energy into chemical energy
What is a neuron?|A specialized cell transmitting nerve impulses
Name the four bases in DNA|Adenine, Thymine, Guanine, Cytosine
What is homeostasis?|Maintenance of a constant internal environment`;
notesInput.value = sampleNotes;
// Event listeners
startBtn.addEventListener('click', startPractice);
restartBtn.addEventListener('click', resetPractice);
flashcard.addEventListener('click', flipCard);
incorrectBtn.addEventListener('click', () => handleSwipe(false));
correctBtn.addEventListener('click', () => handleSwipe(true));
difficultyButtons.forEach(button => {
button.addEventListener('click', function() {
difficultyButtons.forEach(btn => btn.classList.remove('active'));
this.classList.add('active');
currentDifficulty = this.getAttribute('data-difficulty');
filterCardsByDifficulty();
});
});
// Functions
function startPractice() {
const notes = notesInput.value.trim();
const subject = subjectSelect.value;
if (!notes) {
alert('Please enter your notes to create flashcards.');
return;
}
// Parse notes and create flashcards
allFlashcards = parseNotes(notes);
if (allFlashcards.length === 0) {
alert('Could not create flashcards. Please use the format: Question|Answer');
return;
}
// Initialize practice
setupPanel.classList.add('hidden');
flashcardPanel.classList.remove('hidden');
filterCardsByDifficulty();
showCard(0);
updateProgress();
}
function parseNotes(notes) {
const cards = [];
const lines = notes.split('\n');
for (const line of lines) {
const parts = line.split('|');
if (parts.length >= 2) {
const question = parts[0].trim();
const answer = parts[1].trim();
// Assign random difficulty for demo purposes
const difficulties = ['easy', 'medium', 'hard', 'deadly'];
const difficulty = difficulties[Math.floor(Math.random() * difficulties.length)];
cards.push({
question,
answer,
difficulty,
mastered: false
});
}
}
return cards;
}
function filterCardsByDifficulty() {
// For this demo, we'll just use all cards regardless of difficulty
// In a real implementation, you would filter based on currentDifficulty
currentCardIndex = 0;
showCard(0);
}
function showCard(index) {
if (allFlashcards.length === 0) return;
if (index >= allFlashcards.length) {
completePractice();
return;
}
const card = allFlashcards[index];
questionText.textContent = card.question;
answerText.textContent = card.answer;
// Reset card flip state
flashcard.classList.remove('flipped');
}
function flipCard() {
flashcard.classList.toggle('flipped');
}
function handleSwipe(isCorrect) {
if (isCorrect) {
allFlashcards[currentCardIndex].mastered = true;
correctCards++;
} else {
allFlashcards[currentCardIndex].mastered = false;
incorrectCards.push(allFlashcards[currentCardIndex]);
}
// Move to next card
currentCardIndex++;
if (currentCardIndex >= allFlashcards.length) {
// Check if we have any incorrect cards to review
if (incorrectCards.length > 0) {
// Reset with only incorrect cards
allFlashcards = [...incorrectCards];
incorrectCards = [];
currentCardIndex = 0;
} else {
completePractice();
return;
}
}
showCard(currentCardIndex);
updateProgress();
}
function updateProgress() {
const total = allFlashcards.length;
const mastered = allFlashcards.filter(card => card.mastered).length;
const progress = total > 0 ? (mastered / total) * 100 : 0;
progressBar.style.width = `${progress}%`;
progressText.textContent = `${mastered}/${total} cards mastered`;
remainingText.textContent = `${total - mastered} remaining`;
}
function completePractice() {
flashcardPanel.classList.add('hidden');
completionPanel.classList.remove('hidden');
const total = allFlashcards.length;
const accuracy = total > 0 ? Math.round((correctCards / total) * 100) : 0;
totalCardsEl.textContent = total;
correctCardsEl.textContent = correctCards;
accuracyEl.textContent = `${accuracy}%`;
}
function resetPractice() {
completionPanel.classList.add('hidden');
setupPanel.classList.remove('hidden');
// Reset state
allFlashcards = [];
currentCardIndex = 0;
correctCards = 0;
incorrectCards = [];
}
});
</script>
</body>
</html>Editor is loading...
Leave a Comment