Skip to content

Commit a935d1c

Browse files
committed
Add Speller version column to speller overview table
New column added between Repository and Lemma Count: - Created addSpellerVersion() function fetching badgedata/speller-version.json - Updated table header with 'Speller version' as heading_3 - Increased table from 4 to 5 columns - Updated colspan and addEmptyRow calls to match new column count - Badge displays with label 'V' for version
1 parent a637ce9 commit a935d1c

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

assets/js/spellertable.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,18 @@ function addSpellerTableHeader() {
9090
let heading_2 = document.createElement('th');
9191
heading_2.innerHTML = 'Reposi­tory';
9292
let heading_3 = document.createElement('th');
93-
heading_3.innerHTML = 'Lemma Count';
93+
heading_3.innerHTML = 'Speller version';
9494
let heading_4 = document.createElement('th');
95-
heading_4.innerHTML = 'Suggestion Quality';
96-
heading_4.setAttribute('style', 'width: 20%;');
95+
heading_4.innerHTML = 'Lemma Count';
96+
let heading_5 = document.createElement('th');
97+
heading_5.innerHTML = 'Suggestion Quality';
98+
heading_5.setAttribute('style', 'width: 20%;');
9799

98100
row_1.appendChild(heading_1);
99101
row_1.appendChild(heading_2);
100102
row_1.appendChild(heading_3);
101103
row_1.appendChild(heading_4);
104+
row_1.appendChild(heading_5);
102105

103106
return row_1;
104107
}
@@ -116,7 +119,7 @@ function addSpellerRepoTable(repos, mainFilter, filters) {
116119
if (!repos || !Array.isArray(repos)) {
117120
const errorRow = document.createElement('tr');
118121
const errorCell = document.createElement('td');
119-
errorCell.colSpan = 4; // Match number of columns in header
122+
errorCell.colSpan = 5; // Match number of columns in header
120123
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>';
121124
errorCell.style.textAlign = 'center';
122125
errorCell.style.padding = '30px 20px';
@@ -142,13 +145,25 @@ function addSpellerRepoTable(repos, mainFilter, filters) {
142145
}
143146
// If no repos found, inform the user:
144147
if (!tbody.firstChild) {
145-
tbody.appendChild(addEmptyRow(4));
148+
tbody.appendChild(addEmptyRow(5));
146149
}
147150
return table;
148151
}
149152

150153
// Spellchecker-specific table row generation
151154

155+
function addSpellerVersion(repo) {
156+
let row_version = document.createElement('td');
157+
const version_image = document.createElement('img');
158+
version_image.setAttribute(
159+
'src',
160+
'https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fgiellalt%2F' + repo.name + '%2Fgh-pages%2Fbadgedata%2Fspeller-version.json&label=V'
161+
);
162+
version_image.setAttribute('alt', 'Speller version');
163+
row_version.appendChild(version_image);
164+
return row_version;
165+
}
166+
152167
function addSpellerSuggQuality(repo) {
153168
let row_sugg = document.createElement('td');
154169
const sugg_link = document.createElement('a');
@@ -172,6 +187,7 @@ function addSpellerTR(repo) {
172187

173188
row.appendChild(row_lang);
174189
row.appendChild(addRepo(repo));
190+
row.appendChild(addSpellerVersion(repo));
175191
row.appendChild(addLemmaCount(repo));
176192
row.appendChild(addSpellerSuggQuality(repo));
177193

0 commit comments

Comments
 (0)