-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrainee-highlighter.js
48 lines (43 loc) · 1.17 KB
/
trainee-highlighter.js
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
document.addEventListener('DOMContentLoaded', (event) => {
var wordsToHighlightTrainee = [
'Vickruck',
'Robinson',
'Kwafo',
'Neame',
'Cohen',
'Innes',
'Clake',
'Nguyen',
'Ladle',
'Rout',
'Purvis',
'Edwards',
'Best',
'Johnson',
'Gavin',
'Chang',
'Retzlaff',
'Doctolero',
'Chubaty',
`Kersteins`
];
var wordsToHighlightPI = [
'Galpern',
'Summers'
];
var listItems = document.querySelectorAll('li');
listItems.forEach(function(li) {
var html = li.innerHTML;
// Apply trainee highlighting
wordsToHighlightTrainee.forEach(function(word) {
var regex = new RegExp('\\b' + word + '\\b', 'g');
html = html.replace(regex, '<span class="trainee-highlight">' + word + '</span>');
});
// Apply PI highlighting
wordsToHighlightPI.forEach(function(word) {
var regex = new RegExp('\\b' + word + '\\b', 'g');
html = html.replace(regex, '<span class="textual-bold">' + word + '</span>');
});
li.innerHTML = html;
});
});