From 927a2638903654d4e752e290f87bede20715e06b Mon Sep 17 00:00:00 2001 From: Adam Schwartz Date: Wed, 29 Jul 2015 21:58:27 -0400 Subject: [PATCH] Ensure first step attachToSelector is found before running the tour --- src/eager/installHelper.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/eager/installHelper.coffee b/src/eager/installHelper.coffee index cb5fa9910..c08504d70 100644 --- a/src/eager/installHelper.coffee +++ b/src/eager/installHelper.coffee @@ -13,6 +13,8 @@ ready = (fn) -> document.attachEvent 'onreadystatechange', -> fn() if document.readyState isnt 'loading' +firstStepSelector = undefined + ShepherdInstallHelper = init: (options) -> return unless options?.steps?.length > 0 @@ -33,6 +35,9 @@ ShepherdInstallHelper = steps.push step for step, i in steps + if i is 0 + firstStepSelector = step.attachToSelector + stepOptions = title: step.title text: step.text @@ -67,7 +72,7 @@ ShepherdInstallHelper = if window.Eager?.installs?.preview?.appId is 'AalP5veMma6s' tour.start() - else if window.localStorage?.eagerShepherdHasRun isnt 'true' + else if document.querySelector(firstStepSelector) and window.localStorage?.eagerShepherdHasRun isnt 'true' localStorage?.eagerShepherdHasRun = 'true' tour.start()