Greasy Fork is available in English.

PrimPogoda Humidex

Баллы Humidex для Gismeteo

Versión del día 14/6/2020. Echa un vistazo a la versión más reciente.

// ==UserScript==
// @name			PrimPogoda Humidex
// @version			2020.06.14
// @description		Баллы Humidex для Gismeteo
// @include			http*://*primpogoda.ru/*.now
// @icon			https://www.google.com/s2/favicons?domain=primpogoda.ru
// @author			Rainbow-Spike
// @namespace		https://greasyfork.org/users/7568
// @homepage		https://greasyfork.org/ru/users/7568-dr-yukon
// @grant			none
// ==/UserScript==

var cells = document.querySelectorAll ( '.forecast > .current > .row .columns' ) [ 1 ].querySelectorAll ( '.row' ) [ 1 ].querySelectorAll ( '.columns' ),
	temp = cells [ 0 ].querySelector ( 'p' ).innerHTML.split ( '°' ) [ 0 ].replace ( '+', '' ) * 1,
	humd = cells [ 2 ].querySelector ( 'p' ).innerHTML.replace ( '%', '' ) * 1,
	humidex = Math.round ( temp + 5 / 9 * ( ( 6.112 * Math.pow ( 10, ( 7.5 * temp / ( 237.7 + temp ) ) ) * humd / 100 ) - 10 ) ),
	color;

function paint ( h ) {
	switch ( true ) {
		case h < 0:
			color = 'violet';
			break;
		case h < 10:
			color = 'blue';
			break;
		case h < 20:
			color = 'darkturquoise';
			break;
		case h < 30:
			color = 'green';
			break;
		case h < 40:
			color = 'gold';
			break;
		case h < 45:
			color = 'orange';
			break;
		case h < 54:
			color = 'red';
			break;
		case h >= 54:
			color = 'darkred';
			break;
		default:
			color = '';
			break;
	}
	return color;
}
cells [ 1 ].querySelector ( 'p' ).innerHTML = '<div style = "font-weight: bold; color: ' + paint ( humidex ) + '">' + humidex + ' баллов Humidex</div>'