-
Notifications
You must be signed in to change notification settings - Fork 0
/
Settings.html
217 lines (206 loc) · 7.76 KB
/
Settings.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<!DOCTYPE html>
<!--[if lt IE 7]>
<html class="no-js lt-ie9 lt-ie8 lt-ie7">
<![endif]-->
<!--[if IE 7]>
<html class="no-js lt-ie9 lt-ie8">
<![endif]-->
<!--[if IE 8]>
<html class="no-js lt-ie9">
<![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
</head>
<body>
<div class="about">
<h1>Settings</h1>
</div>
<section class="toggles">
<div class="toggle-component">
<p>Show app notifications</p>
<label class="toggle">
<input type="checkbox" onclick="toggle(this,event)"/>
<div data-off="Off" data-on="On">app-notifition</div>
</label>
</div>
<div class="toggle-component">
<p>Show notifications on the lock screen</p>
<label class="toggle">
<input type="checkbox" onclick="toggle(this,event)"/>
<div data-off="Off" data-on="On">lock-screen</div>
</label>
</div>
</section>
<div class="toggles-info"></div>
<style type="text/css" media="screen">
*, *:before, *:after {
box-sizing: border-box;
}
html {
height: 100%;
font-size: 16px;
}
html, body {
min-height: 100%;
}
body {
font-family: 'Open Sans', sans-serif;
color: white;
margin-top: 4rem;
display: flex;
justify-content: flex-start;
align-items: center;
flex-direction: column;
background-color: #0c0000;
}
.about {
color: white;;
}
.toggles-info {
border-top: 1px solid darkgray;
transition: 0.2s;
text-align: center;
margin-top: 1rem;
padding: 2rem;
max-width: 30em;
}
.toggles-info > div {
overflow: hidden;
}
.toggles-info > div span {
position: relative;
display: inline-block;
min-width: 2.5rem;
}
.toggles-info > div span[on] {
color: #0078d7;
float: left;
}
.toggles-info > div span[off] {
color: black;
float: left;
}
.toggles-info > div span[click] {
color: gray;
margin-left: 0.5rem;
float: left;
}
.disappear-from-screen, .toggle input {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.toggle-component {
margin-bottom: 3rem;
}
.toggle-component p {
margin: 0.7rem 0;
}
.toggle {
display: table;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
margin-bottom: 1rem;
}
.toggle input:focus + div {
text-decoration: none;
}
.toggle > div {
cursor: pointer;
border-radius: 2rem;
width: 5rem;
height: 2rem;
background: white;
border: 2px solid black;
user-select: none;
position: relative;
transition: 200ms ease-out;
font-size: 0;
}
.toggle > div:hover {
box-shadow: 0 0 6px #005ca4;
}
.toggle > div:before {
will-change: translate;
display: block;
position: absolute;
top: calc(50% - .5rem);
left: 0.5rem;
content: '';
width: 1rem;
height: 1rem;
background: black;
border-radius: 50%;
transition: 200ms;
}
.toggle > div:after {
font-size: 1rem;
position: absolute;
right: -50%;
top: 50%;
transform: translateY(-50%);
content: attr(data-off);
pointer-events: none;
}
.toggle input:checked + div {
background: #FFCC00;
border-color: #FFCC00;
}
.toggle input:checked + div:before {
color: #0078d7;
transform: translateX(280%);
transform: translateX(calc(2.5*100% + 4px));
background: white;
}
.toggle input:checked + div:after {
content: attr(data-on);
}
input:focus + div:after {
text-decoration: underline;
}
</style>
<script src="" async defer>
window.log = console.log.bind(console);
function $(expr, context) {
return (context || document).querySelector(expr);
}
function $$(expr, context) {
return [].slice.call((context || document).querySelectorAll(expr), 0);
}
function prepend(element, into) {
if (element && into)
into.insertBefore(element, into.firstChild);
}
let info = $('.toggles-info'),
inputs = $$('.toggle input');
function showInfo(styledElement) {
let div = document.createElement('div'),
str = '';
inputs.forEach(input => {
str += input.checked ? '<span on> on </span> ' : '<span off> off </span>';
});
if (styledElement) {
str += `<span click>click: ${styledElement.innerHTML}</span>`;
}
div.innerHTML = str;
prepend(div, info);
}
function toggle(element, event) {
showInfo(element.nextElementSibling);
}
showInfo();
</script>
</body>
</html>