We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a3a0b2b commit 0b2e486Copy full SHA for 0b2e486
web/js/blog.js
@@ -2,6 +2,7 @@
2
"use strict";
3
4
var offlineIcon;
5
+ var isOnline = ("onLine" in navigator) && navigator.onLine;
6
var isLoggedIn = /isLoggedIn=1/.test(document.cookie.toString() || "");
7
8
document.addEventListener("DOMContentLoaded",ready,false);
@@ -11,6 +12,19 @@
11
12
13
function ready() {
14
offlineIcon = document.getElementById("connectivity-status");
15
+
16
+ if (!isOnline) {
17
+ offlineIcon.classList.remove("hidden");
18
+ }
19
20
+ window.addEventListener("online",function online(){
21
+ offlineIcon.classList.add("hidden");
22
+ isOnline = true;
23
+ },false);
24
+ window.addEventListener("offline",function offline(){
25
26
+ isOnline = false;
27
28
}
29
30
})();
0 commit comments