diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-07-10 11:51:41 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-07-10 11:51:41 -0300 |
commit | e47233b1bee1fbb1080027ad1fe4bf365ac5e468 (patch) | |
tree | 64e88c56b1a38f40cbc3ac9a514c9a8fab51b771 /src/content/dependencies/generateContributionTooltipChronologySection.js | |
parent | 8155ad8d22c77c244fe22f070531ff41daf71f64 (diff) |
content: generateContributionTooltip: single dynamics preview
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: |