Skip to content

Commit 3df0d08

Browse files
committed
Add Typos test size column to speller table
- Added addTyposTestSize() function to fetch typossize.json data - Updated table header to include fifth column 'Typos test size' - Increased colspan from 4 to 5 to match new column count - Data source will be available soon on gh-pages branch
1 parent ea294db commit 3df0d08

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

assets/js/spellertable.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,15 @@ function addSpellerTableHeader() {
9494
let heading_4 = document.createElement('th');
9595
heading_4.innerHTML = 'Suggestion Quality';
9696
heading_4.setAttribute('style', 'width: 20%;');
97+
let heading_5 = document.createElement('th');
98+
heading_5.innerHTML = 'Typos test size';
99+
heading_5.setAttribute('style', 'width: 15%;');
97100

98101
row_1.appendChild(heading_1);
99102
row_1.appendChild(heading_2);
100103
row_1.appendChild(heading_3);
101104
row_1.appendChild(heading_4);
105+
row_1.appendChild(heading_5);
102106

103107
return row_1;
104108
}
@@ -116,7 +120,7 @@ function addSpellerRepoTable(repos, mainFilter, filters) {
116120
if (!repos || !Array.isArray(repos)) {
117121
const errorRow = document.createElement('tr');
118122
const errorCell = document.createElement('td');
119-
errorCell.colSpan = 4; // Match number of columns in header
123+
errorCell.colSpan = 5; // Match number of columns in header
120124
errorCell.innerHTML = '<strong>⚠️ GitHub repository data is temporarily unavailable</strong><br><em>This usually resolves automatically. Please try refreshing the page in a few minutes.</em>';
121125
errorCell.style.textAlign = 'center';
122126
errorCell.style.padding = '30px 20px';
@@ -142,7 +146,7 @@ function addSpellerRepoTable(repos, mainFilter, filters) {
142146
}
143147
// If no repos found, inform the user:
144148
if (!tbody.firstChild) {
145-
tbody.appendChild(addEmptyRow(4));
149+
tbody.appendChild(addEmptyRow(5));
146150
}
147151
return table;
148152
}
@@ -161,6 +165,18 @@ function addSpellerSuggQuality(repo) {
161165
return row_sugg;
162166
}
163167

168+
function addTyposTestSize(repo) {
169+
let row_typos = document.createElement('td');
170+
const typos_image = document.createElement('img');
171+
typos_image.setAttribute(
172+
'src',
173+
'https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fgiellalt%2F' + repo.name + '%2Fgh-pages%2Ftypossize.json&label=T'
174+
);
175+
typos_image.setAttribute('alt', 'Typos test size');
176+
row_typos.appendChild(typos_image);
177+
return row_typos;
178+
}
179+
164180
function addSpellerTR(repo) {
165181
let row = document.createElement('tr');
166182

@@ -171,6 +187,7 @@ function addSpellerTR(repo) {
171187
row.appendChild(addRepo(repo));
172188
row.appendChild(addLemmaCount(repo));
173189
row.appendChild(addSpellerSuggQuality(repo));
190+
row.appendChild(addTyposTestSize(repo));
174191

175192
return row;
176193
}

0 commit comments

Comments
 (0)