3 # See if there are lines selected
4 # "#L12" and "#L34-56" supported
5 highlightBlobLines = ->
6 if window.location.hash isnt ""
7 matches = window.location.hash.match(/\#L(\d+)(\-(\d+))?/)
8 first_line = parseInt(matches?[1])
9 last_line = parseInt(matches?[3])
11 unless isNaN first_line
12 last_line = first_line if isNaN(last_line)
13 $("#tree-content-holder .highlight .line").removeClass("hll")
14 $("#LC#{line}").addClass("hll") for line in [first_line..last_line]
15 $("#L#{first_line}").ScrollTo()
17 # Highlight the correct lines on load
20 # Highlight the correct lines when the hash part of the URL changes
21 $(window).on 'hashchange', highlightBlobLines