redeyed-jekyll-theme 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +52 -0
- data/_config.yml +328 -0
- data/_data/assets/cross-origin.yml +65 -0
- data/_data/assets/self-host.yml +51 -0
- data/_data/authors.yml +12 -0
- data/_data/contact.yml +16 -0
- data/_data/locale/en.yml +78 -0
- data/_data/share.yml +16 -0
- data/_includes/back-to-top.html +2 -0
- data/_includes/breadcrumbs.html +1 -0
- data/_includes/comments.html +0 -0
- data/_includes/copyright.html +1 -0
- data/_includes/datetime.html +0 -0
- data/_includes/favicons.html +14 -0
- data/_includes/footer.html +1 -0
- data/_includes/ga-site-tag.html +8 -0
- data/_includes/google-tags-body.html +4 -0
- data/_includes/google-tags-head.html +6 -0
- data/_includes/head.html +72 -0
- data/_includes/header-banner.html +1 -0
- data/_includes/header-wide.html +1 -0
- data/_includes/header.html +1 -0
- data/_includes/javascript.html +89 -0
- data/_includes/jsdelivr-combine.html +18 -0
- data/_includes/lang.html +6 -0
- data/_includes/mermaid.html +1 -0
- data/_includes/mode-toggle.html +138 -0
- data/_includes/navbar.html +6 -0
- data/_includes/no-linenos.html +0 -0
- data/_includes/options.html +13 -0
- data/_includes/pagination.html +0 -0
- data/_includes/panel-bottom.html +1 -0
- data/_includes/panel-foot-2.html +1 -0
- data/_includes/panel-foot-3.html +1 -0
- data/_includes/panel-foot-4.html +1 -0
- data/_includes/panel-foot-full.html +1 -0
- data/_includes/panel-top-2.html +1 -0
- data/_includes/panel-top-3.html +1 -0
- data/_includes/panel-top-4.html +1 -0
- data/_includes/panel-top-full.html +1 -0
- data/_includes/post-nav.html +0 -0
- data/_includes/post-share.html +0 -0
- data/_includes/readtime.html +0 -0
- data/_includes/related-posts.html +0 -0
- data/_includes/search-loader.html +46 -0
- data/_includes/search-results.html +1 -0
- data/_includes/sidebar.html +0 -0
- data/_includes/toc.html +0 -0
- data/_javascript/common/back-to-top.js +20 -0
- data/_javascript/common/mode-toggle.js +13 -0
- data/_javascript/common/scroll-helper.js +36 -0
- data/_javascript/common/search-display.js +129 -0
- data/_javascript/common/sidebar.js +30 -0
- data/_javascript/common/tooltip-loader.js +6 -0
- data/_javascript/common/topbar-switcher.js +90 -0
- data/_javascript/common/topbar-title.js +67 -0
- data/_javascript/utils/category-collapse.js +30 -0
- data/_javascript/utils/checkbox.js +12 -0
- data/_javascript/utils/clipboard.js +133 -0
- data/_javascript/utils/img-extra.js +47 -0
- data/_javascript/utils/locale-datetime.js +45 -0
- data/_javascript/utils/pageviews.js +250 -0
- data/_javascript/utils/smooth-scroll.js +96 -0
- data/_layouts/archive.html +0 -0
- data/_layouts/categories.html +0 -0
- data/_layouts/category.html +0 -0
- data/_layouts/compress.html +10 -0
- data/_layouts/default.html +5 -0
- data/_layouts/page.html +5 -0
- data/_layouts/panel-both.html +14 -0
- data/_layouts/panel-left.html +14 -0
- data/_layouts/panel-none.html +81 -0
- data/_layouts/panel-right.html +14 -0
- data/_layouts/post.html +5 -0
- data/_layouts/tag.html +0 -0
- data/_layouts/tags.html +0 -0
- data/_sass/addon/common.scss +1630 -0
- data/_sass/addon/mixins.scss +144 -0
- data/_sass/addon/syntax.scss +0 -0
- data/_sass/addon/variables.scss +31 -0
- data/_sass/colors/brew-scheme.scss +7 -0
- data/_sass/colors/dark-scheme.scss +21 -0
- data/_sass/colors/dark-syntax.scss +88 -0
- data/_sass/colors/light-scheme.scss +7 -0
- data/_sass/colors/light-syntax.scss +84 -0
- data/_sass/layout/page.scss +0 -0
- data/_sass/layout/panel-both.scss +0 -0
- data/_sass/layout/panel-left.scss +0 -0
- data/_sass/layout/panel-none.scss +146 -0
- data/_sass/layout/panel-right.scss +0 -0
- data/_sass/layout/post.scss +0 -0
- data/_sass/redeyed-jekyll-theme.scss +26 -0
- data/_sass/variables-hook.scss +0 -0
- data/assets/css/style.scss +8 -0
- data/assets/img/d20R/d20R-128.png +0 -0
- data/assets/img/d20R/d20R-16.png +0 -0
- data/assets/img/d20R/d20R-200.png +0 -0
- data/assets/img/d20R/d20R-240.png +0 -0
- data/assets/img/d20R/d20R-32.png +0 -0
- data/assets/img/d20R/d20R-320.png +0 -0
- data/assets/img/d20R/d20R-48.png +0 -0
- data/assets/img/d20R/d20R-500.png +0 -0
- data/assets/img/d20R/d20R-600.png +0 -0
- data/assets/img/d20R/d20R-64.png +0 -0
- data/assets/img/d20R/d20R.svg +98 -0
- data/assets/img/d20RB/d20RB-128.png +0 -0
- data/assets/img/d20RB/d20RB-16.png +0 -0
- data/assets/img/d20RB/d20RB-200.png +0 -0
- data/assets/img/d20RB/d20RB-240.png +0 -0
- data/assets/img/d20RB/d20RB-32.png +0 -0
- data/assets/img/d20RB/d20RB-320.png +0 -0
- data/assets/img/d20RB/d20RB-48.png +0 -0
- data/assets/img/d20RB/d20RB-500.png +0 -0
- data/assets/img/d20RB/d20RB-600.png +0 -0
- data/assets/img/d20RB/d20RB-64.png +0 -0
- data/assets/img/d20RB/d20RB.svg +103 -0
- data/assets/img/favicons/android-chrome-192x192.png +0 -0
- data/assets/img/favicons/android-chrome-512x512.png +0 -0
- data/assets/img/favicons/apple-touch-icon.png +0 -0
- data/assets/img/favicons/browserconfig.xml +12 -0
- data/assets/img/favicons/favicon-16x16.png +0 -0
- data/assets/img/favicons/favicon-32x32.png +0 -0
- data/assets/img/favicons/favicon.ico +0 -0
- data/assets/img/favicons/mstile-150x150.png +0 -0
- data/assets/img/favicons/mstile-310x150.png +0 -0
- data/assets/img/favicons/mstile-310x310.png +0 -0
- data/assets/img/favicons/mstile-70x70.png +0 -0
- data/assets/img/favicons/safari-pinned-tab.svg +112 -0
- data/assets/img/favicons/site.webmanifest +19 -0
- data/assets/js/data/search.json +19 -0
- data/assets/js/data/swcache.js +54 -0
- data/assets/js/fetch.js +458 -0
- data/assets/js/pwa/app.js +47 -0
- data/assets/js/pwa/sw.js +89 -0
- data/assets/js/pwa/unregister.js +12 -0
- data/src/404.html +10 -0
- data/src/favicon.ico +0 -0
- data/src/feed.xml +61 -0
- data/src/index.md +22 -0
- data/src/robots.txt +10 -0
- data/src/style/html.md +7 -0
- data/src/style/index.md +11 -0
- data/src/style/markdown.md +108 -0
- metadata +375 -0
data/assets/js/fetch.js
ADDED
@@ -0,0 +1,458 @@
|
|
1
|
+
(function(self) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
if (self.fetch) {
|
5
|
+
return
|
6
|
+
}
|
7
|
+
|
8
|
+
var support = {
|
9
|
+
searchParams: 'URLSearchParams' in self,
|
10
|
+
iterable: 'Symbol' in self && 'iterator' in Symbol,
|
11
|
+
blob: 'FileReader' in self && 'Blob' in self && (function() {
|
12
|
+
try {
|
13
|
+
new Blob()
|
14
|
+
return true
|
15
|
+
} catch(e) {
|
16
|
+
return false
|
17
|
+
}
|
18
|
+
})(),
|
19
|
+
formData: 'FormData' in self,
|
20
|
+
arrayBuffer: 'ArrayBuffer' in self
|
21
|
+
}
|
22
|
+
|
23
|
+
if (support.arrayBuffer) {
|
24
|
+
var viewClasses = [
|
25
|
+
'[object Int8Array]',
|
26
|
+
'[object Uint8Array]',
|
27
|
+
'[object Uint8ClampedArray]',
|
28
|
+
'[object Int16Array]',
|
29
|
+
'[object Uint16Array]',
|
30
|
+
'[object Int32Array]',
|
31
|
+
'[object Uint32Array]',
|
32
|
+
'[object Float32Array]',
|
33
|
+
'[object Float64Array]'
|
34
|
+
]
|
35
|
+
|
36
|
+
var isDataView = function(obj) {
|
37
|
+
return obj && DataView.prototype.isPrototypeOf(obj)
|
38
|
+
}
|
39
|
+
|
40
|
+
var isArrayBufferView = ArrayBuffer.isView || function(obj) {
|
41
|
+
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
function normalizeName(name) {
|
46
|
+
if (typeof name !== 'string') {
|
47
|
+
name = String(name)
|
48
|
+
}
|
49
|
+
if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
|
50
|
+
throw new TypeError('Invalid character in header field name')
|
51
|
+
}
|
52
|
+
return name.toLowerCase()
|
53
|
+
}
|
54
|
+
|
55
|
+
function normalizeValue(value) {
|
56
|
+
if (typeof value !== 'string') {
|
57
|
+
value = String(value)
|
58
|
+
}
|
59
|
+
return value
|
60
|
+
}
|
61
|
+
|
62
|
+
// Build a destructive iterator for the value list
|
63
|
+
function iteratorFor(items) {
|
64
|
+
var iterator = {
|
65
|
+
next: function() {
|
66
|
+
var value = items.shift()
|
67
|
+
return {done: value === undefined, value: value}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
if (support.iterable) {
|
72
|
+
iterator[Symbol.iterator] = function() {
|
73
|
+
return iterator
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
return iterator
|
78
|
+
}
|
79
|
+
|
80
|
+
function Headers(headers) {
|
81
|
+
this.map = {}
|
82
|
+
|
83
|
+
if (headers instanceof Headers) {
|
84
|
+
headers.forEach(function(value, name) {
|
85
|
+
this.append(name, value)
|
86
|
+
}, this)
|
87
|
+
|
88
|
+
} else if (headers) {
|
89
|
+
Object.getOwnPropertyNames(headers).forEach(function(name) {
|
90
|
+
this.append(name, headers[name])
|
91
|
+
}, this)
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
Headers.prototype.append = function(name, value) {
|
96
|
+
name = normalizeName(name)
|
97
|
+
value = normalizeValue(value)
|
98
|
+
var oldValue = this.map[name]
|
99
|
+
this.map[name] = oldValue ? oldValue+','+value : value
|
100
|
+
}
|
101
|
+
|
102
|
+
Headers.prototype['delete'] = function(name) {
|
103
|
+
delete this.map[normalizeName(name)]
|
104
|
+
}
|
105
|
+
|
106
|
+
Headers.prototype.get = function(name) {
|
107
|
+
name = normalizeName(name)
|
108
|
+
return this.has(name) ? this.map[name] : null
|
109
|
+
}
|
110
|
+
|
111
|
+
Headers.prototype.has = function(name) {
|
112
|
+
return this.map.hasOwnProperty(normalizeName(name))
|
113
|
+
}
|
114
|
+
|
115
|
+
Headers.prototype.set = function(name, value) {
|
116
|
+
this.map[normalizeName(name)] = normalizeValue(value)
|
117
|
+
}
|
118
|
+
|
119
|
+
Headers.prototype.forEach = function(callback, thisArg) {
|
120
|
+
for (var name in this.map) {
|
121
|
+
if (this.map.hasOwnProperty(name)) {
|
122
|
+
callback.call(thisArg, this.map[name], name, this)
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
|
127
|
+
Headers.prototype.keys = function() {
|
128
|
+
var items = []
|
129
|
+
this.forEach(function(value, name) { items.push(name) })
|
130
|
+
return iteratorFor(items)
|
131
|
+
}
|
132
|
+
|
133
|
+
Headers.prototype.values = function() {
|
134
|
+
var items = []
|
135
|
+
this.forEach(function(value) { items.push(value) })
|
136
|
+
return iteratorFor(items)
|
137
|
+
}
|
138
|
+
|
139
|
+
Headers.prototype.entries = function() {
|
140
|
+
var items = []
|
141
|
+
this.forEach(function(value, name) { items.push([name, value]) })
|
142
|
+
return iteratorFor(items)
|
143
|
+
}
|
144
|
+
|
145
|
+
if (support.iterable) {
|
146
|
+
Headers.prototype[Symbol.iterator] = Headers.prototype.entries
|
147
|
+
}
|
148
|
+
|
149
|
+
function consumed(body) {
|
150
|
+
if (body.bodyUsed) {
|
151
|
+
return Promise.reject(new TypeError('Already read'))
|
152
|
+
}
|
153
|
+
body.bodyUsed = true
|
154
|
+
}
|
155
|
+
|
156
|
+
function fileReaderReady(reader) {
|
157
|
+
return new Promise(function(resolve, reject) {
|
158
|
+
reader.onload = function() {
|
159
|
+
resolve(reader.result)
|
160
|
+
}
|
161
|
+
reader.onerror = function() {
|
162
|
+
reject(reader.error)
|
163
|
+
}
|
164
|
+
})
|
165
|
+
}
|
166
|
+
|
167
|
+
function readBlobAsArrayBuffer(blob) {
|
168
|
+
var reader = new FileReader()
|
169
|
+
var promise = fileReaderReady(reader)
|
170
|
+
reader.readAsArrayBuffer(blob)
|
171
|
+
return promise
|
172
|
+
}
|
173
|
+
|
174
|
+
function readBlobAsText(blob) {
|
175
|
+
var reader = new FileReader()
|
176
|
+
var promise = fileReaderReady(reader)
|
177
|
+
reader.readAsText(blob)
|
178
|
+
return promise
|
179
|
+
}
|
180
|
+
|
181
|
+
function readArrayBufferAsText(buf) {
|
182
|
+
var view = new Uint8Array(buf)
|
183
|
+
var chars = new Array(view.length)
|
184
|
+
|
185
|
+
for (var i = 0; i < view.length; i++) {
|
186
|
+
chars[i] = String.fromCharCode(view[i])
|
187
|
+
}
|
188
|
+
return chars.join('')
|
189
|
+
}
|
190
|
+
|
191
|
+
function bufferClone(buf) {
|
192
|
+
if (buf.slice) {
|
193
|
+
return buf.slice(0)
|
194
|
+
} else {
|
195
|
+
var view = new Uint8Array(buf.byteLength)
|
196
|
+
view.set(new Uint8Array(buf))
|
197
|
+
return view.buffer
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
function Body() {
|
202
|
+
this.bodyUsed = false
|
203
|
+
|
204
|
+
this._initBody = function(body) {
|
205
|
+
this._bodyInit = body
|
206
|
+
if (!body) {
|
207
|
+
this._bodyText = ''
|
208
|
+
} else if (typeof body === 'string') {
|
209
|
+
this._bodyText = body
|
210
|
+
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
|
211
|
+
this._bodyBlob = body
|
212
|
+
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
|
213
|
+
this._bodyFormData = body
|
214
|
+
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
215
|
+
this._bodyText = body.toString()
|
216
|
+
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
|
217
|
+
this._bodyArrayBuffer = bufferClone(body.buffer)
|
218
|
+
// IE 10-11 can't handle a DataView body.
|
219
|
+
this._bodyInit = new Blob([this._bodyArrayBuffer])
|
220
|
+
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
|
221
|
+
this._bodyArrayBuffer = bufferClone(body)
|
222
|
+
} else {
|
223
|
+
throw new Error('unsupported BodyInit type')
|
224
|
+
}
|
225
|
+
|
226
|
+
if (!this.headers.get('content-type')) {
|
227
|
+
if (typeof body === 'string') {
|
228
|
+
this.headers.set('content-type', 'text/plain;charset=UTF-8')
|
229
|
+
} else if (this._bodyBlob && this._bodyBlob.type) {
|
230
|
+
this.headers.set('content-type', this._bodyBlob.type)
|
231
|
+
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
232
|
+
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
237
|
+
if (support.blob) {
|
238
|
+
this.blob = function() {
|
239
|
+
var rejected = consumed(this)
|
240
|
+
if (rejected) {
|
241
|
+
return rejected
|
242
|
+
}
|
243
|
+
|
244
|
+
if (this._bodyBlob) {
|
245
|
+
return Promise.resolve(this._bodyBlob)
|
246
|
+
} else if (this._bodyArrayBuffer) {
|
247
|
+
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
|
248
|
+
} else if (this._bodyFormData) {
|
249
|
+
throw new Error('could not read FormData body as blob')
|
250
|
+
} else {
|
251
|
+
return Promise.resolve(new Blob([this._bodyText]))
|
252
|
+
}
|
253
|
+
}
|
254
|
+
|
255
|
+
this.arrayBuffer = function() {
|
256
|
+
if (this._bodyArrayBuffer) {
|
257
|
+
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
|
258
|
+
} else {
|
259
|
+
return this.blob().then(readBlobAsArrayBuffer)
|
260
|
+
}
|
261
|
+
}
|
262
|
+
}
|
263
|
+
|
264
|
+
this.text = function() {
|
265
|
+
var rejected = consumed(this)
|
266
|
+
if (rejected) {
|
267
|
+
return rejected
|
268
|
+
}
|
269
|
+
|
270
|
+
if (this._bodyBlob) {
|
271
|
+
return readBlobAsText(this._bodyBlob)
|
272
|
+
} else if (this._bodyArrayBuffer) {
|
273
|
+
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
|
274
|
+
} else if (this._bodyFormData) {
|
275
|
+
throw new Error('could not read FormData body as text')
|
276
|
+
} else {
|
277
|
+
return Promise.resolve(this._bodyText)
|
278
|
+
}
|
279
|
+
}
|
280
|
+
|
281
|
+
if (support.formData) {
|
282
|
+
this.formData = function() {
|
283
|
+
return this.text().then(decode)
|
284
|
+
}
|
285
|
+
}
|
286
|
+
|
287
|
+
this.json = function() {
|
288
|
+
return this.text().then(JSON.parse)
|
289
|
+
}
|
290
|
+
|
291
|
+
return this
|
292
|
+
}
|
293
|
+
|
294
|
+
// HTTP methods whose capitalization should be normalized
|
295
|
+
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
|
296
|
+
|
297
|
+
function normalizeMethod(method) {
|
298
|
+
var upcased = method.toUpperCase()
|
299
|
+
return (methods.indexOf(upcased) > -1) ? upcased : method
|
300
|
+
}
|
301
|
+
|
302
|
+
function Request(input, options) {
|
303
|
+
options = options || {}
|
304
|
+
var body = options.body
|
305
|
+
|
306
|
+
if (input instanceof Request) {
|
307
|
+
if (input.bodyUsed) {
|
308
|
+
throw new TypeError('Already read')
|
309
|
+
}
|
310
|
+
this.url = input.url
|
311
|
+
this.credentials = input.credentials
|
312
|
+
if (!options.headers) {
|
313
|
+
this.headers = new Headers(input.headers)
|
314
|
+
}
|
315
|
+
this.method = input.method
|
316
|
+
this.mode = input.mode
|
317
|
+
if (!body && input._bodyInit != null) {
|
318
|
+
body = input._bodyInit
|
319
|
+
input.bodyUsed = true
|
320
|
+
}
|
321
|
+
} else {
|
322
|
+
this.url = String(input)
|
323
|
+
}
|
324
|
+
|
325
|
+
this.credentials = options.credentials || this.credentials || 'omit'
|
326
|
+
if (options.headers || !this.headers) {
|
327
|
+
this.headers = new Headers(options.headers)
|
328
|
+
}
|
329
|
+
this.method = normalizeMethod(options.method || this.method || 'GET')
|
330
|
+
this.mode = options.mode || this.mode || null
|
331
|
+
this.referrer = null
|
332
|
+
|
333
|
+
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
334
|
+
throw new TypeError('Body not allowed for GET or HEAD requests')
|
335
|
+
}
|
336
|
+
this._initBody(body)
|
337
|
+
}
|
338
|
+
|
339
|
+
Request.prototype.clone = function() {
|
340
|
+
return new Request(this, { body: this._bodyInit })
|
341
|
+
}
|
342
|
+
|
343
|
+
function decode(body) {
|
344
|
+
var form = new FormData()
|
345
|
+
body.trim().split('&').forEach(function(bytes) {
|
346
|
+
if (bytes) {
|
347
|
+
var split = bytes.split('=')
|
348
|
+
var name = split.shift().replace(/\+/g, ' ')
|
349
|
+
var value = split.join('=').replace(/\+/g, ' ')
|
350
|
+
form.append(decodeURIComponent(name), decodeURIComponent(value))
|
351
|
+
}
|
352
|
+
})
|
353
|
+
return form
|
354
|
+
}
|
355
|
+
|
356
|
+
function parseHeaders(rawHeaders) {
|
357
|
+
var headers = new Headers()
|
358
|
+
rawHeaders.split(/\r?\n/).forEach(function(line) {
|
359
|
+
var parts = line.split(':')
|
360
|
+
var key = parts.shift().trim()
|
361
|
+
if (key) {
|
362
|
+
var value = parts.join(':').trim()
|
363
|
+
headers.append(key, value)
|
364
|
+
}
|
365
|
+
})
|
366
|
+
return headers
|
367
|
+
}
|
368
|
+
|
369
|
+
Body.call(Request.prototype)
|
370
|
+
|
371
|
+
function Response(bodyInit, options) {
|
372
|
+
if (!options) {
|
373
|
+
options = {}
|
374
|
+
}
|
375
|
+
|
376
|
+
this.type = 'default'
|
377
|
+
this.status = 'status' in options ? options.status : 200
|
378
|
+
this.ok = this.status >= 200 && this.status < 300
|
379
|
+
this.statusText = 'statusText' in options ? options.statusText : 'OK'
|
380
|
+
this.headers = new Headers(options.headers)
|
381
|
+
this.url = options.url || ''
|
382
|
+
this._initBody(bodyInit)
|
383
|
+
}
|
384
|
+
|
385
|
+
Body.call(Response.prototype)
|
386
|
+
|
387
|
+
Response.prototype.clone = function() {
|
388
|
+
return new Response(this._bodyInit, {
|
389
|
+
status: this.status,
|
390
|
+
statusText: this.statusText,
|
391
|
+
headers: new Headers(this.headers),
|
392
|
+
url: this.url
|
393
|
+
})
|
394
|
+
}
|
395
|
+
|
396
|
+
Response.error = function() {
|
397
|
+
var response = new Response(null, {status: 0, statusText: ''})
|
398
|
+
response.type = 'error'
|
399
|
+
return response
|
400
|
+
}
|
401
|
+
|
402
|
+
var redirectStatuses = [301, 302, 303, 307, 308]
|
403
|
+
|
404
|
+
Response.redirect = function(url, status) {
|
405
|
+
if (redirectStatuses.indexOf(status) === -1) {
|
406
|
+
throw new RangeError('Invalid status code')
|
407
|
+
}
|
408
|
+
|
409
|
+
return new Response(null, {status: status, headers: {location: url}})
|
410
|
+
}
|
411
|
+
|
412
|
+
self.Headers = Headers
|
413
|
+
self.Request = Request
|
414
|
+
self.Response = Response
|
415
|
+
|
416
|
+
self.fetch = function(input, init) {
|
417
|
+
return new Promise(function(resolve, reject) {
|
418
|
+
var request = new Request(input, init)
|
419
|
+
var xhr = new XMLHttpRequest()
|
420
|
+
|
421
|
+
xhr.onload = function() {
|
422
|
+
var options = {
|
423
|
+
status: xhr.status,
|
424
|
+
statusText: xhr.statusText,
|
425
|
+
headers: parseHeaders(xhr.getAllResponseHeaders() || '')
|
426
|
+
}
|
427
|
+
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')
|
428
|
+
var body = 'response' in xhr ? xhr.response : xhr.responseText
|
429
|
+
resolve(new Response(body, options))
|
430
|
+
}
|
431
|
+
|
432
|
+
xhr.onerror = function() {
|
433
|
+
reject(new TypeError('Network request failed'))
|
434
|
+
}
|
435
|
+
|
436
|
+
xhr.ontimeout = function() {
|
437
|
+
reject(new TypeError('Network request failed'))
|
438
|
+
}
|
439
|
+
|
440
|
+
xhr.open(request.method, request.url, true)
|
441
|
+
|
442
|
+
if (request.credentials === 'include') {
|
443
|
+
xhr.withCredentials = true
|
444
|
+
}
|
445
|
+
|
446
|
+
if ('responseType' in xhr && support.blob) {
|
447
|
+
xhr.responseType = 'blob'
|
448
|
+
}
|
449
|
+
|
450
|
+
request.headers.forEach(function(value, name) {
|
451
|
+
xhr.setRequestHeader(name, value)
|
452
|
+
})
|
453
|
+
|
454
|
+
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
|
455
|
+
})
|
456
|
+
}
|
457
|
+
self.fetch.polyfill = true
|
458
|
+
})(typeof self !== 'undefined' ? self : this);
|
@@ -0,0 +1,47 @@
|
|
1
|
+
---
|
2
|
+
layout: compress
|
3
|
+
permalink: '/app.js'
|
4
|
+
---
|
5
|
+
|
6
|
+
const $notification = $('#notification');
|
7
|
+
const $btnRefresh = $('#notification .toast-body>button');
|
8
|
+
|
9
|
+
if ('serviceWorker' in navigator) {
|
10
|
+
/* Registering Service Worker */
|
11
|
+
navigator.serviceWorker.register('{{ "/sw.js" | relative_url }}')
|
12
|
+
.then(registration => {
|
13
|
+
|
14
|
+
/* in case the user ignores the notification */
|
15
|
+
if (registration.waiting) {
|
16
|
+
$notification.toast('show');
|
17
|
+
}
|
18
|
+
|
19
|
+
registration.addEventListener('updatefound', () => {
|
20
|
+
registration.installing.addEventListener('statechange', () => {
|
21
|
+
if (registration.waiting) {
|
22
|
+
if (navigator.serviceWorker.controller) {
|
23
|
+
$notification.toast('show');
|
24
|
+
}
|
25
|
+
}
|
26
|
+
});
|
27
|
+
});
|
28
|
+
|
29
|
+
$btnRefresh.click(() => {
|
30
|
+
if (registration.waiting) {
|
31
|
+
registration.waiting.postMessage('SKIP_WAITING');
|
32
|
+
}
|
33
|
+
$notification.toast('hide');
|
34
|
+
});
|
35
|
+
}
|
36
|
+
);
|
37
|
+
|
38
|
+
let refreshing = false;
|
39
|
+
|
40
|
+
/* Detect controller change and refresh all the opened tabs */
|
41
|
+
navigator.serviceWorker.addEventListener('controllerchange', () => {
|
42
|
+
if (!refreshing) {
|
43
|
+
window.location.reload();
|
44
|
+
refreshing = true;
|
45
|
+
}
|
46
|
+
});
|
47
|
+
}
|
data/assets/js/pwa/sw.js
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
---
|
2
|
+
layout: compress
|
3
|
+
permalink: '/sw.js'
|
4
|
+
# PWA service worker
|
5
|
+
---
|
6
|
+
|
7
|
+
self.importScripts('{{ "/assets/js/data/swcache.js" | relative_url }}');
|
8
|
+
|
9
|
+
const cacheName = 'chirpy-{{ "now" | date: "%Y%m%d.%H%M%S" }}';
|
10
|
+
|
11
|
+
function verifyDomain(url) {
|
12
|
+
for (const domain of allowedDomains) {
|
13
|
+
const regex = RegExp(`^http(s)?:\/\/${domain}\/`);
|
14
|
+
if (regex.test(url)) {
|
15
|
+
return true;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
return false;
|
20
|
+
}
|
21
|
+
|
22
|
+
function isExcluded(url) {
|
23
|
+
for (const item of denyUrls) {
|
24
|
+
if (url === item) {
|
25
|
+
return true;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
return false;
|
29
|
+
}
|
30
|
+
|
31
|
+
self.addEventListener('install', event => {
|
32
|
+
event.waitUntil(
|
33
|
+
caches.open(cacheName).then(cache => {
|
34
|
+
return cache.addAll(resource);
|
35
|
+
})
|
36
|
+
);
|
37
|
+
});
|
38
|
+
|
39
|
+
self.addEventListener('activate', event => {
|
40
|
+
event.waitUntil(
|
41
|
+
caches.keys().then(keyList => {
|
42
|
+
return Promise.all(
|
43
|
+
keyList.map(key => {
|
44
|
+
if (key !== cacheName) {
|
45
|
+
return caches.delete(key);
|
46
|
+
}
|
47
|
+
})
|
48
|
+
);
|
49
|
+
})
|
50
|
+
);
|
51
|
+
});
|
52
|
+
|
53
|
+
self.addEventListener('message', (event) => {
|
54
|
+
if (event.data === 'SKIP_WAITING') {
|
55
|
+
self.skipWaiting();
|
56
|
+
}
|
57
|
+
});
|
58
|
+
|
59
|
+
self.addEventListener('fetch', event => {
|
60
|
+
event.respondWith(
|
61
|
+
caches.match(event.request).then(response => {
|
62
|
+
if (response) {
|
63
|
+
return response;
|
64
|
+
}
|
65
|
+
|
66
|
+
return fetch(event.request).then(response => {
|
67
|
+
const url = event.request.url;
|
68
|
+
|
69
|
+
if (event.request.method !== 'GET' ||
|
70
|
+
!verifyDomain(url) ||
|
71
|
+
isExcluded(url)) {
|
72
|
+
return response;
|
73
|
+
}
|
74
|
+
|
75
|
+
/*
|
76
|
+
see: <https://developers.google.com/web/fundamentals/primers/service-workers#cache_and_return_requests>
|
77
|
+
*/
|
78
|
+
let responseToCache = response.clone();
|
79
|
+
|
80
|
+
caches.open(cacheName).then(cache => {
|
81
|
+
/* console.log('[sw] Caching new resource: ' + event.request.url); */
|
82
|
+
cache.put(event.request, responseToCache);
|
83
|
+
});
|
84
|
+
|
85
|
+
return response;
|
86
|
+
});
|
87
|
+
})
|
88
|
+
);
|
89
|
+
});
|
data/src/404.html
ADDED
data/src/favicon.ico
ADDED
Binary file
|
data/src/feed.xml
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
---
|
2
|
+
layout: compress
|
3
|
+
permalink: /feed.xml
|
4
|
+
# Atom Feed, reference: https://validator.w3.org/feed/docs/atom.html
|
5
|
+
---
|
6
|
+
|
7
|
+
{% capture source %}
|
8
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
9
|
+
<id>{{ "/" | absolute_url }}</id>
|
10
|
+
<title>{{ site.title }}</title>
|
11
|
+
<subtitle>{{ site.description }}</subtitle>
|
12
|
+
<updated>{{ site.time | date_to_xmlschema }}</updated>
|
13
|
+
<author>
|
14
|
+
<name>{{ site.social.name }}</name>
|
15
|
+
<uri>{{ "/" | absolute_url }}</uri>
|
16
|
+
</author>
|
17
|
+
<link rel="self" type="application/atom+xml" href="{{ page.url | absolute_url }}"/>
|
18
|
+
<link rel="alternate" type="text/html" hreflang="{{ site.lang }}"
|
19
|
+
href="{{ '/' | absolute_url }}"/>
|
20
|
+
<generator uri="https://jekyllrb.com/" version="{{ jekyll.version }}">Jekyll</generator>
|
21
|
+
<rights> © {{ 'now' | date: '%Y' }} {{ site.social.name }} </rights>
|
22
|
+
<icon>{{ site.baseurl }}/assets/img/favicons/favicon.ico</icon>
|
23
|
+
<logo>{{ site.baseurl }}/assets/img/favicons/favicon-96x96.png</logo>
|
24
|
+
|
25
|
+
{% for post in site.posts limit: 5 %}
|
26
|
+
{% assign post_absolute_url = post.url | absolute_url %}
|
27
|
+
<entry>
|
28
|
+
<title>{{ post.title }}</title>
|
29
|
+
<link href="{{ post_absolute_url }}" rel="alternate" type="text/html" title="{{ post.title }}" />
|
30
|
+
<published>{{ post.date | date_to_xmlschema }}</published>
|
31
|
+
{% if post.last_modified_at %}
|
32
|
+
<updated>{{ post.last_modified_at | date_to_xmlschema }}</updated>
|
33
|
+
{% else %}
|
34
|
+
<updated>{{ post.date | date_to_xmlschema }}</updated>
|
35
|
+
{% endif %}
|
36
|
+
<id>{{ post_absolute_url }}</id>
|
37
|
+
<content src="{{ post_absolute_url }}" />
|
38
|
+
<author>
|
39
|
+
<name>{{ post.author | default: site.social.name }}</name>
|
40
|
+
</author>
|
41
|
+
|
42
|
+
{% if post.categories %}
|
43
|
+
{% for category in post.categories %}
|
44
|
+
<category term="{{ category }}" />
|
45
|
+
{% endfor %}
|
46
|
+
{% endif %}
|
47
|
+
|
48
|
+
{% if post.summary %}
|
49
|
+
<summary>{{ post.summary | strip }}</summary>
|
50
|
+
{% else %}
|
51
|
+
<summary>
|
52
|
+
{% include no-linenos.html content=post.content %}
|
53
|
+
{{ content | strip_html | truncate: 400 }}
|
54
|
+
</summary>
|
55
|
+
{% endif %}
|
56
|
+
|
57
|
+
</entry>
|
58
|
+
{% endfor %}
|
59
|
+
</feed>
|
60
|
+
{% endcapture %}
|
61
|
+
{{ source | replace: '&', '&' }}
|
data/src/index.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
title: Home
|
3
|
+
layout: default
|
4
|
+
---
|
5
|
+
|
6
|
+
# Welcome
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
## Profiler
|
11
|
+
|
12
|
+
| ELEMENT | STYLE |
|
13
|
+
|--------------------------------|--------------------------------------|
|
14
|
+
| jekyll.environment | {{ jekyll.environment }} |
|
15
|
+
| page.layout | {{ page.layout }} |
|
16
|
+
| site.lang | {{ site.lang }} |
|
17
|
+
| site.theme_mode | {{ site.theme_mode }} |
|
18
|
+
| prefer_mode | {{ prefer_mode }} |
|
19
|
+
| ---------------------------- | ---------------------------- |
|
20
|
+
| origin | {{ origin }} |
|
21
|
+
| site.resources.self_hosted | {{ site.resources.self_hosted }} |
|
22
|
+
| site.data.authors.ragdata.name | {{ site.data.authors.ragdata.name }} |
|