fix line numbering

This commit is contained in:
Sven Fuchs 2013-03-14 17:18:34 +01:00
parent e1a667407f
commit c011cfafcd
2 changed files with 13 additions and 11 deletions

View File

@ -81,7 +81,7 @@ Travis.reopen
numberLineOnHover: -> numberLineOnHover: ->
$('#log').on 'mouseenter', 'a', -> $('#log').on 'mouseenter', 'a', ->
$(this).attr('href', '#L' + ($(this.parentNode).prevAll('p:visible').length + 1)) $(@).attr('href', '#L' + ($("#log p:visible").index(@parentNode) + 1))
click: -> click: ->
if (href = $(event.target).attr('href')) && matches = href?.match(/#L(\d+)$/) if (href = $(event.target).attr('href')) && matches = href?.match(/#L(\d+)$/)
@ -113,7 +113,7 @@ Log.Scroll.prototype = $.extend new Log.Listener,
true true
tryScroll: -> tryScroll: ->
if element = $("#log > p:visible")[@number - 1] if element = $("#log p:visible")[@number - 1]
$('#main').scrollTop(0) $('#main').scrollTop(0)
$('html, body').scrollTop($(element).offset()?.top) # weird, html works in chrome, body in firefox $('html, body').scrollTop($(element).offset()?.top) # weird, html works in chrome, body in firefox
@highlight(element) @highlight(element)

View File

@ -49,9 +49,11 @@ pre#log
&.open &.open
height: auto height: auto
&.active
p:first-of-type p:first-of-type
padding-right: 130px padding-right: 130px
// &.active
p:first-of-type
background: $color-bg-log-fold inline-image('ui/log.fold.open.2.png') no-repeat 8px 3px background: $color-bg-log-fold inline-image('ui/log.fold.open.2.png') no-repeat 8px 3px
&:not(.open) p:first-of-type &:not(.open) p:first-of-type