Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable regExp for step host option #430

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unused function and add comments
brexis committed Jun 3, 2015

Verified

This commit was signed with the committer’s verified signature.
ImgBotApp Imgbot
commit e22bb5d19ba82215a66ac048f2f23fc8ce9c7f98
26 changes: 4 additions & 22 deletions src/coffee/bootstrap-tour.coffee
Original file line number Diff line number Diff line change
@@ -400,15 +400,19 @@
(({}).toString.call(path) is '[object String]' and @_isPathDifferent(path, currentPath))
)

# Check if it the step host and current host are differents
_isHostDifferent: (host, currentURL) ->
@_getProtocol(host) isnt @_getProtocol(currentURL) or
@_getHost(host) isnt @_getHost(currentURL)

# Check if step path and current path with queries and hash are differents
_isPathDifferent: (path, currentPath) ->
@_getPath(path) isnt @_getPath(currentPath) or not
@_equal(@_getQuery(path), @_getQuery(currentPath)) or not
@_equal(@_getHash(path), @_getHash(currentPath))

# Check if it is just the hash part of the step path
# and current path that is different
_isJustPathHashDifferent: (path, currentPath) ->
if ({}).toString.call(path) is '[object String]'
return @_getPath(path) is @_getPath(currentPath) and
@@ -417,28 +421,6 @@

false

# Check if it is just the hash part of the step path
# and current path that is different
_pathHashDifferent: (host, path, currentPath) ->
if host isnt ''
current_host = document.location.href.substr(0, document.location.href.lastIndexOf(document.location.pathname))
return false if host isnt current_host

diff = false
if ({}).toString.call(path) is '[object String]'
pathArr = path.split('#')
currentPathArr = currentPath.split('#')

if path.indexOf('#') is 0
# Compare just hash part when the step path is an anchor
diff = pathArr[1] isnt currentPathArr[1]
else
# Compare both pathname and hash parts
diff = pathArr[0].replace(/\?.*$/, '').replace(/\/?$/, '') is currentPathArr[0].replace(/\/?$/, '') and
pathArr[1] isnt currentPathArr[1]

diff

# Execute the redirect
_redirect: (step, i, path) ->
if $.isFunction step.redirect