-
Notifications
You must be signed in to change notification settings - Fork 1
/
testpage.html
85 lines (75 loc) · 3.59 KB
/
testpage.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
<!doctype html>
<html>
<head>
<title>Gender Blinder Extension Test Page</title>
<style>
body {
font-family: "Segoe UI", "Lucida Grande", Tahoma, sans-serif;
font-size: 100%;
}
.pass {
background-color: rgb(100,255,100);
}
.fail {
background-color: red;
}
</style>
<script>
function indexOfDiff(first, second) {
if (first === second) return -1;
var index = 0;
while (first[index] === second[index]) {
index++;
};
return index;
}
function checkAll() {
console.log('checkAll');
for (el of document.getElementsByTagName('li')) {
var text = el.innerHTML;
var i = indexOfDiff(text.trim(), el.getAttribute('data-assert').trim());
if (i === -1) {
el.classList.add('pass');
} else {
el.innerHTML = '<span class="pass">' + text.substring(0,i) + '</span>' +
'<span class="fail">' + text.substring(i) + ' </span>';
}
}
}
function checkAllSoon() {
console.log('checkAllSoon');
setTimeout(checkAll, 1000);
}
</script>
</head>
<body onload="checkAllSoon()">
<div>
<ul>
<li data-assert="They themselves gave their/theirs apple to them/their, even though it was their/theirs.">He himself gave his apple to her, even though it was his.</li>
<li data-assert="They themselves gave them/their apple to them, even though it was theirs.">She herself gave her apple to him, even though it was hers.</li>
<li data-assert="The person and the person went to see the wonderperson/superperson film.">The man and the woman went to see the wonderwoman/superman film.</li>
<li data-assert="Humans at the start of a sentence.">Humans at the start of a sentence.</li>
<li data-assert="Human at the start of a sentence.">Human at the start of a sentence.</li>
<li data-assert="A sentence ending in humans. ">A sentence ending in humans. </li>
<li data-assert="A sentence ending in human.">A sentence ending in human.</li>
<li data-assert="People at the start of a sentence.">Women at the start of a sentence.</li>
<li data-assert="Person at the start of a sentence.">Woman at the start of a sentence.</li>
<li data-assert="People at the start of a sentence.">Men at the start of a sentence.</li>
<li data-assert="Person at the start of a sentence.">Man at the start of a sentence.</li>
<li data-assert="A sentence ending in people.">A sentence ending in women.</li>
<li data-assert="A sentence ending in person.">A sentence ending in woman.</li>
<li data-assert=" SHOUTING HUMANS. "> SHOUTING HUMANS. </li>
<li data-assert=" SHOUTING PERSON. "> SHOUTING WOMAN. </li>
<li data-assert=" SHOUTING PEOPLE. "> SHOUTING WOMEN. </li>
<li data-assert=" SHOUTING PERSON. "> SHOUTING MAN. </li>
<li data-assert=" SHOUTING PEOPLE. "> SHOUTING MEN. </li>
<li data-assert=" Mx. and Mx. McBoatFace didn't miss Mx Jenkins or Mx Hopkins at the MS Excel conference."> Mr. and Mrs. McBoatFace didn't miss Miss Jenkins or Ms Hopkins at the MS Excel conference.</li>
<li data-assert="One Person, Two Guvnors.">One Man, Two Guvnors.</li>
<li data-assert="Peoples">Mens</li>
<li data-assert="Peoples">Womens</li>
<li data-assert="The Witzards' and Witzards' friends and friends.">The Witches' and Wizards' boyfriends and girlfriends.</li>
<li data-assert="The Spouses and the spouse.">The Wives and the husband.</li>
</ul>
</div>
</body>
</html>