Skip to content

Commit

Permalink
Ensure first step attachToSelector is found before running the tour
Browse files Browse the repository at this point in the history
  • Loading branch information
adamschwartz committed Jul 30, 2015
1 parent 510088b commit 927a263
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/eager/installHelper.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 927a263

Please sign in to comment.