-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
54 lines (54 loc) · 2.07 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>index.html</title>
<style>
.layout {
display: flex;
flex-direction: row;
justify-content: space-around;
justify-items: start;
}
.code {
font-family: Verdana, Geneva, Tahoma, sans-serif;
}
</style>
</head>
<body>
<div class="layout">
<div>
<h1>This is a test page of the WeatherWidget</h1>
<p>To work with the WeatherWidget, you need your openweather API service token.
<br>If you don't have it, you need to go to https://home.openweathermap.org,
<br>log in and get it. It's free.</p>
<input type="text" id="token" placeholder="Enter your token" />
<button onclick="saveToken()" >OK</button>
<p>To include a widget in your site's page, before initializing it,
<br>place your token in the localStorage with the following command:</p>
<p class="code">localSorage.setItem('WeatherWidgetToken', --Your token--)</p>
<p><strong>Note:</strong> If you don't want to perform additional actions,
<br>but just want to test the widget, click the button below:)</p>
<button onclick="saveDefaultToken()" >Use the built-in token</button>
<p style="color: brown;"><strong>Important!</strong> If you do not use a token,
your own or built-in,<br>the widget will not work.</p>
</div>
<weather-widget />
</div>
<script type="text/javascript"
src="./package/dist/index.iife.js"></script>
<script type="text/javascript">
const saveToken = () => {
const token = document.querySelector('#token').value
localStorage.setItem('WeatherWidgetToken', token)
location.reload()
}
const saveDefaultToken = () => {
localStorage.setItem('WeatherWidgetToken', '00a67aa8ad135d5bfe82da0483bc2d3e')
location.reload()
}
</script>
</body>
</html>