Skip to content

Commit

Permalink
add pwa
Browse files Browse the repository at this point in the history
  • Loading branch information
sfggeogis committed Oct 20, 2021
1 parent 72242e5 commit 515c34b
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 8 deletions.
Binary file added capture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added icgc_icon_192x192.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 icgc_icon_256x256.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 icgc_icon_512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 37 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-46332195-9"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-46332195-9');
</script>
<!-- Google Tag Manager -->
<script>(function (w, d, s, l, i) {
w[l] = w[l] || []; w[l].push({
'gtm.start':
Expand All @@ -17,11 +15,27 @@
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src =
'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-MGS4TSP');</script>
<!-- End Google Tag Manager -->
<title>OpenICGC Resources</title>
<title>Recursos ICGC en obert</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<meta name='viewport' content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<meta name="author" content="Institut Cartogràfic i Geològic de Catalunya" />
<link id="manifest" rel="manifest" href="manifest.webmanifest">
<link rel='icon' type='image/png' href='https://openicgc.github.io/favicon.png'>
<meta property="fb:app_id" content="620717167980164" />
<meta property="og:title" content="Recursos ICGC en obert" />
<meta property="og:type" content="website" />
<meta property="og:image" content="https://openicgc.github.io/capture.png" />
<meta property="og:image:type" content="image/png" />
<meta property="og:url" content="Recursos ICGC en obert" />
<meta property="og:description" content="Recursos ICGC en obert" />
<meta name="description" content="Recursos ICGC en obert" />
<meta name="robots" content="index,follow" />
<meta name="keywords" content="Catalunya, visor">
<meta name="geo.region" content="ES-CT" />
<meta name="geo.placename" content="Barcelona" />
<meta name="geo.position" content="41.363892,2.186279" />
<meta name="language" content="ca" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css"
integrity="sha384-Zug+QiDoJOrZ5t4lssLdxGhVrurbmBWopoEl+M6BdEfwnCJZtKxi1KgxUyJq13dy" crossorigin="anonymous">
<link href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" rel="stylesheet">
Expand Down Expand Up @@ -111,6 +125,17 @@
font-size: 0.88em;
}
</style>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Website",
"url": "https://openicgc.github.io/",
"name": "Recursos ICGC en obert",
"image": "https://openicgc.github.io/capture.png",
"author": "Institut Cartogràfic i Geològic de Catalunya",
"description": "Recull d'estils, tessel·les, codi i exemples basats en dades ICGC"
}
</script>
</head>
<body>
<!-- Google Tag Manager (noscript) -->
Expand Down Expand Up @@ -623,15 +648,13 @@ <h5>Piràmides Vector Tiles (EndPoints)
<div class="row">
<div class="col"><b>
ContextMaps (ICGC + OpenMapTiles)</b><br>

<div>
<span>https://geoserveis.icgc.cat/contextmaps/contextmaps.json (<b>TileJSON endpoint</b>)</span>
<span id="vincle_30" class="far fa-clipboard btn-copy js-tooltip js-copy" data-toggle="tooltip"
data-placement="bottom" data-copy="https://geoserveis.icgc.cat/contextmaps/contextmaps.json"
title="Copiar enllaç">
</span>
</div>

<div>
<span>https://geoserveis.icgc.cat/vector-tiles/contextmaps/{z}/{x}/{y}.pbf</span>
<span id="vincle_28" class="far fa-clipboard btn-copy js-tooltip js-copy" data-toggle="tooltip"
Expand Down Expand Up @@ -1518,5 +1541,11 @@ <h5>Contacte:
});
});
</script>
<script>
if (!navigator.serviceWorker.controller) {
navigator.serviceWorker.register("serviceworker.js").then(function (reg) {
});
}
</script>
</body>
</html>
29 changes: 29 additions & 0 deletions manifest.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "Recursos ICGC en obert",
"short_name": "Recursos ICGC en obert",
"icons": [
{
"src": "icgc_icon_192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "icgc_icon_256x256.png",
"sizes": "256x256",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "icgc_icon_512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable any"
}
],
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#3E4EB8",
"theme_color": "#2F3BA2"
}
1 change: 1 addition & 0 deletions offline.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>Idescat</title></head><body> <header class="app-header"> <h1 class="app-header__heading">You Are Offline</h1> </header> <main class="app-content"> <p> This content is not available while offline. Sorry. </p> </main> <script>"serviceWorker"in navigator&&navigator.serviceWorker.register("serviceworker.js").then(function(e){}).catch(function(e){});</script> </body></html>
49 changes: 49 additions & 0 deletions serviceworker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use strict';
// Update cache names any time any of the cached files change.
const CACHE_NAME = 'static-cache-v1';
// Add list of files to cache here.
const FILES_TO_CACHE = [
'offline.html',
];
self.addEventListener('install', (evt) => {
// console.log('[ServiceWorker] Install');
evt.waitUntil(
caches.open(CACHE_NAME).then((cache) => {
// console.log('[ServiceWorker] Pre-caching offline page');
return cache.addAll(FILES_TO_CACHE);
})
);
self.skipWaiting();
});
self.addEventListener('activate', (evt) => {
// console.log('[ServiceWorker] Activate');
// Remove previous cached data from disk.
evt.waitUntil(
caches.keys().then((keyList) => {
return Promise.all(keyList.map((key) => {
if (key !== CACHE_NAME) {
// console.log('[ServiceWorker] Removing old cache', key);
return caches.delete(key);
}
}));
})
);
self.clients.claim();
});
self.addEventListener('fetch', (evt) => {
// console.log('[ServiceWorker] Fetch', evt.request.url);
// Add fetch event handler here.
if (evt.request.mode !== 'navigate') {
// Not a page navigation, bail.
return;
}
evt.respondWith(
fetch(evt.request)
.catch(() => {
return caches.open(CACHE_NAME)
.then((cache) => {
return cache.match('offline.html');
});
})
);
});

0 comments on commit 515c34b

Please sign in to comment.