aboutsummaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorJieiku2023-08-25 01:44:50 -0700
committerJieiku2023-08-25 01:44:50 -0700
commit009d3f90b1881530bd28003abe83cfc3735882be (patch)
tree5112554449edf2aaff956b9c364133ec41ff39c5 /static
parentc04ff0a3ac2aff149c3454f7563de3f7941e373d (diff)
downloadabridge-009d3f90b1881530bd28003abe83cfc3735882be.tar.gz
abridge-009d3f90b1881530bd28003abe83cfc3735882be.tar.bz2
abridge-009d3f90b1881530bd28003abe83cfc3735882be.zip
Refactor Documentation, PWA Fix, image shortcodes fix, simplify js script loading
Diffstat (limited to 'static')
-rw-r--r--static/android-chrome-192x192.pngbin1609 -> 1592 bytes
-rw-r--r--static/android-chrome-512x512.pngbin3937 -> 3885 bytes
-rw-r--r--static/apple-touch-icon.pngbin1542 -> 1537 bytes
-rw-r--r--static/banner.pngbin4582 -> 4536 bytes
-rw-r--r--static/favicon-32x32.pngbin397 -> 395 bytes
-rw-r--r--static/js/abridge_nosearch.min.js (renamed from static/js/abridge-nosearch.min.js)0
-rw-r--r--static/js/sw_load.js6
-rw-r--r--static/js/sw_load.min.js2
-rw-r--r--static/js/theme_button.js4
-rw-r--r--static/maskable-x128.pngbin816 -> 811 bytes
-rw-r--r--static/maskable-x192.pngbin1086 -> 1085 bytes
-rw-r--r--static/maskable-x384.pngbin1765 -> 1752 bytes
-rw-r--r--static/maskable-x48.pngbin397 -> 394 bytes
-rw-r--r--static/maskable-x512.pngbin2618 -> 2564 bytes
-rw-r--r--static/maskable-x72.pngbin566 -> 519 bytes
-rw-r--r--static/maskable-x96.pngbin671 -> 615 bytes
-rw-r--r--static/maskable_x1024.pngbin5454 -> 5144 bytes
-rw-r--r--static/mstile-150x150.pngbin1202 -> 1200 bytes
-rw-r--r--static/sw.js4
-rw-r--r--static/sw.min.js2
20 files changed, 9 insertions, 9 deletions
diff --git a/static/android-chrome-192x192.png b/static/android-chrome-192x192.png
index 3a075c3..33bf405 100644
--- a/static/android-chrome-192x192.png
+++ b/static/android-chrome-192x192.png
Binary files differ
diff --git a/static/android-chrome-512x512.png b/static/android-chrome-512x512.png
index b671d86..665a714 100644
--- a/static/android-chrome-512x512.png
+++ b/static/android-chrome-512x512.png
Binary files differ
diff --git a/static/apple-touch-icon.png b/static/apple-touch-icon.png
index 2923e41..48a8788 100644
--- a/static/apple-touch-icon.png
+++ b/static/apple-touch-icon.png
Binary files differ
diff --git a/static/banner.png b/static/banner.png
index a4a46d5..b80b8e9 100644
--- a/static/banner.png
+++ b/static/banner.png
Binary files differ
diff --git a/static/favicon-32x32.png b/static/favicon-32x32.png
index df65fe1..5d795a8 100644
--- a/static/favicon-32x32.png
+++ b/static/favicon-32x32.png
Binary files differ
diff --git a/static/js/abridge-nosearch.min.js b/static/js/abridge_nosearch.min.js
index 7ae9810..7ae9810 100644
--- a/static/js/abridge-nosearch.min.js
+++ b/static/js/abridge_nosearch.min.js
diff --git a/static/js/sw_load.js b/static/js/sw_load.js
index 9c10723..8c72944 100644
--- a/static/js/sw_load.js
+++ b/static/js/sw_load.js
@@ -1,13 +1,13 @@
if ("serviceWorker" in navigator) {
navigator.serviceWorker
- .register("/sw.min.js?v=3.7.8", { scope: "/" })
+ .register("/sw.min.js?v=3.8.0", { scope: "/" })
.then(() => {
- console.info("SW Loaded");
+ //console.info("SW Loaded");
}, err => console.error("SW error: ", err));
navigator.serviceWorker
.ready
.then(() => {
- console.info("SW Ready");
+ //console.info("SW Ready");
});
}
diff --git a/static/js/sw_load.min.js b/static/js/sw_load.min.js
index 2bc0802..e991797 100644
--- a/static/js/sw_load.min.js
+++ b/static/js/sw_load.min.js
@@ -1 +1 @@
-"serviceWorker"in navigator&&(navigator.serviceWorker.register("/sw.min.js?v=3.7.8",{scope:"/"}).then(()=>{console.info("SW Loaded")},e=>console.error("SW error: ",e)),navigator.serviceWorker.ready.then(()=>{console.info("SW Ready")})); \ No newline at end of file
+"serviceWorker"in navigator&&(navigator.serviceWorker.register("/sw.min.js?v=3.8.0",{scope:"/"}).then(()=>{},r=>console.error("SW error: ",r)),navigator.serviceWorker.ready.then(()=>{})); \ No newline at end of file
diff --git a/static/js/theme_button.js b/static/js/theme_button.js
index b03f17f..b60f85e 100644
--- a/static/js/theme_button.js
+++ b/static/js/theme_button.js
@@ -1,6 +1,6 @@
-// Set lightmode
+// switch theme mode
if (document.getElementById('mode')) {
- document.getElementById('mode').addEventListener('click', () => {
+ document.getElementById('mode').addEventListener('click', () => {
document.documentElement.classList.toggle('switch');
localStorage.setItem('theme', document.documentElement.classList.contains('switch') ? 'switch' : 'default');
});
diff --git a/static/maskable-x128.png b/static/maskable-x128.png
index a9ea7b0..428f863 100644
--- a/static/maskable-x128.png
+++ b/static/maskable-x128.png
Binary files differ
diff --git a/static/maskable-x192.png b/static/maskable-x192.png
index 6b17a50..0983cd8 100644
--- a/static/maskable-x192.png
+++ b/static/maskable-x192.png
Binary files differ
diff --git a/static/maskable-x384.png b/static/maskable-x384.png
index d1fa562..5909ebb 100644
--- a/static/maskable-x384.png
+++ b/static/maskable-x384.png
Binary files differ
diff --git a/static/maskable-x48.png b/static/maskable-x48.png
index b29fc5d..e7136b4 100644
--- a/static/maskable-x48.png
+++ b/static/maskable-x48.png
Binary files differ
diff --git a/static/maskable-x512.png b/static/maskable-x512.png
index dbd35cf..21daff2 100644
--- a/static/maskable-x512.png
+++ b/static/maskable-x512.png
Binary files differ
diff --git a/static/maskable-x72.png b/static/maskable-x72.png
index 1a9c0ca..763db52 100644
--- a/static/maskable-x72.png
+++ b/static/maskable-x72.png
Binary files differ
diff --git a/static/maskable-x96.png b/static/maskable-x96.png
index 22edaa1..7089028 100644
--- a/static/maskable-x96.png
+++ b/static/maskable-x96.png
Binary files differ
diff --git a/static/maskable_x1024.png b/static/maskable_x1024.png
index 35aa01e..f733670 100644
--- a/static/maskable_x1024.png
+++ b/static/maskable_x1024.png
Binary files differ
diff --git a/static/mstile-150x150.png b/static/mstile-150x150.png
index 7a18d2b..8abea88 100644
--- a/static/mstile-150x150.png
+++ b/static/mstile-150x150.png
Binary files differ
diff --git a/static/sw.js b/static/sw.js
index 7d07a13..130188b 100644
--- a/static/sw.js
+++ b/static/sw.js
@@ -7,7 +7,7 @@ class Pwa {
//this.BASE_CACHE_FILES=['/js/theme.min.js','/js/theme_light.min.js','/abridge.css','/js/abridge.min.js','/','/404.html','/offline/','/manifest.json'];
this.BASE_CACHE_FILES = ['/js/theme.min.js','/js/theme_light.min.js','/abridge.css','/js/abridge.min.js','/','/404.html','/offline/','/manifest.json'];
this.host = `${self.location.protocol}//${self.location.host}`;
- console.info(`Host: ${this.host}`);
+ //console.info(`Host: ${this.host}`);
this.OFFLINE_PAGE = '/offline/';
this.NOT_FOUND_PAGE = '/404.html';
this.CACHE_NAME = `content-v${this.CACHE_VERSION}`;
@@ -116,7 +116,7 @@ class Pwa {
this.installServiceWorker(),
this.scope.skipWaiting(),
]));
- console.info('SW Installed');
+ //console.info('SW Installed');
});
this.scope.addEventListener('activate', event => {
diff --git a/static/sw.min.js b/static/sw.min.js
index f8700c9..89738c1 100644
--- a/static/sw.min.js
+++ b/static/sw.min.js
@@ -1 +1 @@
-class Pwa{constructor(t){this.scope=t;var e=new URL(location).searchParams.get("v");this.CACHE_VERSION=e,this.BASE_CACHE_FILES=["/js/theme.min.js","/js/theme_light.min.js","/abridge.css","/js/abridge.min.js","/","/404.html","/offline/","/manifest.json"],this.host=t.location.protocol+"//"+t.location.host,console.info("Host: "+this.host),this.OFFLINE_PAGE="/offline/",this.NOT_FOUND_PAGE="/404.html",this.CACHE_NAME="content-v"+this.CACHE_VERSION,this.NORM_TTL=86400,this.LONG_TTL=604800,this.TTL_NORM=["sw.min.js","sw_load.min.js"],this.TTL_LONG=["js","css"],this.TTL_EXEMPT=["jpg","jpeg","png","gif","webp","avif","ico","svg","otf","eot","ttf","woff","woff2","xml","xsl","txt","mp4","webm","mp3","ogg"]}canCache(t){return!t.startsWith("http://localhost")&&t.toString().startsWith(this.host)}getFileExtension(t){t=t.split(".").reverse()[0].split("?")[0];return t.endsWith("/")?"/":t}getFileName(t){t=t.substring(t.lastIndexOf("/")+1).split("?")[0];return t.endsWith("/")?"/":t}getTTL(t){var e;return"string"==typeof t?(e=this.getFileExtension(t),t=this.getFileName(t),-1<this.TTL_NORM.indexOf(t)?this.NORM_TTL:-1<this.TTL_LONG.indexOf(e)?this.LONG_TTL:-1<this.TTL_EXEMPT.indexOf(e)?null:this.NORM_TTL):null}async installServiceWorker(){try{return await caches.open(this.CACHE_NAME).then(t=>t.addAll(this.BASE_CACHE_FILES),t=>console.error("Error with "+this.CACHE_NAME,t)),this.scope.skipWaiting()}catch(t){return console.error("Error with installation: ",t)}}cleanupLegacyCache(){const i=[this.CACHE_NAME];return new Promise((e,s)=>{caches.keys().then(t=>t.filter(t=>!~i.indexOf(t))).then(t=>{t.length?Promise.all(t.map(t=>caches.delete(t))).then(()=>e()).catch(t=>{console.error("Error in legacy cleanup: ",t),s(t)}):e()}).catch(t=>{console.error("Error in legacy cleanup: ",t),s(t)})})}async preCacheUrl(e){const s=await caches.open(this.CACHE_NAME);return await s.match(e)?null:fetch(e).then(t=>s.put(e,t.clone()))}register(){this.scope.addEventListener("install",t=>{t.waitUntil(Promise.all([this.installServiceWorker(),this.scope.skipWaiting()])),console.info("SW Installed")}),this.scope.addEventListener("activate",e=>{e.waitUntil(Promise.all([this.cleanupLegacyCache(),this.scope.clients.claim(),this.scope.skipWaiting()]).catch(t=>{console.error("Activation error: ",t),e.skipWaiting()}))}),this.scope.addEventListener("fetch",a=>{a.respondWith(caches.open(this.CACHE_NAME).then(async e=>{if(!this.canCache(a.request.url))return fetch(a.request);const s=await e.match(a.request);if(s){var i;let t=null;for(i of s.headers.entries())if("date"===i[0]){t=new Date(i[1]);break}if(!t)return s;var n=parseInt((((new Date).getTime()-t.getTime())/1e3).toString()),r=this.getTTL(a.request.url);if(null===r||r&&n<r)return s}return fetch(a.request.clone()).then(t=>t.status<400?(this.canCache(a.request.url)&&e.put(a.request,t.clone()),t):e.match(this.NOT_FOUND_PAGE)).catch(t=>s||(console.error(`Error fetching ${a.request.url} resulted in offline`,t),e.match(this.OFFLINE_PAGE)))}))})}}const pwa=new Pwa(self);pwa.register(); \ No newline at end of file
+class Pwa{constructor(t){this.scope=t;var e=new URL(location).searchParams.get("v");this.CACHE_VERSION=e,this.BASE_CACHE_FILES=["/js/theme.min.js","/js/theme_light.min.js","/abridge.css","/js/abridge.min.js","/","/404.html","/offline/","/manifest.json"],this.host=t.location.protocol+"//"+t.location.host,this.OFFLINE_PAGE="/offline/",this.NOT_FOUND_PAGE="/404.html",this.CACHE_NAME="content-v"+this.CACHE_VERSION,this.NORM_TTL=86400,this.LONG_TTL=604800,this.TTL_NORM=["sw.min.js","sw_load.min.js"],this.TTL_LONG=["js","css"],this.TTL_EXEMPT=["jpg","jpeg","png","gif","webp","avif","ico","svg","otf","eot","ttf","woff","woff2","xml","xsl","txt","mp4","webm","mp3","ogg"]}canCache(t){return!t.startsWith("http://localhost")&&t.toString().startsWith(this.host)}getFileExtension(t){t=t.split(".").reverse()[0].split("?")[0];return t.endsWith("/")?"/":t}getFileName(t){t=t.substring(t.lastIndexOf("/")+1).split("?")[0];return t.endsWith("/")?"/":t}getTTL(t){var e;return"string"==typeof t?(e=this.getFileExtension(t),t=this.getFileName(t),-1<this.TTL_NORM.indexOf(t)?this.NORM_TTL:-1<this.TTL_LONG.indexOf(e)?this.LONG_TTL:-1<this.TTL_EXEMPT.indexOf(e)?null:this.NORM_TTL):null}async installServiceWorker(){try{return await caches.open(this.CACHE_NAME).then(t=>t.addAll(this.BASE_CACHE_FILES),t=>console.error("Error with "+this.CACHE_NAME,t)),this.scope.skipWaiting()}catch(t){return console.error("Error with installation: ",t)}}cleanupLegacyCache(){const i=[this.CACHE_NAME];return new Promise((e,s)=>{caches.keys().then(t=>t.filter(t=>!~i.indexOf(t))).then(t=>{t.length?Promise.all(t.map(t=>caches.delete(t))).then(()=>e()).catch(t=>{console.error("Error in legacy cleanup: ",t),s(t)}):e()}).catch(t=>{console.error("Error in legacy cleanup: ",t),s(t)})})}async preCacheUrl(e){const s=await caches.open(this.CACHE_NAME);return await s.match(e)?null:fetch(e).then(t=>s.put(e,t.clone()))}register(){this.scope.addEventListener("install",t=>{t.waitUntil(Promise.all([this.installServiceWorker(),this.scope.skipWaiting()]))}),this.scope.addEventListener("activate",e=>{e.waitUntil(Promise.all([this.cleanupLegacyCache(),this.scope.clients.claim(),this.scope.skipWaiting()]).catch(t=>{console.error("Activation error: ",t),e.skipWaiting()}))}),this.scope.addEventListener("fetch",a=>{a.respondWith(caches.open(this.CACHE_NAME).then(async e=>{if(!this.canCache(a.request.url))return fetch(a.request);const s=await e.match(a.request);if(s){var i;let t=null;for(i of s.headers.entries())if("date"===i[0]){t=new Date(i[1]);break}if(!t)return s;var r=parseInt((((new Date).getTime()-t.getTime())/1e3).toString()),n=this.getTTL(a.request.url);if(null===n||n&&r<n)return s}return fetch(a.request.clone()).then(t=>t.status<400?(this.canCache(a.request.url)&&e.put(a.request,t.clone()),t):e.match(this.NOT_FOUND_PAGE)).catch(t=>s||(console.error(`Error fetching ${a.request.url} resulted in offline`,t),e.match(this.OFFLINE_PAGE)))}))})}}const pwa=new Pwa(self);pwa.register(); \ No newline at end of file