Browse Source

implementacion manifest

master
humano 2 years ago
parent
commit
a72c9eca5a
13 changed files with 275 additions and 1 deletions
  1. BIN
      images/icons/icon-128x128.png
  2. BIN
      images/icons/icon-144x144.png
  3. BIN
      images/icons/icon-152x152.png
  4. BIN
      images/icons/icon-192x192.png
  5. BIN
      images/icons/icon-384x384.png
  6. BIN
      images/icons/icon-512x512.png
  7. BIN
      images/icons/icon-72x72.png
  8. BIN
      images/icons/icon-96x96.png
  9. +11
    -1
      index.php
  10. +53
    -0
      manifest.json
  11. +133
    -0
      manup.js
  12. +14
    -0
      pwabuilder-sw-register.js
  13. +64
    -0
      pwabuilder-sw.js

BIN
images/icons/icon-128x128.png View File

Before After
Width: 128  |  Height: 128  |  Size: 9.9KB

BIN
images/icons/icon-144x144.png View File

Before After
Width: 144  |  Height: 144  |  Size: 11KB

BIN
images/icons/icon-152x152.png View File

Before After
Width: 152  |  Height: 152  |  Size: 12KB

BIN
images/icons/icon-192x192.png View File

Before After
Width: 192  |  Height: 192  |  Size: 15KB

BIN
images/icons/icon-384x384.png View File

Before After
Width: 384  |  Height: 384  |  Size: 31KB

BIN
images/icons/icon-512x512.png View File

Before After
Width: 512  |  Height: 512  |  Size: 43KB

BIN
images/icons/icon-72x72.png View File

Before After
Width: 72  |  Height: 72  |  Size: 5.3KB

BIN
images/icons/icon-96x96.png View File

Before After
Width: 96  |  Height: 96  |  Size: 7.3KB

+ 11
- 1
index.php View File

@@ -395,12 +395,22 @@ if ($variable !=''){
";
$librerias_galeria ="
<link rel='manifest' href='manifest.json'>
<link rel='stylesheet' type='text/css' href='librerias/slick/slick.css'>
<link rel='stylesheet' type='text/css' href='librerias/slick/slick-theme.css'>
<link rel='stylesheet' type='text/css' href='librerias/slick/style.css'>
<script src='manup.js'></script>
";
$librerias_cabeza ="$presentacion_cabeza $librerias_galeria";
$librerias_pie =$aplicacion_pie;
$librerias_pie ="$aplicacion_pie
<script>
if('serviceWorker' in navigator) {
navigator.serviceWorker
.register('pwabuilder-sw.js')
.then(function() { console.log('Service Worker Registered'); });
}
</script>
";

$registros = aplicacion_carrusel("$form",'10','','embebido','',"carousel");
//$registros="<div id='mostrar_carrusel'>$registros</div>";

+ 53
- 0
manifest.json View File

@@ -0,0 +1,53 @@
{
"name": "Avistador.com",
"short_name": "avistador",
"theme_color": "#289042",
"background_color": "#e7d380",
"display": "fullscreen",
"orientation": "portrait",
"Scope": "/a74",
"start_url": "/a74",
"icons": [
{
"src": "images/icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "images/icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "images/icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "images/icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "images/icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png"
},
{
"src": "images/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "images/icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "images/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"splash_pages": null
}

+ 133
- 0
manup.js
File diff suppressed because it is too large
View File


+ 14
- 0
pwabuilder-sw-register.js View File

@@ -0,0 +1,14 @@
//This is the service worker with the Cache-first network
//Add this below content to your HTML page, or add the js file to your page at the very top to register sercie worker
if (navigator.serviceWorker.controller) {
console.log('[PWA Builder] active service worker found, no need to register')
} else {
//Register the ServiceWorker
navigator.serviceWorker.register('pwabuilder-sw.js', {
scope: '.'
}).then(function(reg) {
console.log('Service worker has been registered for scope:'+ reg.scope);
});
}

+ 64
- 0
pwabuilder-sw.js View File

@@ -0,0 +1,64 @@
//This is the service worker with the Cache-first network
var CACHE = 'pwabuilder-precache';
var precacheFiles = [
/* Add an array of files to precache for your app */
];
//Install stage sets up the cache-array to configure pre-cache content
self.addEventListener('install', function(evt) {
console.log('The service worker is being installed.');
evt.waitUntil(precache().then(function() {
console.log('[ServiceWorker] Skip waiting on install');
return self.skipWaiting();
})
);
});
//allow sw to control of current page
self.addEventListener('activate', function(event) {
console.log('[ServiceWorker] Claiming clients for current page');
return self.clients.claim();
});
self.addEventListener('fetch', function(evt) {
console.log('The service worker is serving the asset.'+ evt.request.url);
evt.respondWith(fromCache(evt.request).catch(fromServer(evt.request)));
evt.waitUntil(update(evt.request));
});
function precache() {
return caches.open(CACHE).then(function (cache) {
return cache.addAll(precacheFiles);
});
}
function fromCache(request) {
//we pull files from the cache first thing so we can show them fast
return caches.open(CACHE).then(function (cache) {
return cache.match(request).then(function (matching) {
return matching || Promise.reject('no-match');
});
});
}
function update(request) {
//this is where we call the server to get the newest version of the
//file to use the next time we show view
return caches.open(CACHE).then(function (cache) {
return fetch(request).then(function (response) {
return cache.put(request, response);
});
});
}
function fromServer(request){
//this is the fallback if it is not in the cahche to go to the server and get it
return fetch(request).then(function(response){ return response})
}

Loading…
Cancel
Save