refactor
This commit is contained in:
parent
4920358533
commit
80e1824790
13
main.js
13
main.js
|
@ -1966,7 +1966,8 @@ function rawline(index)
|
||||||
return md.value.split("\n")[index];
|
return md.value.split("\n")[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
function applycolorsonline(line, index, options)
|
var emptyline = "<br>";
|
||||||
|
function rawline2html(line, index, options)
|
||||||
{
|
{
|
||||||
line = escapeHtml(line);
|
line = escapeHtml(line);
|
||||||
|
|
||||||
|
@ -2015,7 +2016,7 @@ function applycolorsonline(line, index, options)
|
||||||
{
|
{
|
||||||
options.header = false;
|
options.header = false;
|
||||||
}
|
}
|
||||||
line = line || " ";
|
line = line || "<br>";
|
||||||
line = "<span style='color:lightgrey'>" + line + "</span>";
|
line = "<span style='color:lightgrey'>" + line + "</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2059,7 +2060,7 @@ function applycolorsonline(line, index, options)
|
||||||
}
|
}
|
||||||
else if (options.comment)
|
else if (options.comment)
|
||||||
{
|
{
|
||||||
line = line || " ";
|
line = line || emptyline;
|
||||||
line = "<span style='color:lightgrey'>" + line
|
line = "<span style='color:lightgrey'>" + line
|
||||||
if (line.includes("-->"))
|
if (line.includes("-->"))
|
||||||
{
|
{
|
||||||
|
@ -2124,8 +2125,8 @@ function applycolors(currentonly)
|
||||||
var linediv = document.getElementById("line" + index);
|
var linediv = document.getElementById("line" + index);
|
||||||
options = JSON.parse(linediv.getAttribute("tag"));
|
options = JSON.parse(linediv.getAttribute("tag"));
|
||||||
var line = rawline(index);
|
var line = rawline(index);
|
||||||
line = applycolorsonline(line, index, options);
|
line = rawline2html(line, index, options);
|
||||||
linediv.innerHTML = line || " ";
|
linediv.innerHTML = line || emptyline;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2142,7 +2143,7 @@ function applycolors(currentonly)
|
||||||
}
|
}
|
||||||
linediv.setAttribute("id", "line" + i);
|
linediv.setAttribute("id", "line" + i);
|
||||||
linediv.setAttribute("tag", JSON.stringify(options));
|
linediv.setAttribute("tag", JSON.stringify(options));
|
||||||
linediv.innerHTML = applycolorsonline(lines[i], i, options) || " ";
|
linediv.innerHTML = rawline2html(lines[i], i, options) || emptyline;
|
||||||
};
|
};
|
||||||
|
|
||||||
// remove remanining
|
// remove remanining
|
||||||
|
|
Loading…
Reference in New Issue