diff options
| -rw-r--r-- | .jekyll-metadata | bin | 30832 -> 31109 bytes | |||
| -rw-r--r-- | assets/cache-polyfill.js | 102 | ||||
| -rw-r--r-- | assets/site.css | 160 | ||||
| -rw-r--r-- | assets/sw.js | 16 |
4 files changed, 278 insertions, 0 deletions
diff --git a/.jekyll-metadata b/.jekyll-metadata index 3b487d2..558b6e7 100644 --- a/.jekyll-metadata +++ b/.jekyll-metadata | |||
| Binary files differ | |||
diff --git a/assets/cache-polyfill.js b/assets/cache-polyfill.js new file mode 100644 index 0000000..7db3ec0 --- /dev/null +++ b/assets/cache-polyfill.js | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | /** | ||
| 2 | * Copyright 2015 Google Inc. All rights reserved. | ||
| 3 | * | ||
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | * you may not use this file except in compliance with the License. | ||
| 6 | * You may obtain a copy of the License at | ||
| 7 | * | ||
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | * | ||
| 10 | * Unless required by applicable law or agreed to in writing, software | ||
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | * See the License for the specific language governing permissions and | ||
| 14 | * limitations under the License. | ||
| 15 | * | ||
| 16 | */ | ||
| 17 | |||
| 18 | (function () { | ||
| 19 | var nativeAddAll = Cache.prototype.addAll; | ||
| 20 | var userAgent = navigator.userAgent.match(/(Firefox|Chrome)\/(\d+\.)/); | ||
| 21 | |||
| 22 | // Has nice behavior of `var` which everyone hates | ||
| 23 | if (userAgent) { | ||
| 24 | var agent = userAgent[1]; | ||
| 25 | var version = parseInt(userAgent[2]); | ||
| 26 | } | ||
| 27 | |||
| 28 | if ( | ||
| 29 | nativeAddAll && (!userAgent || | ||
| 30 | (agent === 'Firefox' && version >= 46) || | ||
| 31 | (agent === 'Chrome' && version >= 50) | ||
| 32 | ) | ||
| 33 | ) { | ||
| 34 | return; | ||
| 35 | } | ||
| 36 | |||
| 37 | Cache.prototype.addAll = function addAll(requests) { | ||
| 38 | var cache = this; | ||
| 39 | |||
| 40 | // Since DOMExceptions are not constructable: | ||
| 41 | function NetworkError(message) { | ||
| 42 | this.name = 'NetworkError'; | ||
| 43 | this.code = 19; | ||
| 44 | this.message = message; | ||
| 45 | } | ||
| 46 | |||
| 47 | NetworkError.prototype = Object.create(Error.prototype); | ||
| 48 | |||
| 49 | return Promise.resolve().then(function () { | ||
| 50 | if (arguments.length < 1) throw new TypeError(); | ||
| 51 | |||
| 52 | // Simulate sequence<(Request or USVString)> binding: | ||
| 53 | var sequence = []; | ||
| 54 | |||
| 55 | requests = requests.map(function (request) { | ||
| 56 | if (request instanceof Request) { | ||
| 57 | return request; | ||
| 58 | } else { | ||
| 59 | return String(request); // may throw TypeError | ||
| 60 | } | ||
| 61 | }); | ||
| 62 | |||
| 63 | return Promise.all( | ||
| 64 | requests.map(function (request) { | ||
| 65 | if (typeof request === 'string') { | ||
| 66 | request = new Request(request); | ||
| 67 | } | ||
| 68 | |||
| 69 | var scheme = new URL(request.url).protocol; | ||
| 70 | |||
| 71 | if (scheme !== 'http:' && scheme !== 'https:') { | ||
| 72 | throw new NetworkError("Invalid scheme"); | ||
| 73 | } | ||
| 74 | |||
| 75 | return fetch(request.clone()); | ||
| 76 | }) | ||
| 77 | ); | ||
| 78 | }).then(function (responses) { | ||
| 79 | // If some of the responses has not OK-eish status, | ||
| 80 | // then whole operation should reject | ||
| 81 | if (responses.some(function (response) { | ||
| 82 | return !response.ok; | ||
| 83 | })) { | ||
| 84 | throw new NetworkError('Incorrect response status'); | ||
| 85 | } | ||
| 86 | |||
| 87 | // TODO: check that requests don't overwrite one another | ||
| 88 | // (don't think this is possible to polyfill due to opaque responses) | ||
| 89 | return Promise.all( | ||
| 90 | responses.map(function (response, i) { | ||
| 91 | return cache.put(requests[i], response); | ||
| 92 | }) | ||
| 93 | ); | ||
| 94 | }).then(function () { | ||
| 95 | return undefined; | ||
| 96 | }); | ||
| 97 | }; | ||
| 98 | |||
| 99 | Cache.prototype.add = function add(request) { | ||
| 100 | return this.addAll([request]); | ||
| 101 | }; | ||
| 102 | }()); | ||
diff --git a/assets/site.css b/assets/site.css new file mode 100644 index 0000000..1fde938 --- /dev/null +++ b/assets/site.css | |||
| @@ -0,0 +1,160 @@ | |||
| 1 | * { | ||
| 2 | box-sizing: border-box; | ||
| 3 | } | ||
| 4 | |||
| 5 | body { | ||
| 6 | font-family: 'Times New Roman', Times, serif; | ||
| 7 | font-size: 16px; | ||
| 8 | line-height: 1.8; | ||
| 9 | color: #000; | ||
| 10 | margin: 0; | ||
| 11 | padding: 0 0 50px 0; | ||
| 12 | } | ||
| 13 | |||
| 14 | article, | ||
| 15 | main, | ||
| 16 | footer, | ||
| 17 | nav, | ||
| 18 | header { | ||
| 19 | max-width: 700px; | ||
| 20 | margin: 0 auto; | ||
| 21 | } | ||
| 22 | |||
| 23 | header { | ||
| 24 | margin-top: 30px; | ||
| 25 | } | ||
| 26 | |||
| 27 | header a, | ||
| 28 | nav ul li a { | ||
| 29 | text-decoration: none; | ||
| 30 | } | ||
| 31 | |||
| 32 | header a { | ||
| 33 | font-size: 150%; | ||
| 34 | font-weight: 700; | ||
| 35 | color: #000; | ||
| 36 | } | ||
| 37 | |||
| 38 | nav ul { | ||
| 39 | margin-top: 10px; | ||
| 40 | padding: 0; | ||
| 41 | } | ||
| 42 | |||
| 43 | nav ul li { | ||
| 44 | display: inline-block; | ||
| 45 | } | ||
| 46 | |||
| 47 | nav ul li a { | ||
| 48 | color: #444; | ||
| 49 | font-size: 85%; | ||
| 50 | margin-right: 10px; | ||
| 51 | } | ||
| 52 | |||
| 53 | h1 { | ||
| 54 | font-size: 200%; | ||
| 55 | } | ||
| 56 | |||
| 57 | h2 { | ||
| 58 | font-size: 160%; | ||
| 59 | } | ||
| 60 | |||
| 61 | h3 { | ||
| 62 | font-size: 140%; | ||
| 63 | } | ||
| 64 | |||
| 65 | h4 { | ||
| 66 | font-size: 120%; | ||
| 67 | } | ||
| 68 | |||
| 69 | article img { | ||
| 70 | max-width: 100%; | ||
| 71 | display: block; | ||
| 72 | } | ||
| 73 | |||
| 74 | time { | ||
| 75 | display: block; | ||
| 76 | font-size: 85%; | ||
| 77 | color: #444; | ||
| 78 | } | ||
| 79 | |||
| 80 | main ul { | ||
| 81 | margin-top: 30px; | ||
| 82 | padding: 0 20px; | ||
| 83 | list-style-type: square; | ||
| 84 | } | ||
| 85 | |||
| 86 | main ul li { | ||
| 87 | margin-bottom: 10px; | ||
| 88 | } | ||
| 89 | |||
| 90 | main ul div { | ||
| 91 | font-size: 116%; | ||
| 92 | } | ||
| 93 | |||
| 94 | blockquote { | ||
| 95 | margin: 40px 0 40px 20px; | ||
| 96 | border-left: 5px solid #eee; | ||
| 97 | padding: 5px 0 10px 20px; | ||
| 98 | } | ||
| 99 | |||
| 100 | table { | ||
| 101 | border: 2px solid #f1f1f1; | ||
| 102 | width: 100%; | ||
| 103 | border-collapse: collapse; | ||
| 104 | border-spacing: 0; | ||
| 105 | } | ||
| 106 | |||
| 107 | table th, | ||
| 108 | table td { | ||
| 109 | border: 2px solid #f1f1f1; | ||
| 110 | text-align: left; | ||
| 111 | padding: 5px 10px; | ||
| 112 | } | ||
| 113 | |||
| 114 | .highlighter-rouge { | ||
| 115 | padding: 0 15px; | ||
| 116 | font-size: 80%; | ||
| 117 | border: 2px solid #f1f1f1; | ||
| 118 | overflow: auto; | ||
| 119 | } | ||
| 120 | |||
| 121 | .highlighter-rouge table, | ||
| 122 | .highlighter-rouge table td { | ||
| 123 | border: 0 !important; | ||
| 124 | } | ||
| 125 | |||
| 126 | ::selection { | ||
| 127 | background: #ff0; | ||
| 128 | color: #000; | ||
| 129 | } | ||
| 130 | |||
| 131 | ::-moz-selection { | ||
| 132 | background: #ff0; | ||
| 133 | color: #000; | ||
| 134 | } | ||
| 135 | |||
| 136 | @media only screen and (max-width:768px) { | ||
| 137 | body { | ||
| 138 | padding: 0 20px; | ||
| 139 | } | ||
| 140 | footer, | ||
| 141 | header, | ||
| 142 | nav { | ||
| 143 | text-align: center; | ||
| 144 | } | ||
| 145 | .responsive-table { | ||
| 146 | width: 100%; | ||
| 147 | overflow: scroll; | ||
| 148 | } | ||
| 149 | } | ||
| 150 | |||
| 151 | @media print { | ||
| 152 | @page { | ||
| 153 | margin: 2cm; | ||
| 154 | } | ||
| 155 | header, | ||
| 156 | nav, | ||
| 157 | .comments { | ||
| 158 | display: none; | ||
| 159 | } | ||
| 160 | } | ||
diff --git a/assets/sw.js b/assets/sw.js index e69de29..8f285e9 100644 --- a/assets/sw.js +++ b/assets/sw.js | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | importScripts('/assets/cache-polyfill.js'); | ||
| 2 | |||
| 3 | |||
| 4 | self.addEventListener('install', function (e) { | ||
| 5 | e.waitUntil( | ||
| 6 | caches.open('airhorner').then(function (cache) { | ||
| 7 | return cache.addAll([ | ||
| 8 | '/', | ||
| 9 | '/index.html', | ||
| 10 | '/index.html?homescreen=1', | ||
| 11 | '/?homescreen=1', | ||
| 12 | '/assets/site.css', | ||
| 13 | ]); | ||
| 14 | }) | ||
| 15 | ); | ||
| 16 | }); | ||
