Cosmetic improvements
This commit is contained in:
parent
25d16eb8b8
commit
24a0a140c7
46
test.html
46
test.html
@ -3,6 +3,32 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>pyRCV2 test</title>
|
<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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<input type="file" id="bltFile">
|
<input type="file" id="bltFile">
|
||||||
@ -66,7 +92,9 @@
|
|||||||
|
|
||||||
// Exhausted votes row
|
// Exhausted votes row
|
||||||
elExhausted1 = document.createElement('tr');
|
elExhausted1 = document.createElement('tr');
|
||||||
|
elExhausted1.classList.add('info');
|
||||||
elExhausted2 = document.createElement('tr');
|
elExhausted2 = document.createElement('tr');
|
||||||
|
elExhausted2.classList.add('info');
|
||||||
|
|
||||||
elTd = document.createElement('td');
|
elTd = document.createElement('td');
|
||||||
elTd.setAttribute('rowspan', '2');
|
elTd.setAttribute('rowspan', '2');
|
||||||
@ -79,8 +107,10 @@
|
|||||||
|
|
||||||
// Quota row
|
// Quota row
|
||||||
elQuota = document.createElement('tr');
|
elQuota = document.createElement('tr');
|
||||||
|
elQuota.classList.add('info');
|
||||||
elTd = document.createElement('td');
|
elTd = document.createElement('td');
|
||||||
elTd.style.borderTop = '1px solid black';
|
elTd.style.borderTop = '1px solid black';
|
||||||
|
elTd.style.borderBottom = '1px solid black';
|
||||||
elTd.innerText = 'Quota';
|
elTd.innerText = 'Quota';
|
||||||
elQuota.appendChild(elTd);
|
elQuota.appendChild(elTd);
|
||||||
tblResults.appendChild(elQuota);
|
tblResults.appendChild(elQuota);
|
||||||
@ -98,6 +128,12 @@
|
|||||||
[elTr1, elTr2] = candMap[candidate];
|
[elTr1, elTr2] = candMap[candidate];
|
||||||
|
|
||||||
elTd = document.createElement('td');
|
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';
|
elTd.style.borderTop = '1px solid black';
|
||||||
if (countCard.transfers != '0.00') {
|
if (countCard.transfers != '0.00') {
|
||||||
elTd.innerText = countCard.transfers;
|
elTd.innerText = countCard.transfers;
|
||||||
@ -105,12 +141,18 @@
|
|||||||
elTr1.appendChild(elTd);
|
elTr1.appendChild(elTd);
|
||||||
|
|
||||||
elTd = document.createElement('td');
|
elTd = document.createElement('td');
|
||||||
|
elTd.classList.add('count');
|
||||||
if (countCard.state == py.pyRCV2.model.CandidateState.WITHDRAWN) {
|
if (countCard.state == py.pyRCV2.model.CandidateState.WITHDRAWN) {
|
||||||
|
elTd.classList.add('excluded');
|
||||||
elTd.innerText = 'WD';
|
elTd.innerText = 'WD';
|
||||||
} else if (countCard.state == py.pyRCV2.model.CandidateState.ELECTED || countCard.state == py.pyRCV2.model.CandidateState.PROVISIONALLY_ELECTED) {
|
} 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.innerText = countCard.votes;
|
||||||
elTd.style.fontWeight = 'bold';
|
elTd.style.fontWeight = 'bold';
|
||||||
|
|
||||||
|
elTr1.querySelector('td:first-child').classList.add('elected');
|
||||||
} else if (countCard.state == py.pyRCV2.model.CandidateState.EXCLUDED) {
|
} else if (countCard.state == py.pyRCV2.model.CandidateState.EXCLUDED) {
|
||||||
|
elTd.classList.add('excluded');
|
||||||
elTd.innerText = 'EX';
|
elTd.innerText = 'EX';
|
||||||
} else {
|
} else {
|
||||||
elTd.innerText = countCard.votes;
|
elTd.innerText = countCard.votes;
|
||||||
@ -120,6 +162,7 @@
|
|||||||
|
|
||||||
// Display exhausted votes
|
// Display exhausted votes
|
||||||
elTd = document.createElement('td');
|
elTd = document.createElement('td');
|
||||||
|
elTd.classList.add('count');
|
||||||
elTd.style.borderTop = '1px solid black';
|
elTd.style.borderTop = '1px solid black';
|
||||||
if (result.exhausted.transfers != '0.00') {
|
if (result.exhausted.transfers != '0.00') {
|
||||||
elTd.innerText = result.exhausted.transfers;
|
elTd.innerText = result.exhausted.transfers;
|
||||||
@ -127,12 +170,15 @@
|
|||||||
elExhausted1.appendChild(elTd);
|
elExhausted1.appendChild(elTd);
|
||||||
|
|
||||||
elTd = document.createElement('td');
|
elTd = document.createElement('td');
|
||||||
|
elTd.classList.add('count');
|
||||||
elTd.innerText = result.exhausted.votes;
|
elTd.innerText = result.exhausted.votes;
|
||||||
elExhausted2.appendChild(elTd);
|
elExhausted2.appendChild(elTd);
|
||||||
|
|
||||||
// Display quota
|
// Display quota
|
||||||
elTd = document.createElement('td');
|
elTd = document.createElement('td');
|
||||||
|
elTd.classList.add('count');
|
||||||
elTd.style.borderTop = '1px solid black';
|
elTd.style.borderTop = '1px solid black';
|
||||||
|
elTd.style.borderBottom = '1px solid black';
|
||||||
elTd.innerText = result.quota;
|
elTd.innerText = result.quota;
|
||||||
elQuota.appendChild(elTd);
|
elQuota.appendChild(elTd);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user