-
Notifications
You must be signed in to change notification settings - Fork 1
/
weatherIcons.js
74 lines (71 loc) · 2.83 KB
/
weatherIcons.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Written by Joshua Fabian, [email protected]
var weatherIconClass = function weatherIconClass(casedCondition,isDaytime) {
var iconClass = 'train';
var condition = casedCondition.toLowerCase();
if (condition.includes('partly cloudy') || condition.includes('mostly cloudy')) {
iconClass = isDaytime + '-cloudy';
} else if (condition.includes('partly clear') || condition.includes('mostly clear')) {
iconClass = isDaytime + '-cloudy';
} else if (condition == 'cloudy' || condition.includes('overcast')) {
iconClass = 'cloudy';
} else if (condition.includes('sunny')) {
iconClass = 'day-sunny';
} else if (condition.includes('clear') && isDaytime == 'day') {
iconClass = 'day-sunny';
} else if (condition.includes('clear')) {
iconClass = 'night-clear';
} else if (condition.includes('flood')) {
iconClass = 'flood';
} else if (condition.includes('snow') && condition.includes('thunderstorm')) {
iconClass = isDaytime + '-snow-thunderstorm';
} else if (condition.includes('thunderstorm')) {
iconClass = 'thunderstorm';
} else if (condition.includes('snow') && condition.includes('wind')) {
iconClass = 'snow-wind';
} else if (condition.includes('rain') && condition.includes('wind')) {
iconClass = 'rain-wind';
} else if (condition.includes('wind') || condition.includes('breez')) {
iconClass = 'strong-wind';
} else if (condition.includes('mix')) {
iconClass = 'rain-mix';
} else if (condition.includes('sleet')) {
iconClass = 'sleet';
} else if (condition.includes('hail')) {
iconClass = 'hail';
} else if (condition.includes('snow')) {
iconClass = 'snow';
} else if (condition.includes('showers')) {
iconClass = 'showers';
} else if (condition.includes('sprinkles')) {
iconClass = 'sprinkle';
} else if (condition.includes('light rain')) {
iconClass = 'sprinkle';
} else if (condition.includes('rain')) {
iconClass = 'raub';
} else if (condition.includes('smoke')) {
iconClass = 'smoke';
} else if (condition.includes('dust')) {
iconClass = 'dust';
} else if (condition.includes('sandstorm')) {
iconClass = 'sandstorm';
} else if (condition.includes('haze') || condition.includes('hazy')) {
iconClass = 'day-haze';
} else if (condition.includes('hot')) {
iconClass = 'hot';
} else if (condition.includes('cold')) {
iconClass = 'thermometer-exterior';
} else if (condition.includes('fog')) {
iconClass = 'fog';
} else if (condition.includes('hurricane') || condition.includes('tropical storm') || condition.includes('tropical depression')) {
iconClass = 'hurricane';
} else if (condition.includes('tornado')) {
iconClass = 'tornado';
} else if (condition.includes('volcano')) {
iconClass = 'volcano';
} else if (condition.includes('fire')) {
iconClass = 'fire';
} else if (condition.includes('meteor') || condition.includes('asteroid')) {
iconClass = 'meteor';
}
return ('wi-' + iconClass);
}