diff --git a/html/index.js b/html/index.js
index c894408..fc23064 100644
--- a/html/index.js
+++ b/html/index.js
@@ -75,6 +75,7 @@ worker.onmessage = function(evt) {
} else if (evt.data.type === 'updateStageComments') {
let elLi = document.createElement('li');
+ elLi.id = 'stage' + (olStageComments.childElementCount + 1);
elLi.innerHTML = evt.data.comment;
olStageComments.append(elLi);
@@ -82,6 +83,14 @@ worker.onmessage = function(evt) {
divLogs2.insertAdjacentHTML('beforeend', evt.data.summary);
document.getElementById('printPane').style.display = 'block';
+ // Linkify stage numbers
+ document.querySelectorAll('tr.stage-no a').forEach(function(elA) {
+ elA.onclick = function() {
+ olStageComments.childNodes.forEach(function(elLi) { elLi.classList.remove('highlight'); });
+ document.getElementById(elA.href.substring(elA.href.indexOf('#') + 1)).classList.add('highlight');
+ };
+ });
+
} else if (evt.data.type === 'requireInput') {
let response = window.prompt(evt.data.message);
while (response === null) {
@@ -171,6 +180,8 @@ if (document.getElementById('txtSeed').value === '') {
// Print logic
async function printResult() {
+ olStageComments.childNodes.forEach(function(elLi) { elLi.classList.remove('highlight'); });
+
let printableWidth; // Printable width in CSS pixels
let paperSize = document.getElementById('selPaperSize').value;
if (paperSize === 'A4') {
@@ -259,8 +270,8 @@ async function printResult() {
let elTd2 = wprint.document.createElement('td');
elTd2.innerHTML = elTd1.innerHTML;
elTd2.className = elTd1.className;
- elTd2.setAttribute('rowspan', elTd1.getAttribute('rowspan'));
- elTd2.setAttribute('style', elTd1.getAttribute('style'));
+ if (elTd1.getAttribute('rowspan') !== null) { elTd2.setAttribute('rowspan', elTd1.getAttribute('rowspan')); }
+ if (elTd1.getAttribute('style') !== null) { elTd2.setAttribute('style', elTd1.getAttribute('style')); }
elTrs2[r].appendChild(elTd2);
tdsAdded.push(elTd2);
}
@@ -512,7 +523,7 @@ function changePreset() {
document.getElementById('selQuotaCriterion').value = 'geq';
document.getElementById('selQuota').value = 'droop';
document.getElementById('selQuotaMode').value = 'static';
- document.getElementById('chkBulkElection').checked = false;
+ document.getElementById('chkBulkElection').checked = true;
document.getElementById('chkBulkExclusion').checked = false;
document.getElementById('chkDeferSurpluses').checked = false;
document.getElementById('selNumbers').value = 'rational';
diff --git a/html/main.css b/html/main.css
index 5a2cb89..8ac70da 100644
--- a/html/main.css
+++ b/html/main.css
@@ -34,6 +34,13 @@ a:hover {
color: #1d3da2;
text-decoration: underline;
}
+tr.stage-no a {
+ color: initial !important;
+}
+
+li.highlight {
+ background-color: #fffedd;
+}
/* Menu styling */
diff --git a/src/stv/wasm.rs b/src/stv/wasm.rs
index 272ac9d..3890d1f 100644
--- a/src/stv/wasm.rs
+++ b/src/stv/wasm.rs
@@ -316,7 +316,7 @@ fn update_results_table(stage_num: usize, state: &CountState, opts
tdclasses2 = r#"blw "#;
}
- result.push(&format!(r#"{} | "#, tdclasses1, stage_num).into());
+ result.push(&format!(r##"{1} | "##, tdclasses1, stage_num).into());
result.push(&format!(r#"{} | "#, tdclasses1, state.kind.unwrap_or("")).into());
result.push(&format!(r#"{} | "#, tdclasses1, state.title).into());
for candidate in state.election.candidates.iter() {
@@ -340,7 +340,7 @@ fn update_results_table(stage_num: usize, state: &CountState, opts
}
CandidateState::Excluded => {
result.push(&format!(r#"{} | "#, tdclasses2, pp(&count_card.transfers, opts.pp_decimals)).into());
- if count_card.votes.is_zero() {
+ if count_card.parcels.is_empty() {
result.push(&format!(r#"Ex | "#, tdclasses2).into());
} else {
result.push(&format!(r#"{} | "#, tdclasses2, pp(&count_card.votes, opts.pp_decimals)).into());