Skip to content

Commit

Permalink
attermpt to check for an invalid index
Browse files Browse the repository at this point in the history
  • Loading branch information
zeptofine committed Nov 29, 2023
1 parent 9747ed3 commit d93d6b6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
const interleave = ([x, ...xs], ...rest) =>
x === undefined
? rest.length === 0
? [] // base: no x, no rest
: interleave(...rest) // inductive: no x, some rest
: [x, ...interleave(...rest, xs)]; // inductive: some x, some rest
? [] // base: no x, no rest
: interleave(...rest) // inductive: no x, some rest
: [x, ...interleave(...rest, xs)]; // inductive: some x, some rest


function createTableButtons() {
Expand All @@ -25,7 +25,7 @@ function createTableButtons() {
}


function interleaveDots(divs) {
function interleaveSeparators(divs) {
let dots = [];
var dot;
for (let i = 1; i < divs.length; i++) {
Expand All @@ -43,13 +43,13 @@ let selected;
let listdiv = document.getElementById("buttonbox");
let buttons = createTableButtons();

Array.from(interleaveDots(buttons)).forEach(element => listdiv.appendChild(element));
Array.from(interleaveSeparators(buttons)).forEach(element => listdiv.appendChild(element));


root = document.querySelector(":root");
function open(sel) {
if (tables[sel] === selected)
return;
return false;

var table;
for (let i = 0; i < tables.length; i++) {
Expand Down Expand Up @@ -80,16 +80,16 @@ function open(sel) {
buttons[i].style.color = "";
}
}
return true;
}


// Search Parameter Handler
idx = new URLSearchParams(url.search).get("idx")
if (idx === null) {
if (idx !== null || !open(idx)) {
open(0);
} else {
open(idx);
}


for (const button of buttons) {
button.addEventListener("keydown", (event) => {
console.log(event);
Expand Down

0 comments on commit d93d6b6

Please sign in to comment.