Last active
October 6, 2015 05:47
-
-
Save icholy/2945744 to your computer and use it in GitHub Desktop.
highlight lines specified in hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).bind('hashchange', function() { | |
var m = /\#L(\d+)(\-L(\d+))?/.match(window.location.hash), | |
n1 = parseInt(m[1]), | |
n2 = parseInt(m[3]), | |
i; | |
if (!isNaN(n1)) { | |
n2 = isNaN(n2) ? n1 : n2; | |
for (n1 = 0; i <= n2; i++) { | |
$("#L" + i).addClass('highlight'); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment