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.
- checksums.yaml +4 -4
- data/README.md +63 -63
- data/_sass/_app.scss +152 -157
- data/assets/js/app.js +267 -241
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4073e461beb6e1747a08cb7317678bbad64f697a
|
4
|
+
data.tar.gz: 6566292279fd83ea5ffbd290c65d0b5b7232d1b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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).
|
data/_sass/_app.scss
CHANGED
@@ -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
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
-
|
140
|
-
|
141
|
-
}
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
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
|
+
}
|
data/assets/js/app.js
CHANGED
@@ -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
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
horizon
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
if (
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
}
|
164
|
-
|
165
|
-
function
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
}
|
187
|
-
|
188
|
-
|
189
|
-
scrollFactor =
|
190
|
-
}
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
case '
|
234
|
-
return popupSharing('https://
|
235
|
-
case '
|
236
|
-
return popupSharing('
|
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
|
+
});
|