COVID 1 Out of Calculator

try to take over the world!

// ==UserScript==
// @name         COVID 1 Out of Calculator
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://coronavirus.jhu.edu/testing/states-comparison
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function AddNewTH(Name, SourceIndex) {
        var ThisNewTH = document.createElement('th');
        var ThisNewTHDiv = document.createElement('div');
        var ThisNewTHDivInner = document.createElement('div');
        $(ThisNewTHDivInner).text(Name);
        $(ThisNewTHDiv).addClass('TFormat_inactive__Nkaqk');
        $(ThisNewTHDiv).append($(ThisNewTHDivInner));
        $(ThisNewTH).append($(ThisNewTHDiv));
        console.log($($('.TFormat_main__35Moj > table > thead > tr > th')[SourceIndex]));
        ThisNewTH.addEventListener('click', function() {$($('.TFormat_main__35Moj > table > thead > tr > th')[SourceIndex]).trigger('click')}, true);

        $('.TFormat_main__35Moj > table > thead > tr').append($(ThisNewTH));

        $('.TFormat_main__35Moj > table > tbody > tr').each(function() {
            var ThisNewTD = document.createElement('td');
            var CasesNumber = $($(this).find('td')[SourceIndex]).text();
            var OutOfCount = Number.parseFloat(100000 / CasesNumber).toFixed(1);
            $(ThisNewTD).text(OutOfCount);
            $(this).append(ThisNewTD);
        });
    }

    AddNewTH('1 in (cases)', 2);
    AddNewTH('1 in (tests)', 1);
    AddNewTH('1 in (deaths)', 3);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址