-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
126 lines (115 loc) · 5.76 KB
/
index.html
File metadata and controls
126 lines (115 loc) · 5.76 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!DOCTYPE html>
<html lang="en">
<head>
<title>HMS Weather Forecast</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/svg" href="resources/weatherIcons/partly-cloudy-day.svg">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script type="module" src="scripts/main.js" defer></script>
</head>
<body>
<header>
<h1>HMS Weather </h1>
</header>
<div id="app">
<form @submit.prevent="fetchData">
<button type="button" id="heartButton" @click="modifyLocalStorage()"><img :src="heartIcon"
alt="Heart"></button>
<label for="location-input"></label>
<input type="text" placeholder="Search here" @input="updateHeartIcon()" v-model="searchLocation"
id="location-input" list="locationDropdown" autocomplete="off">
<datalist id="locationDropdown">
<option v-for="location in storedLocations">{{location}}</option>
</datalist>
<button type="submit" id="searchButton"><img src="resources/magnifying-glass-svgrepo-com.svg"
alt="Magnifying glass"></button>
</form>
<ul id="presentOptions" v-if="hasData">
<li>
<button @click="selectOption('hourly')" :disabled="selectedOption == 1">Daily Forecast</button>
</li>
<li>
<button @click="selectOption('two-weeks')" :disabled="selectedOption == 2">14-Day Forecast</button>
</li>
<li>
<button @click="selectOption('graph')" :disabled="selectedOption == 3">Graph</button>
</li>
</ul>
<div class="showLocation gray-last-child borderNshadow hidden">
<p>{{ location }}</p>
<p class="">{{ country }}</p>
</div>
<div class="weatherDeck hidden" @scroll="handleScroll" ref="scrollContainer">
<div id="scroll-left" class="scroll-buttons" @click="scroll()" v-show="showLeftScroll">
<img src="resources/double-arrow-left-icon.svg" alt="Left Scroll Button">
</div>
<!--weather.daily[index] display template-->
<article class="weatherCard borderNshadow" v-if="hasData" v-for="(value, index) in weather.daily"
@click="scrollTo(value.time)">
<section class="dateTime">
<h3 class="itemDate">
<time v-if="value.time" :datetime="value.time">{{
getDayName(value.time) }}</time>
</h3>
<p>{{getMonthName(value.time)}}</p>
</section>
<section class="temp gray-last-child">
<p class="temperature">{{ value.temp }}°C</p>
<p>Feels like: {{ value.apparent_temp }}°C</p>
</section>
<section class="weatherIcon">
<img :src="getWeatherIcons(value.weather_code)" alt="Weather Icon" class="weatherIcons">
</section>
<div class="weatherElementsSubContainer">
<section class="showPrecipitation gray-last-child">
<p>{{ value.precipitation }} mm </p>
<p> {{ value.precipitation_probability }} %</p>
</section>
<section class="showWindSpeed gray-last-child">
<p>
<span class="windArrow"
:style="{ display: 'inline-block', transform: 'rotate(' + value.wind_direction + 'deg)' }">↓</span>
{{ value.wind_speed }} m/s
</p>
<p>{{ value.wind_gusts }}m/s </p>
</section>
</div>
</article>
<div id="scroll-right" class="scroll-buttons" @click="scroll(true)" v-show="showRightScroll">
<img src="resources/double-arrow-right-icon.svg" alt="Right Scroll Button">
</div>
</div>
<div id="hourlyPresentation" class="hidden">
<table class="borderNshadow" v-for="(date, index) in getAvailableDates()" :id="date">
<tr>
<th><time :datetime="date">{{getMonthName(date)}}</time></th>
<th></th>
<th>Temp</th>
<th>Feels like</th>
<th>mm</th>
<th>m/s (Gusts)</th>
</tr>
<tr v-for="(value, index) in weatherOneDay(date)">
<td> {{ value.time }} </td>
<td> <img :src="getWeatherIcons(value.weather_code, value.time)" alt="Weather Icon"
class="weatherIcons"> </td>
<td> {{ value.temp }}° </td>
<td> {{ value.apparent_temp }}° </td>
<td> {{ value.precipitation }} <br> {{ value.precipitation_probability }} %</td>
<td><span class="windArrow"
:style="{ display: 'inline-block', transform: 'rotate(' + value.wind_direction + 'deg)' }">↓</span>
{{ value.wind_speed }} ({{ value.wind_gusts }}) </td>
</tr>
</table>
</div>
<div id="svgWrapper" class="hidden">
</div>
</div>
</html>