-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
107 lines (99 loc) · 3.97 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
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
<html>
<head>
</head>
<body>
<script>
function setTheme() {
console.log(localStorage.getItem('themeused'));
if (localStorage.getItem('themeused')) {
if (localStorage.getItem('themeused') == "light") {
switchToLight();
} else if (localStorage.getItem('themeused') == "dark") {
//console.log("In Dark")
switchToDark();
}
} else {
switchToLight();
}
}
function switchToDark() {
document.body.style.background = "#2F3437"
document.getElementById("light").style.display = "none";
document.getElementById("dark").style.display = "block";
localStorage.setItem('themeused', "dark");
}
function switchToLight() {
document.body.style.background = "#FFFFFF"
document.getElementById("dark").style.display = "none";
document.getElementById("light").style.display = "block";
localStorage.setItem('themeused', "light");
}
!function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = 'https://weatherwidget.io/js/widget.min.js'; fjs.parentNode.insertBefore(js, fjs); } }(document, 'script', 'weatherwidget-io-js');
document.addEventListener('readystatechange', function () {
if (document.readyState === "complete") {
setTheme();
}
});
</script>
<style>
.buttondivouter {
position: relative;
width: 300px;
height: 35px;
margin: 0 auto;
float: right;
opacity: 1;
transition: 3s;
}
.darkbuttonoverlap {
position: absolute;
z-index: 2;
height: 30px;
width: 80px;
top: 4px;
left: 180px;
opacity: 0;
transition: 3s;
}
.lightbuttonoverlap {
position: absolute;
z-index: 2;
height: 30px;
width: 80px;
top: 4px;
left: 80px;
opacity: 0;
transition: 3s;
}
.buttondivouter:hover .darkbuttonoverlap {
display: block;
opacity: 1;
}
.buttondivouter:hover .lightbuttonoverlap {
display: block;
opacity: 1;
}
</style>
<div id="dark">
<!--Snippet from https://weatherwidget.io/ with a dark mode config-->
<a class="weatherwidget-io" href="https://forecast7.com/en/51d51n0d13/london/" data-label_1="LONDON"
data-label_2="WEATHER" data-font="Open Sans" data-days="5" data-theme="gray" data-basecolor="#32323E"
data-highcolor="#ffffff" data-lowcolor="#ffffff" data-suncolor="#ffffff" data-mooncolor="#e0e0e0"
data-raincolor="#ffffff">LONDON WEATHER</a>
<!--Snippet ends-->
</div>
<div id="light">
<!--Snippet from https://weatherwidget.io/ with a light mode config-->
<a class="weatherwidget-io" href="https://forecast7.com/en/51d51n0d13/london/" data-label_1="LONDON"
data-label_2="WEATHER" data-font="Open Sans" data-days="5" data-theme="gray" data-basecolor="#FFFFFF"
data-accent="#f2f2f2" data-textcolor="rgba(0, 0, 0, 0.9)" data-highcolor="rgba(0, 0, 0, 0.9)"
data-lowcolor="rgba(0, 0, 0, 0.9)" data-suncolor="#686868" data-mooncolor="#686868"
data-cloudcolor="#686868" data-cloudfill="#686868" data-raincolor="#686868"
data-snowcolor="#686868">LONDON WEATHER</a>
<!--Snippet ends-->
</div>
<div class="buttondivouter">
<button class="darkbuttonoverlap" style="float: right;" onclick="switchToDark()">Dark</button>
<button class="lightbuttonoverlap" style="float: right;" onclick="switchToLight()">Light</button>
</div>
</html>