diff options
Diffstat (limited to 'src/content/dependencies/generateContributionTooltipChronologySection.js')
-rw-r--r-- | src/content/dependencies/generateContributionTooltipChronologySection.js | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/content/dependencies/generateContributionTooltipChronologySection.js b/src/content/dependencies/generateContributionTooltipChronologySection.js index fb668844..4ee9bb35 100644 --- a/src/content/dependencies/generateContributionTooltipChronologySection.js +++ b/src/content/dependencies/generateContributionTooltipChronologySection.js @@ -10,23 +10,27 @@ function getName(thing) { return thing.name; } +function getSiblings(contribution) { + let previous = contribution; + while (previous && previous.thing === contribution.thing) { + previous = previous.previousBySameArtist; + } + + let next = contribution; + while (next && next.thing === contribution.thing) { + next = next.nextBySameArtist; + } + + return {previous, next}; +} + export default { contentDependencies: ['linkAnythingMan'], extraDependencies: ['html', 'language'], - query(contribution) { - let previous = contribution; - while (previous && previous.thing === contribution.thing) { - previous = previous.previousBySameArtist; - } - - let next = contribution; - while (next && next.thing === contribution.thing) { - next = next.nextBySameArtist; - } - - return {previous, next}; - }, + query: (contribution) => ({ + ...getSiblings(contribution), + }), relations: (relation, query, _contribution) => ({ previousLink: |