-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
402 lines (360 loc) · 23.8 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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
<meta name="apple-mobile-web-app-status-bar-style" content="white" />
<meta name="GOOGLEBOT" content="index follow" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- =========================================
start of seo
========================================== -->
<meta name="author" content="John Itebu">
<meta name="robots" content="index,follow">
<meta name="distribution" content="global">
<meta name="designer" content="John Itebu">
<meta name="publisher" content="John Itebu">
<meta name="copyright" content="John Itebu">
<meta name="owner" content="John Itebu">
<meta name='language' content='en_GB'>
<meta name="Classification" content="Tool, Software">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="imagetoolbar" content="no">
<meta http-equiv="x-dns-prefetch-control" content="off">
<meta name="coverage" content="Worldwide">
<meta name="rating" content="General">
<meta name="revisit-after" content="7 days">
<meta name="target" content="all">
<!--Apple meta tags-->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="mask-icon" href="http://ojanti.com/assets/img/icon_/icons/favicon_152x152.png" color="white">
<!--Apple meta tags-->
<!--Google Plus-->
<link rel="author" href="https://plus.google.com/u/0/113492363467510904943"/>
<link rel="publisher" href="https://plus.google.com/u/0/113492363467510904943"/>
<!--Ms meta tags-->
<meta http-equiv="Page-Enter" content="RevealTrans(Duration=2.0,Transition=2)">
<meta http-equiv="Page-Exit" content="RevealTrans(Duration=3.0,Transition=12)">
<meta name="mssmarttagspreventparsing" content="true">
<meta name="msapplication-window" content="width=800;height=600">
<meta name="msapplication-navbutton-color" content="red">
<meta name="msapplication-TileImage" content="" />
<meta name="msvalidate.01" content="" />
<link rel="me" type="text/html" href="https://www.linkedin.com/in/itebujohn">
<meta name="keywords" content="Javascript, VanillaJS, UX, User Experience, Internet Detection , vanilla-javascript">
<meta property="og:locale" content="en_GB" />
<meta property="og:site_name" content="lightweight Internet Detect Feature with VanillaJS " />
<meta property="article:publisher" content="https://www.facebook.com/j.ojanti" />
<meta property="article:author" content="https://www.facebook.com/j.ojanti" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@ojanti" />
<meta name="twitter:creator" content="@ojanti" />
<!--Facebook / Object Graph-->
<meta property="og:title" content="Lightweight Internet Detect Feature with VanillaJS."/>
<meta property="og:type" content="website"/>
<meta property="og:image" content="http://ojanti.com/assets/img/uploads/Internet_Detect_Feature_with_VanilaJS1.jpg"/>
<meta property="og:url" content="https://ojanti.github.io/Internet-Detect-Feature-with-Javascript/"/>
<meta property="og:description" content="Build a lightweight Internet Detect Feature with VanillaJS"/>
<!--Twitter-->
<meta name="twitter:url" content="https://ojanti.github.io/Internet-Detect-Feature-with-Javascript/">
<meta name="twitter:title" content="Lightweight Internet Detect Feature with VanillaJS.">
<meta name="twitter:description" content="Build a lightweight Internet Detect Feature with VanillaJS">
<meta name="twitter:image" content="http://ojanti.com/assets/img/uploads/Internet_Detect_Feature_with_VanilaJS1.jpg">
<meta name="twitter:image:src" content="http://ojanti.com/assets/img/uploads/Internet_Detect_Feature_with_VanilaJS1.jpg" />
<title> Lightweight Internet Detect Feature with VanillaJS. </title>
<meta name="subject" content=" Lightweight Internet Detect Feature with VanillaJS.">
<meta name="description" content="Build a lightweight Internet Detect Feature with VanillaJS">
<meta name="url" content="https://ojanti.github.io/Internet-Detect-Feature-with-Javascript/">
<link rel="canonical" href="https://ojanti.github.io/Internet-Detect-Feature-with-Javascript/">
<meta name="pagename" content="Lightweight Internet Detect Feature with VanillaJS. ">
<link rel="bookmark" title="Lightweight Internet Detect Feature with VanillaJS." href="https://ojanti.github.io/Internet-Detect-Feature-with-Javascript/">
<!-- =========================================
end of seo
========================================== -->
<link href="https://s3.eu-west-2.amazonaws.com/ojanticdnbucket/_shadesSCSS/cdn/boilerplate.min.css" rel="stylesheet">
<style>
.rawNotificationArea {
position: fixed;
top: 2px;
left: 0;
width: 100%;
text-align: center;
padding: 10px 0;
display: none;
z-index: 99999999;
}
.rawNotificationArea .notification_message {
max-width: 50%;
border: solid thin #888888;
color: #333;
background-color: #DCDCDC;
text-align: center;
padding: 5px 15px;
border-radius: 4px;
box-shadow: 2px 3px 20px rgba(0, 0, 0, 0.17);
display: inline-block;
text-align: center;
font-size: 14px;
letter-spacing: 1px;
}
.rawNotificationArea .notification_message.warning {
background-color: #fcf8e3;
border-color: #faf2cc;
color: #8a6d3b;
}
.rawNotificationArea .notification_message.success {
background-color: #dff0d8;
border-color: #d0e9c6;
color: #3c763d;
}
.rawNotificationArea .notification_message.info {
background-color: #d9edf7;
border-color: #bcdff1;
color: #31708f;
}
.rawNotificationArea .notification_message.danger, .rawNotificationArea .notification_message.error {
background-color: #f2dede;
border-color: #ebcccc;
color: #a94442;
}
</style>
<script type="text/javascript">
// Notification
var nativeNotification = {
// fadeEl: document.getElementById('content_body'),
fadeEl: function () {
return (document.getElementById('content_body'));
},
// messageHolder: document.getElementById('rawNotificationArea'),
messageHolder: function () {
return (document.getElementById('rawNotificationArea'));
},
contentFade: function() {
this.fadeEl().style.opacity = "0.5";
},
contentUnfade: function() {
this.fadeEl().style.opacity = "1.0";
},
notify: function(message, tone) {
this.messageHolder().innerHTML = '<span class="notification_message ' + tone + '">' + message + '</span>';
this.messageHolder().style.display = "block";
},
unotify: function() {
while (this.messageHolder().firstChild) {
this.messageHolder().removeChild(this.messageHolder().firstChild);
}
},
timedUnotify: function(time) {
setTimeout(function() {
nativeNotification.unotify();
}, time);
}
};
//Detect internet status amd motify user
var wasInternetConnectionBad = '';
var internetCheckActions = function() {
var xhr = new XMLHttpRequest();
var file = "https://s3.eu-west-2.amazonaws.com/ojanticdnbucket/staticassets/rch8muQ.jpg";
var randomNum = Math.round(Math.random() * 10000);
xhr.open('HEAD', file + "?rand=" + randomNum, true);
xhr.withCredentials = false;
xhr.send();
xhr.addEventListener("readystatechange", processRequest, false);
function processRequest(e) {
if (xhr.readyState == 4) {
if (xhr.status >= 200 && xhr.status < 304) {
if (wasInternetConnectionBad == "1") {
nativeNotification.contentUnfade();
nativeNotification.notify("Your internet connection has been restored", 'info');
nativeNotification.timedUnotify(5000);
}
wasInternetConnectionBad = '';
} else {
nativeNotification.contentFade();
nativeNotification.notify("We've detected a problem with your internet connection.\n Some functions may not work as expected<div><strong>Retrying <img src='https://cdnjs.cloudflare.com/ajax/libs/slippry/1.4.0/images/sy-loader.gif' width='20' height='20'></strong></div>", 'warning');
wasInternetConnectionBad = '1';
}
}
}
}
// Invoke when DOM content has loaded
document.addEventListener('DOMContentLoaded', function () {
internetCheckActions();
});
//& every subsequent 5 seconds
var checkInternetConnection = function() {
setInterval(function () {
internetCheckActions();
}, 5000);
}
checkInternetConnection();
</script>
<!-- Share buttons-->
<script type="text/javascript" src="//platform-api.sharethis.com/js/sharethis.js#property=5a1b0d9a63750b0012e6ba18&product=sticky-share-buttons"></script>
</head>
<body style="background:#f6f6f6;">
<!--[if lte IE 9]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>
<![endif]-->
<!-- start - motification markup -->
<img src="https://cdnjs.cloudflare.com/ajax/libs/slippry/1.4.0/images/sy-loader.gif" width="1" height="1"
style="position:absolute; z-index:-2;">
<!-- Attepmting to preload an animated loader image which will be used later. NOTE, different browser behave differently -->
<div class="rawNotificationArea" id="rawNotificationArea">
<div class="notification_message"></div>
</div>
<!-- end - motification markup -->
<!-- start - content wrapper -->
<div id="content_body">
<header id="header" >
<div class="row">
<div class="container">
<div class="row">
<div class="col s12 m12 l12 padding-top-50 padding-bottom-30 padding-right-20 padding-left-20">
<div class="margin-top-10 margin-bottom-10 text-center">
<h1>Javascript Internet Detect Feature Demo </h1>
<h4 class="text-primary margin-top-5 margin-bottom-5">Turn off your internet to see how it works</h4>
<div>
<small> Show some <span style="color:#FF3E3E;">❤</span> </small>
</div>
<div class="margin-bottom-20 margin-top-10">
<a class="github-button" href="https://github.com/small" aria-label="Follow @ojanti on GitHub" data-size="large">Follow @ojanti</a>
<a class="github-button" href="https://github.com/Ojanti/Internet-Detect-Feature-with-Javascript" data-icon="octicon-star" data-size="large" aria-label="Star ojanti/Internet-Detect-Feature-with-Javascript
on GitHub">Star This Repo</a>
<a href="https://twitter.com/ojanti?ref_src=twsrc%5Etfw" class="twitter-follow-button" data-size="large" data-show-count="false">Follow @ojanti</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
<a href="http://ojanti.com/projects/Build-a-lightweight-Internet-Detect-Feature-with-VanilaJS" class="button large" target="_blank"> Visit Tutorial Page </a>
</div>
</div>
</div>
</div>
</div>
</header><!-- /header -->
<section>
<div class="row">
<div class="container">
<!-- start - dummy content -->
<div class="row text-justify">
<div class="col s12 m6 l6">
<h3>One morning, when Gregor Samsa woke from troubleddreams.</h3>
<p>One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover <strong>strong</strong> it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, <a class="external ext" href="#">link</a> waved about helplessly as he looked. "What's happened to me? " he thought. It wasn't a dream. His room, a proper human room although a little too small, lay peacefully between its four familiar walls.</p>
<h4>One morning, when Gregor Samsa woke from troubled dreams. </h4>
<h3>The bedding was hardly able to cover it.</h3>
<p>It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. </p>
<h3>The bedding was hardly able to cover it.</h3>
<p>It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. </p>
<ul>
<li>Lorem ipsum dolor sit amet consectetuer.</li>
<li>Aenean commodo ligula eget dolor.</li>
<li>Aenean massa cum sociis natoque penatibus.</li>
</ul>
<p>It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. </p>
<form action="#" method="post">
<fieldset> <label for="name">Name:</label> <input type="text" id="name" placeholder="Enter your full name" /> <label for="email">Email:</label> <input type="email" id="email" placeholder="Enter your email address" /> <label for="message">Message:</label> <textarea id="message" placeholder="What's on your mind?"></textarea> <input type="submit" value="Send message" /> </fieldset>
</form>
<p>It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. </p>
<table class="data">
<tr>
<th>Entry Header 1</th>
<th>Entry Header 2</th>
<th>Entry Header 3</th>
<th>Entry Header 4</th>
</tr>
<tr>
<td>Entry First Line 1</td>
<td>Entry First Line 2</td>
<td>Entry First Line 3</td>
<td>Entry First Line 4</td>
</tr>
<tr>
<td>Entry Line 1</td>
<td>Entry Line 2</td>
<td>Entry Line 3</td>
<td>Entry Line 4</td>
</tr>
<tr>
<td>Entry Last Line 1</td>
<td>Entry Last Line 2</td>
<td>Entry Last Line 3</td>
<td>Entry Last Line 4</td>
</tr>
</table>
<p>It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. </p>
</div>
<div class="col s12 m6 l6">
<h3>Lorem ipsum dolor sit amet consectetuer adipiscing elit</h3>
<p>Lorem ipsum dolor sit amet, <a href="#" title="test link">test link</a> adipiscing elit. Nullam dignissim convallis est. Quisque aliquam. Donec faucibus. Nunc iaculis suscipit dui. Nam sit amet sem. Aliquam libero nisi, imperdiet at, tincidunt nec, gravida vehicula, nisl. Praesent mattis, massa quis luctus fermentum, turpis mi volutpat justo, eu volutpat enim diam eget metus. Maecenas ornare tortor. Donec sed tellus eget sapien fringilla nonummy. Mauris a ante. Suspendisse quam sem, consequat at, commodo vitae, feugiat in, nunc. Morbi imperdiet augue quis tellus.</p>
<p>Lorem ipsum dolor sit amet, <em>emphasis</em> consectetuer adipiscing elit. Nullam dignissim convallis est. Quisque aliquam. Donec faucibus. Nunc iaculis suscipit dui. Nam sit amet sem. Aliquam libero nisi, imperdiet at, tincidunt nec, gravida vehicula, nisl. Praesent mattis, massa quis luctus fermentum, turpis mi volutpat justo, eu volutpat enim diam eget metus. Maecenas ornare tortor. Donec sed tellus eget sapien fringilla nonummy. Mauris a ante. Suspendisse quam sem, consequat at, commodo vitae, feugiat in, nunc. Morbi imperdiet augue quis tellus.</p>
<hr/>
<h4 id="form_elements">Fieldsets, Legends, and Form Elements</h4>
<fieldset>
<legend>Legend</legend>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam dignissim convallis est. Quisque aliquam. Donec faucibus. Nunc iaculis suscipit dui. Nam sit amet sem. Aliquam libero nisi, imperdiet at, tincidunt nec, gravida vehicula, nisl. Praesent mattis, massa quis luctus fermentum, turpis mi volutpat justo, eu volutpat enim diam eget metus.</p>
<form method="post" action="#">
<h4>Form Element</h4>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam dignissim convallis est. Quisque aliquam. Donec faucibus. Nunc iaculis suscipit dui.</p>
<p><label for="text_field">Text Field:</label><br/> <input type="text" id="text_field" name="text_field" /></p>
<p> <button>Submit</button> <button type="reset">Clear</button> </p>
</form>
</fieldset>
<hr/>
<h3 id="tables">Tables</h3>
<table>
<caption>Table Caption Goes Here</caption>
<thead>
<tr>
<th>Table Header 1</th>
<th>Table Header 2</th>
<th>Table Header 3</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Footer 1</th>
<th>Footer 2</th>
<th>Footer 3</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>Division 1</td>
<td>Division 2</td>
<td>Division 3</td>
</tr>
<tr class="even">
<td>Division 1</td>
<td>Division 2</td>
<td>Division 3</td>
</tr>
<tr>
<td>Division 1</td>
<td>Division 2</td>
<td>Division 3</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- end - dummy content -->
</div>
</div>
</section>
<footer class="margin-top-10 padding-10 text-center">
<hr>
<p class="no-margin">
Built with <a href="https://github.com/Ojanti/_ShadesSCSS" class="" target="_blank"> ShadesSCSS </a>
by
<a href="http://ojanti.com/aboutme" target="_blank" title="ShadesSCSS & Internet Detect Features Created by John Itebu"> John Itebu </a>
</p>
</footer>
</div>
<!-- emd - content wrapper -->
<script async defer src="https://buttons.github.io/buttons.js"></script>
</body>
</html>