diff --git a/vetupdates/pubmed_abstracts.js b/vetupdates/pubmed_abstracts.js index 7351327..70b86e2 100644 --- a/vetupdates/pubmed_abstracts.js +++ b/vetupdates/pubmed_abstracts.js @@ -117,7 +117,7 @@ class Cache { } } } -const cache = new Cache(window.localStorage, 'PUBMED', 5); +const cache = new Cache(window.localStorage, 'PUBMED', 6); class Xml { static parse(xml) { @@ -555,16 +555,17 @@ function parsePMIDAuthors(article) { } function formatAuthors(rawAuthors, maxAuthors) { - let authors = rawAuthors.map(x => { + const authors = rawAuthors.map(x => { const [lastName, initials] = x; if (initials == '') return lastName; return `${lastName} ${initials}`; }); + let displayedAuthors = authors; if (maxAuthors >= 0 && authors.length > maxAuthors) { - authors = authors.slice(0, maxAuthors); - authors.push('et al'); + displayedAuthors = displayedAuthors.slice(0, maxAuthors - 1); + displayedAuthors.push(`... ${authors[authors.length - 1]}`); } - return authors.join(', '); + return displayedAuthors.join(', '); } function parsePMIDDoi(article) { diff --git a/vetupdates/pubmedtool.html b/vetupdates/pubmedtool.html index 4ce1128..d6e6fe6 100644 --- a/vetupdates/pubmedtool.html +++ b/vetupdates/pubmedtool.html @@ -293,17 +293,21 @@ generate(); } +function cleanTagName(tag) { + return tag[0].toUpperCase() + tag.substr(1); +} + async function fillKnownTags() { const majorTags = document.getElementById('major_tags'); for (const tag of kMajorTags) { - newButton(majorTags, ['tag-button'], tag, () => copyText(tag)); + newButton(majorTags, ['tag-button'], cleanTagName(tag), () => copyText(tag)); } const [journals, tags] = await metadataRequest(); tags.sort(); const minorTags = document.getElementById('minor_tags'); for (const tag of tags) { if (!kMajorTags.has(tag)) { - newButton(minorTags, ['tag-button'], tag, () => copyText(tag)); + newButton(minorTags, ['tag-button'], cleanTagName(tag), () => copyText(tag)); } } } @@ -499,9 +503,8 @@ color: #f44336; } #major_tags, #minor_tags { - display: flex; - flex-direction: row; - flex-wrap: wrap; + display: grid; + grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); column-gap: 12px; padding-bottom: 16px; } @@ -546,8 +549,10 @@