Skip to content

Commit

Permalink
Show freq tag only on first definition (#44)
Browse files Browse the repository at this point in the history
Whoops. It'd be nice to have per-definition frequency ranks.
  • Loading branch information
mreichhoff authored Jul 14, 2024
1 parent 7223b97 commit 7d6b76b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion public/js/modules/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ let setupDefinitions = function (word, definitionList, container) {
return;
}
let parsedDefinitions = parseDefinitions(definitionList);
// unfortunately, we don't have definition-specific frequency numbers
// just show any frequency tag on the first one
let isFirstlineItem = true;
for (const lineItem of Object.values(parsedDefinitions)) {
let definitionItem = document.createElement('li');
definitionItem.classList.add('definition');
Expand Down Expand Up @@ -203,7 +206,10 @@ let setupDefinitions = function (word, definitionList, container) {
tagHolder.appendChild(measureSpan);
}
}
addFrequencyTag(word, tagHolder);
if (isFirstlineItem) {
addFrequencyTag(word, tagHolder);
isFirstlineItem = false;
}
definitionItem.appendChild(tagHolder);
container.appendChild(definitionItem);
}
Expand Down

0 comments on commit 7d6b76b

Please sign in to comment.