This commit is contained in:
Nicolas Stepien 2013-04-08 23:25:44 +02:00
parent cd89d93189
commit 661f969de1
2 changed files with 8 additions and 0 deletions

View File

@ -1,3 +1,4 @@
- Fixed the Header going above posts when following quotelinks for example.
- Fixed a bug where dead quotelinks would disappear.
### 3.0.1 - *2013-04-08*

View File

@ -21,6 +21,7 @@ Header =
@menu = new UI.Menu 'header'
$.on $('.menu-button', @bar), 'click', @menuToggle
$.on @toggle, 'mousedown', @toggleBarVisibility
$.on window, 'hashchange', Header.hashScroll
catalogToggler = $.el 'label',
innerHTML: "<input type=checkbox #{if Conf['Header catalog links'] then 'checked' else ''}> Use catalog board links"
@ -131,6 +132,12 @@ Header =
setBarVisibility: (hide) ->
Header.headerToggler.firstElementChild.checked = hide
(if hide then $.addClass else $.rmClass) Header.bar, 'autohide'
hashScroll: ->
return unless post = $.id @location.hash[1..]
postRect = post.getBoundingClientRect()
headRect = Header.toggle.getBoundingClientRect()
root = if $.engine is 'webkit' then d.body else doc
root.scrollTop += postRect.top - headRect.top - headRect.height
toggleBarVisibility: (e) ->
return if e.type is 'mousedown' and e.button isnt 0 # not LMB
hide = if @nodeName is 'INPUT'