Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Deleted obsolete or-shell folder

Christian Bauer5ca314c5f095
diff --git a/or-shell/android/src/main/assets/bower.json b/or-shell/android/src/main/assets/bower.json
deleted file mode 100644
index c1b3d04e5..000000000
--- a/or-shell/android/src/main/assets/bower.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "name": "Blok61",
- "main": "index.html",
- "dependencies": {
- "polymer": "Polymer/polymer#^1.4.0",
- "paper-menu": "PolymerElements/paper-menu#^1.2.2",
- "paper-item": "PolymerElements/paper-item#^1.2.1",
- "app-layout": "PolymerElements/app-layout#^0.10.6",
- "iron-pages": "PolymerElements/iron-pages#^1.0.8",
- "paper-toggle-button": "PolymerElements/paper-toggle-button#^1.2.1",
- "iron-icon": "PolymerElements/iron-icon#^1.0.12",
- "paper-radio-button": "PolymerElements/paper-radio-button#^1.3.1",
- "paper-radio-group": "PolymerElements/paper-radio-group#^1.2.1",
- "paper-dropdown-menu": "PolymerElements/paper-dropdown-menu#^1.4.3",
- "paper-listbox": "PolymerElements/paper-listbox#^1.1.2",
- "iron-overlay-behavior": "PolymerElements/iron-overlay-behavior#^1.10.2",
- "iron-form": "PolymerElements/iron-form#^1.1.4",
- "paper-button": "PolymerElements/paper-button#^1.0.14",
- "paper-checkbox": "PolymerElements/paper-checkbox#^1.4.2",
- "paper-styles": "PolymerElements/paper-styles#^1.1.5",
- "paper-spinner": "PolymerElements/paper-spinner#^1.2.1",
- "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.23",
- "iron-resizable-behavior": "PolymerElements/iron-resizable-behavior#^1.0.5",
- "app-route": "PolymerElements/app-route#^0.9.3",
- "iron-ajax": "PolymerElements/iron-ajax#^1.4.3",
- "iron-collapse": "PolymerElements/iron-collapse#^1.3.0",
- "paper-dialog": "PolymerElements/paper-dialog#^1.1.0"
- },
- "devDependencies": {
- "iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
- "iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.0.0",
- "web-component-tester": "^4.0.0",
- "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
- }
-}
diff --git a/or-shell/android/src/main/assets/images/bg-image.jpeg b/or-shell/android/src/main/assets/images/bg-image.jpeg
deleted file mode 100644
index 61a6705c2..000000000
Binary files a/or-shell/android/src/main/assets/images/bg-image.jpeg and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/bg-image.jpg b/or-shell/android/src/main/assets/images/bg-image.jpg
deleted file mode 100644
index e2f1eb06e..000000000
Binary files a/or-shell/android/src/main/assets/images/bg-image.jpg and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/alarm_large_off.png b/or-shell/android/src/main/assets/images/panel/alarm_large_off.png
deleted file mode 100644
index 08b0233f8..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/alarm_large_off.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/alarm_large_on.png b/or-shell/android/src/main/assets/images/panel/alarm_large_on.png
deleted file mode 100644
index 267cf2faa..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/alarm_large_on.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/alarm_off.png b/or-shell/android/src/main/assets/images/panel/alarm_off.png
deleted file mode 100644
index b865a523b..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/alarm_off.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/alarm_on.png b/or-shell/android/src/main/assets/images/panel/alarm_on.png
deleted file mode 100644
index 7cb62d78f..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/alarm_on.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/energy_battery.png b/or-shell/android/src/main/assets/images/panel/energy_battery.png
deleted file mode 100644
index 6a9a13477..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/energy_battery.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/energy_no_battery.png b/or-shell/android/src/main/assets/images/panel/energy_no_battery.png
deleted file mode 100644
index 95f7250b7..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/energy_no_battery.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/home_on.png b/or-shell/android/src/main/assets/images/panel/home_on.png
deleted file mode 100644
index 955131fcd..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/home_on.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/light_off.png b/or-shell/android/src/main/assets/images/panel/light_off.png
deleted file mode 100644
index 10eab3ec1..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/light_off.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/light_on.png b/or-shell/android/src/main/assets/images/panel/light_on.png
deleted file mode 100644
index 8e7a188e9..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/light_on.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/minus.png b/or-shell/android/src/main/assets/images/panel/minus.png
deleted file mode 100644
index 423e033c1..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/minus.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/minus_pressed.png b/or-shell/android/src/main/assets/images/panel/minus_pressed.png
deleted file mode 100644
index d3dae62ba..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/minus_pressed.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/plus.png b/or-shell/android/src/main/assets/images/panel/plus.png
deleted file mode 100644
index 95970221d..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/plus.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/plus_pressed.png b/or-shell/android/src/main/assets/images/panel/plus_pressed.png
deleted file mode 100644
index d1a367a00..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/plus_pressed.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/star.png b/or-shell/android/src/main/assets/images/panel/star.png
deleted file mode 100644
index 374592cd5..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/star.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/temperature_gauge_00.png b/or-shell/android/src/main/assets/images/panel/temperature_gauge_00.png
deleted file mode 100644
index a57841696..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/temperature_gauge_00.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/temperature_gauge_100.png b/or-shell/android/src/main/assets/images/panel/temperature_gauge_100.png
deleted file mode 100644
index 95e635462..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/temperature_gauge_100.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/temperature_gauge_25.png b/or-shell/android/src/main/assets/images/panel/temperature_gauge_25.png
deleted file mode 100644
index 8325183a1..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/temperature_gauge_25.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/temperature_gauge_50.png b/or-shell/android/src/main/assets/images/panel/temperature_gauge_50.png
deleted file mode 100644
index 7e2f9bedc..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/temperature_gauge_50.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/temperature_gauge_75.png b/or-shell/android/src/main/assets/images/panel/temperature_gauge_75.png
deleted file mode 100644
index 9f2ae1351..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/temperature_gauge_75.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/images/panel/theme.css b/or-shell/android/src/main/assets/images/panel/theme.css
deleted file mode 100644
index d99126ab5..000000000
--- a/or-shell/android/src/main/assets/images/panel/theme.css
+++ /dev/null
@@ -1,209 +0,0 @@
-@font-face {
- font-family: 'robotoregular';
- /* TODO webcomponent.js bug fixed in 0.6 */
- src: url('Roboto-Regular-webfont.woff') format('woff'), url('panels/demo/Roboto-Regular-webfont.woff') format('woff');
-}
-
-@font-face {
- font-family: 'robotoregular';
- /* TODO webcomponent.js bug fixed in 0.6 */
- src: url('Roboto-Bold-webfont.woff') format('woff'), url('panels/demo/Roboto-Bold-webfont.woff') format('woff');
- font-weight: bold;
-}
-
-@font-face {
- font-family: "robotocondensed";
- /* TODO webcomponent.js bug fixed in 0.6 */
- src: url("RobotoCondensed-Regular-webfont.woff") format("woff"), url("panels/demo/RobotoCondensed-Regular-webfont.woff") format("woff");
-}
-
-@font-face {
- font-family: "robotocondensed";
- /* TODO webcomponent.js bug fixed in 0.6 */
- src: url("RobotoCondensed-Bold-webfont.woff") format("woff"), url("panels/demo/RobotoCondensed-Bold-webfont.woff") format("woff");
- font-weight: bold;
-}
-
-or-console-frontend {
- font-family: robotoregular, sans-serif;
- background-color: white;
- color: #333333;
-}
-
-or-console-frontend /deep/ core-drawer-panel core-header-panel {
- background-color: #374C4F;
- color: white;
-}
-
-or-console-frontend /deep/ core-drawer-panel core-toolbar {
- font-family: robotocondensed, sans-serif;
- background-color: #C0D62E;
- color: #333333;
-}
-
-or-console-frontend /deep/ .menu .panelItem {
-}
-
-or-console-frontend /deep/ .menu .groupItem {
-}
-
-or-console-frontend /deep/ .menu .screenItem {
-}
-
-or-console-frontend /deep/ .menu .selected {
- color: #C0D62E;
- font-weight: bold;
-}
-
-or-console-frontend /deep/ paper-tabs {
- font-family: robotoregular, sans-serif;
- font-weight: bold;
- background-color: #F2F2F2;
- color: #666666;
-}
-
-or-console-frontend /deep/ paper-tabs::shadow #selectionBar {
- background-color: #C0D62E;
-}
-
-or-console-frontend /deep/ paper-tabs paper-tab::shadow #ink {
- color: #C0D62E;
-}
-
-or-console-frontend /deep/ .screens {
- font-family: robotoregular, sans-serif;
- background-color: white;
- color: black;
-}
-
-or-console-frontend /deep/ .unfocused-underline {
- background-color: #cccccc;
- height: 2px;
-}
-
-or-console-frontend /deep/ .focused-underline {
- background-color: #C0D62E;
- height: 2px;
-}
-
-or-console-frontend /deep/ paper-ripple {
- color: #C0D62E;
-}
-
-or-console-frontend /deep/ paper-slider::shadow #sliderBar::shadow #activeProgress {
- background-color: #C0D62E;
-}
-
-or-console-frontend /deep/ paper-slider::shadow #sliderKnobInner {
- background-color: #C0D62E;
-}
-
-or-console-frontend /deep/ paper-slider::shadow .ring > #sliderKnob > #sliderKnobInner {
- border-color: #C0D62E;
- background-color: #C0D62E;
-}
-
-or-console-frontend /deep/ paper-slider::shadow #sliderKnobInner::before {
- background-color: #333333;
-}
-
-or-console-frontend /deep/ paper-slider::shadow #sliderKnob > #sliderKnobInner::after {
- color: white;
-}
-
-or-console-frontend /deep/ paper-slider::shadow #sliderBar::shadow #progressContainer {
- background-color: #374C4F;
-}
-
-or-console-frontend /deep/ paper-slider::shadow paper-input::shadow paper-input-decorator {
- padding: 0.5em 0;
-}
-
-or-console-frontend /deep/ paper-slider::shadow /deep/ .unfocused-underline {
- display: none;
-}
-
-or-console-frontend /deep/ paper-toggle-button::shadow .toggle-bar {
- background-color: black;
-}
-
-or-console-frontend /deep/ paper-toggle-button::shadow .toggle-button {
- background-color: #666666;
-}
-
-or-console-frontend /deep/ paper-toggle-button::shadow [checked] .toggle-bar {
- background-color: black;
-}
-
-or-console-frontend /deep/ paper-toggle-button::shadow [checked] .toggle-button {
- background-color: #C0D62E;
-}
-
-or-console-frontend /deep/ paper-toggle-button::shadow .toggle-ink {
- color: #C0D62E;
-}
-
-or-console-frontend /deep/ paper-toggle-button::shadow [checked] .toggle-ink {
- color: #374C4F;
-}
-
-or-console-frontend /deep/ paper-radio-button::shadow #onRadio {
- background-color: #C0D62E;
-}
-
-or-console-frontend /deep/ paper-radio-button[checked]::shadow #offRadio {
- border-color: #C0D62E;
- background-color: white;
-}
-
-or-console-frontend /deep/ paper-radio-button::shadow #offRadio {
- border-color: #333333;
- background-color: white;
-}
-
-or-console-frontend /deep/ paper-radio-button::shadow #ink[checked] {
- color: #C0D62E;
-}
-
-or-console-frontend /deep/ paper-radio-button::shadow #ink {
- color: #374C4F;
-}
-
-or-console-frontend /deep/ paper-checkbox::shadow #ink[checked] {
- color: #C0D62E;
-}
-
-or-console-frontend /deep/ paper-checkbox::shadow #checkbox.checked {
- background-color: #C0D62E;
- border-color: #C0D62E;
-}
-
-or-console-frontend /deep/ paper-checkbox::shadow #checkbox {
- border-color: #333333;
-}
-
-or-console-frontend /deep/ paper-checkbox::shadow #ink {
- color: #374C4F;
-}
-
-or-console-frontend /deep/ or-console-label::shadow .on {
- color: #C0D62E;
-}
-
-or-console-frontend /deep/ or-console-label::shadow .off {
- color: #374C4F;
-}
-
-or-console-frontend /deep/ .box {
- height: 100%;
-}
-
-or-console-frontend /deep/ .box.border {
- border: 1px solid #666666;
-}
-
-or-console-frontend /deep/ .box.solid {
- background-color: #CCCCCC;
-}
-
-
diff --git a/or-shell/android/src/main/assets/images/panel/ventilation.png b/or-shell/android/src/main/assets/images/panel/ventilation.png
deleted file mode 100644
index 68f4b4539..000000000
Binary files a/or-shell/android/src/main/assets/images/panel/ventilation.png and /dev/null differ
diff --git a/or-shell/android/src/main/assets/index.html b/or-shell/android/src/main/assets/index.html
deleted file mode 100644
index cd0648617..000000000
--- a/or-shell/android/src/main/assets/index.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!doctype html>
-
-<html>
-<head>
-
- <title>Blok 61</title>
-
- <meta charset="utf-8">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="mobile-web-app-capable" content="yes">
-
- <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
- <script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
-
- <link rel="import" href="src/openremote-app.html">
- <style>
- html{
- height:100%;
- background: url(images/bg-image.jpg) no-repeat center center fixed;
- -webkit-background-size: cover;
- -moz-background-size: cover;
- -o-background-size: cover;
- background-size: cover;
- }
- body {
- height:100%;
- font-family: 'Roboto', sans-serif;
- margin: 0;
- }
- input,
- textarea,
- button,
- select,
- a {
- -webkit-tap-highlight-color: rgba(0,0,0,0);
- }
- .paper-toggle-button-0[checked]:not([disabled]) .toggle-bar.paper-toggle-button{
- opacity: 1;
- }
- </style>
-
-</head>
-<body>
- <openremote-app></openremote-app>
-</body>
-</html>
\ No newline at end of file
diff --git a/or-shell/android/src/main/assets/manifest.json b/or-shell/android/src/main/assets/manifest.json
deleted file mode 100644
index d7290e51e..000000000
--- a/or-shell/android/src/main/assets/manifest.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "Blok61",
- "short_name": "Blok61",
- "start_url": "/",
- "display": "standalone"
-}
diff --git a/or-shell/android/src/main/assets/service-worker.js b/or-shell/android/src/main/assets/service-worker.js
deleted file mode 100644
index 1aaae088f..000000000
--- a/or-shell/android/src/main/assets/service-worker.js
+++ /dev/null
@@ -1,258 +0,0 @@
-/**
- * Copyright 2016 Google Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// This generated service worker JavaScript will precache your site's resources.
-// The code needs to be saved in a .js file at the top-level of your site, and registered
-// from your pages in order to be used. See
-// https://github.com/googlechrome/sw-precache/blob/master/demo/app/js/service-worker-registration.js
-// for an example of how you can register this script and handle various service worker events.
-
-/* eslint-env worker, serviceworker */
-/* eslint-disable indent, no-unused-vars, no-multiple-empty-lines, max-nested-callbacks, space-before-function-paren */
-'use strict';
-
-
-
-
-
-/* eslint-disable quotes, comma-spacing */
-var PrecacheConfig = [["/index.html","19125a7faf09955f10304d7aab5a291e"]];
-/* eslint-enable quotes, comma-spacing */
-var CacheNamePrefix = 'sw-precache-v1--' + (self.registration ? self.registration.scope : '') + '-';
-
-
-var IgnoreUrlParametersMatching = [/^utm_/];
-
-
-
-var addDirectoryIndex = function (originalUrl, index) {
- var url = new URL(originalUrl);
- if (url.pathname.slice(-1) === '/') {
- url.pathname += index;
- }
- return url.toString();
- };
-
-var getCacheBustedUrl = function (url, param) {
- param = param || Date.now();
-
- var urlWithCacheBusting = new URL(url);
- urlWithCacheBusting.search += (urlWithCacheBusting.search ? '&' : '') +
- 'sw-precache=' + param;
-
- return urlWithCacheBusting.toString();
- };
-
-var isPathWhitelisted = function (whitelist, absoluteUrlString) {
- // If the whitelist is empty, then consider all URLs to be whitelisted.
- if (whitelist.length === 0) {
- return true;
- }
-
- // Otherwise compare each path regex to the path of the URL passed in.
- var path = (new URL(absoluteUrlString)).pathname;
- return whitelist.some(function(whitelistedPathRegex) {
- return path.match(whitelistedPathRegex);
- });
- };
-
-var populateCurrentCacheNames = function (precacheConfig,
- cacheNamePrefix, baseUrl) {
- var absoluteUrlToCacheName = {};
- var currentCacheNamesToAbsoluteUrl = {};
-
- precacheConfig.forEach(function(cacheOption) {
- var absoluteUrl = new URL(cacheOption[0], baseUrl).toString();
- var cacheName = cacheNamePrefix + absoluteUrl + '-' + cacheOption[1];
- currentCacheNamesToAbsoluteUrl[cacheName] = absoluteUrl;
- absoluteUrlToCacheName[absoluteUrl] = cacheName;
- });
-
- return {
- absoluteUrlToCacheName: absoluteUrlToCacheName,
- currentCacheNamesToAbsoluteUrl: currentCacheNamesToAbsoluteUrl
- };
- };
-
-var stripIgnoredUrlParameters = function (originalUrl,
- ignoreUrlParametersMatching) {
- var url = new URL(originalUrl);
-
- url.search = url.search.slice(1) // Exclude initial '?'
- .split('&') // Split into an array of 'key=value' strings
- .map(function(kv) {
- return kv.split('='); // Split each 'key=value' string into a [key, value] array
- })
- .filter(function(kv) {
- return ignoreUrlParametersMatching.every(function(ignoredRegex) {
- return !ignoredRegex.test(kv[0]); // Return true iff the key doesn't match any of the regexes.
- });
- })
- .map(function(kv) {
- return kv.join('='); // Join each [key, value] array into a 'key=value' string
- })
- .join('&'); // Join the array of 'key=value' strings into a string with '&' in between each
-
- return url.toString();
- };
-
-
-var mappings = populateCurrentCacheNames(PrecacheConfig, CacheNamePrefix, self.location);
-var AbsoluteUrlToCacheName = mappings.absoluteUrlToCacheName;
-var CurrentCacheNamesToAbsoluteUrl = mappings.currentCacheNamesToAbsoluteUrl;
-
-function deleteAllCaches() {
- return caches.keys().then(function(cacheNames) {
- return Promise.all(
- cacheNames.map(function(cacheName) {
- return caches.delete(cacheName);
- })
- );
- });
-}
-
-self.addEventListener('install', function(event) {
- event.waitUntil(
- // Take a look at each of the cache names we expect for this version.
- Promise.all(Object.keys(CurrentCacheNamesToAbsoluteUrl).map(function(cacheName) {
- return caches.open(cacheName).then(function(cache) {
- // Get a list of all the entries in the specific named cache.
- // For caches that are already populated for a given version of a
- // resource, there should be 1 entry.
- return cache.keys().then(function(keys) {
- // If there are 0 entries, either because this is a brand new version
- // of a resource or because the install step was interrupted the
- // last time it ran, then we need to populate the cache.
- if (keys.length === 0) {
- // Use the last bit of the cache name, which contains the hash,
- // as the cache-busting parameter.
- // See https://github.com/GoogleChrome/sw-precache/issues/100
- var cacheBustParam = cacheName.split('-').pop();
- var urlWithCacheBusting = getCacheBustedUrl(
- CurrentCacheNamesToAbsoluteUrl[cacheName], cacheBustParam);
-
- var request = new Request(urlWithCacheBusting,
- {credentials: 'same-origin'});
- return fetch(request).then(function(response) {
- if (response.ok) {
- return cache.put(CurrentCacheNamesToAbsoluteUrl[cacheName],
- response);
- }
-
- console.error('Request for %s returned a response status %d, ' +
- 'so not attempting to cache it.',
- urlWithCacheBusting, response.status);
- // Get rid of the empty cache if we can't add a successful response to it.
- return caches.delete(cacheName);
- });
- }
- });
- });
- })).then(function() {
- return caches.keys().then(function(allCacheNames) {
- return Promise.all(allCacheNames.filter(function(cacheName) {
- return cacheName.indexOf(CacheNamePrefix) === 0 &&
- !(cacheName in CurrentCacheNamesToAbsoluteUrl);
- }).map(function(cacheName) {
- return caches.delete(cacheName);
- })
- );
- });
- }).then(function() {
- if (typeof self.skipWaiting === 'function') {
- // Force the SW to transition from installing -> active state
- self.skipWaiting();
- }
- })
- );
-});
-
-if (self.clients && (typeof self.clients.claim === 'function')) {
- self.addEventListener('activate', function(event) {
- event.waitUntil(self.clients.claim());
- });
-}
-
-self.addEventListener('message', function(event) {
- if (event.data.command === 'delete_all') {
- console.log('About to delete all caches...');
- deleteAllCaches().then(function() {
- console.log('Caches deleted.');
- event.ports[0].postMessage({
- error: null
- });
- }).catch(function(error) {
- console.log('Caches not deleted:', error);
- event.ports[0].postMessage({
- error: error
- });
- });
- }
-});
-
-
-self.addEventListener('fetch', function(event) {
- if (event.request.method === 'GET') {
- var urlWithoutIgnoredParameters = stripIgnoredUrlParameters(event.request.url,
- IgnoreUrlParametersMatching);
-
- var cacheName = AbsoluteUrlToCacheName[urlWithoutIgnoredParameters];
- var directoryIndex = 'index.html';
- if (!cacheName && directoryIndex) {
- urlWithoutIgnoredParameters = addDirectoryIndex(urlWithoutIgnoredParameters, directoryIndex);
- cacheName = AbsoluteUrlToCacheName[urlWithoutIgnoredParameters];
- }
-
- var navigateFallback = '';
- // Ideally, this would check for event.request.mode === 'navigate', but that is not widely
- // supported yet:
- // https://code.google.com/p/chromium/issues/detail?id=540967
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1209081
- if (!cacheName && navigateFallback && event.request.headers.has('accept') &&
- event.request.headers.get('accept').includes('text/html') &&
- /* eslint-disable quotes, comma-spacing */
- isPathWhitelisted([], event.request.url)) {
- /* eslint-enable quotes, comma-spacing */
- var navigateFallbackUrl = new URL(navigateFallback, self.location);
- cacheName = AbsoluteUrlToCacheName[navigateFallbackUrl.toString()];
- }
-
- if (cacheName) {
- event.respondWith(
- // Rely on the fact that each cache we manage should only have one entry, and return that.
- caches.open(cacheName).then(function(cache) {
- return cache.keys().then(function(keys) {
- return cache.match(keys[0]).then(function(response) {
- if (response) {
- return response;
- }
- // If for some reason the response was deleted from the cache,
- // raise and exception and fall back to the fetch() triggered in the catch().
- throw Error('The cache ' + cacheName + ' is empty.');
- });
- });
- }).catch(function(e) {
- console.warn('Couldn\'t serve response for "%s" from cache: %O', event.request.url, e);
- return fetch(event.request);
- })
- );
- }
- }
-});
-
-
-
-