blob: e70df1b2d685cd2da454d01865b5ea67eaf2db60 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
//hardcoded contents
content.NEWLINE = "\n\n";
Object.keys(content).forEach(k => {
document.querySelectorAll("#content"+k).forEach(contentContainer => {
if(contentContainer){
contentContainer.textContent = content[k];
}else{
console.log("MISSING CONTAINER FOR #content"+k);
}
});
});
hljs.initHighlightingOnLoad();
document.querySelectorAll("pre code").forEach(n => {
let lines = n.innerHTML.split("\n");
let prefixChar = ''
prefixChar += '<span class="diff">';
if(n.classList.contains('add')){
prefixChar += '<span class="noselect"> + </span>';
}else if(n.classList.contains('remove')){
prefixChar += '<span class="noselect"> - </span>';
}else{
prefixChar += '<span class="noselect"> </span>';
}
prefixChar += '</span>';
if(lines.length){
let lineHtml = lines[0];
//ignore first and last lines
for(let i=1;i<lines.length-1;i++){
lineHtml += "\n";
lineHtml += prefixChar;
lineHtml += lines[i] ;
}
n.innerHTML = lineHtml;
}
});
|