From 9c0a7f8bee1ed3f3aa924e592225d9b9cf2e18bf Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 29 May 2017 01:46:00 +0300 Subject: Release of version 0.0.1. --- docs/scripts/linenumber.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 docs/scripts/linenumber.js (limited to 'docs/scripts/linenumber.js') diff --git a/docs/scripts/linenumber.js b/docs/scripts/linenumber.js new file mode 100644 index 0000000..8d52f7e --- /dev/null +++ b/docs/scripts/linenumber.js @@ -0,0 +1,25 @@ +/*global document */ +(function() { + var source = document.getElementsByClassName('prettyprint source linenums'); + var i = 0; + var lineNumber = 0; + var lineId; + var lines; + var totalLines; + var anchorHash; + + if (source && source[0]) { + anchorHash = document.location.hash.substring(1); + lines = source[0].getElementsByTagName('li'); + totalLines = lines.length; + + for (; i < totalLines; i++) { + lineNumber++; + lineId = 'line' + lineNumber; + lines[i].id = lineId; + if (lineId === anchorHash) { + lines[i].className += ' selected'; + } + } + } +})(); -- cgit v1.2.3