-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
186 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<!DOCTYPE html> | ||
<html lang="ca"> | ||
|
||
<head> | ||
<!-- Global site tag (gtag.js) - Google Analytics --> | ||
<script async src=" | ||
https://www.googletagmanager.com/gtag/js?id=G-GR9JCZYNFH"></script> | ||
<script> | ||
window.dataLayer = window.dataLayer || []; | ||
|
||
function gtag() { | ||
dataLayer.push(arguments); | ||
} | ||
gtag('js', new Date()); | ||
gtag('config', 'UA-46332195-11'); | ||
</script> | ||
<meta charset='utf-8'> | ||
<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" /> | ||
<!-- | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/svelte-material-ui@4.2.0/bare.min.css" /> | ||
--> | ||
<meta name="author" content="Institut Cartogràfic i Geològic de Catalunya" /> | ||
<link rel="manifest" href="manifest.json"> | ||
<meta property="fb:app_id" content="620717167980164" /> | ||
<meta property="og:title" content="API Territorial" /> | ||
<meta property="og:type" content="website" /> | ||
<meta property="og:image" content="icgc_icon_512.png" /> | ||
<meta property="og:image:type" content="image/png" /> | ||
<meta property="og:url" content="API Territorial" /> | ||
<meta property="og:description" content="API Territorial" /> | ||
<meta name="description" content="ContexMaps" /> | ||
<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" /> | ||
<title>API Territorial</title> | ||
<!-- | ||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> | ||
--> | ||
<link href="https://fonts.googleapis.com/css?family=Material+Icons+Outlined|Material+Icons" rel="stylesheet"> | ||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700" rel="stylesheet"> | ||
|
||
<link rel='icon' type='image/png' href='favicon.png'> | ||
<!----> | ||
|
||
<!-- | ||
<script src='https://api.mapbox.com/mapbox-gl-js/v1.13.1/mapbox-gl.js'></script> | ||
--> | ||
|
||
</head> | ||
|
||
<body> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,71 @@ | ||
'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'); | ||
// 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); | ||
}) | ||
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'); | ||
// 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); | ||
} | ||
})); | ||
}) | ||
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); | ||
// console.log('[ServiceWorker] Fetch', evt.request.url); | ||
// Add fetch event handler here. | ||
if (evt.request.url.startsWith('https://geoserveis.icgc.cat/servei/catalunya')) { | ||
evt.respondWith( | ||
caches.open(CACHE_NAME).then((cache) => { | ||
return cache.match(evt.request).then((response) => { | ||
if (response) { | ||
return response; | ||
} | ||
return fetch(evt.request).then((networkResponse) => { | ||
cache.put(evt.request, networkResponse.clone()); | ||
return networkResponse; | ||
}); | ||
}); | ||
}) | ||
); | ||
return; | ||
} | ||
|
||
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'); | ||
}); | ||
}) | ||
fetch(evt.request).catch(() => { | ||
return caches.open(CACHE_NAME) | ||
.then((cache) => { | ||
return cache.match('offline.html'); | ||
}); | ||
}) | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters