From 771e69c6310a8099ffc55d1899dc3e339e3d6d7e Mon Sep 17 00:00:00 2001 From: Bauke Date: Sat, 1 Jul 2023 11:33:54 +0200 Subject: [PATCH] Only start the next tour if the selected tour is not the introduction. --- source/content-scripts/setup.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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) {