jekyll-bulma-theme 1.0.11 → 1.0.12

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +63 -63
  3. data/_sass/_app.scss +152 -157
  4. data/assets/js/app.js +267 -241
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7c847aeeaab1bf7fafc2e8b1715585e1e81d7c3
4
- data.tar.gz: 469aef19f1988f6c3dafd4433e27b11d259b9b9c
3
+ metadata.gz: 4073e461beb6e1747a08cb7317678bbad64f697a
4
+ data.tar.gz: 6566292279fd83ea5ffbd290c65d0b5b7232d1b9
5
5
  SHA512:
6
- metadata.gz: 5f89fae160c84eb1337da437d25722444bf6403c58eb3e6fe9eeb3417e6a6d089167c2bfbc1f8cd0a29fb6beea2d61cf3756d1e6003da2bf90d8ea6990f04ece
7
- data.tar.gz: 5f2acc8c74d350931610eb09da7de59332c7d3df52948608d4e9365588e4c8696848404b4787f6f5f147a860290009fd4085d8bcacc095686d9454d15863cacf
6
+ metadata.gz: 77d527732a99ebdf1be0de69d016447e21881e7f0a6a2ee55d10b134b21352d09d8e7b44042939d2805ea9b956836fac4ee1f880271538cedaf93c499f8273ef
7
+ data.tar.gz: 6a3ada547d2fae9c12a8dc63d4e0eddaa88dabe9f2c993f5a17d6435621c615ee788e9651b5a25bb5066fff1056fc7af7a0cf65857f7cba4c806f208dddb7d3d
data/README.md CHANGED
@@ -1,63 +1,63 @@
1
- # Bulma theme for Jekyll 3
2
-
3
- This is a pure [Bulma CSS Framework](https://bulma.io) by using a `cdnjs` provider instead of using `npm`, so this may need internet connection for development and cannot custom a `sass` for your own.
4
-
5
- > My English is not good, so you can make pull request to improvement this `README.md`.
6
-
7
- ## Feature
8
-
9
- - Layout `default.html` that clone from [Bulma Documentation](https://bulma.io/documentation/overview/start/).
10
- - Favicon 32x32 and 64x64 pixel support.
11
- - Scroll up to show `navbar` as fixed.
12
- - Add navbar shadow for wrapper when active.
13
- - Dropdown and Modal support.
14
- - Share button for `Facebook`, `Twitter`, `Google Plus` and `Pinterest`
15
- - Example of `index.html` for `jekyll-pagination`.
16
- - Meta tag of `description` by `page.excerpt` (Receive from before `<!--more-->` of posts).
17
- - Custom css for header to show `#` like markdown.
18
- - Author information for posts.
19
- - Custom version of packages from cdn provider.
20
- - Configable for date formatting.
21
-
22
- ## Installation
23
-
24
- Add this line to your Jekyll site's `Gemfile`:
25
-
26
- ```ruby
27
- gem "jekyll-bulma-theme"
28
- ```
29
-
30
- And add this line to your Jekyll site's `_config.yml`:
31
-
32
- ```yaml
33
- theme: jekyll-bulma-theme
34
- ```
35
-
36
- And then execute:
37
-
38
- $ bundle
39
-
40
- Or install it yourself as:
41
-
42
- $ gem install jekyll-bulma-theme
43
-
44
- ## Usage
45
-
46
- After done of installation, so you may copy a `index.html` for index page that included with `jekyll-pagination` support, also you can custom you own `_includes` by replace exact name to custom `_layouts/default.html` like you may need an extra sub-route for `header.html` or translate to you own language.
47
-
48
- ## Contributing
49
-
50
- Bug reports and pull requests are welcome on GitHub at https://github.com/anitation/jekyll-bulma-theme. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
51
-
52
- ## Development
53
-
54
- To set up your environment to develop this theme, run `bundle install`.
55
-
56
- Your theme is setup just like a normal Jekyll site! To test your theme, run `bundle exec jekyll serve` and open your browser at `http://localhost:4000`. This starts a Jekyll server using your theme. Add pages, documents, data, etc. like normal to test your theme's contents. As you make modifications to your theme and to your content, your site will regenerate and you should see the changes in the browser after a refresh, just like normal.
57
-
58
- When your theme is released, only the files in `_layouts`, `_includes`, `_sass` and `assets` tracked with Git will be bundled.
59
- To add a custom directory to your theme-gem, please edit the regexp in `jekyll-bulma-theme.gemspec` accordingly.
60
-
61
- ## License
62
-
63
- The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
1
+ # Bulma theme for Jekyll 3
2
+
3
+ This is a pure [Bulma CSS Framework](https://bulma.io) by using a `cdnjs` provider instead of using `npm`, so this may need internet connection for development and cannot custom a `sass` for your own.
4
+
5
+ > My English is not good, so you can make pull request to improvement this `README.md`.
6
+
7
+ ## Feature
8
+
9
+ - Layout `default.html` that clone from [Bulma Documentation](https://bulma.io/documentation/overview/start/).
10
+ - Favicon 32x32 and 64x64 pixel support.
11
+ - Scroll up to show `navbar` as fixed.
12
+ - Add navbar shadow for wrapper when active.
13
+ - Dropdown and Modal support.
14
+ - Share button for `Facebook`, `Twitter`, `Google Plus` and `Pinterest`
15
+ - Example of `index.html` for `jekyll-pagination`.
16
+ - Meta tag of `description` by `page.excerpt` (Receive from before `<!--more-->` of posts).
17
+ - Custom css for header to show `#` like markdown.
18
+ - Author information for posts.
19
+ - Custom version of packages from cdn provider.
20
+ - Configable for date formatting.
21
+
22
+ ## Installation
23
+
24
+ Add this line to your Jekyll site's `Gemfile`:
25
+
26
+ ```ruby
27
+ gem "jekyll-bulma-theme"
28
+ ```
29
+
30
+ And add this line to your Jekyll site's `_config.yml`:
31
+
32
+ ```yaml
33
+ theme: jekyll-bulma-theme
34
+ ```
35
+
36
+ And then execute:
37
+
38
+ $ bundle
39
+
40
+ Or install it yourself as:
41
+
42
+ $ gem install jekyll-bulma-theme
43
+
44
+ ## Usage
45
+
46
+ After done of installation, so you may copy a `index.html` for index page that included with `jekyll-pagination` support, also you can custom you own `_includes` by replace exact name to custom `_layouts/default.html` like you may need an extra sub-route for `header.html` or translate to you own language.
47
+
48
+ ## Contributing
49
+
50
+ Bug reports and pull requests are welcome on GitHub at https://github.com/anitation/jekyll-bulma-theme. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
51
+
52
+ ## Development
53
+
54
+ To set up your environment to develop this theme, run `bundle install`.
55
+
56
+ Your theme is setup just like a normal Jekyll site! To test your theme, run `bundle exec jekyll serve` and open your browser at `http://localhost:4000`. This starts a Jekyll server using your theme. Add pages, documents, data, etc. like normal to test your theme's contents. As you make modifications to your theme and to your content, your site will regenerate and you should see the changes in the browser after a refresh, just like normal.
57
+
58
+ When your theme is released, only the files in `_layouts`, `_includes`, `_sass` and `assets` tracked with Git will be bundled.
59
+ To add a custom directory to your theme-gem, please edit the regexp in `jekyll-bulma-theme.gemspec` accordingly.
60
+
61
+ ## License
62
+
63
+ The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -1,157 +1,152 @@
1
- @import "syntax";
2
-
3
- $github: #333333;
4
- $twitter: #1da1f2;
5
- $facebook: #3b5998;
6
- $google: #dd4b39;
7
- $pinterest: #bd081c;
8
-
9
- body {
10
- display: flex;
11
- min-height: 100vh;
12
- flex-direction: column;
13
- margin-top: 52px;
14
- }
15
-
16
- #app {
17
- flex: 1 0 auto;
18
- }
19
-
20
- .media-content {
21
- overflow: hidden;
22
- }
23
-
24
- .text-github, a.navbar-item.text-github:hover {
25
- color: $github;
26
- }
27
-
28
- .text-twitter, a.navbar-item.text-twitter:hover {
29
- color: $twitter;
30
- }
31
-
32
- .text-facebook, a.navbar-item.text-facebook:hover {
33
- color: $facebook;
34
- }
35
-
36
- .is-github {
37
- background-color: $github;
38
- }
39
-
40
- .is-twitter {
41
- background-color: $twitter;
42
- }
43
-
44
- .is-facebook {
45
- background-color: $facebook;
46
- }
47
-
48
- .is-google {
49
- background-color: $google;
50
- }
51
-
52
- .is-pinterest {
53
- background-color: $pinterest;
54
- }
55
-
56
- .button {
57
- &.is-github,
58
- &.is-twitter,
59
- &.is-facebook,
60
- &.is-google,
61
- &.is-pinterest {
62
- border-color: transparent;
63
- color: white;
64
- }
65
- }
66
-
67
- .task-list-item-checkbox {
68
- margin-right: 5px;
69
- }
70
-
71
- .task-list-item {
72
- list-style: none;
73
- }
74
-
75
- %header-hashtag {
76
- color: #3273dc;
77
- margin-right: 10px;
78
- }
79
-
80
- .content {
81
- h1::before {
82
- content: "#";
83
- @extend %header-hashtag;
84
- }
85
- h2::before {
86
- content: "##";
87
- @extend %header-hashtag;
88
- }
89
- h3::before {
90
- content: "###";
91
- @extend %header-hashtag;
92
- }
93
- h4::before {
94
- content: "####";
95
- @extend %header-hashtag;
96
- }
97
- h5::before {
98
- content: "#####";
99
- @extend %header-hashtag;
100
- }
101
- h6::before {
102
- content: "######";
103
- @extend %header-hashtag;
104
- }
105
- }
106
-
107
- .message-body .media {
108
- img.avatar {
109
- height: 80px;
110
- width: 80px;
111
- border-radius: 50%;
112
- }
113
- blockquote {
114
- background-color: transparent;
115
- border-left: none;
116
- padding: 0 1.5em 0.5em;
117
- color: grey;
118
- font-size: 1.2rem;
119
- &::before {
120
- content: "\2014\2014\2014";
121
- }
122
- }
123
- a:not(.button):not(.tag) {
124
- text-decoration: none;
125
- }
126
- }
127
-
128
- .bd-special-shadow {
129
- background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.1)), to(transparent));
130
- background-image: linear-gradient(rgba(0, 0, 0, 0.1), transparent);
131
- height: 8px;
132
- left: 0;
133
- opacity: 0;
134
- position: absolute;
135
- right: 0;
136
- top: 100%;
137
- -webkit-transform: scaleY(0);
138
- transform: scaleY(0);
139
- -webkit-transform-origin: center top;
140
- transform-origin: center top;
141
- }
142
-
143
- @media screen and (max-width: 1023px) {
144
- .bd-is-clipped-touch {
145
- overflow: hidden !important;
146
- }
147
- }
148
-
149
- #shadowed {
150
- position: fixed;
151
- top: 0;
152
- right: 0;
153
- bottom: 0;
154
- left: 0;
155
- z-index: 10;
156
- background-color: rgba(0, 0, 0, .5);
157
- }
1
+ @import "syntax";
2
+
3
+ $github: #333333;
4
+ $twitter: #1da1f2;
5
+ $facebook: #3b5998;
6
+ $google: #dd4b39;
7
+ $pinterest: #bd081c;
8
+
9
+ body {
10
+ display: flex;
11
+ min-height: 100vh;
12
+ flex-direction: column;
13
+ margin-top: 52px;
14
+ }
15
+
16
+ #app {
17
+ flex: 1 0 auto;
18
+ }
19
+
20
+ .media-content {
21
+ overflow: hidden;
22
+ }
23
+
24
+ .text-github, a.navbar-item.text-github:hover {
25
+ color: $github;
26
+ }
27
+
28
+ .text-twitter, a.navbar-item.text-twitter:hover {
29
+ color: $twitter;
30
+ }
31
+
32
+ .text-facebook, a.navbar-item.text-facebook:hover {
33
+ color: $facebook;
34
+ }
35
+
36
+ .is-github {
37
+ background-color: $github;
38
+ }
39
+
40
+ .is-twitter {
41
+ background-color: $twitter;
42
+ }
43
+
44
+ .is-facebook {
45
+ background-color: $facebook;
46
+ }
47
+
48
+ .is-google {
49
+ background-color: $google;
50
+ }
51
+
52
+ .is-pinterest {
53
+ background-color: $pinterest;
54
+ }
55
+
56
+ .button {
57
+ &.is-github,
58
+ &.is-twitter,
59
+ &.is-facebook,
60
+ &.is-google,
61
+ &.is-pinterest {
62
+ border-color: transparent;
63
+ color: white;
64
+ }
65
+ }
66
+
67
+ .task-list-item-checkbox {
68
+ margin-right: 5px;
69
+ }
70
+
71
+ .task-list-item {
72
+ list-style: none;
73
+ }
74
+
75
+ // .content {
76
+ // h1::before {
77
+ // content: "#";
78
+ // @extend %header-hashtag;
79
+ // }
80
+ // h2::before {
81
+ // content: "##";
82
+ // @extend %header-hashtag;
83
+ // }
84
+ // h3::before {
85
+ // content: "###";
86
+ // @extend %header-hashtag;
87
+ // }
88
+ // h4::before {
89
+ // content: "####";
90
+ // @extend %header-hashtag;
91
+ // }
92
+ // h5::before {
93
+ // content: "#####";
94
+ // @extend %header-hashtag;
95
+ // }
96
+ // h6::before {
97
+ // content: "######";
98
+ // @extend %header-hashtag;
99
+ // }
100
+ // }
101
+
102
+ .message-body .media {
103
+ img.avatar {
104
+ height: 80px;
105
+ width: 80px;
106
+ border-radius: 50%;
107
+ }
108
+ blockquote {
109
+ background-color: transparent;
110
+ border-left: none;
111
+ padding: 0 1.5em 0.5em;
112
+ color: grey;
113
+ font-size: 1.2rem;
114
+ &::before {
115
+ content: "\2014\2014\2014";
116
+ }
117
+ }
118
+ a:not(.button):not(.tag) {
119
+ text-decoration: none;
120
+ }
121
+ }
122
+
123
+ .bd-special-shadow {
124
+ background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.1)), to(transparent));
125
+ background-image: linear-gradient(rgba(0, 0, 0, 0.1), transparent);
126
+ height: 8px;
127
+ left: 0;
128
+ opacity: 0;
129
+ position: absolute;
130
+ right: 0;
131
+ top: 100%;
132
+ -webkit-transform: scaleY(0);
133
+ transform: scaleY(0);
134
+ -webkit-transform-origin: center top;
135
+ transform-origin: center top;
136
+ }
137
+
138
+ @media screen and (max-width: 1023px) {
139
+ .bd-is-clipped-touch {
140
+ overflow: hidden !important;
141
+ }
142
+ }
143
+
144
+ #shadowed {
145
+ position: fixed;
146
+ top: 0;
147
+ right: 0;
148
+ bottom: 0;
149
+ left: 0;
150
+ z-index: 10;
151
+ background-color: rgba(0, 0, 0, .5);
152
+ }
@@ -1,241 +1,267 @@
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
+ if (!navbarOpen) {
142
+ var trigger = NAVBAR_HEIGHT;
143
+ whereYouStoppedScrolling = currentY;
144
+
145
+ if (currentY > horizon) {
146
+ horizon = currentY;
147
+ }
148
+
149
+ translateHeader(currentY, false);
150
+ }
151
+ }
152
+
153
+ function goingUp(currentY) {
154
+ if (!navbarOpen) {
155
+ var trigger = 0;
156
+
157
+ if (currentY < whereYouStoppedScrolling - NAVBAR_HEIGHT) {
158
+ horizon = currentY + NAVBAR_HEIGHT;
159
+ }
160
+
161
+ translateHeader(currentY, true);
162
+ }
163
+ }
164
+
165
+ function constrainDelta(delta) {
166
+ return Math.max(0, Math.min(delta, NAVBAR_HEIGHT));
167
+ }
168
+
169
+ function translateHeader(currentY, upwards) {
170
+ // let topTranslateValue;
171
+ var translateValue = void 0;
172
+
173
+ if (upwards && currentTranslate == 0) {
174
+ translateValue = 0;
175
+ } else if (currentY <= NAVBAR_HEIGHT) {
176
+ translateValue = currentY * -1;
177
+ } else {
178
+ var delta = constrainDelta(Math.abs(currentY - horizon));
179
+ translateValue = delta - NAVBAR_HEIGHT;
180
+ }
181
+
182
+ if (translateValue != currentTranslate) {
183
+ var navbarStyle = '\n transform: translateY(' + translateValue + 'px);\n ';
184
+ currentTranslate = translateValue;
185
+ navbarEl.setAttribute('style', navbarStyle);
186
+ }
187
+
188
+ if (currentY > THRESHOLD * 2) {
189
+ scrollFactor = 1;
190
+ } else if (currentY > THRESHOLD) {
191
+ scrollFactor = (currentY - THRESHOLD) / THRESHOLD;
192
+ } else {
193
+ scrollFactor = 0;
194
+ }
195
+
196
+ var translateFactor = 1 + translateValue / NAVBAR_HEIGHT;
197
+ specialShadow.style.opacity = scrollFactor;
198
+ specialShadow.style.transform = 'scaleY(' + translateFactor + ')';
199
+ }
200
+
201
+ translateHeader(window.scrollY, false);
202
+
203
+ var ticking = false;
204
+ var lastY = 0;
205
+
206
+ window.addEventListener('scroll', function () {
207
+ var currentY = window.scrollY;
208
+
209
+ if (!ticking) {
210
+ window.requestAnimationFrame(function () {
211
+ upOrDown(lastY, currentY);
212
+ ticking = false;
213
+ lastY = currentY;
214
+ });
215
+ }
216
+
217
+ ticking = true;
218
+ });
219
+
220
+ // Popup Sharing
221
+
222
+ function popupSharing(url, provider) {
223
+ return window.open(url, 'Share to ' + provider, 'menubar=1,resizable=1,width=600,height=350')
224
+ }
225
+
226
+ var $onShare = Array.prototype.slice.call(document.querySelectorAll('.on-share'), 0);
227
+ if ($onShare.length > 0) {
228
+ $onShare.forEach(function ($el) {
229
+ $el.addEventListener('click', function () {
230
+ var url = $el.dataset.url;
231
+ var provider = $el.dataset.provider;
232
+ switch (provider) {
233
+ case 'facebook':
234
+ return popupSharing('https://www.facebook.com/sharer/sharer.php?u=' + url, provider);
235
+ case 'twitter':
236
+ return popupSharing('https://twitter.com/intent/tweet?url=' + url, provider);
237
+ case 'google':
238
+ return popupSharing('https://plus.google.com/share?url=' + url, provider);
239
+ case 'pinterest':
240
+ return popupSharing('http://pinterest.com/pin/create/button/?url=' + url, provider);
241
+ }
242
+ });
243
+ });
244
+ }
245
+
246
+ // Heading anchor
247
+
248
+ var contentEl = document.getElementsByClassName('content');
249
+ for (var el of contentEl) {
250
+ [].forEach.call(el.querySelectorAll('h1, h2, h3, h4, h5, h6'), (function (head) {
251
+ head.innerHTML = `
252
+ <a href="#${head.id}">
253
+ ${toHashTag(head.tagName.substring(1))}
254
+ </a>
255
+ <span>${head.innerText}</span>
256
+ `;
257
+ }));
258
+ }
259
+
260
+ function toHashTag(num) {
261
+ var hashTags = '';
262
+ for(var i = 0; i < num; i++) {
263
+ hashTags += '#';
264
+ }
265
+ return hashTags;
266
+ }
267
+ });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-bulma-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nakorn Sinpadung