yandexweather
Advanced tools
Comparing version 0.0.3 to 0.0.4
94
index.js
@@ -21,3 +21,3 @@ 'use strict'; | ||
after0: { | ||
dayPart: dayPartToTm($('.current-weather__thermometer-name').eq(0).text()), | ||
dayPart: $('.current-weather__thermometer-name').eq(0).text(), | ||
temp: $('.current-weather__thermometer_type_after').eq(0).text(), | ||
@@ -28,3 +28,3 @@ icon: $('.current-weather__col_type_after').eq(0).children('i').attr('class').split(' ')[1] | ||
after1: { | ||
dayPart: dayPartToTm($('.current-weather__thermometer-name').eq(1).text()), | ||
dayPart: $('.current-weather__thermometer-name').eq(1).text(), | ||
temp: $('.current-weather__thermometer_type_after').eq(1).text(), | ||
@@ -36,6 +36,6 @@ icon: $('.current-weather__col_type_after').eq(1).children('i').attr('class').split(' ')[1] | ||
sunset: $('.current-weather__info-row').eq(0).text().split('Закат: ')[1], | ||
windSpeed: $('.current-weather__info-row').eq(1).children('span.wind-speed').text().split(' ')[0] + ' m/s' , | ||
windDirection: windToTm($('.current-weather__info-row').eq(1).children('abbr').text()), | ||
windSpeed: $('.current-weather__info-row').eq(1).children('span.wind-speed').text().split(' ')[0] , | ||
windDirection: $('.current-weather__info-row').eq(1).children('abbr').text(), | ||
humidity: $('.current-weather__info-row').eq(2).text().split(" ")[1], | ||
airPressure: $('.current-weather__info-row').eq(3).text().split(" ")[1] + ' mmHg' | ||
airPressure: $('.current-weather__info-row').eq(3).text().split(" ")[1] | ||
} | ||
@@ -75,3 +75,3 @@ | ||
humidity: morning.eq(4).text(), | ||
windDirection: windToTm(morning.eq(5).children('div').children('abbr').text()), | ||
windDirection: morning.eq(5).children('div').children('abbr').text(), | ||
windSpeed: morning.eq(5).children('div').children('span').text() + ' m/s', | ||
@@ -85,3 +85,3 @@ }, | ||
humidity: noon.eq(4).text(), | ||
windDirection: windToTm(noon.eq(5).children('div').children('abbr').text()), | ||
windDirection: noon.eq(5).children('div').children('abbr').text(), | ||
windSpeed: noon.eq(5).children('div').children('span').text() + ' m/s', | ||
@@ -95,3 +95,3 @@ }, | ||
humidity: evening.eq(4).text(), | ||
windDirection: windToTm(evening.eq(5).children('div').children('abbr').text()), | ||
windDirection: evening.eq(5).children('div').children('abbr').text(), | ||
windSpeed: evening.eq(5).children('div').children('span').text() + ' m/s', | ||
@@ -105,3 +105,3 @@ }, | ||
humidity: night.eq(4).text(), | ||
windDirection: windToTm(night.eq(5).children('div').children('abbr').text()), | ||
windDirection: night.eq(5).children('div').children('abbr').text(), | ||
windSpeed: night.eq(5).children('div').children('span').text() + ' m/s', | ||
@@ -118,76 +118,2 @@ }, | ||
function dayPartToTm (ru) { | ||
switch (ru) { | ||
case 'утром': | ||
return 'irden'; | ||
break; | ||
case 'днём': | ||
return 'gündiz'; | ||
break; | ||
case 'вечером': | ||
return 'agşam'; | ||
break; | ||
case 'ночью': | ||
return 'gije'; | ||
break; | ||
default: | ||
return '-'; | ||
} | ||
} | ||
function windToTm (ru) { | ||
switch (ru) { | ||
case 'С': | ||
return 'Dg'; | ||
break; | ||
case 'СВ': | ||
return 'Dg-Gd'; | ||
break; | ||
case 'СЮ': | ||
return 'Dg-Go'; | ||
break; | ||
case 'СЗ': | ||
return 'Dg-Gb'; | ||
break; | ||
case 'В': | ||
return 'Gd'; | ||
break; | ||
case 'ВС': | ||
return 'Gd-Dg'; | ||
break; | ||
case 'ВЮ': | ||
return 'Gd-Go'; | ||
break; | ||
case 'ВЗ': | ||
return 'Gd-Gb'; | ||
break; | ||
case 'Ю': | ||
return 'Go'; | ||
break; | ||
case 'ЮС': | ||
return 'Go-Dg'; | ||
break; | ||
case 'ЮВ': | ||
return 'Go-Gd'; | ||
break; | ||
case 'ЮЗ': | ||
return 'Go-Gb'; | ||
break; | ||
case 'З': | ||
return 'Gb'; | ||
break; | ||
case 'ЗС': | ||
return 'Gb-Dg'; | ||
break; | ||
case 'ЗВ': | ||
return 'Gb-Gd'; | ||
break; | ||
case 'ЗЮ': | ||
return 'Gb-Go'; | ||
break; | ||
default: | ||
return '-'; | ||
} | ||
} | ||
function getIcon (iconAttr) { | ||
@@ -222,5 +148,5 @@ let icons = []; | ||
return 'icons/' + icons[iconAttr]; | ||
return 'https://yastatic.net/weather/i/icons/blueye/color/svg/' + icons[iconAttr]; | ||
} | ||
exports.getWeatherForecast = getWeatherForecast; |
{ | ||
"name": "yandexweather", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Yandex Weather API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
35250
116