-
Notifications
You must be signed in to change notification settings - Fork 0
/
exam1c.html
152 lines (138 loc) · 4.61 KB
/
exam1c.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MRCOG Part 3 Exam UI</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/2.1.3/marked.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
#timer {
position: fixed;
top: 0;
left: 0;
right: 0;
background-color: #f8f9fa;
font-size: 24px;
font-weight: bold;
padding: 10px;
text-align: center;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
z-index: 1000;
}
#exam-content {
margin-top: 60px;
}
#task-title, #task-content, #notes {
margin-bottom: 20px;
}
button {
padding: 10px 20px;
font-size: 16px;
}
#task-content {
border: 1px solid #ccc;
padding: 15px;
background-color: #f9f9f9;
}
#notes {
width: 100%;
height: 150px;
resize: vertical;
}
</style>
</head>
<body>
<div id="timer"></div>
<div id="exam-content">
<h1>MRCOG Part 3 Exam UI</h1>
<div id="start-screen">
<button id="start-btn">Start Exam</button>
</div>
<div id="exam-screen" style="display: none;">
<div id="task-title"></div>
<div id="task-content"></div>
<textarea id="notes" placeholder="Type your notes here..."></textarea>
</div>
</div>
<script>
const startBtn = document.getElementById('start-btn');
const startScreen = document.getElementById('start-screen');
const examScreen = document.getElementById('exam-screen');
const timerDisplay = document.getElementById('timer');
const taskTitleDisplay = document.getElementById('task-title');
const taskContentDisplay = document.getElementById('task-content');
const notesArea = document.getElementById('notes');
let tasks = [];
let currentTask = 0;
let timer;
let timeLeft;
startBtn.addEventListener('click', startExam);
function loadTasks() {
return fetch('mrcog-exam-tasks.json')
.then(response => response.json())
.then(data => {
tasks = data.tasks;
})
.catch(error => console.error('Error loading tasks:', error));
}
function startExam() {
loadTasks().then(() => {
startScreen.style.display = 'none';
examScreen.style.display = 'block';
nextTask();
});
}
function startTimer(seconds, label) {
clearInterval(timer);
timeLeft = seconds;
updateTimerDisplay(label);
timer = setInterval(() => {
timeLeft--;
updateTimerDisplay(label);
if (timeLeft <= 0) {
clearInterval(timer);
if (label === 'Reading Time') {
startTimer(600, 'Task Time');
} else {
nextTask();
}
}
}, 1000);
}
function updateTimerDisplay(label) {
const minutes = Math.floor(timeLeft / 60);
const seconds = timeLeft % 60;
timerDisplay.textContent = `${label}: ${minutes}:${seconds.toString().padStart(2, '0')}`;
}
function showTask() {
const task = tasks[currentTask];
taskTitleDisplay.textContent = task.title;
fetch(task.file)
.then(response => response.text())
.then(markdown => {
taskContentDisplay.innerHTML = marked.parse(markdown);
})
.catch(error => console.error('Error loading task content:', error));
notesArea.value = ''; // Clear notes for new task
}
function nextTask() {
if (currentTask < tasks.length) {
showTask();
startTimer(120, 'Reading Time');
} else {
endExam();
}
currentTask++;
}
function endExam() {
examScreen.innerHTML = '<h2>Exam Completed</h2><p>Thank you for taking the MRCOG Part 3 Exam.</p>';
}
</script>
</body>
</html>