Skip to content

Instantly share code, notes, and snippets.

@icholy
Last active October 6, 2015 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icholy/2945744 to your computer and use it in GitHub Desktop.
Save icholy/2945744 to your computer and use it in GitHub Desktop.
highlight lines specified in hash
$(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