...
 
Commits (3)
......@@ -22,6 +22,7 @@
<meta property="twitter:title" content="Open Source Diversity">
<meta property="twitter:description" content="For more diversity &amp; inclusion in free &amp; open source software communities :)">
<meta property="twitter:image" content="img/opensourcediversity-icon.png">
</head>
<body>
<nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-dark">
......@@ -350,5 +351,11 @@
<script src="vendor/jquery-3.2.1.slim.min.js"></script>
<script src="vendor/popper.min.js"></script>
<script src="vendor/bootstrap.min.js"></script>
<script>
if('serviceWorker' in navigator) {
navigator.serviceWorker.register('/service_worker.js')
}
</script>
</body>
</html>
importScripts('vendor/cache-polyfill.js');
const version = "0.6";
const cacheName = `opensourcediversity-${version}`;
self.addEventListener('install', function(e) {
e.waitUntil(
caches.open(cacheName).then(function(cache) {
return cache.addAll([
'/',
'/index.html',
'/css/custom.css',
'/css/Nunito-Bold.ttf',
'/css/Nunito-Regular.ttf',
'/css/OFL.txt',
'/css/custom.css',
'/vendor/bootstrap.min.css',
'/vendor/bootstrap.min.js',
'/vendor/jquery-3.2.1.slim.min.js',
'/vendor/popper.min.js',
'/img/highlight-white-small-left.svg',
'/img/highlight-white-small-right.svg',
'/img/highlight.svg',
'/img/opensourcediversity-icon-margin.svg',
'/img/opensourcediversity-icon-white.svg',
'/img/twitter.svg',
'/img/github.svg',
'/img/irc.svg',
'/img/projects/accessibilitycloud.png',
'/img/projects/chayn.png',
'/img/projects/commonvoice.png',
'/img/projects/contributorcovenant.png',
'/img/projects/diversitytickets.svg',
'/img/projects/doubleunion.png',
'/img/projects/fossjobs.svg',
'/img/projects/fundclub.jpg',
'/img/projects/haeqs.jpg',
'/img/projects/heartofcode.jpg',
'/img/projects/lereset.jpg',
'/img/projects/openheroines.jpg',
'/img/projects/openlabs.jpg',
'/img/projects/opensourcedesign.svg',
'/img/projects/opensourceladies.jpg',
'/img/projects/outreachy.png',
'/img/projects/outspokenwomen.jpg',
'/img/projects/prototypefund.jpg',
'/img/projects/railsgirls.png',
'/img/projects/signdict.svg',
'/img/projects/speakerinnen.jpg',
'/img/projects/supernovaproject.svg',
'/img/projects/upforgrabs.png',
'/img/projects/wheelmap.jpg',
'/img/projects/wikipedia-womeninred.png',
'/img/projects/womenhackfornonprofits.jpg',
'/img/projects/womeninopensource.png',
'/img/projects/writespeakcode.jpg',
'/img/projects/yourfirstpr.png'
]);
})
);
});
self.addEventListener('fetch', event => {
event.respondWith(
caches.open(cacheName)
.then(cache => cache.match(event.request, {ignoreSearch: true}))
.then(response => {
return response || fetch(event.request);
})
);
});
/*
*
* Air Horner
* Copyright 2015 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
*
* https://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
*
*/
if (!Cache.prototype.add) {
Cache.prototype.add = function add(request) {
return this.addAll([request]);
};
}
if (!Cache.prototype.addAll) {
Cache.prototype.addAll = function addAll(requests) {
var cache = this;
// Since DOMExceptions are not constructable:
function NetworkError(message) {
this.name = 'NetworkError';
this.code = 19;
this.message = message;
}
NetworkError.prototype = Object.create(Error.prototype);
return Promise.resolve().then(function() {
if (arguments.length < 1) throw new TypeError();
// Simulate sequence<(Request or USVString)> binding:
var sequence = [];
requests = requests.map(function(request) {
if (request instanceof Request) {
return request;
}
else {
return String(request); // may throw TypeError
}
});
return Promise.all(
requests.map(function(request) {
if (typeof request === 'string') {
request = new Request(request);
}
var scheme = new URL(request.url).protocol;
if (scheme !== 'http:' && scheme !== 'https:') {
throw new NetworkError("Invalid scheme");
}
return fetch(request.clone());
})
);
}).then(function(responses) {
// TODO: check that requests don't overwrite one another
// (don't think this is possible to polyfill due to opaque responses)
return Promise.all(
responses.map(function(response, i) {
return cache.put(requests[i], response);
})
);
}).then(function() {
return undefined;
});
};
}
if (!CacheStorage.prototype.match) {
// This is probably vulnerable to race conditions (removing caches etc)
CacheStorage.prototype.match = function match(request, opts) {
var caches = this;
return this.keys().then(function(cacheNames) {
var match;
return cacheNames.reduce(function(chain, cacheName) {
return chain.then(function() {
return match || caches.open(cacheName).then(function(cache) {
return cache.match(request, opts);
}).then(function(response) {
match = response;
return match;
});
});
}, Promise.resolve());
});
};
}