-
Notifications
You must be signed in to change notification settings - Fork 0
/
exam1r.html
103 lines (94 loc) · 2.96 KB
/
exam1r.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
<!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.0.3/marked.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
#case-number {
font-size: 24px;
font-weight: bold;
text-align: center;
margin-bottom: 20px;
}
#case-content {
border: 1px solid #ccc;
padding: 20px;
margin-bottom: 20px;
}
.navigation {
display: flex;
justify-content: space-between;
}
button {
font-size: 18px;
padding: 10px 20px;
cursor: pointer;
}
</style>
</head>
<body>
<div id="case-number"></div>
<div id="case-content"></div>
<div class="navigation">
<button id="prev-btn">← Previous</button>
<button id="next-btn">Next →</button>
</div>
<script>
let cases = [];
let currentCase = 0;
// Load exam data from external JSON file
fetch('exam_data.json')
.then(response => response.json())
.then(data => {
cases = data.cases;
loadMarkdownContent();
})
.catch(error => console.error('Error loading exam data:', error));
function loadMarkdownContent() {
const loadPromises = cases.map(caseData =>
fetch(caseData.contentFile)
.then(response => response.text())
.then(content => {
caseData.content = content;
})
);
Promise.all(loadPromises).then(() => {
updateCase();
});
}
function updateCase() {
document.getElementById('case-number').textContent = `Case ${cases[currentCase].number} of ${cases.length}`;
document.getElementById('case-content').innerHTML = marked(cases[currentCase].content);
}
function nextCase() {
if (currentCase < cases.length - 1) {
currentCase++;
updateCase();
}
}
function prevCase() {
if (currentCase > 0) {
currentCase--;
updateCase();
}
}
document.getElementById('next-btn').addEventListener('click', nextCase);
document.getElementById('prev-btn').addEventListener('click', prevCase);
document.addEventListener('keydown', (event) => {
if (event.key === 'ArrowRight') {
nextCase();
} else if (event.key === 'ArrowLeft') {
prevCase();
}
});
</script>
</body>
</html>