1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-06-03 06:22:34 +02:00
TableFilter/docs/script/pretty-print.js
koalyptus 4481fbe361 publish Docs to gh-pages (auto)
branch:       master
SHA:          c7d6de72f7
range SHA:    81f31a3106fb...c7d6de72f785
build id:     375208741
build number: 1103
2018-05-05 08:21:30 +00:00

26 lines
759 B
JavaScript

(function(){
prettyPrint();
var lines = document.querySelectorAll('.prettyprint.linenums li[class^="L"]');
for (var i = 0; i < lines.length; i++) {
lines[i].id = 'lineNumber' + (i + 1);
}
var matched = location.hash.match(/errorLines=([\d,]+)/);
if (matched) {
var lines = matched[1].split(',');
for (var i = 0; i < lines.length; i++) {
var id = '#lineNumber' + lines[i];
var el = document.querySelector(id);
el.classList.add('error-line');
}
return;
}
if (location.hash) {
// ``[ ] . ' " @`` are not valid in DOM id. so must escape these.
var id = location.hash.replace(/([\[\].'"@$])/g, '\\$1');
var line = document.querySelector(id);
if (line) line.classList.add('active');
}
})();