jekyll-theme-primcraft 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e900571468f7a18a3efa5d0f3776ec5bc580eee600fc4be65d5ca0ffe9c7dd7
4
- data.tar.gz: 40e156045e1e91b4002182f511e8279b9bb004865e72bfe21da66c96a18b055b
3
+ metadata.gz: 329b7d025e29b6f35186e4bf3a33340ac16f60e4592b4b0f356f712f0bc20827
4
+ data.tar.gz: c0600e720b0c4979df77ac6f93acd48e7718cfb4973640481c29e1fc58a279c4
5
5
  SHA512:
6
- metadata.gz: 13e088a6a5cb59e0047faa6206230a9e76e5c6708b2a86c1fd03e45322c1e277ab20f20a0b4a4c617a27aefacfc899e1a7c48cd373edce54f706b9c818d2e182
7
- data.tar.gz: 46dc4aba6ebfaddb27b902ee34366f162ed200fbdd93924172b3909b53ad2aeb1a1e58ab152e87e1a50263c7f7e0853d18f58a5a9cc9b82d7fcafd92b4dec3a8
6
+ metadata.gz: 4f36ac38745311015b99a9a2bb2e6fc3d909f7dd939c74df08ebec61765945d5ba8982c790942ff49953c523e339e68c4193e3cb5de30b17aa4666bff9e3399f
7
+ data.tar.gz: '0258bea95186aa38d003ebd07fe0fa1b37529aa76d7509f5824b6b0f608e3ae93a54d1ea607ad60787069338db8228645bbb269a213b61834ea148939bb8f5c9'
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html>
2
+ <html lang="{{ page.lang | default: site.lang | default: "en" }}">
3
+
4
+ {%- include head.html -%}
5
+
6
+ <body>
7
+
8
+ {%- include header.html -%}
9
+ <div class="pagetop"></div>
10
+ <div class="container">
11
+ <div class="row">
12
+ <div class="col-12">
13
+ <header class="post-header">
14
+ <h1 class="post-title">{%- include fmi.html datas = page.titles data = page.title -%}</h1>
15
+ </header>
16
+
17
+ {{ content }}
18
+
19
+ <ol class="breadcrumb" id="navigation">
20
+ </ol>
21
+
22
+ <div id="listing"></div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+
27
+ {%- include footer.html -%}
28
+
29
+ <script src="/assets/js/list.js"></script>
30
+
31
+ <script type="text/javascript">
32
+ var S3BL_IGNORE_PATH = true;
33
+ var BUCKET_URL = 'https://primcraftarchive.sfo2.digitaloceanspaces.com';
34
+ var BUCKET_WEBSITE_URL = 'https://primcraftarchive.sfo2.cdn.digitaloceanspaces.com';
35
+ </script>
36
+
37
+ </body>
38
+
39
+ </html>
data/assets/js/list.js ADDED
@@ -0,0 +1,336 @@
1
+ /**
2
+ * Copyright 2012-2016 Rufus Pollock.
3
+ * Licensed under the MIT license
4
+ */
5
+ if (typeof AUTO_TITLE != 'undefined' && AUTO_TITLE == true) {
6
+ document.title = location.hostname;
7
+ }
8
+
9
+ if (typeof S3_REGION != 'undefined') {
10
+ var BUCKET_URL = 'http://' + location.hostname + '.' + S3_REGION + '.amazonaws.com'; // e.g. just 's3' for us-east-1 region
11
+ var BUCKET_WEBSITE_URL = location.protocol + '//' + location.hostname;
12
+ }
13
+
14
+ if (typeof S3BL_IGNORE_PATH == 'undefined' || S3BL_IGNORE_PATH != true) {
15
+ var S3BL_IGNORE_PATH = false;
16
+ }
17
+
18
+ if (typeof BUCKET_URL == 'undefined') {
19
+ var BUCKET_URL = location.protocol + '//' + location.hostname;
20
+ }
21
+
22
+ if (typeof BUCKET_NAME != 'undefined') {
23
+ // if bucket_url does not start with bucket_name,
24
+ // assume path-style url
25
+ if (!~BUCKET_URL.indexOf(location.protocol + '//' + BUCKET_NAME)) {
26
+ BUCKET_URL += '/' + BUCKET_NAME;
27
+ }
28
+ }
29
+
30
+ if (typeof BUCKET_WEBSITE_URL == 'undefined') {
31
+ var BUCKET_WEBSITE_URL = BUCKET_URL;
32
+ }
33
+
34
+ if (typeof S3B_ROOT_DIR == 'undefined') {
35
+ var S3B_ROOT_DIR = '';
36
+ }
37
+
38
+ if (typeof S3B_SORT == 'undefined') {
39
+ var S3B_SORT = 'DEFAULT';
40
+ }
41
+
42
+ if (typeof EXCLUDE_FILE == 'undefined') {
43
+ var EXCLUDE_FILE = [];
44
+ } else if (typeof EXCLUDE_FILE == 'string') {
45
+ var EXCLUDE_FILE = [EXCLUDE_FILE];
46
+ }
47
+
48
+ // https://tc39.github.io/ecma262/#sec-array.prototype.includes
49
+ if (!Array.prototype.includes) {
50
+ Object.defineProperty(Array.prototype, 'includes', {
51
+ value: function(searchElement, fromIndex) {
52
+
53
+ if (this == null) {
54
+ throw new TypeError('"this" is null or not defined');
55
+ }
56
+
57
+ // 1. Let O be ? ToObject(this value).
58
+ var o = Object(this);
59
+
60
+ // 2. Let len be ? ToLength(? Get(O, "length")).
61
+ var len = o.length >>> 0;
62
+
63
+ // 3. If len is 0, return false.
64
+ if (len === 0) {
65
+ return false;
66
+ }
67
+
68
+ // 4. Let n be ? ToInteger(fromIndex).
69
+ // (If fromIndex is undefined, this step produces the value 0.)
70
+ var n = fromIndex | 0;
71
+
72
+ // 5. If n ≥ 0, then
73
+ // a. Let k be n.
74
+ // 6. Else n < 0,
75
+ // a. Let k be len + n.
76
+ // b. If k < 0, let k be 0.
77
+ var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
78
+
79
+ function sameValueZero(x, y) {
80
+ return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y));
81
+ }
82
+
83
+ // 7. Repeat, while k < len
84
+ while (k < len) {
85
+ // a. Let elementK be the result of ? Get(O, ! ToString(k)).
86
+ // b. If SameValueZero(searchElement, elementK) is true, return true.
87
+ if (sameValueZero(o[k], searchElement)) {
88
+ return true;
89
+ }
90
+ // c. Increase k by 1.
91
+ k++;
92
+ }
93
+
94
+ // 8. Return false
95
+ return false;
96
+ }
97
+ });
98
+ }
99
+
100
+ jQuery(function($) { getS3Data(); });
101
+
102
+ // This will sort your file listing by most recently modified.
103
+ // Flip the comparator to '>' if you want oldest files first.
104
+ function sortFunction(a, b) {
105
+ switch (S3B_SORT) {
106
+ case "OLD2NEW":
107
+ return a.LastModified > b.LastModified ? 1 : -1;
108
+ case "NEW2OLD":
109
+ return a.LastModified < b.LastModified ? 1 : -1;
110
+ case "A2Z":
111
+ return a.Key < b.Key ? 1 : -1;
112
+ case "Z2A":
113
+ return a.Key > b.Key ? 1 : -1;
114
+ case "BIG2SMALL":
115
+ return a.Size < b.Size ? 1 : -1;
116
+ case "SMALL2BIG":
117
+ return a.Size > b.Size ? 1 : -1;
118
+ }
119
+ }
120
+
121
+ function getS3Data(marker, html) {
122
+ var s3_rest_url = createS3QueryUrl(marker);
123
+ // set loading notice
124
+ $('#listing')
125
+ .html('<img src="//assets.okfn.org/images/icons/ajaxload-circle.gif" />');
126
+ $.get(s3_rest_url)
127
+ .done(function(data) {
128
+ // clear loading notice
129
+ $('#listing').html('');
130
+ var xml = $(data);
131
+ var info = getInfoFromS3Data(xml);
132
+
133
+ // Slight modification by FuzzBall03
134
+ // This will sort your file listing based on var S3B_SORT
135
+ // See url for example:
136
+ // http://esp-link.s3-website-us-east-1.amazonaws.com/
137
+ if (S3B_SORT != 'DEFAULT') {
138
+ var sortedFiles = info.files;
139
+ sortedFiles.sort(sortFunction);
140
+ info.files = sortedFiles;
141
+ }
142
+
143
+ buildNavigation(info);
144
+
145
+ html = typeof html !== 'undefined' ? html + prepareTable(info) :
146
+ prepareTable(info);
147
+ if (info.nextMarker != "null") {
148
+ getS3Data(info.nextMarker, html);
149
+ } else {
150
+ document.getElementById('listing').innerHTML =
151
+ '<pre>' + html + '</pre>';
152
+ }
153
+ })
154
+ .fail(function(error) {
155
+ console.error(error);
156
+ $('#listing').html('<strong>Error: ' + error + '</strong>');
157
+ });
158
+ }
159
+
160
+ function buildNavigation(info) {
161
+ var root = '<li class="breadcrumb-item"><a href="?prefix=">Root</a></li>'
162
+ // $('#bucket_website_url').html(BUCKET_WEBSITE_URL);
163
+ if (info.prefix) {
164
+ var processedPathSegments = '';
165
+ var content = $.map(info.prefix.split('/'), function(pathSegment) {
166
+ processedPathSegments =
167
+ processedPathSegments + encodeURIComponent(pathSegment) + '/';
168
+ return '<li class="breadcrumb-item"><a href="?prefix=' + processedPathSegments + '">' + pathSegment +
169
+ '</a></li>';
170
+ });
171
+ $('#navigation').html(root + content.join(''));
172
+ } else {
173
+ $('#navigation').html(root);
174
+ }
175
+ }
176
+
177
+ function createS3QueryUrl(marker) {
178
+ var s3_rest_url = BUCKET_URL;
179
+ s3_rest_url += '?delimiter=/';
180
+
181
+ //
182
+ // Handling paths and prefixes:
183
+ //
184
+ // 1. S3BL_IGNORE_PATH = false
185
+ // Uses the pathname
186
+ // {bucket}/{path} => prefix = {path}
187
+ //
188
+ // 2. S3BL_IGNORE_PATH = true
189
+ // Uses ?prefix={prefix}
190
+ //
191
+ // Why both? Because we want classic directory style listing in normal
192
+ // buckets but also allow deploying to non-buckets
193
+ //
194
+
195
+ var rx = '.*[?&]prefix=' + S3B_ROOT_DIR + '([^&]+)(&.*)?$';
196
+ var prefix = '';
197
+ if (S3BL_IGNORE_PATH == false) {
198
+ var prefix = location.pathname.replace(/^\//, S3B_ROOT_DIR);
199
+ }
200
+ var match = location.search.match(rx);
201
+ if (match) {
202
+ prefix = S3B_ROOT_DIR + match[1];
203
+ } else {
204
+ if (S3BL_IGNORE_PATH) {
205
+ var prefix = S3B_ROOT_DIR;
206
+ }
207
+ }
208
+ if (prefix) {
209
+ // make sure we end in /
210
+ var prefix = prefix.replace(/\/$/, '') + '/';
211
+ s3_rest_url += '&prefix=' + prefix;
212
+ }
213
+ if (marker) {
214
+ s3_rest_url += '&marker=' + marker;
215
+ }
216
+ return s3_rest_url;
217
+ }
218
+
219
+ function getInfoFromS3Data(xml) {
220
+ var files = $.map(xml.find('Contents'), function(item) {
221
+ item = $(item);
222
+ // clang-format off
223
+ return {
224
+ Key: item.find('Key').text(),
225
+ LastModified: item.find('LastModified').text(),
226
+ Size: bytesToHumanReadable(item.find('Size').text()),
227
+ Type: 'file'
228
+ }
229
+ // clang-format on
230
+ });
231
+ var directories = $.map(xml.find('CommonPrefixes'), function(item) {
232
+ item = $(item);
233
+ // clang-format off
234
+ return {
235
+ Key: item.find('Prefix').text(),
236
+ LastModified: '',
237
+ Size: '0',
238
+ Type: 'directory'
239
+ }
240
+ // clang-format on
241
+ });
242
+ if ($(xml.find('IsTruncated')[0]).text() == 'true') {
243
+ var nextMarker = $(xml.find('NextMarker')[0]).text();
244
+ } else {
245
+ var nextMarker = null;
246
+ }
247
+ // clang-format off
248
+ return {
249
+ files: files,
250
+ directories: directories,
251
+ prefix: $(xml.find('Prefix')[0]).text(),
252
+ nextMarker: encodeURIComponent(nextMarker)
253
+ }
254
+ // clang-format on
255
+ }
256
+
257
+ // info is object like:
258
+ // {
259
+ // files: ..
260
+ // directories: ..
261
+ // prefix: ...
262
+ // }
263
+ function prepareTable(info) {
264
+ var files = info.directories.concat(info.files), prefix = info.prefix;
265
+ var cols = [45, 30, 15];
266
+ var content = [];
267
+ content.push(padRight('Last Modified', cols[1]) + ' ' +
268
+ padRight('Size', cols[2]) + 'Key \n');
269
+ content.push(new Array(cols[0] + cols[1] + cols[2] + 4).join('-') + '\n');
270
+
271
+ // add ../ at the start of the dir listing, unless we are already at root dir
272
+ if (prefix && prefix !== S3B_ROOT_DIR) {
273
+ var up = prefix.replace(/\/$/, '').split('/').slice(0, -1).concat('').join(
274
+ '/'), // one directory up
275
+ item =
276
+ {
277
+ Key: up,
278
+ LastModified: '',
279
+ Size: '',
280
+ keyText: '../',
281
+ href: S3BL_IGNORE_PATH ? '?prefix=' + up : '../'
282
+ },
283
+ row = renderRow(item, cols);
284
+ content.push(row + '\n');
285
+ }
286
+
287
+ jQuery.each(files, function(idx, item) {
288
+ // strip off the prefix
289
+ item.keyText = item.Key.substring(prefix.length);
290
+ if (item.Type === 'directory') {
291
+ if (S3BL_IGNORE_PATH) {
292
+ item.href = location.protocol + '//' + location.hostname +
293
+ location.pathname + '?prefix=' + item.Key;
294
+ } else {
295
+ item.href = item.keyText;
296
+ }
297
+ } else {
298
+ item.href = BUCKET_WEBSITE_URL + '/' + encodeURIComponent(item.Key);
299
+ item.href = item.href.replace(/%2F/g, '/');
300
+ }
301
+ var row = renderRow(item, cols);
302
+ if (!EXCLUDE_FILE.includes(item.Key))
303
+ content.push(row + '\n');
304
+ });
305
+
306
+ return content.join('');
307
+ }
308
+
309
+ function renderRow(item, cols) {
310
+ var row = '';
311
+ row += padRight(item.LastModified, cols[1]) + ' ';
312
+ row += padRight(item.Size, cols[2]);
313
+ row += '<a href="' + item.href + '">' + item.keyText + '</a>';
314
+ return row;
315
+ }
316
+
317
+ function padRight(padString, length) {
318
+ var str = padString.slice(0, length - 3);
319
+ if (padString.length > str.length) {
320
+ str += '...';
321
+ }
322
+ while (str.length < length) {
323
+ str = str + ' ';
324
+ }
325
+ return str;
326
+ }
327
+
328
+ function bytesToHumanReadable(sizeInBytes) {
329
+ var i = -1;
330
+ var units = [' kB', ' MB', ' GB'];
331
+ do {
332
+ sizeInBytes = sizeInBytes / 1024;
333
+ i++;
334
+ } while (sizeInBytes > 1024);
335
+ return Math.max(sizeInBytes, 0.1).toFixed(1) + units[i];
336
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-primcraft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - BakaSoniji
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-04 00:00:00.000000000 Z
11
+ date: 2019-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -179,6 +179,7 @@ files:
179
179
  - _layouts/content.html
180
180
  - _layouts/default.html
181
181
  - _layouts/home.html
182
+ - _layouts/map-archive.html
182
183
  - _layouts/page.html
183
184
  - _layouts/post.html
184
185
  - _layouts/server.html
@@ -187,6 +188,7 @@ files:
187
188
  - assets/64x64.svg
188
189
  - assets/js/bootstrap.min.js
189
190
  - assets/js/jquery.min.js
191
+ - assets/js/list.js
190
192
  - assets/js/popper.min.js
191
193
  - assets/jumbotron.jpg
192
194
  - assets/main.scss