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