DEV Community

Cover image for Coronavirus stats: worldwide country position bookmarklet
Janko
Janko

Posted on

Coronavirus stats: worldwide country position bookmarklet

javascript:
void( 
document.body.onclick = async function (event) {
 event = event || window.event;
 var element = event.target || event.srcElement;
 await new Promise(resolve => setTimeout(resolve, 10));
 state = 'Czechia'; /* CHANGE THIS TO SEE OTHER STATE */
 index = document.body.innerText.search(state);
 place = document.body.innerText.substring(index - 4,index).match(/\n([0-9]+)/);
 alert(state + ' is #' + place[1] + ' in ' + element.textContent + ' worldwide.')} );
Enter fullscreen mode Exit fullscreen mode

Simply add this code in place of a bookmark URL - Alt Text

Go to https://www.worldometers.info/coronavirus/ and click this bookmark. Then - when you click on the first row of the data table with data
Alt Text
the bookmarklet will show you the position of the selected country (see in code)
Alt Text

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay