blob: e70df1b2d685cd2da454d01865b5ea67eaf2db60 (
plain) (
tree)
|
|
//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;
}
});
|