Load threshold with sci names
This commit is contained in:
@@ -251,7 +251,7 @@ $result = $db->query($sql);
|
|||||||
$scient_link = "<i>{$scient}</i>";
|
$scient_link = "<i>{$scient}</i>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<tr data-comname=\"{$common}\">"
|
echo "<tr data-comname=\"{$common}\" data-sciname=\"{$scient}\">"
|
||||||
. "<td>{$common_link}</td>"
|
. "<td>{$common_link}</td>"
|
||||||
. "<td>{$scient_link}</td>"
|
. "<td>{$scient_link}</td>"
|
||||||
. "<td>{$chart_cell}</td>"
|
. "<td>{$chart_cell}</td>"
|
||||||
@@ -287,15 +287,15 @@ function loadThresholds() {
|
|||||||
const val = parseFloat(m[2]);
|
const val = parseFloat(m[2]);
|
||||||
if (Number.isNaN(val)) continue;
|
if (Number.isNaN(val)) continue;
|
||||||
const u = left.lastIndexOf('_');
|
const u = left.lastIndexOf('_');
|
||||||
const common = u >= 0 ? left.slice(u + 1) : left;
|
const sci = u >= 0 ? left.slice(0, u) : left;
|
||||||
map[common] = val; map[left] = val;
|
map[sci] = val; map[left] = val;
|
||||||
}
|
}
|
||||||
const decoder = document.createElement('textarea');
|
const decoder = document.createElement('textarea');
|
||||||
document.querySelectorAll('#speciesTable tbody tr').forEach(row => {
|
document.querySelectorAll('#speciesTable tbody tr').forEach(row => {
|
||||||
decoder.innerHTML = row.getAttribute('data-comname') || '';
|
decoder.innerHTML = row.getAttribute('data-sciname') || '';
|
||||||
const commonName = decoder.value;
|
const sciName = decoder.value;
|
||||||
if (Object.prototype.hasOwnProperty.call(map, commonName)) {
|
if (Object.prototype.hasOwnProperty.call(map, sciName)) {
|
||||||
const v = map[commonName];
|
const v = map[sciName];
|
||||||
const cell = row.querySelector('td.threshold');
|
const cell = row.querySelector('td.threshold');
|
||||||
cell.textContent = v.toFixed(4);
|
cell.textContent = v.toFixed(4);
|
||||||
cell.style.color = v >= sfThresh ? 'green' : 'red';
|
cell.style.color = v >= sfThresh ? 'green' : 'red';
|
||||||
|
|||||||
Reference in New Issue
Block a user