diff --git a/source/content-scripts/setup.ts b/source/content-scripts/setup.ts index c5e891f..8f46ebe 100644 --- a/source/content-scripts/setup.ts +++ b/source/content-scripts/setup.ts @@ -17,12 +17,20 @@ async function main(): Promise { const prefix = "tildes-shepherd-tour="; const startsWithPrefix = anchor.startsWith(prefix); + // Get the tour ID from the anchor by removing the prefix. + const anchorTourId = anchor.slice(prefix.length); + // Automatically start the introduction tour if the person hasn't already // been through it and only when on the Tildes homepage. if (!introductionUnderstood.value && window.location.pathname === "/") { // If a different tour is selected but the introduction hasn't happened yet, // then the main function will be rerun once this tour finishes. - startTour("introduction", introductionSteps, [], startsWithPrefix); + startTour( + "introduction", + introductionSteps, + [], + startsWithPrefix && anchorTourId !== "introduction", + ); return; } @@ -30,9 +38,6 @@ async function main(): Promise { return; } - // Get the tour ID from the anchor by removing the prefix. - const anchorTourId = anchor.slice(prefix.length); - // Then run through all of the tours we have and start the first match for the // ID. for (const [id, steps, eventHandlers] of tourIdsAndSteps) {