Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show freq tag only on first definition #44

Merged
merged 1 commit into from
Jul 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading