jekyll-theme-ethereal 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -0
- data/_includes/contact_form.html +21 -0
- data/_includes/contact_script.html +52 -0
- data/_includes/date.html +12 -10
- data/_includes/footer.html +4 -4
- data/_includes/head.html +13 -5
- data/_includes/language.html +6 -7
- data/_includes/panel.html +11 -9
- data/_includes/panel_contact.html +12 -19
- data/_includes/panel_map.html +57 -0
- data/_includes/scripts.html +26 -13
- data/_includes/social.html +22 -22
- data/_includes/space_launch_calendar.json +155 -0
- data/_includes/thread.html +4 -6
- data/_layouts/collection.html +8 -10
- data/_layouts/default.html +8 -7
- data/_layouts/home.html +1 -3
- data/_layouts/index.html +17 -0
- data/_layouts/post.html +4 -4
- data/_layouts/robots.html +7 -0
- data/_layouts/sitemap.html +10 -12
- data/assets/css/mapbox-gl.css +600 -0
- data/assets/images/screenshot.jpg +0 -0
- data/assets/js/main.js +546 -546
- data/assets/js/mapbox-gl.js +40 -0
- data/assets/js/simple-jekyll-search.min.js +6 -0
- data/en/privacy-policy.md +1 -1
- metadata +28 -4
Binary file
|
data/assets/js/main.js
CHANGED
@@ -1,759 +1,759 @@
|
|
1
1
|
/*
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
Ethereal by HTML5 UP
|
3
|
+
html5up.net | @ajlkn
|
4
|
+
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
|
5
5
|
*/
|
6
6
|
|
7
7
|
(function($) {
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
// Settings.
|
10
|
+
var settings = {
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
// Keyboard shortcuts.
|
13
|
+
keyboardShortcuts: {
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
// If true, enables scrolling via keyboard shortcuts.
|
16
|
+
enabled: true,
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
// Sets the distance to scroll when using the left/right arrow keys.
|
19
|
+
distance: 50
|
20
20
|
|
21
|
-
|
21
|
+
},
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
// Scroll wheel.
|
24
|
+
scrollWheel: {
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
// If true, enables scrolling via the scroll wheel.
|
27
|
+
enabled: true,
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
// Sets the scroll wheel factor. (Ideally) a value between 0 and 1 (lower = slower scroll, higher = faster scroll).
|
30
|
+
factor: 1
|
31
31
|
|
32
|
-
|
32
|
+
},
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
// Scroll zones.
|
35
|
+
scrollZones: {
|
36
36
|
|
37
|
-
|
38
|
-
|
37
|
+
// If true, enables scrolling via scroll zones on the left/right edges of the scren.
|
38
|
+
enabled: true,
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
// Sets the speed at which the page scrolls when a scroll zone is active (higher = faster scroll, lower = slower scroll).
|
41
|
+
speed: 15
|
42
42
|
|
43
|
-
|
43
|
+
},
|
44
44
|
|
45
|
-
|
46
|
-
|
45
|
+
// Dragging.
|
46
|
+
dragging: {
|
47
47
|
|
48
|
-
|
49
|
-
|
48
|
+
// If true, enables scrolling by dragging the main wrapper with the mouse.
|
49
|
+
enabled: true,
|
50
50
|
|
51
|
-
|
52
|
-
|
51
|
+
// Sets the momentum factor. Must be a value between 0 and 1 (lower = less momentum, higher = more momentum, 0 = disable momentum scrolling).
|
52
|
+
momentum: 0.875,
|
53
53
|
|
54
|
-
|
55
|
-
|
54
|
+
// Sets the drag threshold (in pixels).
|
55
|
+
threshold: 10
|
56
56
|
|
57
|
-
|
57
|
+
},
|
58
58
|
|
59
|
-
|
60
|
-
|
59
|
+
// If set to a valid selector , prevents key/mouse events from bubbling from these elements.
|
60
|
+
excludeSelector: 'input:focus, select:focus, textarea:focus, audio, video, iframe',
|
61
61
|
|
62
|
-
|
63
|
-
|
62
|
+
// Link scroll speed.
|
63
|
+
linkScrollSpeed: 1000
|
64
64
|
|
65
|
-
|
65
|
+
};
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
67
|
+
// Vars.
|
68
|
+
var $window = $(window),
|
69
|
+
$document = $(document),
|
70
|
+
$body = $('body'),
|
71
|
+
$html = $('html'),
|
72
|
+
$bodyHtml = $('body,html'),
|
73
|
+
$wrapper = $('#wrapper');
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
75
|
+
// Breakpoints.
|
76
|
+
breakpoints({
|
77
|
+
xlarge: [ '1281px', '1680px' ],
|
78
|
+
large: [ '981px', '1280px' ],
|
79
|
+
medium: [ '737px', '980px' ],
|
80
|
+
small: [ '481px', '736px' ],
|
81
|
+
xsmall: [ '361px', '480px' ],
|
82
|
+
xxsmall: [ null, '360px' ],
|
83
|
+
short: '(min-aspect-ratio: 16/7)',
|
84
|
+
xshort: '(min-aspect-ratio: 16/6)'
|
85
|
+
});
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
87
|
+
// Play initial animations on page load.
|
88
|
+
$window.on('load', function() {
|
89
|
+
window.setTimeout(function() {
|
90
|
+
$body.removeClass('is-preload');
|
91
|
+
}, 100);
|
92
|
+
});
|
93
93
|
|
94
|
-
|
94
|
+
// Tweaks/fixes.
|
95
95
|
|
96
|
-
|
97
|
-
|
96
|
+
// Mobile: Revert to native scrolling.
|
97
|
+
if (browser.mobile) {
|
98
98
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
99
|
+
// Disable all scroll-assist features.
|
100
|
+
settings.keyboardShortcuts.enabled = false;
|
101
|
+
settings.scrollWheel.enabled = false;
|
102
|
+
settings.scrollZones.enabled = false;
|
103
|
+
settings.dragging.enabled = false;
|
104
104
|
|
105
|
-
|
106
|
-
|
105
|
+
// Re-enable overflow on body.
|
106
|
+
$body.css('overflow-x', 'auto');
|
107
107
|
|
108
|
-
|
108
|
+
}
|
109
109
|
|
110
|
-
|
111
|
-
|
110
|
+
// IE: Various fixes.
|
111
|
+
if (browser.name == 'ie') {
|
112
112
|
|
113
|
-
|
114
|
-
|
113
|
+
// Enable IE mode.
|
114
|
+
$body.addClass('is-ie');
|
115
115
|
|
116
|
-
|
117
|
-
|
118
|
-
|
116
|
+
// Page widths.
|
117
|
+
$window
|
118
|
+
.on('load resize', function() {
|
119
119
|
|
120
|
-
|
121
|
-
|
120
|
+
// Calculate wrapper width.
|
121
|
+
var w = 0;
|
122
122
|
|
123
|
-
|
124
|
-
|
125
|
-
|
123
|
+
$wrapper.children().each(function() {
|
124
|
+
w += $(this).width();
|
125
|
+
});
|
126
126
|
|
127
|
-
|
128
|
-
|
127
|
+
// Apply to page.
|
128
|
+
$html.css('width', w + 'px');
|
129
129
|
|
130
|
-
|
130
|
+
});
|
131
131
|
|
132
|
-
|
132
|
+
}
|
133
133
|
|
134
|
-
|
135
|
-
|
134
|
+
// Polyfill: Object fit.
|
135
|
+
if (!browser.canUse('object-fit')) {
|
136
136
|
|
137
|
-
|
137
|
+
$('.image[data-position]').each(function() {
|
138
138
|
|
139
|
-
|
140
|
-
|
139
|
+
var $this = $(this),
|
140
|
+
$img = $this.children('img');
|
141
141
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
142
|
+
// Apply img as background.
|
143
|
+
$this
|
144
|
+
.css('background-image', 'url("' + $img.attr('src') + '")')
|
145
|
+
.css('background-position', $this.data('position'))
|
146
|
+
.css('background-size', 'cover')
|
147
|
+
.css('background-repeat', 'no-repeat');
|
148
148
|
|
149
|
-
|
150
|
-
|
151
|
-
|
149
|
+
// Hide img.
|
150
|
+
$img
|
151
|
+
.css('opacity', '0');
|
152
152
|
|
153
|
-
|
153
|
+
});
|
154
154
|
|
155
|
-
|
155
|
+
}
|
156
156
|
|
157
|
-
|
158
|
-
|
159
|
-
|
157
|
+
// Keyboard shortcuts.
|
158
|
+
if (settings.keyboardShortcuts.enabled)
|
159
|
+
(function() {
|
160
160
|
|
161
|
-
|
161
|
+
$wrapper
|
162
162
|
|
163
|
-
|
164
|
-
|
163
|
+
// Prevent keystrokes inside excluded elements from bubbling.
|
164
|
+
.on('keypress keyup keydown', settings.excludeSelector, function(event) {
|
165
165
|
|
166
|
-
|
167
|
-
|
166
|
+
// Stop propagation.
|
167
|
+
event.stopPropagation();
|
168
168
|
|
169
|
-
|
169
|
+
});
|
170
170
|
|
171
|
-
|
171
|
+
$window
|
172
172
|
|
173
|
-
|
174
|
-
|
173
|
+
// Keypress event.
|
174
|
+
.on('keydown', function(event) {
|
175
175
|
|
176
|
-
|
176
|
+
var scrolled = false;
|
177
177
|
|
178
|
-
|
178
|
+
switch (event.keyCode) {
|
179
179
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
180
|
+
// Left arrow.
|
181
|
+
case 37:
|
182
|
+
$document.scrollLeft($document.scrollLeft() - settings.keyboardShortcuts.distance);
|
183
|
+
scrolled = true;
|
184
|
+
break;
|
185
185
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
186
|
+
// Right arrow.
|
187
|
+
case 39:
|
188
|
+
$document.scrollLeft($document.scrollLeft() + settings.keyboardShortcuts.distance);
|
189
|
+
scrolled = true;
|
190
|
+
break;
|
191
191
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
192
|
+
// Page Up.
|
193
|
+
case 33:
|
194
|
+
$document.scrollLeft($document.scrollLeft() - $window.width() + 100);
|
195
|
+
scrolled = true;
|
196
|
+
break;
|
197
197
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
198
|
+
// Page Down, Space.
|
199
|
+
case 34:
|
200
|
+
case 32:
|
201
|
+
$document.scrollLeft($document.scrollLeft() + $window.width() - 100);
|
202
|
+
scrolled = true;
|
203
|
+
break;
|
204
204
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
205
|
+
// Home.
|
206
|
+
case 36:
|
207
|
+
$document.scrollLeft(0);
|
208
|
+
scrolled = true;
|
209
|
+
break;
|
210
210
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
211
|
+
// End.
|
212
|
+
case 35:
|
213
|
+
$document.scrollLeft($document.width());
|
214
|
+
scrolled = true;
|
215
|
+
break;
|
216
216
|
|
217
|
-
|
217
|
+
}
|
218
218
|
|
219
|
-
|
220
|
-
|
219
|
+
// Scrolled?
|
220
|
+
if (scrolled) {
|
221
221
|
|
222
|
-
|
223
|
-
|
224
|
-
|
222
|
+
// Prevent default.
|
223
|
+
event.preventDefault();
|
224
|
+
event.stopPropagation();
|
225
225
|
|
226
|
-
|
227
|
-
|
226
|
+
// Stop link scroll.
|
227
|
+
$bodyHtml.stop();
|
228
228
|
|
229
|
-
|
229
|
+
}
|
230
230
|
|
231
|
-
|
231
|
+
});
|
232
232
|
|
233
|
-
|
233
|
+
})();
|
234
234
|
|
235
|
-
|
236
|
-
|
237
|
-
|
235
|
+
// Scroll wheel.
|
236
|
+
if (settings.scrollWheel.enabled)
|
237
|
+
(function() {
|
238
238
|
|
239
|
-
|
240
|
-
|
241
|
-
|
239
|
+
// Based on code by @miorel + @pieterv of Facebook (thanks guys :)
|
240
|
+
// github.com/facebook/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js
|
241
|
+
var normalizeWheel = function(event) {
|
242
242
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
243
|
+
var pixelStep = 10,
|
244
|
+
lineHeight = 40,
|
245
|
+
pageHeight = 800,
|
246
|
+
sX = 0,
|
247
|
+
sY = 0,
|
248
|
+
pX = 0,
|
249
|
+
pY = 0;
|
250
250
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
251
|
+
// Legacy.
|
252
|
+
if ('detail' in event)
|
253
|
+
sY = event.detail;
|
254
|
+
else if ('wheelDelta' in event)
|
255
|
+
sY = event.wheelDelta / -120;
|
256
|
+
else if ('wheelDeltaY' in event)
|
257
|
+
sY = event.wheelDeltaY / -120;
|
258
258
|
|
259
|
-
|
260
|
-
|
259
|
+
if ('wheelDeltaX' in event)
|
260
|
+
sX = event.wheelDeltaX / -120;
|
261
261
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
262
|
+
// Side scrolling on FF with DOMMouseScroll.
|
263
|
+
if ('axis' in event
|
264
|
+
&& event.axis === event.HORIZONTAL_AXIS) {
|
265
|
+
sX = sY;
|
266
|
+
sY = 0;
|
267
|
+
}
|
268
268
|
|
269
|
-
|
270
|
-
|
271
|
-
|
269
|
+
// Calculate.
|
270
|
+
pX = sX * pixelStep;
|
271
|
+
pY = sY * pixelStep;
|
272
272
|
|
273
|
-
|
274
|
-
|
273
|
+
if ('deltaY' in event)
|
274
|
+
pY = event.deltaY;
|
275
275
|
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
276
|
+
if ('deltaX' in event)
|
277
|
+
pX = event.deltaX;
|
278
|
+
|
279
|
+
if ((pX || pY)
|
280
|
+
&& event.deltaMode) {
|
281
|
+
|
282
|
+
if (event.deltaMode == 1) {
|
283
|
+
pX *= lineHeight;
|
284
|
+
pY *= lineHeight;
|
285
|
+
}
|
286
|
+
else {
|
287
|
+
pX *= pageHeight;
|
288
|
+
pY *= pageHeight;
|
289
|
+
}
|
290
|
+
|
291
|
+
}
|
292
|
+
|
293
|
+
// Fallback if spin cannot be determined.
|
294
|
+
if (pX && !sX)
|
295
|
+
sX = (pX < 1) ? -1 : 1;
|
296
|
+
|
297
|
+
if (pY && !sY)
|
298
|
+
sY = (pY < 1) ? -1 : 1;
|
299
|
+
|
300
|
+
// Return.
|
301
|
+
return {
|
302
|
+
spinX: sX,
|
303
|
+
spinY: sY,
|
304
|
+
pixelX: pX,
|
305
|
+
pixelY: pY
|
306
|
+
};
|
307
307
|
|
308
|
-
|
308
|
+
};
|
309
309
|
|
310
|
-
|
311
|
-
|
310
|
+
// Wheel event.
|
311
|
+
$body.on('wheel', function(event) {
|
312
312
|
|
313
|
-
|
314
|
-
|
315
|
-
|
313
|
+
// Disable on <=small.
|
314
|
+
if (breakpoints.active('<=small'))
|
315
|
+
return;
|
316
316
|
|
317
|
-
|
318
|
-
|
319
|
-
|
317
|
+
// Prevent default.
|
318
|
+
event.preventDefault();
|
319
|
+
event.stopPropagation();
|
320
320
|
|
321
|
-
|
322
|
-
|
321
|
+
// Stop link scroll.
|
322
|
+
$bodyHtml.stop();
|
323
323
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
324
|
+
// Calculate delta, direction.
|
325
|
+
var n = normalizeWheel(event.originalEvent),
|
326
|
+
x = (n.pixelX != 0 ? n.pixelX : n.pixelY),
|
327
|
+
delta = Math.min(Math.abs(x), 150) * settings.scrollWheel.factor,
|
328
|
+
direction = x > 0 ? 1 : -1;
|
329
329
|
|
330
|
-
|
331
|
-
|
330
|
+
// Scroll page.
|
331
|
+
$document.scrollLeft($document.scrollLeft() + (delta * direction));
|
332
332
|
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
333
|
+
});
|
334
|
+
|
335
|
+
})();
|
336
|
+
|
337
|
+
// Scroll zones.
|
338
|
+
if (settings.scrollZones.enabled)
|
339
|
+
(function() {
|
340
|
+
|
341
|
+
var $left = $('<div class="scrollZone left"></div>'),
|
342
|
+
$right = $('<div class="scrollZone right"></div>'),
|
343
|
+
$zones = $left.add($right),
|
344
|
+
paused = false,
|
345
|
+
intervalId = null,
|
346
|
+
direction,
|
347
|
+
activate = function(d) {
|
348
348
|
|
349
|
-
|
350
|
-
|
351
|
-
|
349
|
+
// Disable on <=small.
|
350
|
+
if (breakpoints.active('<=small'))
|
351
|
+
return;
|
352
352
|
|
353
|
-
|
354
|
-
|
355
|
-
|
353
|
+
// Paused? Bail.
|
354
|
+
if (paused)
|
355
|
+
return;
|
356
356
|
|
357
|
-
|
358
|
-
|
357
|
+
// Stop link scroll.
|
358
|
+
$bodyHtml.stop();
|
359
359
|
|
360
|
-
|
361
|
-
|
360
|
+
// Set direction.
|
361
|
+
direction = d;
|
362
362
|
|
363
|
-
|
364
|
-
|
363
|
+
// Initialize interval.
|
364
|
+
clearInterval(intervalId);
|
365
365
|
|
366
|
-
|
367
|
-
|
368
|
-
|
366
|
+
intervalId = setInterval(function() {
|
367
|
+
$document.scrollLeft($document.scrollLeft() + (settings.scrollZones.speed * direction));
|
368
|
+
}, 25);
|
369
369
|
|
370
|
-
|
371
|
-
|
370
|
+
},
|
371
|
+
deactivate = function() {
|
372
372
|
|
373
|
-
|
374
|
-
|
373
|
+
// Unpause.
|
374
|
+
paused = false;
|
375
375
|
|
376
|
-
|
377
|
-
|
376
|
+
// Clear interval.
|
377
|
+
clearInterval(intervalId);
|
378
378
|
|
379
|
-
|
379
|
+
};
|
380
380
|
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
381
|
+
$zones
|
382
|
+
.appendTo($wrapper)
|
383
|
+
.on('mouseleave mousedown', function(event) {
|
384
|
+
deactivate();
|
385
|
+
});
|
386
386
|
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
387
|
+
$left
|
388
|
+
.css('left', '0')
|
389
|
+
.on('mouseenter', function(event) {
|
390
|
+
activate(-1);
|
391
|
+
});
|
392
392
|
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
393
|
+
$right
|
394
|
+
.css('right', '0')
|
395
|
+
.on('mouseenter', function(event) {
|
396
|
+
activate(1);
|
397
|
+
});
|
398
398
|
|
399
|
-
|
400
|
-
|
399
|
+
$wrapper
|
400
|
+
.on('---pauseScrollZone', function(event) {
|
401
401
|
|
402
|
-
|
403
|
-
|
402
|
+
// Pause.
|
403
|
+
paused = true;
|
404
404
|
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
405
|
+
// Unpause after delay.
|
406
|
+
setTimeout(function() {
|
407
|
+
paused = false;
|
408
|
+
}, 500);
|
409
409
|
|
410
|
-
|
410
|
+
});
|
411
411
|
|
412
|
-
|
412
|
+
})();
|
413
413
|
|
414
|
-
|
415
|
-
|
416
|
-
|
414
|
+
// Dragging.
|
415
|
+
if (settings.dragging.enabled)
|
416
|
+
(function() {
|
417
417
|
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
418
|
+
var dragging = false,
|
419
|
+
dragged = false,
|
420
|
+
distance = 0,
|
421
|
+
startScroll,
|
422
|
+
momentumIntervalId, velocityIntervalId,
|
423
|
+
startX, currentX, previousX,
|
424
|
+
velocity, direction;
|
425
425
|
|
426
|
-
|
426
|
+
$wrapper
|
427
427
|
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
428
|
+
// Prevent image drag and drop.
|
429
|
+
.on('mouseup mousemove mousedown', '.image, img', function(event) {
|
430
|
+
event.preventDefault();
|
431
|
+
})
|
432
432
|
|
433
|
-
|
434
|
-
|
433
|
+
// Prevent mouse events inside excluded elements from bubbling.
|
434
|
+
.on('mouseup mousemove mousedown', settings.excludeSelector, function(event) {
|
435
435
|
|
436
|
-
|
437
|
-
|
436
|
+
// Prevent event from bubbling.
|
437
|
+
event.stopPropagation();
|
438
438
|
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
439
|
+
// End drag.
|
440
|
+
dragging = false;
|
441
|
+
$wrapper.removeClass('is-dragging');
|
442
|
+
clearInterval(velocityIntervalId);
|
443
|
+
clearInterval(momentumIntervalId);
|
444
444
|
|
445
|
-
|
446
|
-
|
445
|
+
// Pause scroll zone.
|
446
|
+
$wrapper.triggerHandler('---pauseScrollZone');
|
447
447
|
|
448
|
-
|
448
|
+
})
|
449
449
|
|
450
|
-
|
451
|
-
|
450
|
+
// Mousedown event.
|
451
|
+
.on('mousedown', function(event) {
|
452
452
|
|
453
|
-
|
454
|
-
|
455
|
-
|
453
|
+
// Disable on <=small.
|
454
|
+
if (breakpoints.active('<=small'))
|
455
|
+
return;
|
456
456
|
|
457
|
-
|
458
|
-
|
457
|
+
// Clear momentum interval.
|
458
|
+
clearInterval(momentumIntervalId);
|
459
459
|
|
460
|
-
|
461
|
-
|
460
|
+
// Stop link scroll.
|
461
|
+
$bodyHtml.stop();
|
462
462
|
|
463
|
-
|
464
|
-
|
465
|
-
|
463
|
+
// Start drag.
|
464
|
+
dragging = true;
|
465
|
+
$wrapper.addClass('is-dragging');
|
466
466
|
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
467
|
+
// Initialize and reset vars.
|
468
|
+
startScroll = $document.scrollLeft();
|
469
|
+
startX = event.clientX;
|
470
|
+
previousX = startX;
|
471
|
+
currentX = startX;
|
472
|
+
distance = 0;
|
473
|
+
direction = 0;
|
474
474
|
|
475
|
-
|
476
|
-
|
475
|
+
// Initialize velocity interval.
|
476
|
+
clearInterval(velocityIntervalId);
|
477
477
|
|
478
|
-
|
478
|
+
velocityIntervalId = setInterval(function() {
|
479
479
|
|
480
|
-
|
481
|
-
|
482
|
-
|
480
|
+
// Calculate velocity, direction.
|
481
|
+
velocity = Math.abs(currentX - previousX);
|
482
|
+
direction = (currentX > previousX ? -1 : 1);
|
483
483
|
|
484
|
-
|
485
|
-
|
484
|
+
// Update previous X.
|
485
|
+
previousX = currentX;
|
486
486
|
|
487
|
-
|
487
|
+
}, 50);
|
488
488
|
|
489
|
-
|
489
|
+
})
|
490
490
|
|
491
|
-
|
492
|
-
|
491
|
+
// Mousemove event.
|
492
|
+
.on('mousemove', function(event) {
|
493
493
|
|
494
|
-
|
495
|
-
|
496
|
-
|
494
|
+
// Not dragging? Bail.
|
495
|
+
if (!dragging)
|
496
|
+
return;
|
497
497
|
|
498
|
-
|
499
|
-
|
498
|
+
// Velocity.
|
499
|
+
currentX = event.clientX;
|
500
500
|
|
501
|
-
|
502
|
-
|
501
|
+
// Scroll page.
|
502
|
+
$document.scrollLeft(startScroll + (startX - currentX));
|
503
503
|
|
504
|
-
|
505
|
-
|
504
|
+
// Update distance.
|
505
|
+
distance = Math.abs(startScroll - $document.scrollLeft());
|
506
506
|
|
507
|
-
|
508
|
-
|
509
|
-
|
507
|
+
// Distance exceeds threshold? Disable pointer events on all descendents.
|
508
|
+
if (!dragged
|
509
|
+
&& distance > settings.dragging.threshold) {
|
510
510
|
|
511
|
-
|
511
|
+
$wrapper.addClass('is-dragged');
|
512
512
|
|
513
|
-
|
513
|
+
dragged = true;
|
514
514
|
|
515
|
-
|
515
|
+
}
|
516
516
|
|
517
|
-
|
517
|
+
})
|
518
518
|
|
519
|
-
|
520
|
-
|
519
|
+
// Mouseup/mouseleave event.
|
520
|
+
.on('mouseup mouseleave', function(event) {
|
521
521
|
|
522
|
-
|
522
|
+
var m;
|
523
523
|
|
524
|
-
|
525
|
-
|
526
|
-
|
524
|
+
// Not dragging? Bail.
|
525
|
+
if (!dragging)
|
526
|
+
return;
|
527
527
|
|
528
|
-
|
529
|
-
|
528
|
+
// Dragged? Re-enable pointer events on all descendents.
|
529
|
+
if (dragged) {
|
530
530
|
|
531
|
-
|
532
|
-
|
533
|
-
|
531
|
+
setTimeout(function() {
|
532
|
+
$wrapper.removeClass('is-dragged');
|
533
|
+
}, 100);
|
534
534
|
|
535
|
-
|
535
|
+
dragged = false;
|
536
536
|
|
537
|
-
|
537
|
+
}
|
538
538
|
|
539
|
-
|
540
|
-
|
541
|
-
|
539
|
+
// Distance exceeds threshold? Prevent default.
|
540
|
+
if (distance > settings.dragging.threshold)
|
541
|
+
event.preventDefault();
|
542
542
|
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
543
|
+
// End drag.
|
544
|
+
dragging = false;
|
545
|
+
$wrapper.removeClass('is-dragging');
|
546
|
+
clearInterval(velocityIntervalId);
|
547
|
+
clearInterval(momentumIntervalId);
|
548
548
|
|
549
|
-
|
550
|
-
|
549
|
+
// Pause scroll zone.
|
550
|
+
$wrapper.triggerHandler('---pauseScrollZone');
|
551
551
|
|
552
|
-
|
553
|
-
|
552
|
+
// Initialize momentum interval.
|
553
|
+
if (settings.dragging.momentum > 0) {
|
554
554
|
|
555
|
-
|
555
|
+
m = velocity;
|
556
556
|
|
557
|
-
|
557
|
+
momentumIntervalId = setInterval(function() {
|
558
558
|
|
559
|
-
|
560
|
-
|
559
|
+
// Momentum is NaN? Bail.
|
560
|
+
if (isNaN(m)) {
|
561
561
|
|
562
|
-
|
563
|
-
|
562
|
+
clearInterval(momentumIntervalId);
|
563
|
+
return;
|
564
564
|
|
565
|
-
|
565
|
+
}
|
566
566
|
|
567
|
-
|
568
|
-
|
567
|
+
// Scroll page.
|
568
|
+
$document.scrollLeft($document.scrollLeft() + (m * direction));
|
569
569
|
|
570
|
-
|
571
|
-
|
570
|
+
// Decrease momentum.
|
571
|
+
m = m * settings.dragging.momentum;
|
572
572
|
|
573
|
-
|
574
|
-
|
575
|
-
|
573
|
+
// Negligible momentum? Clear interval and end.
|
574
|
+
if (Math.abs(m) < 1)
|
575
|
+
clearInterval(momentumIntervalId);
|
576
576
|
|
577
|
-
|
577
|
+
}, 15);
|
578
578
|
|
579
|
-
|
579
|
+
}
|
580
580
|
|
581
|
-
|
581
|
+
});
|
582
582
|
|
583
|
-
|
583
|
+
})();
|
584
584
|
|
585
|
-
|
586
|
-
|
587
|
-
|
585
|
+
// Link scroll.
|
586
|
+
$wrapper
|
587
|
+
.on('mousedown mouseup', 'a[href^="#"]', function(event) {
|
588
588
|
|
589
|
-
|
590
|
-
|
589
|
+
// Stop propagation.
|
590
|
+
event.stopPropagation();
|
591
591
|
|
592
|
-
|
593
|
-
|
592
|
+
})
|
593
|
+
.on('click', 'a[href^="#"]', function(event) {
|
594
594
|
|
595
|
-
|
596
|
-
|
597
|
-
|
595
|
+
var $this = $(this),
|
596
|
+
href = $this.attr('href'),
|
597
|
+
$target, x, y;
|
598
598
|
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
599
|
+
// Get target.
|
600
|
+
if (href == '#'
|
601
|
+
|| ($target = $(href)).length == 0)
|
602
|
+
return;
|
603
603
|
|
604
|
-
|
605
|
-
|
606
|
-
|
604
|
+
// Prevent default.
|
605
|
+
event.preventDefault();
|
606
|
+
event.stopPropagation();
|
607
607
|
|
608
|
-
|
609
|
-
|
608
|
+
// Calculate x, y.
|
609
|
+
if (breakpoints.active('<=small')) {
|
610
610
|
|
611
|
-
|
612
|
-
|
611
|
+
x = $target.offset().top - (Math.max(0, $window.height() - $target.outerHeight()) / 2);
|
612
|
+
y = { scrollTop: x };
|
613
613
|
|
614
|
-
|
615
|
-
|
614
|
+
}
|
615
|
+
else {
|
616
616
|
|
617
|
-
|
618
|
-
|
617
|
+
x = $target.offset().left - (Math.max(0, $window.width() - $target.outerWidth()) / 2);
|
618
|
+
y = { scrollLeft: x };
|
619
619
|
|
620
|
-
|
620
|
+
}
|
621
621
|
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
622
|
+
// Scroll.
|
623
|
+
$bodyHtml
|
624
|
+
.stop()
|
625
|
+
.animate(
|
626
|
+
y,
|
627
|
+
settings.linkScrollSpeed,
|
628
|
+
'swing'
|
629
|
+
);
|
630
630
|
|
631
|
-
|
631
|
+
});
|
632
632
|
|
633
|
-
|
634
|
-
|
635
|
-
|
633
|
+
// Gallery.
|
634
|
+
$('.gallery')
|
635
|
+
.on('click', 'a', function(event) {
|
636
636
|
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
637
|
+
var $a = $(this),
|
638
|
+
$gallery = $a.parents('.gallery'),
|
639
|
+
$modal = $gallery.children('.modal'),
|
640
|
+
$modalImg = $modal.find('img'),
|
641
|
+
href = $a.attr('href');
|
642
642
|
|
643
|
-
|
644
|
-
|
645
|
-
|
643
|
+
// Not an image? Bail.
|
644
|
+
if (!href.match(/\.(jpg|gif|png|mp4)$/))
|
645
|
+
return;
|
646
646
|
|
647
|
-
|
648
|
-
|
649
|
-
|
647
|
+
// Prevent default.
|
648
|
+
event.preventDefault();
|
649
|
+
event.stopPropagation();
|
650
650
|
|
651
|
-
|
652
|
-
|
653
|
-
|
651
|
+
// Locked? Bail.
|
652
|
+
if ($modal[0]._locked)
|
653
|
+
return;
|
654
654
|
|
655
|
-
|
656
|
-
|
655
|
+
// Lock.
|
656
|
+
$modal[0]._locked = true;
|
657
657
|
|
658
|
-
|
659
|
-
|
658
|
+
// Set src.
|
659
|
+
$modalImg.attr('src', href);
|
660
660
|
|
661
|
-
|
662
|
-
|
661
|
+
// Set visible.
|
662
|
+
$modal.addClass('visible');
|
663
663
|
|
664
|
-
|
665
|
-
|
664
|
+
// Focus.
|
665
|
+
$modal.focus();
|
666
666
|
|
667
|
-
|
668
|
-
|
667
|
+
// Delay.
|
668
|
+
setTimeout(function() {
|
669
669
|
|
670
|
-
|
671
|
-
|
670
|
+
// Unlock.
|
671
|
+
$modal[0]._locked = false;
|
672
672
|
|
673
|
-
|
673
|
+
}, 600);
|
674
674
|
|
675
|
-
|
676
|
-
|
675
|
+
})
|
676
|
+
.on('click', '.modal', function(event) {
|
677
677
|
|
678
|
-
|
679
|
-
|
678
|
+
var $modal = $(this),
|
679
|
+
$modalImg = $modal.find('img');
|
680
680
|
|
681
|
-
|
682
|
-
|
683
|
-
|
681
|
+
// Locked? Bail.
|
682
|
+
if ($modal[0]._locked)
|
683
|
+
return;
|
684
684
|
|
685
|
-
|
686
|
-
|
687
|
-
|
685
|
+
// Already hidden? Bail.
|
686
|
+
if (!$modal.hasClass('visible'))
|
687
|
+
return;
|
688
688
|
|
689
|
-
|
690
|
-
|
689
|
+
// Stop propagation.
|
690
|
+
event.stopPropagation();
|
691
691
|
|
692
|
-
|
693
|
-
|
692
|
+
// Lock.
|
693
|
+
$modal[0]._locked = true;
|
694
694
|
|
695
|
-
|
696
|
-
|
697
|
-
|
695
|
+
// Clear visible, loaded.
|
696
|
+
$modal
|
697
|
+
.removeClass('loaded')
|
698
698
|
|
699
|
-
|
700
|
-
|
699
|
+
// Delay.
|
700
|
+
setTimeout(function() {
|
701
701
|
|
702
|
-
|
703
|
-
|
702
|
+
$modal
|
703
|
+
.removeClass('visible')
|
704
704
|
|
705
|
-
|
706
|
-
|
705
|
+
// Pause scroll zone.
|
706
|
+
$wrapper.triggerHandler('---pauseScrollZone');
|
707
707
|
|
708
|
-
|
708
|
+
setTimeout(function() {
|
709
709
|
|
710
|
-
|
711
|
-
|
710
|
+
// Clear src.
|
711
|
+
$modalImg.attr('src', '');
|
712
712
|
|
713
|
-
|
714
|
-
|
713
|
+
// Unlock.
|
714
|
+
$modal[0]._locked = false;
|
715
715
|
|
716
|
-
|
717
|
-
|
716
|
+
// Focus.
|
717
|
+
$body.focus();
|
718
718
|
|
719
|
-
|
719
|
+
}, 475);
|
720
720
|
|
721
|
-
|
721
|
+
}, 125);
|
722
722
|
|
723
|
-
|
724
|
-
|
723
|
+
})
|
724
|
+
.on('keypress', '.modal', function(event) {
|
725
725
|
|
726
|
-
|
726
|
+
var $modal = $(this);
|
727
727
|
|
728
|
-
|
729
|
-
|
730
|
-
|
728
|
+
// Escape? Hide modal.
|
729
|
+
if (event.keyCode == 27)
|
730
|
+
$modal.trigger('click');
|
731
731
|
|
732
|
-
|
733
|
-
|
732
|
+
})
|
733
|
+
.on('mouseup mousedown mousemove', '.modal', function(event) {
|
734
734
|
|
735
|
-
|
736
|
-
|
735
|
+
// Stop propagation.
|
736
|
+
event.stopPropagation();
|
737
737
|
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
738
|
+
})
|
739
|
+
.prepend('<div class="modal" tabIndex="-1"><div class="inner"><img src="" /></div></div>')
|
740
|
+
.find('img')
|
741
|
+
.on('load', function(event) {
|
742
742
|
|
743
|
-
|
744
|
-
|
743
|
+
var $modalImg = $(this),
|
744
|
+
$modal = $modalImg.parents('.modal');
|
745
745
|
|
746
|
-
|
746
|
+
setTimeout(function() {
|
747
747
|
|
748
|
-
|
749
|
-
|
750
|
-
|
748
|
+
// No longer visible? Bail.
|
749
|
+
if (!$modal.hasClass('visible'))
|
750
|
+
return;
|
751
751
|
|
752
|
-
|
753
|
-
|
752
|
+
// Set loaded.
|
753
|
+
$modal.addClass('loaded');
|
754
754
|
|
755
|
-
|
755
|
+
}, 275);
|
756
756
|
|
757
|
-
|
757
|
+
});
|
758
758
|
|
759
|
-
})(jQuery);
|
759
|
+
})(jQuery);
|