diff --git a/examples/embed.html b/examples/embed.html
index de46bc00..c21f46c6 100644
--- a/examples/embed.html
+++ b/examples/embed.html
@@ -13,6 +13,7 @@
+
diff --git a/images/icons/icon-144.png b/images/icons/icon-144.png
new file mode 100644
index 00000000..6ab78a45
Binary files /dev/null and b/images/icons/icon-144.png differ
diff --git a/index.html b/index.html
index 6b458db5..83b01401 100644
--- a/index.html
+++ b/index.html
@@ -6,11 +6,21 @@
+
+
+
+
+
+
+
+
Community toolbox
-
+
+
+
@@ -33,7 +43,7 @@
-
+
Fork me on GitHub
diff --git a/manifest.json b/manifest.json
new file mode 100644
index 00000000..eb76c622
--- /dev/null
+++ b/manifest.json
@@ -0,0 +1,20 @@
+{
+ "name": "Community Toolbox",
+ "short_name": "Community Toolbox",
+ "start_url": "/index.html",
+ "scope": ".",
+ "display": "standalone",
+ "background_color": "#fff",
+ "theme_color": "#3F51B5",
+ "description": "A platform for community growth.",
+ "dir": "ltr",
+ "lang": "en-US",
+ "orientation": "portrait-primary",
+ "icons": [
+ {
+ "src": "./images/icons/icon-144.png",
+ "type": "image/png",
+ "sizes": "144x144"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/offline.html b/offline.html
new file mode 100644
index 00000000..84207f7b
--- /dev/null
+++ b/offline.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ Community Toolbox
+
+
+ Sorry, You're offline!!!
+
+
\ No newline at end of file
diff --git a/src/scripts/pwainit.js b/src/scripts/pwainit.js
new file mode 100644
index 00000000..8d654075
--- /dev/null
+++ b/src/scripts/pwainit.js
@@ -0,0 +1,9 @@
+var deferredPrompt;
+
+if('serviceWorker' in navigator) {
+ navigator.serviceWorker
+ .register('../../sw.js')
+ .then(() => {
+ console.log("Service Worker registered!");
+ })
+}
diff --git a/sw.js b/sw.js
new file mode 100644
index 00000000..2e3d6043
--- /dev/null
+++ b/sw.js
@@ -0,0 +1,51 @@
+var STATIC_CACHE = "static-v1";
+var DYNAMIC_CACHE = "dynamic-v1";
+
+self.addEventListener('install', (e) => {
+ console.log("[Service Worker] installing...");
+});
+
+self.addEventListener('activate', (e) => {
+ console.log("[Service Worker] activating...",e);
+ e.waitUntil(
+ caches.keys()
+ .then((keyList) => {
+ return Promise.all(keyList.map((key) => {
+ if(key !== STATIC_CACHE && key !== DYNAMIC_CACHE) {
+ return caches.delete(key);
+ }
+ }))
+ })
+ );
+
+ return self.clients.claim();
+});
+
+
+self.addEventListener('fetch', function (e) {
+ let urlReq = e.request;
+
+ e.respondWith(
+ fetch(urlReq)
+ .then((res) => {
+ var resClone = res.clone();
+ return caches.open(DYNAMIC_CACHE)
+ .then((cache) => {
+ cache.delete(urlReq.url)
+ .then((bool) => {
+ cache.add(urlReq.url, resClone);
+ })
+
+ return res;
+ })
+ })
+ .catch((err) => {
+ return caches.match(urlReq.url)
+ .then((data) => {
+ if(data!=undefined) {
+ return data;
+ }
+ })
+ })
+ );
+});
\ No newline at end of file