-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathka-privacy.html
More file actions
218 lines (207 loc) · 6.51 KB
/
ka-privacy.html
File metadata and controls
218 lines (207 loc) · 6.51 KB
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Privacy & Online Rights – Crossword</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f8f8f8;
padding: 2rem;
color: #333;
}
h1 {
text-align: center;
color: #800000;
}
#stats {
text-align: center;
margin: 1rem 0;
font-weight: bold;
}
#crossword {
display: grid;
grid-template-columns: repeat(20, 30px);
gap: 2px;
justify-content: center;
margin: 2rem 0;
overflow-x: auto;
}
.cell {
position: relative;
width: 30px;
height: 30px;
border: 1px solid #ccc;
background: white;
text-align: center;
}
.cell input {
width: 100%;
height: 100%;
text-align: center;
border: none;
font-size: 1rem;
text-transform: uppercase;
}
.cell .number {
position: absolute;
top: 0;
left: 2px;
font-size: 0.6rem;
color: #555;
}
.black {
background: #000;
}
.clues {
max-width: 800px;
margin: auto;
text-align: left;
}
.clues h2, .clues h3 {
text-align: center;
}
.controls {
text-align: center;
margin: 1rem;
}
.controls button {
padding: 0.5rem 1rem;
margin: 0.5rem;
font-size: 1rem;
background-color: #800000;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
</style>
</head>
<body>
<h1>Privacy & Online Rights – Crossword</h1>
<div id="stats">⏱️ Time: 0s | ✅ Score: 0%</div>
<div id="crossword"></div>
<div class="controls">
<button onclick="checkAnswers()">Check Answers</button>
<button onclick="revealAnswers()">Reveal Answers</button>
<button onclick="finalScore()">Final Score</button>
<button onclick="resetPuzzle()">Reset Puzzle</button>
</div>
<div class="clues">
<h2>Clues</h2>
<div>
<h3>Across</h3>
<p>1. A property which allows a database to be queried without revealing which record is being accessed (3)</p>
<p>3. A key vector where privacy needs to be enforced (13)</p>
<p>6. The property that ensures that data is real, accurate and safeguarded from unauthorised user modification (9)</p>
<p>7. The property that ensures that information is not made available to unauthorised individuals, entities, or processes (15)</p>
</div>
<div>
<h3>Down</h3>
<p>2. Central concept involving control over personal information (7)</p>
<p>4. Information about data or sent along with data, e.g., the IP address (8)</p>
<p>5. A comprehensive Body of Knowledge to inform and underpin education and professional training for the cyber security sector (5)</p>
<p>8. Decoupling identity from the information (9)</p>
<p>9. The protection of data in transit (4)</p>
</div>
</div>
<script>
const words = [
{ word: 'PRIVACY', x: 0, y: 0, dir: 'down', number: 2 },
{ word: 'METADATA', x: 3, y: 5, dir: 'down', number: 4 },
{ word: 'CYBOK', x: 9, y: 10, dir: 'down', number: 5 },
{ word: 'ANONYMITY', x: 14, y: 11, dir: 'down', number: 8 },
{ word: 'E2EE', x: 6, y: 16, dir: 'down', number: 9 },
{ word: 'PIR', x: 0, y: 0, dir: 'across', number: 1 },
{ word: 'COMMUNICATION', x: 0, y: 5, dir: 'across', number: 3 },
{ word: 'INTEGRITY', x: 1, y: 11, dir: 'across', number: 6 },
{ word: 'CONFIDENTIALITY', x: 0, y: 19, dir: 'across', number: 7 }
];
const gridSize = 20;
const grid = Array.from({ length: gridSize }, () => Array(gridSize).fill(''));
const clueNumbers = Array.from({ length: gridSize }, () => Array(gridSize).fill(null));
const inputRefs = [];
words.forEach(({ word, x, y, dir, number }) => {
for (let i = 0; i < word.length; i++) {
const row = dir === 'down' ? y + i : y;
const col = dir === 'across' ? x + i : x;
grid[row][col] = word[i];
if (i === 0) clueNumbers[row][col] = number;
}
});
const crossword = document.getElementById('crossword');
for (let r = 0; r < gridSize; r++) {
for (let c = 0; c < gridSize; c++) {
const cell = document.createElement('div');
cell.classList.add('cell');
if (grid[r][c] === '') {
cell.classList.add('black');
} else {
if (clueNumbers[r][c]) {
const number = document.createElement('div');
number.className = 'number';
number.textContent = clueNumbers[r][c];
cell.appendChild(number);
}
const input = document.createElement('input');
input.maxLength = 1;
input.dataset.row = r;
input.dataset.col = c;
input.addEventListener('input', function() {
this.value = this.value.toUpperCase();
});
cell.appendChild(input);
inputRefs.push({ input, correct: grid[r][c] });
}
crossword.appendChild(cell);
}
}
function checkAnswers() {
let correct = 0;
inputRefs.forEach(({ input, correct: answer }) => {
const value = input.value.toUpperCase();
if (value === answer) {
input.style.backgroundColor = '#d4edda';
correct++;
} else {
input.style.backgroundColor = '#f8d7da';
}
});
const score = Math.round((correct / inputRefs.length) * 100);
document.getElementById('stats').textContent = `⏱️ Time: ${elapsed}s | ✅ Score: ${score}%`;
}
function revealAnswers() {
inputRefs.forEach(({ input, correct }) => {
input.value = correct;
input.style.backgroundColor = '#fff3cd';
});
}
function resetPuzzle() {
inputRefs.forEach(({ input }) => {
input.value = '';
input.style.backgroundColor = '';
});
elapsed = 0;
document.getElementById('stats').textContent = '⏱️ Time: 0s | ✅ Score: 0%';
}
function finalScore() {
let correct = 0;
inputRefs.forEach(({ input, correct: answer }) => {
const value = input.value.toUpperCase();
if (value === answer) correct++;
});
const score = Math.round((correct / inputRefs.length) * 100);
alert(`⏱️ Time: ${elapsed}s
✅ Final Score: ${score}%`);
}
let elapsed = 0;
setInterval(() => {
elapsed++;
const stats = document.getElementById('stats');
const scoreText = stats.textContent.includes('%') ? stats.textContent.split('|')[1].trim() : '✅ Score: 0%';
stats.textContent = `⏱️ Time: ${elapsed}s | ${scoreText}`;
}, 1000);
</script>
</body>
</html>