Skip to content

Commit

Permalink
use css instead of JS to fix link issue
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed May 28, 2024
1 parent 36e6e1a commit 7d17b00
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions src/listing.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,19 @@
table#files tr:nth-child(odd) {
background: #444;
}
table#files tr {
position: relative;
}
table#files tr a {
color: #ACF;
}
table#files a::after {
content: "";
position: absolute;
width: 100%;
height: 100%;
left: 0;
}
.sort-down,
.sort-up {
color: lightseagreen;
Expand Down Expand Up @@ -170,25 +180,6 @@ <h1><a href="/">~</a>{linked-path}</h1>
{files}
</div>
<script>
{
// this shouldn't happen here but our hand is forced
// because we want Kodi to be able to parse the HTML
document.querySelector('#files').addEventListener('click', function(e) {
var tr = e.target.closest('tr');
if (tr) {
var a = tr.querySelector('a');
if (a) {
if (e.metaKey || e.ctrlKey) {
e.preventDefault();
window.open(a.href, '_blank');
} else {
a.click();
}
}
}
});
}

{
function createElem(tag, attrs = {}) {
const elem = document.createElement(tag);
Expand Down

0 comments on commit 7d17b00

Please sign in to comment.