Make stage number link to comment
This commit is contained in:
parent
bea51611b0
commit
85eda02d4d
@ -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';
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -316,7 +316,7 @@ fn update_results_table<N: Number>(stage_num: usize, state: &CountState<N>, opts
|
||||
tdclasses2 = r#"blw "#;
|
||||
}
|
||||
|
||||
result.push(&format!(r#"<td{}>{}</td>"#, tdclasses1, stage_num).into());
|
||||
result.push(&format!(r##"<td{0}><a href="#stage{1}">{1}</a></td>"##, tdclasses1, stage_num).into());
|
||||
result.push(&format!(r#"<td{}>{}</td>"#, tdclasses1, state.kind.unwrap_or("")).into());
|
||||
result.push(&format!(r#"<td{}>{}</td>"#, tdclasses1, state.title).into());
|
||||
for candidate in state.election.candidates.iter() {
|
||||
@ -340,7 +340,7 @@ fn update_results_table<N: Number>(stage_num: usize, state: &CountState<N>, opts
|
||||
}
|
||||
CandidateState::Excluded => {
|
||||
result.push(&format!(r#"<td class="{}count excluded">{}</td>"#, 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#"<td class="{}count excluded">Ex</td>"#, tdclasses2).into());
|
||||
} else {
|
||||
result.push(&format!(r#"<td class="{}count excluded">{}</td>"#, tdclasses2, pp(&count_card.votes, opts.pp_decimals)).into());
|
||||
|
Loading…
Reference in New Issue
Block a user