Skip to content

Commit

Permalink
Add PWA
Browse files Browse the repository at this point in the history
  • Loading branch information
salif committed Jun 24, 2024
1 parent a381f5b commit d702b52
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 0 deletions.
11 changes: 11 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<meta name="robots" content="index, follow" />
{% seo %}
<link rel="stylesheet" href="{{ "/assets/css/style.css?v=" | append: site.github.build_revision | relative_url }}" />
<link rel="manifest" href="./manifest.json" />
{% if jekyll.environment == "production" %}
<script data-goatcounter="https://sgi.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
{% endif %}
Expand All @@ -29,5 +30,15 @@ <h1>{{ page.title }}</h1>
{% include style.html %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js" integrity="sha256-lZaRhKri35AyJSypXXs4o6OPFTbTmUoltBbDCbdzegg=" crossorigin="anonymous"></script>
<script>anchors.add();</script>
<script>
if ("serviceWorker" in navigator) {
window.addEventListener("load", function () {
navigator.serviceWorker
.register("./serviceWorker.js")
.then(res => console.log("service worker registered"))
.catch(err => console.log("service worker not registered", err))
})
}
</script>
</body>
</html>
Binary file added icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "Globasa-Xwexi",
"short_name": "globasa-xwexi",
"id": "globasa-xwexi",
"start_url": "./index.html",
"display": "minimal-ui",
"background_color": "#ffffff",
"description": "Content of pages for xwexi.globasa.net including Bulgarian translation",
"icons": [
{
"src": "./icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "./icon-512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"screenshots": [
{
"src": "./icon-512.png",
"sizes": "512x512",
"type": "image/png",
"label": "icon"
},
{
"src": "./icon-512.png",
"sizes": "512x512",
"type": "image/png",
"form_factor": "wide",
"label": "icon"
}
]
}
116 changes: 116 additions & 0 deletions serviceWorker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
const VERSION = "v2024.06.24";

const APP_STATIC_RESOURCES = [
"./",
"./index.html",
"./assets/css/style.css",
"./icon-192.png",
"./icon-512.png",
"./01.default.default.bul.html",
"./01.default.default.eng.html",
"./01.default.default.spa.html",
"./02.darsu.00.default.bul.html",
"./02.darsu.01.default.bul.html",
"./02.darsu.01.default.eng.html",
"./02.darsu.01.default.epo.html",
"./02.darsu.01.default.fra.html",
"./02.darsu.01.default.spa.html",
"./02.darsu.02.default.bul.html",
"./02.darsu.02.default.eng.html",
"./02.darsu.02.default.spa.html",
"./02.darsu.03.default.bul.html",
"./02.darsu.03.default.eng.html",
"./02.darsu.03.default.spa.html",
"./02.darsu.04.default.bul.html",
"./02.darsu.04.default.eng.html",
"./02.darsu.04.default.spa.html",
"./02.darsu.05.default.bul.html",
"./02.darsu.05.default.eng.html",
"./02.darsu.05.default.spa.html",
"./02.darsu.06.default.eng.html",
"./02.darsu.06.default.spa.html",
"./02.darsu.07.default.eng.html",
"./02.darsu.07.default.spa.html",
"./02.darsu.08.default.eng.html",
"./02.darsu.08.default.spa.html",
"./02.darsu.09.default.eng.html",
"./02.darsu.09.default.spa.html",
"./02.darsu.10.default.eng.html",
"./02.darsu.10.default.spa.html",
"./02.darsu.11.default.eng.html",
"./02.darsu.11.default.spa.html",
"./02.darsu.12.default.eng.html",
"./02.darsu.12.default.spa.html",
"./02.darsu.13.default.eng.html",
"./02.darsu.13.default.spa.html",
"./02.darsu.14.default.eng.html",
"./02.darsu.14.default.spa.html",
"./02.darsu.15.default.eng.html",
"./02.darsu.15.default.spa.html",
"./02.darsu.16.default.eng.html",
"./02.darsu.16.default.spa.html",
"./02.darsu.17.default.eng.html",
"./02.darsu.17.default.spa.html",
"./02.darsu.18.default.eng.html",
"./02.darsu.18.default.spa.html",
"./02.darsu.19.default.eng.html",
"./02.darsu.19.default.spa.html",
"./02.darsu.20.default.eng.html",
"./02.darsu.20.default.spa.html",
"./02.darsu.default.bul.html",
"./02.darsu.default.eng.html",
"./02.darsu.default.spa.html",
"./03.gramati.01.abece-ji-lafuzu.default.eng.html",
"./03.gramati.01.abece-ji-lafuzu.default.epo.html",
"./03.gramati.01.abece-ji-lafuzu.default.spa.html",
"./03.gramati.02.inharelexi.default.eng.html",
"./03.gramati.02.inharelexi.default.spa.html",
"./03.gramati.03.gramatilexi.default.eng.html",
"./03.gramati.03.gramatilexi.default.spa.html",
"./03.gramati.04.pronamelexi.default.eng.html",
"./03.gramati.04.pronamelexi.default.spa.html",
"./03.gramati.05.tabellexi.default.eng.html",
"./03.gramati.05.tabellexi.default.spa.html",
"./03.gramati.06.numer-ji-mesi.default.bul.html",
"./03.gramati.06.numer-ji-mesi.default.eng.html",
"./03.gramati.06.numer-ji-mesi.default.spa.html",
"./03.gramati.07.falelexili-morfo.default.eng.html",
"./03.gramati.07.falelexili-morfo.default.spa.html",
"./03.gramati.08.jumlemonli-estrutur.default.eng.html",
"./03.gramati.08.jumlemonli-estrutur.default.spa.html",
"./03.gramati.09.jumleli-estrutur.default.eng.html",
"./03.gramati.09.jumleli-estrutur.default.spa.html",
"./03.gramati.10.lexikostrui.default.eng.html",
"./03.gramati.10.lexikostrui.default.spa.html",
"./03.gramati.11.ofkatado-morfomon.default.eng.html",
"./03.gramati.11.ofkatado-morfomon.default.spa.html",
"./03.gramati.12.lexiklase.default.eng.html",
"./03.gramati.12.lexiklase.default.epo.html",
"./03.gramati.12.lexiklase.default.spa.html",
"./03.gramati.default.bul.html",
"./03.gramati.default.eng.html",
"./03.gramati.default.spa.html",
"./04.pimpan-logaxey.default.bul.html",
"./04.pimpan-logaxey.default.eng.html",
"./04.pimpan-logaxey.default.spa.html",
"./05.dict.default.eng.html",
"./05.max-resurso.default.bul.html",
"./05.max-resurso.default.eng.html",
"./05.max-resurso.default.spa.html",
];

self.addEventListener("install", installEvent => {
installEvent.waitUntil(
caches.open(VERSION).then(cache => {
cache.addAll(APP_STATIC_RESOURCES)
})
)
})

self.addEventListener("fetch", fetchEvent => {
fetchEvent.respondWith(
caches.match(fetchEvent.request).then(res => {
return res || fetch(fetchEvent.request)
})
)
})

0 comments on commit d702b52

Please sign in to comment.