History

Decode URL fragment before searching for the target element

Thibaut committed 13 years ago

Commit 258c97e1 parent 12043901 file · +4 −1Browse files

Showing the changes to assets/javascripts (1 of 1 file). Show all

Unified · Split

assets/javascripts/views/content/content.coffee+4−1
@@ -85,7 +85,7 @@ class app.views.Content extends app.View · 84 unmodified lines
8585 return
8686
8787 scrollToTarget: ->
88− if @routeCtx.hash and el = $.id @routeCtx.hash
88+ if @routeCtx.hash and el = @findTargetByHash @routeCtx.hash
8989 $.scrollToWithImageLock el, @scrollEl, 'top',
9090 margin: 20 + if @scrollEl is @el then 0 else $.offset(@el).top
9191 $.highlight el, className: '_highlight'
@@ -150,5 +150,8 @@ class app.views.Content extends app.View · 58 unmodified lines
150150 $.popup(link)
151151 return
152152
153+ findTargetByHash: (hash) ->
154+ try $.id decodeURIComponent(hash) catch
155+
153156 isExternalUrl: (url) ->
154157 url?[0..3] is 'http'