-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
268 lines (219 loc) · 10.5 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
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="description" content="WebBleed | playground for all cutting edge WebAPIs">
<!--Social meta-->
<meta property="og:title" content="WebBleed" />
<meta property="og:url" content="" />
<meta property="og:description" content="WebBleed | playground for all cutting edge WebAPIs" />
<meta property="og:image" content="/assets/icons/icon.png" />
<meta property="og:type" content="website" />
<!---->
<link rel="apple-touch-icon" sizes="180x180" href="assets/icons/icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="assets/icons/icon.png">
<link rel="icon" type="image/png" href="assets/icons/icon.png" />
<meta name="theme-color" content="#640700">
<link rel="manifest" href="manifest.json">
<!---->
<!---->
<link rel="stylesheet" href="css/main.css">
<title>Web Bleed</title>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script>
var clicky_site_ids = clicky_site_ids || [];
clicky_site_ids.push(101299198);
</script>
<script async src="//static.getclicky.com/js"></script>
</head>
<body>
<header>
</header>
<div class="mainContainer">
<div id="navPannel">
<input type="checkbox" id="navTog">
<label for="navTog">
<span id="showLabel">
<img src="assets/icons/arrow.png" alt="">
</span>
</label>
<div class="navContent">
<div class="header">
<img src="assets/icons/icon.png" alt="">
<h1>Web Bleed</h1>
<div id="version"></div>
<div class="controllers">
<div class="downloadPrompt">
<div class="promptControllers">
<button class="downloadButton">Install Now </button>
</div>
</div>
</div>
</div>
<ul id="navLinkUl">
<li><button data-page="home" data-url="components/home/index.html" class="navLinkBtn">🏠 Home</button></li>
<li>
<button data-page="contact" data-inpage="true" data-id="contectPicker" class="navLinkBtn">📘 Contact Picker
</button>
</li>
<li>
<button data-page="push-notification" data-url="components/notification/index.html" class="navLinkBtn">🔔 Push
Notification</button>
</li>
<li>
<button data-page="vibration" data-url="components/vibrate/index.html" class="navLinkBtn">📳 Vibration API</button>
</li>
<li>
<button data-page="battery" data-url="components/battery/index.html" class="navLinkBtn">🔋 Battery API</button>
</li>
<li>
<button data-page="platform" data-url="components/platform/index.html" class="navLinkBtn">💻 Platform API</button>
</li>
<li>
<button data-page="network" data-url="components/connectivity/index.html" class="navLinkBtn">📡 Network Info API</button>
</li>
<li>
<button data-page="share" data-url="components/share/index.html" class="navLinkBtn"> <img style="width: 30px;" src="assets/icons/share.png" alt=""> Share API</button>
</li>
<li>
<button data-page="screen-capture" data-url="components/screencapture/index.html" class="navLinkBtn"> <img style="width: 30px;" src="assets/icons/screenshare.png" alt=""> Screen Capture</button>
</li>
<li>
<button data-page="screen-capture" data-url="components/url/index.html" class="navLinkBtn"> 🌐 URL api</button>
</li>
</ul>
</div>
</div>
<div id="playground">
<div class="spinner">
<div class="lds-facebook">
<div></div>
<div></div>
<div></div>
</div>
</div>
<div id="installNowPrompt">
<button onclick="this.parentElement.style.display='none'"> x </button>
<div id="installNowPromptContent">
<img src="assets/icons/icon.png" alt="">
<span>
Install our PWA to stay ahead of the curve
</span>
<button class="downloadButton">Install Now </button>
</div>
</div>
<iframe class="component" id="playgroundIframe" src="" frameborder="0"></iframe>
<div class="component" id="contectPicker">
<style>
#contectPicker {
display: none;
}
div#contactPickerDemo {
background: #E91E63;
padding: 10px;
display: grid;
grid-template-rows: 40px 40px;
grid-gap: 5px;
border-radius: 3px;
overflow: hidden;
}
#contactPickerDemo>input {
padding: 10px;
margin: 0 10px;
border-radius: 3px;
border: 1px solid #b95778;
}
#contactPickerDemo>button {
background: #FFF;
border: 1px solid #8d0d0d;
box-shadow: 4px 3px 5px 0px #a30037;
border-radius: 4px;
}
</style>
<div class="componentContent">
<h2>📘 Contact Picker API</h2>
<p>
This API helps you select user contacts form phone contact book. This is improve the UX in many applications dealing with Phone numbers, like TopUp Recharge Web Sites, various registrations forms etc.
</p>
<div id="contactPickerDemo">
<input type="text" id="contactDisplay" placeholder="Phone No">
<button onclick="selectContact()"> 📘 Select Contact </button>
</div>
<pre id="contactPickerRaw">
</pre>
<p>
This API only works after user has given permission and requested form top Frame (not form iFrame)
</p>
<p>
Links
<ul>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/API/Contact_Picker_API">MDN link</a>
</li>
</ul>
</p>
<script>
async function selectContact() {
const supported = ('contacts' in navigator && 'ContactsManager' in window);
if (!supported) {
alert('Contact Picker not supported');
} else {
//alert((await navigator.contacts.getProperties()))
const props = await navigator.contacts.getProperties() // ['name', 'email', 'tel', 'address', 'icon'];
const opts = {
multiple: true
};
try {
const contacts = await navigator.contacts.select(props, opts);
document.querySelector('#contactPickerRaw').innerHTML = `Raw data \n` + (JSON.stringify(contacts, null, ' '));
document.querySelector('#contactDisplay').value = contacts[0].tel[0];
} catch (ex) {
alert(ex);
document.querySelector('#contactDisplay').value = '';
// Handle any errors here.
}
}
}
</script>
</div>
</div>
</div>
</div>
<footer>
</footer>
<script type="text/javascript">
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register(`service-worker.js`)
.then(function(reg) {
console.log("Service Worker Registered", reg);
let serviceWorker = reg.installing || reg.waiting || reg.active;
if (serviceWorker) {
console.log("sw current state", serviceWorker.state);
if (serviceWorker.state == "activated") {
serviceWorkerActivatedEmitter();
}
serviceWorker.addEventListener("statechange", function(e) {
console.log("sw statechange : ", e.target.state);
if (e.target.state == "activated") {
// use pushManger for subscribing here.
console.log("Just now activated. now we can subscribe for push notification");
serviceWorkerActivatedEmitter();
}
});
}
});
function serviceWorkerActivatedEmitter() {
const channel = new BroadcastChannel('sw-events');
channel.postMessage('activated')
console.log('serviceWorkerActivatedEmitter')
}
}
</script>
<script defer src="js/settings.js"></script>
<script defer src="js/install-handler.js"></script>
<script defer src="js/main.js"></script>
</body>
</html>