Corona Cases Counter

Corona Cases Counter

How to implement the Corona Cases Counter on your website or blog

Show what’s going on – show you care!

It is very easy to display something like this on your website or blog.
Copy and paste the HTML code and you are set!

Corona Cases Counter worldwide:

INFECTED:
RECOVERED:
DEAD:

Corona Cases Counter in different countries:

CORONA CASES COUNTER
INFECTED US:
RECOVERED US:
DEAD US:
INFECTED DE:
RECOVERED DE:
DEAD THE:
INFECTED IT:
RECOVERED IT:
DEAD IT:
INFECTED IS:
RECOVERED IS:
DEAD IS:
INFECTED FR:
RECOVERED FR:
DEAD FR:
INFECTED UK:
RECOVERED UK:
DEAD UK:
INFECTED CHINA:
RECOVERED CHINA:
DEAD CHINA:

Here’s how it works:

If you want to display the current number of people infected by the corona virus worldwide, just copy and paste the Corona Cases Counter worldwide HTML code to your webpage or blog. The Corona Cases Counter also includes the number of people recovered and the number of people who unfortunately have died after a Covid-19 infection.
Feel free to edit the code according to your needs.

Corona Cases Counter worldwide HTML:

Getting this counter up and running is pretty easy!
Having some time on our hand these days – why not learn some rudimentary coding?

This html code is split into three parts: HEADER, SCRIPT and TABLE
HEADER contains an auto refresh function set to 1800(sec) which translates to 30 minutes. This way you are always displaying the current numbers.

SCRIPT asks the covid19.mathdro.id-API (thank you mathdro.id-team for providing that) for the current stats. The API’s answer is a text file like this:

{“confirmed“:{“value“:311988,”detail”:”https://covid19.mathdro.id/api/confirmed”},”recovered”:{“value”:93790,”detail”:”https://covid19.mathdro.id/api/recovered”},”deaths”:{“value”:13407,”detail”:”https://covid19.mathdro.id/api/deaths”},”dailySummary”:”https://covid19.mathdro.id/api/daily”,”dailyTimeSeries”:{“pattern”:”https://covid19.mathdro.id/api/daily/[dateString]”,”example”:”https://covid19.mathdro.id/api/daily/2-14-2020″},”image”:”https://covid19.mathdro.id/api/og”,”source”:”https://github.com/mathdroid/covid19″,”countries”:”https://covid19.mathdro.id/api/countries”,”countryDetail”:{“pattern”:”https://covid19.mathdro.id/api/countries/[country]”,”example”:”https://covid19.mathdro.id/api/countries/USA”},”lastUpdate”:”2020-03-22T11:43:03.000FROM”}

https://covid19.mathdro.id/api

The text file can now be checked for specific values, e.g. “.confirmed.value“. In this example, the value would be “311988“. This value is then written into a variable “#inf-all“.

TABLE displays the variables, e.g. “#inf-all” as “INFECTED: [NUMBER]”

And that’s it!

Different countries:

If you want to display a specific country as well – copy/paste this code to your website or blog.

Corona Cases Counter in different countries HTML:


There’s a SCRIPT part for every country e.g. <!—SCRIPT FOR THE US—>
and a TABLE part for every country e.g. <!—TABLE FOR THE US—>

In the SCRIPT we ask the API for specific countries, e.g. https://covid19.mathdro.id/api/countries/Italy
The API answers with a text file:

{“confirmed”:{“value”:53578,”detail”:”https://covid19.mathdro.id/api/countries/Italy/confirmed”},”recovered”:{“value”:6072,”detail”:”https://covid19.mathdro.id/api/countries/Italy/recovered”},”deaths”:{“value”:4825,”detail”:”https://covid19.mathdro.id/api/countries/Italy/deaths”},”lastUpdate”:”2020-03-21T17:43:03.000FROM”}

https://covid19.mathdro.id/api/countries/Italy

The text file is then analysed for specific values, e.g. “.confirmed.value“. In this example, the value would be “53578“. This value is then written into a variable “#inf-it“.

TABLE displays the variables, e.g. “#inf-it” as “INFECTED IT: [NUMBER]”

If it is up and running it should look something like this:

CORONA CASES COUNTER

You can play around with the style of your table. Change the font, the size, the colors. You can delete and/or add countries. Just ask the API for other countries. Change e.g. https://covid19.mathdro.id/api/countries/Italy to
https://covid19.mathdro.id/api/countries/Switzerland. You might want to change the variable, in this case “#inf-itto “#inf-chin the SCRIPT as well as in the TABLE.
Feel free to edit the code according to your needs.
Happy coding!

Stay at homelearn something new todaystay healthy!!

Every appreciation is appreciated! 🙂

Buy me a coffeeBuy me a coffee