🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

PrimPogoda Humidex

Баллы Humidex для Gismeteo

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name			PrimPogoda Humidex
// @version			2020.10.23
// @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 .columns' ),
	temp = cells [ 4 ].querySelector ( 'p' ).innerHTML.split ( '°' ) [ 0 ].replace ( '+', '' ).replace ( '−', '-' ) * 1,
	humd = cells [ 6 ].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,
	text;

function paint ( h ) {
	switch ( true ) {
		case h <= 0:
			color = 'violet';
			text = 'Нет дискомфорта';
			break;
		case h <= 10:
			color = 'blue';
			text = 'Нет дискомфорта';
			break;
		case h <= 20:
			color = 'darkturquoise';
			text = 'Нет дискомфорта';
			break;
		case h <= 30:
			color = 'green';
			text = 'Нет дискомфорта';
			break;
		case h <= 40:
			color = 'gold';
			text = 'Некоторый дискомфорт';
			break;
		case h <= 45:
			color = 'orange';
			text = 'Большой дискомфорт; избегать усилий';
			break;
		case h < 54:
			color = 'red';
			text = 'Опасно; возможен тепловой удар';
			break;
		case h >= 54:
			color = 'darkred';
			text = 'Опасно; возможен тепловой удар';
			break;
		default:
			color = 'black';
			text = '-';
			break;
	}
}

paint ( humidex );
cells [ 5 ].querySelector ( 'p' ).innerHTML = '<span style = "font-weight: bold; color: ' + color + '" title = "' + text + '">' + humidex + '</span> баллов Humidex';