diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 927d4dd..0000000 --- a/manifest.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "theme_color": "#8a35f6", - "background_color": "#f69435", - "display": "standalone", - "scope": "/", - "start_url": "/", - "name": "Notification Tester With Root Scope URL", - "short_name": "NTWRSU", - "description": "Tests web notifications", - "icons": [ - { - "src": "/repro_pages/notifications/icon-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/repro_pages/notifications/icon-256x256.png", - "sizes": "256x256", - "type": "image/png" - }, - { - "src": "/repro_pages/notifications/icon-384x384.png", - "sizes": "384x384", - "type": "image/png" - }, - { - "src": "/repro_pages/notifications/icon-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ] -} diff --git a/notifications_without_favicon/dedicated-worker.js b/notifications_without_favicon/dedicated-worker.js deleted file mode 100644 index bfb1105..0000000 --- a/notifications_without_favicon/dedicated-worker.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -onmessage = (messageEvent) => { - if (messageEvent.data === "close") { - closeNotifications(); - } else { - showNotification(messageEvent.data); - } -}; - -let notificationList = []; - -function showNotification(title) { - const notification = new Notification(`DedicatedWorkerGlobalScope Title ${title}`, { body: `DedicatedWorkerGlobalScope Body ${title}`, icon: "../resources/happy.jpg" }); - notificationList.push(notification); - notification.onclick = () => { - postMessage(`DedicatedWorkerGlobalScope 'click' event for: ${notification.title}`); - }; - notification.onerror = () => { - postMessage(`DedicatedWorkerGlobalScope 'error' event for: ${notification.title}`); - }; - notification.onshow = () => { - postMessage(`DedicatedWorkerGlobalScope 'show' event for: ${notification.title}`); - }; - notification.onclose = () => { - postMessage(`DedicatedWorkerGlobalScope 'close' event for: ${notification.title}`); - }; -} - -function closeNotifications() { - notificationList.forEach((toast) => { - toast.close(); - }); - notificationList = []; -} \ No newline at end of file diff --git a/notifications_without_favicon/demo.html b/notifications_without_favicon/demo.html deleted file mode 100644 index fb086b3..0000000 --- a/notifications_without_favicon/demo.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
-

- - - - diff --git a/notifications_without_favicon/demo2.html b/notifications_without_favicon/demo2.html deleted file mode 100644 index 7444534..0000000 --- a/notifications_without_favicon/demo2.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
-

- - - - \ No newline at end of file diff --git a/notifications_without_favicon/icon-192x192.png b/notifications_without_favicon/icon-192x192.png deleted file mode 100644 index 4eaa526..0000000 Binary files a/notifications_without_favicon/icon-192x192.png and /dev/null differ diff --git a/notifications_without_favicon/icon-256x256.png b/notifications_without_favicon/icon-256x256.png deleted file mode 100644 index 0d1ee8a..0000000 Binary files a/notifications_without_favicon/icon-256x256.png and /dev/null differ diff --git a/notifications_without_favicon/icon-384x384.png b/notifications_without_favicon/icon-384x384.png deleted file mode 100644 index 3a255c7..0000000 Binary files a/notifications_without_favicon/icon-384x384.png and /dev/null differ diff --git a/notifications_without_favicon/icon-512x512.png b/notifications_without_favicon/icon-512x512.png deleted file mode 100644 index 74b3aef..0000000 Binary files a/notifications_without_favicon/icon-512x512.png and /dev/null differ diff --git a/notifications_without_favicon/manifest.json b/notifications_without_favicon/manifest.json deleted file mode 100644 index e8951b6..0000000 --- a/notifications_without_favicon/manifest.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "theme_color": "#8a35f6", - "background_color": "#f69435", - "display": "standalone", - "scope": "/repro_pages/pwa/notifications/", - "start_url": "/repro_pages/pwa/notifications/demo.html", - "name": "Notification Tester", - "short_name": "NT", - "description": "Tests web notifications", - "icons": [ - { - "src": "/repro_pages/pwa/notifications/icon-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/repro_pages/pwa/notifications/icon-256x256.png", - "sizes": "256x256", - "type": "image/png" - }, - { - "src": "/repro_pages/pwa/notifications/icon-384x384.png", - "sizes": "384x384", - "type": "image/png" - }, - { - "src": "/repro_pages/pwa/notifications/icon-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ] -} \ No newline at end of file diff --git a/notifications_without_favicon/on-click.html b/notifications_without_favicon/on-click.html deleted file mode 100644 index abac7cd..0000000 --- a/notifications_without_favicon/on-click.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Notification Clicked!!!

- - - \ No newline at end of file diff --git a/notifications_without_favicon/service-worker.js b/notifications_without_favicon/service-worker.js deleted file mode 100644 index 1072454..0000000 --- a/notifications_without_favicon/service-worker.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; - -skipWaiting(); - -onactivate = () => { - return clients.claim(); -} - -onmessage = (messageEvent) => { - registration.showNotification(`ServiceWorkerGlobalScope Title ${messageEvent.data}`, { body: `ServiceWorkerGlobalScope Body ${messageEvent.data}`, icon: "../resources/happy.jpg" }) - .then(() => { - messageEvent.source.postMessage("ServiceWorkerGlobalScope showNotification() succeeded."); - }).catch((error) => { - messageEvent.source.postMessage(`ServiceWorkerGlobalScope showNotification() failed: ${error}.`); - }); -}; - -onnotificationclick = (event) => { - clients.matchAll() - .then((resultList) => { - resultList.forEach((client) => { - const notification = event.notification; - client.postMessage(`ServiceWorkerGlobalScope 'click' event for: ${notification.title} , timestamp: ${new Date(notification.timestamp)}, requireInteraction: ${notification.requireInteraction}, silent: ${notification.silent}`); - notification.close(); - }); - }); - event.waitUntil(new Promise((resolve) => { - setTimeout(() => { - clients.openWindow('on-click.html'); - resolve(); - }, 0); - })); -}; - -onnotificationclose = (event) => { - clients.matchAll() - .then((resultList) => { - resultList.forEach((client) => { - const notification = event.notification; - client.postMessage(`ServiceWorkerGlobalScope 'close' event for: ${notification.title} , timestamp: ${new Date(notification.timestamp)}, requireInteraction: ${notification.requireInteraction}, silent: ${notification.silent}`); - }); - }); -}; - -onfetch = (fetchEvent) => { - console.log(fetchEvent.request.url); - fetchEvent.respondWith(fetch(fetchEvent.request)); -} diff --git a/other_notifications/dedicated-worker.js b/other_notifications/dedicated-worker.js deleted file mode 100644 index bfb1105..0000000 --- a/other_notifications/dedicated-worker.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -onmessage = (messageEvent) => { - if (messageEvent.data === "close") { - closeNotifications(); - } else { - showNotification(messageEvent.data); - } -}; - -let notificationList = []; - -function showNotification(title) { - const notification = new Notification(`DedicatedWorkerGlobalScope Title ${title}`, { body: `DedicatedWorkerGlobalScope Body ${title}`, icon: "../resources/happy.jpg" }); - notificationList.push(notification); - notification.onclick = () => { - postMessage(`DedicatedWorkerGlobalScope 'click' event for: ${notification.title}`); - }; - notification.onerror = () => { - postMessage(`DedicatedWorkerGlobalScope 'error' event for: ${notification.title}`); - }; - notification.onshow = () => { - postMessage(`DedicatedWorkerGlobalScope 'show' event for: ${notification.title}`); - }; - notification.onclose = () => { - postMessage(`DedicatedWorkerGlobalScope 'close' event for: ${notification.title}`); - }; -} - -function closeNotifications() { - notificationList.forEach((toast) => { - toast.close(); - }); - notificationList = []; -} \ No newline at end of file diff --git a/other_notifications/demo.html b/other_notifications/demo.html deleted file mode 100644 index 99881c3..0000000 --- a/other_notifications/demo.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -
-

- - - - diff --git a/other_notifications/demo2.html b/other_notifications/demo2.html deleted file mode 100644 index 172d155..0000000 --- a/other_notifications/demo2.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
-

- - - - \ No newline at end of file diff --git a/other_notifications/favicon-16x16.png b/other_notifications/favicon-16x16.png deleted file mode 100644 index 3df7dff..0000000 Binary files a/other_notifications/favicon-16x16.png and /dev/null differ diff --git a/other_notifications/favicon-32x32.png b/other_notifications/favicon-32x32.png deleted file mode 100644 index 20e2c4c..0000000 Binary files a/other_notifications/favicon-32x32.png and /dev/null differ diff --git a/other_notifications/favicon.ico b/other_notifications/favicon.ico deleted file mode 100644 index 4868e7a..0000000 Binary files a/other_notifications/favicon.ico and /dev/null differ diff --git a/other_notifications/icon-192x192.png b/other_notifications/icon-192x192.png deleted file mode 100644 index 4eaa526..0000000 Binary files a/other_notifications/icon-192x192.png and /dev/null differ diff --git a/other_notifications/icon-256x256.png b/other_notifications/icon-256x256.png deleted file mode 100644 index 0d1ee8a..0000000 Binary files a/other_notifications/icon-256x256.png and /dev/null differ diff --git a/other_notifications/icon-384x384.png b/other_notifications/icon-384x384.png deleted file mode 100644 index 3a255c7..0000000 Binary files a/other_notifications/icon-384x384.png and /dev/null differ diff --git a/other_notifications/icon-512x512.png b/other_notifications/icon-512x512.png deleted file mode 100644 index 74b3aef..0000000 Binary files a/other_notifications/icon-512x512.png and /dev/null differ diff --git a/other_notifications/manifest.json b/other_notifications/manifest.json deleted file mode 100644 index e8951b6..0000000 --- a/other_notifications/manifest.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "theme_color": "#8a35f6", - "background_color": "#f69435", - "display": "standalone", - "scope": "/repro_pages/pwa/notifications/", - "start_url": "/repro_pages/pwa/notifications/demo.html", - "name": "Notification Tester", - "short_name": "NT", - "description": "Tests web notifications", - "icons": [ - { - "src": "/repro_pages/pwa/notifications/icon-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/repro_pages/pwa/notifications/icon-256x256.png", - "sizes": "256x256", - "type": "image/png" - }, - { - "src": "/repro_pages/pwa/notifications/icon-384x384.png", - "sizes": "384x384", - "type": "image/png" - }, - { - "src": "/repro_pages/pwa/notifications/icon-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ] -} \ No newline at end of file diff --git a/other_notifications/on-click.html b/other_notifications/on-click.html deleted file mode 100644 index abac7cd..0000000 --- a/other_notifications/on-click.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Notification Clicked!!!

- - - \ No newline at end of file diff --git a/other_notifications/service-worker.js b/other_notifications/service-worker.js deleted file mode 100644 index 1072454..0000000 --- a/other_notifications/service-worker.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; - -skipWaiting(); - -onactivate = () => { - return clients.claim(); -} - -onmessage = (messageEvent) => { - registration.showNotification(`ServiceWorkerGlobalScope Title ${messageEvent.data}`, { body: `ServiceWorkerGlobalScope Body ${messageEvent.data}`, icon: "../resources/happy.jpg" }) - .then(() => { - messageEvent.source.postMessage("ServiceWorkerGlobalScope showNotification() succeeded."); - }).catch((error) => { - messageEvent.source.postMessage(`ServiceWorkerGlobalScope showNotification() failed: ${error}.`); - }); -}; - -onnotificationclick = (event) => { - clients.matchAll() - .then((resultList) => { - resultList.forEach((client) => { - const notification = event.notification; - client.postMessage(`ServiceWorkerGlobalScope 'click' event for: ${notification.title} , timestamp: ${new Date(notification.timestamp)}, requireInteraction: ${notification.requireInteraction}, silent: ${notification.silent}`); - notification.close(); - }); - }); - event.waitUntil(new Promise((resolve) => { - setTimeout(() => { - clients.openWindow('on-click.html'); - resolve(); - }, 0); - })); -}; - -onnotificationclose = (event) => { - clients.matchAll() - .then((resultList) => { - resultList.forEach((client) => { - const notification = event.notification; - client.postMessage(`ServiceWorkerGlobalScope 'close' event for: ${notification.title} , timestamp: ${new Date(notification.timestamp)}, requireInteraction: ${notification.requireInteraction}, silent: ${notification.silent}`); - }); - }); -}; - -onfetch = (fetchEvent) => { - console.log(fetchEvent.request.url); - fetchEvent.respondWith(fetch(fetchEvent.request)); -} diff --git a/service_worker/app.js b/service_worker/app.js deleted file mode 100644 index f19cf75..0000000 --- a/service_worker/app.js +++ /dev/null @@ -1,74 +0,0 @@ -// register service worker - -if ('serviceWorker' in navigator) { - navigator.serviceWorker.register('/sw-test/sw.js', { scope: '/sw-test/' }).then(function(reg) { - - if(reg.installing) { - console.log('Service worker installing'); - } else if(reg.waiting) { - console.log('Service worker installed'); - } else if(reg.active) { - console.log('Service worker active'); - } - - }).catch(function(error) { - // registration failed - console.log('Registration failed with ' + error); - }); -} - -// function for loading each image via XHR - -function imgLoad(imgJSON) { - // return a promise for an image loading - return new Promise(function(resolve, reject) { - var request = new XMLHttpRequest(); - request.open('GET', imgJSON.url); - request.responseType = 'blob'; - - request.onload = function() { - if (request.status == 200) { - var arrayResponse = []; - arrayResponse[0] = request.response; - arrayResponse[1] = imgJSON; - resolve(arrayResponse); - } else { - reject(Error('Image didn\'t load successfully; error code:' + request.statusText)); - } - }; - - request.onerror = function() { - reject(Error('There was a network error.')); - }; - - // Send the request - request.send(); - }); -} - -var imgSection = document.querySelector('section'); - -window.onload = function() { - - // load each set of image, alt text, name and caption - for(var i = 0; i<=Gallery.images.length-1; i++) { - imgLoad(Gallery.images[i]).then(function(arrayResponse) { - - var myImage = document.createElement('img'); - var myFigure = document.createElement('figure'); - var myCaption = document.createElement('caption'); - var imageURL = window.URL.createObjectURL(arrayResponse[0]); - - myImage.src = imageURL; - myImage.setAttribute('alt', arrayResponse[1].alt); - myCaption.innerHTML = '' + arrayResponse[1].name + ': Taken by ' + arrayResponse[1].credit; - - imgSection.appendChild(myFigure); - myFigure.appendChild(myImage); - myFigure.appendChild(myCaption); - - }, function(Error) { - console.log(Error); - }); - } -}; diff --git a/service_worker/code_cache.html b/service_worker/code_cache.html deleted file mode 100644 index 39d1d56..0000000 --- a/service_worker/code_cache.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - -

- - - \ No newline at end of file diff --git a/service_worker/image.png b/service_worker/image.png deleted file mode 100644 index 74b3aef..0000000 Binary files a/service_worker/image.png and /dev/null differ diff --git a/service_worker/load_image.html b/service_worker/load_image.html deleted file mode 100644 index 508a69f..0000000 --- a/service_worker/load_image.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - -

- - - - - \ No newline at end of file diff --git a/service_worker/load_image.js b/service_worker/load_image.js deleted file mode 100644 index 3fd0558..0000000 --- a/service_worker/load_image.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; - -const image_element = document.createElement('img'); -image_element.src = 'image.png'; -document.body.appendChild(image_element); - -function load_image() { - const image_element = document.createElement('img'); - image_element.src = 'image.png'; - document.body.appendChild(image_element); -} \ No newline at end of file diff --git a/service_worker/service_worker.js b/service_worker/service_worker.js deleted file mode 100644 index bad5be9..0000000 --- a/service_worker/service_worker.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; - -oninstall = (install_event) => { - install_event.waitUntil( - caches.open('v1').then(cache => { - return cache.addAll([ - 'app.js', - 'code_cache.html', - 'load_image.html', - 'load_image.js', - 'image.png', - ]); - }) - ); -} - -onfetch = (fetch_event) => { - fetch_event.respondWith(caches.match(fetch_event.request)); -}