Skip to content
Snippets Groups Projects
Commit 4c93d71c authored by echicken's avatar echicken :chicken:
Browse files

Only change cursor if desc td has div child; exit desc click handler if no...

Only change cursor if desc td has div child; exit desc click handler if no extdesc div; only add div child to desc td if extdesc present;
parent e0ec9ae2
No related branches found
No related tags found
No related merge requests found
......@@ -17,14 +17,14 @@ function header(title) {
writeln("tbody > tr { border-top: 1px solid silver; }");
writeln("tbody > tr:nth-child(even) { background-color: whitesmoke; }");
writeln("td { padding: .5rem; vertical-align: top; }");
writeln("td.desc { cursor: pointer; }");
writeln("td.desc:has(div) { cursor: pointer; }");
writeln("div.extdesc { margin-top: .5rem; white-space: pre; line-height: 1; font-family: monospace; overflow: hidden; }");
writeln("@media (prefers-color-scheme: dark) { body { color: #FAFAFA; background-color: #0A0A0A; } a { color: #FAFAFA; font-weight: bold; } a:visited { color: #FAFAFA; font-weight: bold; } thead th { background-color: black; } tbody > tr:nth-child(even) { background-color: #2A2A2A; } tbody > tr { border-color: #1F1F1F; } }");
writeln("</style>");
writeln("<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>");
writeln("<title>" + system.name + " " + title + "</title>");
writeln('<script>');
writeln("function showExtDesc(evt) { const ext = evt.target.querySelector('.extdesc'); if (ext.innerHTML === '') { return; } if (ext.style.display === 'none') { ext.style.display = 'block'; } else { ext.style.display = 'none'; } }");
writeln("function showExtDesc(evt) { const ext = evt.target.querySelector('.extdesc'); if (!ext) { return; } if (ext.style.display === 'none') { ext.style.display = 'block'; } else { ext.style.display = 'none'; } }");
writeln('</script>');
writeln("</head>");
writeln("<h1>" + system.name + " " + title + "</h1>");
......@@ -96,7 +96,12 @@ function dir_index(dir)
write("<td>" + f.name.link(f.name) + "</td>");
write("<td align=right>" + file_size_float(f.size, 1, 0) + "</td>");
write("<td align=right>" + strftime("%b %d, %Y", f.time) + "</td>");
write('<td class="desc" onclick="showExtDesc(event)">' + utf8_encode(f.desc || '') + '<div class="extdesc" style="display: none;">' + utf8_encode(f.extdesc || '') + '</div></td>');
write('<td class="desc" onclick="showExtDesc(event)">');
write(utf8_encode(f.desc || ''));
if (f.extdesc !== undefined) {
write('<div class="extdesc" style="display: none;">' + utf8_encode(f.extdesc) + '</div>');
}
write('</td>');
writeln("</tr>");
}
writeln("</tbody>");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment