mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-26 07:15:37 +00:00
26 lines
671 B
JavaScript
26 lines
671 B
JavaScript
/*global document */
|
|
(() => {
|
|
const source = document.getElementsByClassName('prettyprint source linenums');
|
|
let i = 0;
|
|
let lineNumber = 0;
|
|
let lineId;
|
|
let lines;
|
|
let totalLines;
|
|
let 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';
|
|
}
|
|
}
|
|
}
|
|
})();
|