diff options
author | Valentin Popov <info@valentineus.link> | 2017-05-29 01:46:00 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2017-05-29 01:46:00 +0300 |
commit | 9c0a7f8bee1ed3f3aa924e592225d9b9cf2e18bf (patch) | |
tree | 38d03ec46b3a33647fba8a5e686d08a18bf95b12 /docs/scripts/linenumber.js | |
download | iii-client-9c0a7f8bee1ed3f3aa924e592225d9b9cf2e18bf.tar.xz iii-client-9c0a7f8bee1ed3f3aa924e592225d9b9cf2e18bf.zip |
Release of version 0.0.1.
Diffstat (limited to 'docs/scripts/linenumber.js')
-rw-r--r-- | docs/scripts/linenumber.js | 25 |
1 files changed, 25 insertions, 0 deletions
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'; + } + } + } +})(); |