Skip to content
Snippets Groups Projects
Commit 053d21a7 authored by Martin Mareš's avatar Martin Mareš
Browse files

Cleaned up JS

In accordance with contemporary JS style, we now prefer "const" over "var"
where appropriate.
parent 22c571d3
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !6. Comments created here will be created in the context of that merge request.
......@@ -23,20 +23,19 @@ md.use(mhl, {
hljs: hljs,
});
const cmt = document.getElementById("comment");
exports.render_md = function () {
console.log('Owl: Rendering Markdown');
var pb = document.getElementsByClassName("pbody");
const pb = document.getElementsByClassName("pbody");
const cmt = document.getElementById("comment");
var i;
for (i=0; i < pb.length; i++) {
var b = pb[i];
const b = pb[i];
// b.style.backgroundColor = "blue";
var src = b.innerText;
var result = md.render(src);
const src = b.innerText;
const result = md.render(src);
b.innerHTML = result;
var reply = b.parentElement.getElementsByClassName("preply")[0];
const reply = b.parentElement.getElementsByClassName("preply")[0];
reply.onclick = function() {
cmt.value = n.replaceAll(/^/gm, "> ");
}
......@@ -46,9 +45,9 @@ exports.render_md = function () {
exports.preview = function () {
console.log('Owl: Preview');
var src = document.getElementById('comment').value;
var pb = document.getElementById('previewbox');
var pv = document.getElementById('preview');
const src = document.getElementById('comment').value;
const pb = document.getElementById('previewbox');
const pv = document.getElementById('preview');
pv.innerHTML = md.render(src)
pb.style.display = "block";
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment