NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Worldometer-covid-enhancer // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @license MIT // @match https://www.worldometers.info/coronavirus/ // @grant none // @run-at document-body // ==/UserScript== var setup = function() { 'use strict'; var parseNumber = function(t) { t = t.replace(',', ''); return parseInt(t) || 0; }; var table = document.getElementById('main_table_countries_today'); var headRow = table.tHead.rows[0]; { let th_cell1 = document.createElement("th"); headRow.appendChild(th_cell1); th_cell1.appendChild(document.createTextNode("Deaths / Cases")); } { let th_cell1 = document.createElement("th"); headRow.appendChild(th_cell1); th_cell1.appendChild(document.createTextNode("Deaths / 1M pop")); } { let th_cell1 = document.createElement("th"); headRow.appendChild(th_cell1); th_cell1.appendChild(document.createTextNode("Deaths / (Deaths+Recovered)")); } var enrichRow = function(row) { let totalCases = parseNumber(row.cells[1].innerHTML); let casesPer1M = parseNumber(row.cells[8].innerHTML); let totalDeaths = parseNumber(row.cells[3].innerHTML); let totalRecovered = parseNumber(row.cells[5].innerHTML); // "Deaths / Cases" let cell = row.insertCell(row.cells.length); if (totalDeaths == 0 || totalCases == 0) { cell.appendChild(document.createTextNode("")); } else { cell.appendChild(document.createTextNode( (Math.round((totalDeaths / totalCases) * 10000) / 100).toFixed(2) + " %")); } // "Deaths / 1M pop" cell = row.insertCell(row.cells.length); if (totalDeaths == 0 || totalCases == 0 || casesPer1M == 0) { cell.appendChild(document.createTextNode("")); } else { let fnum = totalDeaths / (totalCases / casesPer1M); cell.appendChild(document.createTextNode(Math.round(fnum * 100).toFixed(2) / 100)); } // "Deaths / (Deaths+Recovered)" cell = row.insertCell(row.cells.length); if (totalDeaths == 0 || totalCases == 0 || casesPer1M == 0) { cell.appendChild(document.createTextNode("")); } else { let fnum = totalDeaths / (totalDeaths + totalRecovered); cell.appendChild(document.createTextNode(Math.round(fnum * 100).toFixed(2) / 100)); } }; for (var i = 0, row; row = table.tBodies[0].rows[i]; i++) { enrichRow(row); } enrichRow(document.getElementById('main_table_countries_today').tBodies[1].rows[0]); }; $(document).ready(setup);