jekyll-bulma-theme 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/_sass/syntax.scss CHANGED
@@ -1,214 +1,214 @@
1
- .highlighter-rouge {
2
- margin-bottom: 10px;
3
- }
4
-
5
- .highlight table td { padding: 5px; }
6
- .highlight table pre { margin: 0; }
7
- .highlight .c, .highlight .cd {
8
- color: #75715e;
9
- font-style: italic;
10
- }
11
- .highlight .cm {
12
- color: #75715e;
13
- font-style: italic;
14
- }
15
- .highlight .c1 {
16
- color: #75715e;
17
- font-style: italic;
18
- }
19
- .highlight .cp {
20
- color: #75715e;
21
- font-weight: bold;
22
- }
23
- .highlight .cs {
24
- color: #75715e;
25
- font-weight: bold;
26
- font-style: italic;
27
- }
28
- .highlight .err {
29
- color: #960050;
30
- background-color: #1e0010;
31
- }
32
- .highlight .gi {
33
- color: #ffffff;
34
- background-color: #324932;
35
- }
36
- .highlight .gd {
37
- color: #ffffff;
38
- background-color: #493131;
39
- }
40
- .highlight .ge {
41
- color: #000000;
42
- font-style: italic;
43
- }
44
- .highlight .gr {
45
- color: #aa0000;
46
- }
47
- .highlight .gt {
48
- color: #aa0000;
49
- }
50
- .highlight .gh {
51
- color: #999999;
52
- }
53
- .highlight .go {
54
- color: #888888;
55
- }
56
- .highlight .gp {
57
- color: #555555;
58
- }
59
- .highlight .gs {
60
- font-weight: bold;
61
- }
62
- .highlight .gu {
63
- color: #aaaaaa;
64
- }
65
- .highlight .k, .highlight .kv {
66
- color: #66d9ef;
67
- font-weight: bold;
68
- }
69
- .highlight .kc {
70
- color: #66d9ef;
71
- font-weight: bold;
72
- }
73
- .highlight .kd {
74
- color: #66d9ef;
75
- font-weight: bold;
76
- }
77
- .highlight .kp {
78
- color: #66d9ef;
79
- font-weight: bold;
80
- }
81
- .highlight .kr {
82
- color: #66d9ef;
83
- font-weight: bold;
84
- }
85
- .highlight .kt {
86
- color: #66d9ef;
87
- font-weight: bold;
88
- }
89
- .highlight .kn {
90
- color: #f92672;
91
- font-weight: bold;
92
- }
93
- .highlight .ow {
94
- color: #f92672;
95
- font-weight: bold;
96
- }
97
- .highlight .o {
98
- color: #f92672;
99
- font-weight: bold;
100
- }
101
- .highlight .mf {
102
- color: #ae81ff;
103
- }
104
- .highlight .mh {
105
- color: #ae81ff;
106
- }
107
- .highlight .il {
108
- color: #ae81ff;
109
- }
110
- .highlight .mi {
111
- color: #ae81ff;
112
- }
113
- .highlight .mo {
114
- color: #ae81ff;
115
- }
116
- .highlight .m, .highlight .mb, .highlight .mx {
117
- color: #ae81ff;
118
- }
119
- .highlight .se {
120
- color: #ae81ff;
121
- }
122
- .highlight .sb {
123
- color: #e6db74;
124
- }
125
- .highlight .sc {
126
- color: #e6db74;
127
- }
128
- .highlight .sd {
129
- color: #e6db74;
130
- }
131
- .highlight .s2 {
132
- color: #e6db74;
133
- }
134
- .highlight .sh {
135
- color: #e6db74;
136
- }
137
- .highlight .si {
138
- color: #e6db74;
139
- }
140
- .highlight .sx {
141
- color: #e6db74;
142
- }
143
- .highlight .sr {
144
- color: #e6db74;
145
- }
146
- .highlight .s1 {
147
- color: #e6db74;
148
- }
149
- .highlight .ss {
150
- color: #e6db74;
151
- }
152
- .highlight .s {
153
- color: #e6db74;
154
- }
155
- .highlight .na {
156
- color: #a6e22e;
157
- }
158
- .highlight .nc {
159
- color: #a6e22e;
160
- font-weight: bold;
161
- }
162
- .highlight .nd {
163
- color: #a6e22e;
164
- font-weight: bold;
165
- }
166
- .highlight .ne {
167
- color: #a6e22e;
168
- font-weight: bold;
169
- }
170
- .highlight .nf {
171
- color: #a6e22e;
172
- font-weight: bold;
173
- }
174
- .highlight .no {
175
- color: #66d9ef;
176
- }
177
- .highlight .bp {
178
- color: #f8f8f2;
179
- }
180
- .highlight .nb {
181
- color: #f8f8f2;
182
- }
183
- .highlight .ni {
184
- color: #f8f8f2;
185
- }
186
- .highlight .nn {
187
- color: #f8f8f2;
188
- }
189
- .highlight .vc {
190
- color: #f8f8f2;
191
- }
192
- .highlight .vg {
193
- color: #f8f8f2;
194
- }
195
- .highlight .vi {
196
- color: #f8f8f2;
197
- }
198
- .highlight .nv {
199
- color: #f8f8f2;
200
- }
201
- .highlight .w {
202
- color: #f8f8f2;
203
- }
204
- .highlight .nl {
205
- color: #f8f8f2;
206
- font-weight: bold;
207
- }
208
- .highlight .nt {
209
- color: #f92672;
210
- }
211
- .highlight {
212
- color: #f8f8f2;
213
- background-color: #49483e;
214
- }
1
+ .highlighter-rouge {
2
+ margin-bottom: 10px;
3
+ }
4
+
5
+ .highlight table td { padding: 5px; }
6
+ .highlight table pre { margin: 0; }
7
+ .highlight .c, .highlight .cd {
8
+ color: #75715e;
9
+ font-style: italic;
10
+ }
11
+ .highlight .cm {
12
+ color: #75715e;
13
+ font-style: italic;
14
+ }
15
+ .highlight .c1 {
16
+ color: #75715e;
17
+ font-style: italic;
18
+ }
19
+ .highlight .cp {
20
+ color: #75715e;
21
+ font-weight: bold;
22
+ }
23
+ .highlight .cs {
24
+ color: #75715e;
25
+ font-weight: bold;
26
+ font-style: italic;
27
+ }
28
+ .highlight .err {
29
+ color: #960050;
30
+ background-color: #1e0010;
31
+ }
32
+ .highlight .gi {
33
+ color: #ffffff;
34
+ background-color: #324932;
35
+ }
36
+ .highlight .gd {
37
+ color: #ffffff;
38
+ background-color: #493131;
39
+ }
40
+ .highlight .ge {
41
+ color: #000000;
42
+ font-style: italic;
43
+ }
44
+ .highlight .gr {
45
+ color: #aa0000;
46
+ }
47
+ .highlight .gt {
48
+ color: #aa0000;
49
+ }
50
+ .highlight .gh {
51
+ color: #999999;
52
+ }
53
+ .highlight .go {
54
+ color: #888888;
55
+ }
56
+ .highlight .gp {
57
+ color: #555555;
58
+ }
59
+ .highlight .gs {
60
+ font-weight: bold;
61
+ }
62
+ .highlight .gu {
63
+ color: #aaaaaa;
64
+ }
65
+ .highlight .k, .highlight .kv {
66
+ color: #66d9ef;
67
+ font-weight: bold;
68
+ }
69
+ .highlight .kc {
70
+ color: #66d9ef;
71
+ font-weight: bold;
72
+ }
73
+ .highlight .kd {
74
+ color: #66d9ef;
75
+ font-weight: bold;
76
+ }
77
+ .highlight .kp {
78
+ color: #66d9ef;
79
+ font-weight: bold;
80
+ }
81
+ .highlight .kr {
82
+ color: #66d9ef;
83
+ font-weight: bold;
84
+ }
85
+ .highlight .kt {
86
+ color: #66d9ef;
87
+ font-weight: bold;
88
+ }
89
+ .highlight .kn {
90
+ color: #f92672;
91
+ font-weight: bold;
92
+ }
93
+ .highlight .ow {
94
+ color: #f92672;
95
+ font-weight: bold;
96
+ }
97
+ .highlight .o {
98
+ color: #f92672;
99
+ font-weight: bold;
100
+ }
101
+ .highlight .mf {
102
+ color: #ae81ff;
103
+ }
104
+ .highlight .mh {
105
+ color: #ae81ff;
106
+ }
107
+ .highlight .il {
108
+ color: #ae81ff;
109
+ }
110
+ .highlight .mi {
111
+ color: #ae81ff;
112
+ }
113
+ .highlight .mo {
114
+ color: #ae81ff;
115
+ }
116
+ .highlight .m, .highlight .mb, .highlight .mx {
117
+ color: #ae81ff;
118
+ }
119
+ .highlight .se {
120
+ color: #ae81ff;
121
+ }
122
+ .highlight .sb {
123
+ color: #e6db74;
124
+ }
125
+ .highlight .sc {
126
+ color: #e6db74;
127
+ }
128
+ .highlight .sd {
129
+ color: #e6db74;
130
+ }
131
+ .highlight .s2 {
132
+ color: #e6db74;
133
+ }
134
+ .highlight .sh {
135
+ color: #e6db74;
136
+ }
137
+ .highlight .si {
138
+ color: #e6db74;
139
+ }
140
+ .highlight .sx {
141
+ color: #e6db74;
142
+ }
143
+ .highlight .sr {
144
+ color: #e6db74;
145
+ }
146
+ .highlight .s1 {
147
+ color: #e6db74;
148
+ }
149
+ .highlight .ss {
150
+ color: #e6db74;
151
+ }
152
+ .highlight .s {
153
+ color: #e6db74;
154
+ }
155
+ .highlight .na {
156
+ color: #a6e22e;
157
+ }
158
+ .highlight .nc {
159
+ color: #a6e22e;
160
+ font-weight: bold;
161
+ }
162
+ .highlight .nd {
163
+ color: #a6e22e;
164
+ font-weight: bold;
165
+ }
166
+ .highlight .ne {
167
+ color: #a6e22e;
168
+ font-weight: bold;
169
+ }
170
+ .highlight .nf {
171
+ color: #a6e22e;
172
+ font-weight: bold;
173
+ }
174
+ .highlight .no {
175
+ color: #66d9ef;
176
+ }
177
+ .highlight .bp {
178
+ color: #f8f8f2;
179
+ }
180
+ .highlight .nb {
181
+ color: #f8f8f2;
182
+ }
183
+ .highlight .ni {
184
+ color: #f8f8f2;
185
+ }
186
+ .highlight .nn {
187
+ color: #f8f8f2;
188
+ }
189
+ .highlight .vc {
190
+ color: #f8f8f2;
191
+ }
192
+ .highlight .vg {
193
+ color: #f8f8f2;
194
+ }
195
+ .highlight .vi {
196
+ color: #f8f8f2;
197
+ }
198
+ .highlight .nv {
199
+ color: #f8f8f2;
200
+ }
201
+ .highlight .w {
202
+ color: #f8f8f2;
203
+ }
204
+ .highlight .nl {
205
+ color: #f8f8f2;
206
+ font-weight: bold;
207
+ }
208
+ .highlight .nt {
209
+ color: #f92672;
210
+ }
211
+ .highlight {
212
+ color: #f8f8f2;
213
+ background-color: #49483e;
214
+ }
data/assets/css/app.scss CHANGED
@@ -1,4 +1,4 @@
1
- ---
2
- ---
3
-
4
- @import "app";
1
+ ---
2
+ ---
3
+
4
+ @import "app";
data/assets/js/app.js CHANGED
@@ -1,241 +1,241 @@
1
- 'use strict';
2
-
3
- document.addEventListener('DOMContentLoaded', function () {
4
-
5
- // Dropdowns
6
-
7
- var $metalinks = getAll('#meta a');
8
-
9
- if ($metalinks.length > 0) {
10
- $metalinks.forEach(function ($el) {
11
- $el.addEventListener('click', function (event) {
12
- event.preventDefault();
13
- var target = $el.getAttribute('href');
14
- var $target = document.getElementById(target.substring(1));
15
- $target.scrollIntoView(true);
16
- // window.history.replaceState(null, document.title, `${window.location.origin}${window.location.pathname}${target}`);
17
- return false;
18
- });
19
- });
20
- }
21
-
22
- // Dropdowns
23
-
24
- var $dropdowns = getAll('.dropdown:not(.is-hoverable)');
25
-
26
- if ($dropdowns.length > 0) {
27
- $dropdowns.forEach(function ($el) {
28
- $el.addEventListener('click', function (event) {
29
- event.stopPropagation();
30
- $el.classList.toggle('is-active');
31
- });
32
- });
33
-
34
- document.addEventListener('click', function (event) {
35
- closeDropdowns();
36
- });
37
- }
38
-
39
- function closeDropdowns() {
40
- $dropdowns.forEach(function ($el) {
41
- $el.classList.remove('is-active');
42
- });
43
- }
44
-
45
- // Toggles
46
-
47
- var $burgers = getAll('.navbar-burger');
48
-
49
- if ($burgers.length > 0) {
50
- $burgers.forEach(function ($el) {
51
- $el.addEventListener('click', function () {
52
- var target = $el.dataset.target;
53
- var $target = document.getElementById(target);
54
- $el.classList.toggle('is-active');
55
- $target.classList.toggle('is-active');
56
- });
57
- });
58
- }
59
-
60
- // Modals
61
-
62
- var rootEl = document.documentElement;
63
- var $modals = getAll('.modal');
64
- var $modalButtons = getAll('.modal-button');
65
- var $modalCloses = getAll('.modal-background, .modal-close, .modal-card-head .delete, .modal-card-foot .button');
66
-
67
- if ($modalButtons.length > 0) {
68
- $modalButtons.forEach(function ($el) {
69
- $el.addEventListener('click', function () {
70
- var target = $el.dataset.target;
71
- var $target = document.getElementById(target);
72
- rootEl.classList.add('is-clipped');
73
- $target.classList.add('is-active');
74
- });
75
- });
76
- }
77
-
78
- if ($modalCloses.length > 0) {
79
- $modalCloses.forEach(function ($el) {
80
- $el.addEventListener('click', function () {
81
- closeModals();
82
- });
83
- });
84
- }
85
-
86
- document.addEventListener('keydown', function (event) {
87
- var e = event || window.event;
88
- if (e.keyCode === 27) {
89
- closeModals();
90
- closeDropdowns();
91
- }
92
- });
93
-
94
- function closeModals() {
95
- rootEl.classList.remove('is-clipped');
96
- $modals.forEach(function ($el) {
97
- $el.classList.remove('is-active');
98
- });
99
- }
100
-
101
- // Functions
102
-
103
- function getAll(selector) {
104
- return Array.prototype.slice.call(document.querySelectorAll(selector), 0);
105
- }
106
-
107
- // Scrolling
108
-
109
- var shadowedEl = document.getElementById('shadowed');
110
- var navbarEl = document.getElementById('navbar');
111
- var navbarBurger = document.getElementById('navbarBurger');
112
- var specialShadow = document.getElementById('specialShadow');
113
- var NAVBAR_HEIGHT = 52;
114
- var THRESHOLD = 160;
115
- var navbarOpen = false;
116
- var horizon = NAVBAR_HEIGHT;
117
- var whereYouStoppedScrolling = 0;
118
- var scrollFactor = 0;
119
- var currentTranslate = 0;
120
-
121
- navbarBurger.addEventListener('click', function (el) {
122
- navbarOpen = !navbarOpen;
123
-
124
- if (navbarOpen) {
125
- rootEl.classList.add('bd-is-clipped-touch');
126
- shadowedEl.style.display = shadowedEl.style.display == 'none' ? 'block' : 'none';
127
- } else {
128
- rootEl.classList.remove('bd-is-clipped-touch');
129
- shadowedEl.style.display = shadowedEl.style.display == 'none' ? 'block' : 'none';
130
- }
131
- });
132
-
133
- function upOrDown(lastY, currentY) {
134
- if (currentY >= lastY) {
135
- return goingDown(currentY);
136
- }
137
- return goingUp(currentY);
138
- }
139
-
140
- function goingDown(currentY) {
141
- var trigger = NAVBAR_HEIGHT;
142
- whereYouStoppedScrolling = currentY;
143
-
144
- if (currentY > horizon) {
145
- horizon = currentY;
146
- }
147
-
148
- translateHeader(currentY, false);
149
- }
150
-
151
- function goingUp(currentY) {
152
- var trigger = 0;
153
-
154
- if (currentY < whereYouStoppedScrolling - NAVBAR_HEIGHT) {
155
- horizon = currentY + NAVBAR_HEIGHT;
156
- }
157
-
158
- translateHeader(currentY, true);
159
- }
160
-
161
- function constrainDelta(delta) {
162
- return Math.max(0, Math.min(delta, NAVBAR_HEIGHT));
163
- }
164
-
165
- function translateHeader(currentY, upwards) {
166
- // let topTranslateValue;
167
- var translateValue = void 0;
168
-
169
- if (upwards && currentTranslate == 0) {
170
- translateValue = 0;
171
- } else if (currentY <= NAVBAR_HEIGHT) {
172
- translateValue = currentY * -1;
173
- } else {
174
- var delta = constrainDelta(Math.abs(currentY - horizon));
175
- translateValue = delta - NAVBAR_HEIGHT;
176
- }
177
-
178
- if (translateValue != currentTranslate) {
179
- var navbarStyle = '\n transform: translateY(' + translateValue + 'px);\n ';
180
- currentTranslate = translateValue;
181
- navbarEl.setAttribute('style', navbarStyle);
182
- }
183
-
184
- if (currentY > THRESHOLD * 2) {
185
- scrollFactor = 1;
186
- } else if (currentY > THRESHOLD) {
187
- scrollFactor = (currentY - THRESHOLD) / THRESHOLD;
188
- } else {
189
- scrollFactor = 0;
190
- }
191
-
192
- var translateFactor = 1 + translateValue / NAVBAR_HEIGHT;
193
- specialShadow.style.opacity = scrollFactor;
194
- specialShadow.style.transform = 'scaleY(' + translateFactor + ')';
195
- }
196
-
197
- translateHeader(window.scrollY, false);
198
-
199
- var ticking = false;
200
- var lastY = 0;
201
-
202
- window.addEventListener('scroll', function () {
203
- var currentY = window.scrollY;
204
-
205
- if (!ticking) {
206
- window.requestAnimationFrame(function () {
207
- upOrDown(lastY, currentY);
208
- ticking = false;
209
- lastY = currentY;
210
- });
211
- }
212
-
213
- ticking = true;
214
- });
215
-
216
- // Popup Sharing
217
-
218
- function popupSharing(url, provider) {
219
- return window.open(url, 'Share to ' + provider, 'menubar=1,resizable=1,width=600,height=350')
220
- }
221
-
222
- var $onShare = Array.prototype.slice.call(document.querySelectorAll('.on-share'), 0);
223
- if ($onShare.length > 0) {
224
- $onShare.forEach(function ($el) {
225
- $el.addEventListener('click', function () {
226
- var url = $el.dataset.url;
227
- var provider = $el.dataset.provider;
228
- switch (provider) {
229
- case 'facebook':
230
- return popupSharing('https://www.facebook.com/sharer/sharer.php?u=' + url, provider);
231
- case 'twitter':
232
- return popupSharing('https://twitter.com/intent/tweet?url=' + url, provider);
233
- case 'google':
234
- return popupSharing('https://plus.google.com/share?url=' + url, provider);
235
- case 'pinterest':
236
- return popupSharing('http://pinterest.com/pin/create/button/?url=' + url, provider);
237
- }
238
- });
239
- });
240
- }
241
- });
1
+ 'use strict';
2
+
3
+ document.addEventListener('DOMContentLoaded', function () {
4
+
5
+ // Dropdowns
6
+
7
+ var $metalinks = getAll('#meta a');
8
+
9
+ if ($metalinks.length > 0) {
10
+ $metalinks.forEach(function ($el) {
11
+ $el.addEventListener('click', function (event) {
12
+ event.preventDefault();
13
+ var target = $el.getAttribute('href');
14
+ var $target = document.getElementById(target.substring(1));
15
+ $target.scrollIntoView(true);
16
+ // window.history.replaceState(null, document.title, `${window.location.origin}${window.location.pathname}${target}`);
17
+ return false;
18
+ });
19
+ });
20
+ }
21
+
22
+ // Dropdowns
23
+
24
+ var $dropdowns = getAll('.dropdown:not(.is-hoverable)');
25
+
26
+ if ($dropdowns.length > 0) {
27
+ $dropdowns.forEach(function ($el) {
28
+ $el.addEventListener('click', function (event) {
29
+ event.stopPropagation();
30
+ $el.classList.toggle('is-active');
31
+ });
32
+ });
33
+
34
+ document.addEventListener('click', function (event) {
35
+ closeDropdowns();
36
+ });
37
+ }
38
+
39
+ function closeDropdowns() {
40
+ $dropdowns.forEach(function ($el) {
41
+ $el.classList.remove('is-active');
42
+ });
43
+ }
44
+
45
+ // Toggles
46
+
47
+ var $burgers = getAll('.navbar-burger');
48
+
49
+ if ($burgers.length > 0) {
50
+ $burgers.forEach(function ($el) {
51
+ $el.addEventListener('click', function () {
52
+ var target = $el.dataset.target;
53
+ var $target = document.getElementById(target);
54
+ $el.classList.toggle('is-active');
55
+ $target.classList.toggle('is-active');
56
+ });
57
+ });
58
+ }
59
+
60
+ // Modals
61
+
62
+ var rootEl = document.documentElement;
63
+ var $modals = getAll('.modal');
64
+ var $modalButtons = getAll('.modal-button');
65
+ var $modalCloses = getAll('.modal-background, .modal-close, .modal-card-head .delete, .modal-card-foot .button');
66
+
67
+ if ($modalButtons.length > 0) {
68
+ $modalButtons.forEach(function ($el) {
69
+ $el.addEventListener('click', function () {
70
+ var target = $el.dataset.target;
71
+ var $target = document.getElementById(target);
72
+ rootEl.classList.add('is-clipped');
73
+ $target.classList.add('is-active');
74
+ });
75
+ });
76
+ }
77
+
78
+ if ($modalCloses.length > 0) {
79
+ $modalCloses.forEach(function ($el) {
80
+ $el.addEventListener('click', function () {
81
+ closeModals();
82
+ });
83
+ });
84
+ }
85
+
86
+ document.addEventListener('keydown', function (event) {
87
+ var e = event || window.event;
88
+ if (e.keyCode === 27) {
89
+ closeModals();
90
+ closeDropdowns();
91
+ }
92
+ });
93
+
94
+ function closeModals() {
95
+ rootEl.classList.remove('is-clipped');
96
+ $modals.forEach(function ($el) {
97
+ $el.classList.remove('is-active');
98
+ });
99
+ }
100
+
101
+ // Functions
102
+
103
+ function getAll(selector) {
104
+ return Array.prototype.slice.call(document.querySelectorAll(selector), 0);
105
+ }
106
+
107
+ // Scrolling
108
+
109
+ var shadowedEl = document.getElementById('shadowed');
110
+ var navbarEl = document.getElementById('navbar');
111
+ var navbarBurger = document.getElementById('navbarBurger');
112
+ var specialShadow = document.getElementById('specialShadow');
113
+ var NAVBAR_HEIGHT = 52;
114
+ var THRESHOLD = 160;
115
+ var navbarOpen = false;
116
+ var horizon = NAVBAR_HEIGHT;
117
+ var whereYouStoppedScrolling = 0;
118
+ var scrollFactor = 0;
119
+ var currentTranslate = 0;
120
+
121
+ navbarBurger.addEventListener('click', function (el) {
122
+ navbarOpen = !navbarOpen;
123
+
124
+ if (navbarOpen) {
125
+ rootEl.classList.add('bd-is-clipped-touch');
126
+ shadowedEl.style.display = shadowedEl.style.display == 'none' ? 'block' : 'none';
127
+ } else {
128
+ rootEl.classList.remove('bd-is-clipped-touch');
129
+ shadowedEl.style.display = shadowedEl.style.display == 'none' ? 'block' : 'none';
130
+ }
131
+ });
132
+
133
+ function upOrDown(lastY, currentY) {
134
+ if (currentY >= lastY) {
135
+ return goingDown(currentY);
136
+ }
137
+ return goingUp(currentY);
138
+ }
139
+
140
+ function goingDown(currentY) {
141
+ var trigger = NAVBAR_HEIGHT;
142
+ whereYouStoppedScrolling = currentY;
143
+
144
+ if (currentY > horizon) {
145
+ horizon = currentY;
146
+ }
147
+
148
+ translateHeader(currentY, false);
149
+ }
150
+
151
+ function goingUp(currentY) {
152
+ var trigger = 0;
153
+
154
+ if (currentY < whereYouStoppedScrolling - NAVBAR_HEIGHT) {
155
+ horizon = currentY + NAVBAR_HEIGHT;
156
+ }
157
+
158
+ translateHeader(currentY, true);
159
+ }
160
+
161
+ function constrainDelta(delta) {
162
+ return Math.max(0, Math.min(delta, NAVBAR_HEIGHT));
163
+ }
164
+
165
+ function translateHeader(currentY, upwards) {
166
+ // let topTranslateValue;
167
+ var translateValue = void 0;
168
+
169
+ if (upwards && currentTranslate == 0) {
170
+ translateValue = 0;
171
+ } else if (currentY <= NAVBAR_HEIGHT) {
172
+ translateValue = currentY * -1;
173
+ } else {
174
+ var delta = constrainDelta(Math.abs(currentY - horizon));
175
+ translateValue = delta - NAVBAR_HEIGHT;
176
+ }
177
+
178
+ if (translateValue != currentTranslate) {
179
+ var navbarStyle = '\n transform: translateY(' + translateValue + 'px);\n ';
180
+ currentTranslate = translateValue;
181
+ navbarEl.setAttribute('style', navbarStyle);
182
+ }
183
+
184
+ if (currentY > THRESHOLD * 2) {
185
+ scrollFactor = 1;
186
+ } else if (currentY > THRESHOLD) {
187
+ scrollFactor = (currentY - THRESHOLD) / THRESHOLD;
188
+ } else {
189
+ scrollFactor = 0;
190
+ }
191
+
192
+ var translateFactor = 1 + translateValue / NAVBAR_HEIGHT;
193
+ specialShadow.style.opacity = scrollFactor;
194
+ specialShadow.style.transform = 'scaleY(' + translateFactor + ')';
195
+ }
196
+
197
+ translateHeader(window.scrollY, false);
198
+
199
+ var ticking = false;
200
+ var lastY = 0;
201
+
202
+ window.addEventListener('scroll', function () {
203
+ var currentY = window.scrollY;
204
+
205
+ if (!ticking) {
206
+ window.requestAnimationFrame(function () {
207
+ upOrDown(lastY, currentY);
208
+ ticking = false;
209
+ lastY = currentY;
210
+ });
211
+ }
212
+
213
+ ticking = true;
214
+ });
215
+
216
+ // Popup Sharing
217
+
218
+ function popupSharing(url, provider) {
219
+ return window.open(url, 'Share to ' + provider, 'menubar=1,resizable=1,width=600,height=350')
220
+ }
221
+
222
+ var $onShare = Array.prototype.slice.call(document.querySelectorAll('.on-share'), 0);
223
+ if ($onShare.length > 0) {
224
+ $onShare.forEach(function ($el) {
225
+ $el.addEventListener('click', function () {
226
+ var url = $el.dataset.url;
227
+ var provider = $el.dataset.provider;
228
+ switch (provider) {
229
+ case 'facebook':
230
+ return popupSharing('https://www.facebook.com/sharer/sharer.php?u=' + url, provider);
231
+ case 'twitter':
232
+ return popupSharing('https://twitter.com/intent/tweet?url=' + url, provider);
233
+ case 'google':
234
+ return popupSharing('https://plus.google.com/share?url=' + url, provider);
235
+ case 'pinterest':
236
+ return popupSharing('http://pinterest.com/pin/create/button/?url=' + url, provider);
237
+ }
238
+ });
239
+ });
240
+ }
241
+ });