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
85 return85 return
86 86
87 scrollToTarget: ->87 scrollToTarget: ->
88 if @routeCtx.hash and el = $.id @routeCtx.hash88 if @routeCtx.hash and el = @findTargetByHash @routeCtx.hash
89 $.scrollToWithImageLock el, @scrollEl, 'top',89 $.scrollToWithImageLock el, @scrollEl, 'top',
90 margin: 20 + if @scrollEl is @el then 0 else $.offset(@el).top90 margin: 20 + if @scrollEl is @el then 0 else $.offset(@el).top
91 $.highlight el, className: '_highlight'91 $.highlight el, className: '_highlight'
@@ -150,5 +150,8 @@ class app.views.Content extends app.View · 58 unmodified lines
150 $.popup(link)150 $.popup(link)
151 return151 return
152 152
153 findTargetByHash: (hash) ->
154 try $.id decodeURIComponent(hash) catch
155
153 isExternalUrl: (url) ->156 isExternalUrl: (url) ->
154 url?[0..3] is 'http'157 url?[0..3] is 'http'