Skip to content

Commit

Permalink
chaser
Browse files Browse the repository at this point in the history
  • Loading branch information
windoverwater committed Mar 7, 2024
1 parent 21aa662 commit 30e08dc
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions voting.html
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,11 @@ <h3>Your RCV selection:</h3>
return newString;
}

function nullifySession() {
blankBallot = null;
listOfContests.length = 0;
}

// Setup the chechout page vote button
function setupVoteButtonListener(buttonString, rootElement) {
const newItem = document.createElement("div");
Expand All @@ -584,10 +589,12 @@ <h3>Your RCV selection:</h3>
// For now, just print it to the page
let jsonString = JSON.stringify(blankBallot, undefined, 2);
rootElement.appendChild(document.createElement('pre')).innerHTML = syntaxHighlight(jsonString);
// ZZZ for the demo, destroy the blankBallot as well
nullifySession();
} else if (buttonString == "Spoil Ballot") {
// For now, just print something, destroy the blankBallot,
// and go to home page
blankBallot = null;
nullifySession();
const newItem = document.createElement("p");
newItem.innerHTML = "Your ballot has been destroyed. To vote, click the start over button below";
rootElement.appendChild(newItem);
Expand Down Expand Up @@ -755,8 +762,13 @@ <h3>Your RCV selection:</h3>
const voteTable = document.createElement("table");
voteTable.classList.add("tableStyle");
const row1 = document.createElement("tr");
row1.appendChild(spoilButton);
row1.appendChild(voteButton);
const col1 = document.createElement("td");
const col2 = document.createElement("td");
col2.innerHTML = "&nbsp&nbsp";
col1.appendChild(spoilButton);
col2.appendChild(voteButton);
row1.appendChild(col1);
row1.appendChild(col2);
voteTable.appendChild(row1);
rootElement.appendChild(voteTable);
}
Expand Down

0 comments on commit 30e08dc

Please sign in to comment.