simplify lint report html/css/js
This commit is contained in:
parent
4fee2d4038
commit
5fa5410822
|
@ -843,6 +843,8 @@ body:not(.find-open) [data-match-highlight-count="1"] .CodeMirror-selection-high
|
|||
border-spacing: 0;
|
||||
line-height: 1.0;
|
||||
width: 100%;
|
||||
font-size: 85%;
|
||||
cursor: pointer;
|
||||
}
|
||||
#lint tr td:last-child {
|
||||
width: 100%;
|
||||
|
@ -850,6 +852,9 @@ body:not(.find-open) [data-match-highlight-count="1"] .CodeMirror-selection-high
|
|||
#lint td[role="line"] {
|
||||
padding-left: 0.25rem;
|
||||
}
|
||||
#lint .report {
|
||||
display: flex;
|
||||
}
|
||||
#lint .empty {
|
||||
display: none;
|
||||
}
|
||||
|
@ -858,16 +863,12 @@ body:not(.find-open) [data-match-highlight-count="1"] .CodeMirror-selection-high
|
|||
line-height: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
#lint .report {
|
||||
font-size: 85%;
|
||||
cursor: pointer;
|
||||
}
|
||||
.lint-report-container > :not(.empty) ~ :not(.empty) {
|
||||
#lint .report:not(.empty) ~ :not(.empty) {
|
||||
border-top: 1px dotted rgba(128, 128, 128, .5);
|
||||
margin-top: .25em;
|
||||
padding-top: .25em;
|
||||
}
|
||||
#lint .report tr:hover {
|
||||
#lint tr:hover {
|
||||
background-color: hsla(180, 50%, 36%, .2);
|
||||
}
|
||||
#lint td {
|
||||
|
|
|
@ -328,16 +328,12 @@ linterMan.DEFAULTS = {
|
|||
}
|
||||
|
||||
function createTable(cm) {
|
||||
const caption = $create('td.caption');
|
||||
const tbody = $create('tbody.report');
|
||||
const table = $create('table',
|
||||
$create('tr', [
|
||||
caption,
|
||||
$create('td', tbody),
|
||||
]));
|
||||
const caption = $create('.caption');
|
||||
const table = $create('table');
|
||||
const report = $create('.report', [caption, table]);
|
||||
const trs = [];
|
||||
return {
|
||||
element: table,
|
||||
element: report,
|
||||
trs,
|
||||
updateAnnotations,
|
||||
updateCaption,
|
||||
|
@ -357,20 +353,20 @@ linterMan.DEFAULTS = {
|
|||
} else {
|
||||
tr = createTr();
|
||||
trs.push(tr);
|
||||
tbody.append(tr.element);
|
||||
table.appendChild(tr.element);
|
||||
}
|
||||
tr.update(anno);
|
||||
i++;
|
||||
}
|
||||
if (i === 0) {
|
||||
trs.length = 0;
|
||||
tbody.textContent = '';
|
||||
table.textContent = '';
|
||||
} else {
|
||||
while (trs.length > i) {
|
||||
trs.pop().element.remove();
|
||||
}
|
||||
}
|
||||
table.classList.toggle('empty', trs.length === 0);
|
||||
report.classList.toggle('empty', !trs.length);
|
||||
|
||||
function *getAnnotations() {
|
||||
for (const line of lines.filter(Boolean)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user