Cosmetic improvements

This commit is contained in:
RunasSudo 2020-10-18 00:23:25 +11:00
parent 25d16eb8b8
commit 24a0a140c7
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
1 changed files with 46 additions and 0 deletions

View File

@ -3,6 +3,32 @@
<head>
<meta charset="utf-8">
<title>pyRCV2 test</title>
<style type="text/css">
html, body {
font-family: 'Liberation Sans', FreeSans, Helvetica, Arial, sans-serif;
}
table {
border-collapse: collapse;
}
td {
padding: 0px 8px;
}
td.count {
text-align: right;
}
tr:first-child td {
vertical-align: bottom;
}
td.excluded {
background-color: #fecfcfff;
}
td.elected {
background-color: #d1fca7ff;
}
tr.info td {
background-color: #edededff;
}
</style>
</head>
<body>
<input type="file" id="bltFile">
@ -66,7 +92,9 @@
// Exhausted votes row
elExhausted1 = document.createElement('tr');
elExhausted1.classList.add('info');
elExhausted2 = document.createElement('tr');
elExhausted2.classList.add('info');
elTd = document.createElement('td');
elTd.setAttribute('rowspan', '2');
@ -79,8 +107,10 @@
// Quota row
elQuota = document.createElement('tr');
elQuota.classList.add('info');
elTd = document.createElement('td');
elTd.style.borderTop = '1px solid black';
elTd.style.borderBottom = '1px solid black';
elTd.innerText = 'Quota';
elQuota.appendChild(elTd);
tblResults.appendChild(elQuota);
@ -98,6 +128,12 @@
[elTr1, elTr2] = candMap[candidate];
elTd = document.createElement('td');
elTd.classList.add('count');
if (countCard.state == py.pyRCV2.model.CandidateState.WITHDRAWN || countCard.state == py.pyRCV2.model.CandidateState.EXCLUDED) {
elTd.classList.add('excluded');
} else if (countCard.state == py.pyRCV2.model.CandidateState.ELECTED || countCard.state == py.pyRCV2.model.CandidateState.PROVISIONALLY_ELECTED) {
elTd.classList.add('elected');
}
elTd.style.borderTop = '1px solid black';
if (countCard.transfers != '0.00') {
elTd.innerText = countCard.transfers;
@ -105,12 +141,18 @@
elTr1.appendChild(elTd);
elTd = document.createElement('td');
elTd.classList.add('count');
if (countCard.state == py.pyRCV2.model.CandidateState.WITHDRAWN) {
elTd.classList.add('excluded');
elTd.innerText = 'WD';
} else if (countCard.state == py.pyRCV2.model.CandidateState.ELECTED || countCard.state == py.pyRCV2.model.CandidateState.PROVISIONALLY_ELECTED) {
elTd.classList.add('elected');
elTd.innerText = countCard.votes;
elTd.style.fontWeight = 'bold';
elTr1.querySelector('td:first-child').classList.add('elected');
} else if (countCard.state == py.pyRCV2.model.CandidateState.EXCLUDED) {
elTd.classList.add('excluded');
elTd.innerText = 'EX';
} else {
elTd.innerText = countCard.votes;
@ -120,6 +162,7 @@
// Display exhausted votes
elTd = document.createElement('td');
elTd.classList.add('count');
elTd.style.borderTop = '1px solid black';
if (result.exhausted.transfers != '0.00') {
elTd.innerText = result.exhausted.transfers;
@ -127,12 +170,15 @@
elExhausted1.appendChild(elTd);
elTd = document.createElement('td');
elTd.classList.add('count');
elTd.innerText = result.exhausted.votes;
elExhausted2.appendChild(elTd);
// Display quota
elTd = document.createElement('td');
elTd.classList.add('count');
elTd.style.borderTop = '1px solid black';
elTd.style.borderBottom = '1px solid black';
elTd.innerText = result.quota;
elQuota.appendChild(elTd);
}