Decode URL fragment before searching for the target element

pull/15/head
Thibaut 11 years ago
parent 1204390f81
commit 258c97e387

@ -85,7 +85,7 @@ class app.views.Content extends app.View
return
scrollToTarget: ->
if @routeCtx.hash and el = $.id @routeCtx.hash
if @routeCtx.hash and el = @findTargetByHash @routeCtx.hash
$.scrollToWithImageLock el, @scrollEl, 'top',
margin: 20 + if @scrollEl is @el then 0 else $.offset(@el).top
$.highlight el, className: '_highlight'
@ -150,5 +150,8 @@ class app.views.Content extends app.View
$.popup(link)
return
findTargetByHash: (hash) ->
try $.id decodeURIComponent(hash) catch
isExternalUrl: (url) ->
url?[0..3] is 'http'

Loading…
Cancel
Save