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') {
|
} else if (evt.data.type === 'updateStageComments') {
|
||||||
let elLi = document.createElement('li');
|
let elLi = document.createElement('li');
|
||||||
|
elLi.id = 'stage' + (olStageComments.childElementCount + 1);
|
||||||
elLi.innerHTML = evt.data.comment;
|
elLi.innerHTML = evt.data.comment;
|
||||||
olStageComments.append(elLi);
|
olStageComments.append(elLi);
|
||||||
|
|
||||||
@ -82,6 +83,14 @@ worker.onmessage = function(evt) {
|
|||||||
divLogs2.insertAdjacentHTML('beforeend', evt.data.summary);
|
divLogs2.insertAdjacentHTML('beforeend', evt.data.summary);
|
||||||
document.getElementById('printPane').style.display = 'block';
|
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') {
|
} else if (evt.data.type === 'requireInput') {
|
||||||
let response = window.prompt(evt.data.message);
|
let response = window.prompt(evt.data.message);
|
||||||
while (response === null) {
|
while (response === null) {
|
||||||
@ -171,6 +180,8 @@ if (document.getElementById('txtSeed').value === '') {
|
|||||||
// Print logic
|
// Print logic
|
||||||
|
|
||||||
async function printResult() {
|
async function printResult() {
|
||||||
|
olStageComments.childNodes.forEach(function(elLi) { elLi.classList.remove('highlight'); });
|
||||||
|
|
||||||
let printableWidth; // Printable width in CSS pixels
|
let printableWidth; // Printable width in CSS pixels
|
||||||
let paperSize = document.getElementById('selPaperSize').value;
|
let paperSize = document.getElementById('selPaperSize').value;
|
||||||
if (paperSize === 'A4') {
|
if (paperSize === 'A4') {
|
||||||
@ -259,8 +270,8 @@ async function printResult() {
|
|||||||
let elTd2 = wprint.document.createElement('td');
|
let elTd2 = wprint.document.createElement('td');
|
||||||
elTd2.innerHTML = elTd1.innerHTML;
|
elTd2.innerHTML = elTd1.innerHTML;
|
||||||
elTd2.className = elTd1.className;
|
elTd2.className = elTd1.className;
|
||||||
elTd2.setAttribute('rowspan', elTd1.getAttribute('rowspan'));
|
if (elTd1.getAttribute('rowspan') !== null) { elTd2.setAttribute('rowspan', elTd1.getAttribute('rowspan')); }
|
||||||
elTd2.setAttribute('style', elTd1.getAttribute('style'));
|
if (elTd1.getAttribute('style') !== null) { elTd2.setAttribute('style', elTd1.getAttribute('style')); }
|
||||||
elTrs2[r].appendChild(elTd2);
|
elTrs2[r].appendChild(elTd2);
|
||||||
tdsAdded.push(elTd2);
|
tdsAdded.push(elTd2);
|
||||||
}
|
}
|
||||||
@ -512,7 +523,7 @@ function changePreset() {
|
|||||||
document.getElementById('selQuotaCriterion').value = 'geq';
|
document.getElementById('selQuotaCriterion').value = 'geq';
|
||||||
document.getElementById('selQuota').value = 'droop';
|
document.getElementById('selQuota').value = 'droop';
|
||||||
document.getElementById('selQuotaMode').value = 'static';
|
document.getElementById('selQuotaMode').value = 'static';
|
||||||
document.getElementById('chkBulkElection').checked = false;
|
document.getElementById('chkBulkElection').checked = true;
|
||||||
document.getElementById('chkBulkExclusion').checked = false;
|
document.getElementById('chkBulkExclusion').checked = false;
|
||||||
document.getElementById('chkDeferSurpluses').checked = false;
|
document.getElementById('chkDeferSurpluses').checked = false;
|
||||||
document.getElementById('selNumbers').value = 'rational';
|
document.getElementById('selNumbers').value = 'rational';
|
||||||
|
@ -34,6 +34,13 @@ a:hover {
|
|||||||
color: #1d3da2;
|
color: #1d3da2;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
tr.stage-no a {
|
||||||
|
color: initial !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
li.highlight {
|
||||||
|
background-color: #fffedd;
|
||||||
|
}
|
||||||
|
|
||||||
/* Menu styling */
|
/* Menu styling */
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ fn update_results_table<N: Number>(stage_num: usize, state: &CountState<N>, opts
|
|||||||
tdclasses2 = r#"blw "#;
|
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.kind.unwrap_or("")).into());
|
||||||
result.push(&format!(r#"<td{}>{}</td>"#, tdclasses1, state.title).into());
|
result.push(&format!(r#"<td{}>{}</td>"#, tdclasses1, state.title).into());
|
||||||
for candidate in state.election.candidates.iter() {
|
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 => {
|
CandidateState::Excluded => {
|
||||||
result.push(&format!(r#"<td class="{}count excluded">{}</td>"#, tdclasses2, pp(&count_card.transfers, opts.pp_decimals)).into());
|
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());
|
result.push(&format!(r#"<td class="{}count excluded">Ex</td>"#, tdclasses2).into());
|
||||||
} else {
|
} else {
|
||||||
result.push(&format!(r#"<td class="{}count excluded">{}</td>"#, tdclasses2, pp(&count_card.votes, opts.pp_decimals)).into());
|
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