jekyll-text-theme 2.2.3 → 2.2.4
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/CHANGELOG.md +13 -1
- data/README.md +2 -2
- data/_data/variables.yml +2 -0
- data/_includes/comments-providers/valine.html +33 -0
- data/_includes/comments.html +2 -0
- data/_includes/scripts/components/lightbox.js +49 -0
- data/_includes/scripts/components/search/search.js +30 -45
- data/_includes/scripts/components/sidebar.js +2 -5
- data/_includes/scripts/lib/affix.js +1 -1
- data/_includes/scripts/lib/gallery.js +89 -0
- data/_includes/scripts/lib/modal.js +62 -0
- data/_includes/scripts/lib/swiper.js +65 -34
- data/_includes/scripts/lib/toc.js +1 -1
- data/_includes/scripts/utils/imagesLoad.js +28 -0
- data/_includes/scripts/{utils.js → utils/utils.js} +8 -3
- data/_includes/scripts/variables.html +2 -1
- data/_includes/search.html +2 -4
- data/_layouts/base.html +4 -2
- data/_layouts/page.html +20 -7
- data/_sass/common/_reset.scss +5 -10
- data/_sass/common/_variables.scss +10 -10
- data/_sass/common/classes/_overflow.scss +22 -4
- data/_sass/common/components/_button.scss +20 -1
- data/_sass/common/components/_card.scss +1 -0
- data/_sass/common/components/_gallery.scss +21 -0
- data/_sass/common/components/_item.scss +1 -1
- data/_sass/common/components/_modal.scss +39 -0
- data/_sass/common/components/_swiper.scss +7 -4
- data/_sass/common/components/_toc.scss +47 -50
- data/_sass/components/_article-content.scss +1 -1
- data/_sass/components/_header.scss +1 -1
- data/_sass/components/_lightbox.scss +7 -0
- data/_sass/components/_search.scss +52 -26
- data/_sass/layout/_base.scss +0 -4
- data/_sass/layout/_page.scss +17 -54
- data/_sass/skins/_chocolate.scss +4 -1
- data/_sass/skins/_dark.scss +4 -1
- data/_sass/skins/_default.scss +4 -1
- data/_sass/skins/_forest.scss +4 -1
- data/_sass/skins/_ocean.scss +9 -6
- data/_sass/skins/_orange.scss +4 -1
- data/assets/css/main.scss +3 -0
- metadata +11 -4
- data/_includes/comments-providers/custom.html +0 -0
@@ -3,39 +3,31 @@
|
|
3
3
|
window.Lazyload.js(SOURCES.jquery, function() {
|
4
4
|
function swiper(options) {
|
5
5
|
var $window = $(window), $root = this, $swiperWrapper, $swiperButtonPrev, $swiperButtonNext,
|
6
|
-
initialSlide,
|
7
|
-
rootWidth,
|
6
|
+
initialSlide, animation,
|
7
|
+
rootWidth, count, curIndex, translateX, CRITICAL_ANGLE = Math.PI / 3;
|
8
8
|
|
9
9
|
function setOptions(options) {
|
10
10
|
var _options = options || {};
|
11
11
|
initialSlide = _options.initialSlide || 0;
|
12
12
|
animation = _options.animation === undefined && true;
|
13
|
-
width = _options.width === undefined ||
|
14
|
-
typeof _options.width === 'string' ? _options.width :
|
15
|
-
typeof _options.width === 'number' ? _options.width + 'px' : undefined;
|
16
|
-
height = _options.height === undefined ||
|
17
|
-
typeof _options.height === 'string' ? _options.height :
|
18
|
-
typeof _options.height === 'number' ? _options.height + 'px' : undefined;
|
19
|
-
init();
|
20
13
|
}
|
21
14
|
|
22
15
|
function init() {
|
23
16
|
$swiperWrapper = $root.find('.swiper__wrapper');
|
24
17
|
$swiperButtonPrev = $root.find('.swiper__button--prev');
|
25
18
|
$swiperButtonNext = $root.find('.swiper__button--next');
|
26
|
-
count = $swiperWrapper.children('.swiper__slide').length;
|
27
|
-
curIndex = initialSlide || 0;
|
28
|
-
translateX = getTranslateXFromCurIndex();
|
29
|
-
var _cssObj = {};
|
30
|
-
width === undefined || (_cssObj.width = width);
|
31
|
-
height === undefined || (_cssObj.height = height);
|
32
|
-
$root.css(_cssObj);
|
33
19
|
animation && $swiperWrapper.addClass('swiper__wrapper--animation');
|
20
|
+
calc(true);
|
34
21
|
}
|
35
22
|
|
36
23
|
function preCalc() {
|
37
24
|
rootWidth = $root.width();
|
38
|
-
|
25
|
+
count = $swiperWrapper.children('.swiper__slide').length;
|
26
|
+
if (count < 2) {
|
27
|
+
$swiperButtonPrev.addClass('d-none');
|
28
|
+
$swiperButtonNext.addClass('d-none');
|
29
|
+
}
|
30
|
+
curIndex = initialSlide || 0;
|
39
31
|
translateX = getTranslateXFromCurIndex();
|
40
32
|
}
|
41
33
|
|
@@ -49,13 +41,17 @@
|
|
49
41
|
$swiperWrapper.removeClass('swiper__wrapper--animation');
|
50
42
|
}
|
51
43
|
$swiperWrapper.css('transform', 'translate(' + translateX + 'px, 0)');
|
52
|
-
if (
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
44
|
+
if (count > 1) {
|
45
|
+
if (curIndex <= 0) {
|
46
|
+
$swiperButtonPrev.addClass('disabled');
|
47
|
+
} else {
|
48
|
+
$swiperButtonPrev.removeClass('disabled');
|
49
|
+
}
|
50
|
+
if (curIndex >= count - 1) {
|
51
|
+
$swiperButtonNext.addClass('disabled');
|
52
|
+
} else {
|
53
|
+
$swiperButtonNext.removeClass('disabled');
|
54
|
+
}
|
59
55
|
}
|
60
56
|
};
|
61
57
|
})();
|
@@ -88,12 +84,14 @@
|
|
88
84
|
}
|
89
85
|
|
90
86
|
setOptions(options);
|
91
|
-
|
87
|
+
init();
|
92
88
|
|
93
|
-
$swiperButtonPrev.on('click', function() {
|
89
|
+
$swiperButtonPrev.on('click', function(e) {
|
90
|
+
e.stopPropagation();
|
94
91
|
move('prev');
|
95
92
|
});
|
96
|
-
$swiperButtonNext.on('click', function() {
|
93
|
+
$swiperButtonNext.on('click', function(e) {
|
94
|
+
e.stopPropagation();
|
97
95
|
move('next');
|
98
96
|
});
|
99
97
|
$window.on('resize', function() {
|
@@ -103,14 +101,14 @@
|
|
103
101
|
|
104
102
|
(function() {
|
105
103
|
var pageX, pageY, velocityX, preTranslateX = translateX, timeStamp, touching;
|
106
|
-
|
104
|
+
function handleTouchstart(e) {
|
107
105
|
var point = e.touches ? e.touches[0] : e;
|
108
106
|
pageX = point.pageX;
|
109
107
|
pageY = point.pageY;
|
110
108
|
velocityX = 0;
|
111
109
|
preTranslateX = translateX;
|
112
|
-
}
|
113
|
-
|
110
|
+
}
|
111
|
+
function handleTouchmove(e) {
|
114
112
|
var point = e.touches ? e.touches[0] : e;
|
115
113
|
var deltaX = point.pageX - pageX;
|
116
114
|
var deltaY = point.pageY - pageY;
|
@@ -123,8 +121,8 @@
|
|
123
121
|
}
|
124
122
|
pageX = point.pageX;
|
125
123
|
pageY = point.pageY;
|
126
|
-
}
|
127
|
-
|
124
|
+
}
|
125
|
+
function handleTouchend() {
|
128
126
|
touching = false;
|
129
127
|
var deltaX = translateX - preTranslateX;
|
130
128
|
var distance = deltaX + velocityX * rootWidth;
|
@@ -133,7 +131,31 @@
|
|
133
131
|
} else {
|
134
132
|
move('cur');
|
135
133
|
}
|
136
|
-
}
|
134
|
+
}
|
135
|
+
$swiperWrapper.on('touchstart', handleTouchstart);
|
136
|
+
$swiperWrapper.on('touchmove', handleTouchmove);
|
137
|
+
$swiperWrapper.on('touchend', handleTouchend);
|
138
|
+
$swiperWrapper.on('touchcancel', handleTouchend);
|
139
|
+
|
140
|
+
(function() {
|
141
|
+
var pressing = false, moved = false;
|
142
|
+
$swiperWrapper.on('mousedown', function(e) {
|
143
|
+
pressing = true; handleTouchstart(e);
|
144
|
+
});
|
145
|
+
$swiperWrapper.on('mousemove', function(e) {
|
146
|
+
pressing && (e.preventDefault(), moved = true, handleTouchmove(e));
|
147
|
+
});
|
148
|
+
$swiperWrapper.on('mouseup', function(e) {
|
149
|
+
pressing && (pressing = false, handleTouchend(e));
|
150
|
+
});
|
151
|
+
$swiperWrapper.on('mouseleave', function(e) {
|
152
|
+
pressing && (pressing = false, handleTouchend(e));
|
153
|
+
});
|
154
|
+
$swiperWrapper.on('click', function(e) {
|
155
|
+
moved && (e.stopPropagation(), moved = false);
|
156
|
+
});
|
157
|
+
})();
|
158
|
+
|
137
159
|
$root.on('touchmove', function(e) {
|
138
160
|
if (e.cancelable & touching) {
|
139
161
|
e.preventDefault();
|
@@ -142,7 +164,16 @@
|
|
142
164
|
})();
|
143
165
|
|
144
166
|
return {
|
145
|
-
setOptions: setOptions
|
167
|
+
setOptions: setOptions,
|
168
|
+
previous: function(){
|
169
|
+
move('prev');
|
170
|
+
},
|
171
|
+
next: function(){
|
172
|
+
move('next');
|
173
|
+
},
|
174
|
+
refresh: function() {
|
175
|
+
calc(true, { animation: false });
|
176
|
+
}
|
146
177
|
};
|
147
178
|
}
|
148
179
|
$.fn.swiper = swiper;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
var SOURCES = window.TEXT_VARIABLES.sources;
|
3
3
|
window.Lazyload.js(SOURCES.jquery, function() {
|
4
4
|
function toc(options) {
|
5
|
-
var $root = this, $window = $(window), $scrollTarget, $scroller, $tocUl = $('<ul class="toc"></ul>'), $tocLi, $headings, $activeLast, $activeCur,
|
5
|
+
var $root = this, $window = $(window), $scrollTarget, $scroller, $tocUl = $('<ul class="toc toc--ellipsis"></ul>'), $tocLi, $headings, $activeLast, $activeCur,
|
6
6
|
selectors = 'h1,h2,h3', container = 'body', scrollTarget = window, scroller = 'html, body', disabled = false,
|
7
7
|
headingsPos, scrolling = false, hasRendered = false, hasInit = false;
|
8
8
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
(function() {
|
2
|
+
window.imagesLoad = function(images) {
|
3
|
+
images = images || document.getElementsByTagName('img');
|
4
|
+
var imagesCount = images.length, loadedCount = 0, image;
|
5
|
+
var i, j, loaded = false, cbs = [];
|
6
|
+
imagesCount < 1 && (loaded = true);
|
7
|
+
for (i = 0; i < imagesCount; i++) {
|
8
|
+
image = images[i];
|
9
|
+
image.complete ? handleImageLoad() : image.addEventListener('load', handleImageLoad);
|
10
|
+
}
|
11
|
+
function handleImageLoad() {
|
12
|
+
loadedCount++;
|
13
|
+
if (loadedCount === imagesCount) {
|
14
|
+
loaded = true;
|
15
|
+
if (cbs.length > 0) {
|
16
|
+
for (j = 0; j < cbs.length; j++) {
|
17
|
+
cbs[j]();
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
return {
|
23
|
+
then: function(cb) {
|
24
|
+
cb && (loaded ? cb() : (cbs.push(cb)));
|
25
|
+
}
|
26
|
+
};
|
27
|
+
};
|
28
|
+
})();
|
@@ -10,7 +10,6 @@
|
|
10
10
|
return str ? decodeURIComponent(str.replace(/\+/g, '%20')) : '';
|
11
11
|
};
|
12
12
|
|
13
|
-
|
14
13
|
window.hasEvent = function(event) {
|
15
14
|
return 'on'.concat(event) in window.document;
|
16
15
|
};
|
@@ -19,13 +18,19 @@
|
|
19
18
|
return node === document.documentElement || node === document.body || node === window;
|
20
19
|
};
|
21
20
|
|
21
|
+
window.isFormElement = function(node) {
|
22
|
+
var tagName = node.tagName;
|
23
|
+
return tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA';
|
24
|
+
};
|
25
|
+
|
22
26
|
window.pageLoad = (function () {
|
23
27
|
var loaded = false, cbs = [];
|
24
28
|
window.addEventListener('load', function () {
|
25
|
-
var i
|
29
|
+
var i;
|
30
|
+
loaded = true;
|
26
31
|
if (cbs.length > 0) {
|
27
32
|
for (i = 0; i < cbs.length; i++) {
|
28
|
-
|
33
|
+
cbs[i]();
|
29
34
|
}
|
30
35
|
}
|
31
36
|
});
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<script>
|
8
8
|
(function() {
|
9
9
|
var TEXT_VARIABLES = {
|
10
|
-
version: '2.2.
|
10
|
+
version: '2.2.4',
|
11
11
|
sources: {
|
12
12
|
font_awesome: '{{ _sources.font_awesome }}',
|
13
13
|
jquery: '{{ _sources.jquery }}',
|
@@ -17,6 +17,7 @@
|
|
17
17
|
js: '{{ _sources.gitalk.js }}',
|
18
18
|
css: '{{ _sources.gitalk.css }}'
|
19
19
|
},
|
20
|
+
valine: '{{ _sources.valine }}',
|
20
21
|
mathjax: '{{ _sources.mathjax }}',
|
21
22
|
mermaid: '{{ _sources.mermaid }}'
|
22
23
|
},
|
data/_includes/search.html
CHANGED
@@ -14,11 +14,9 @@
|
|
14
14
|
<a><i class="fas fa-times"></i></a>
|
15
15
|
</div>
|
16
16
|
</div>
|
17
|
-
<button class="button button--
|
17
|
+
<button class="button button--theme-dark button--pill search__cancel js-search-toggle">
|
18
18
|
{{ _locale_cancel }}</button>
|
19
19
|
</div>
|
20
20
|
<div class="search-result js-search-result"></div>
|
21
21
|
</div>
|
22
|
-
</div>
|
23
|
-
|
24
|
-
<script>{%- include scripts/components/search/search.js -%}</script>
|
22
|
+
</div>
|
data/_layouts/base.html
CHANGED
@@ -8,7 +8,7 @@ layout: none
|
|
8
8
|
{%- include analytics.html -%}
|
9
9
|
{%- include head.html -%}
|
10
10
|
<script>
|
11
|
-
{%- include scripts/utils.js -%}
|
11
|
+
{%- include scripts/utils/utils.js -%}
|
12
12
|
{%- include scripts/lib/throttle.js -%}
|
13
13
|
{%- include scripts/lib/lazyload.js -%}
|
14
14
|
</script>
|
@@ -18,6 +18,8 @@ layout: none
|
|
18
18
|
<div class="root" data-is-touch="false">
|
19
19
|
{{ content }}
|
20
20
|
</div>
|
21
|
-
<script>
|
21
|
+
<script>
|
22
|
+
{%- include scripts/common.js -%}
|
23
|
+
</script>
|
22
24
|
</body>
|
23
25
|
</html>
|
data/_layouts/page.html
CHANGED
@@ -13,6 +13,10 @@ layout: base
|
|
13
13
|
target=layout.footer source0=page.footer -%}
|
14
14
|
{%- assign _footer = __return -%}
|
15
15
|
|
16
|
+
{%- include snippets/assign.html
|
17
|
+
target=layout.lightbox source0=page.lightbox -%}
|
18
|
+
{%- assign _lightbox = __return -%}
|
19
|
+
|
16
20
|
{%- include snippets/assign.html
|
17
21
|
target = site.data.variables.default.page.full_width
|
18
22
|
source0=layout.full_width source1=page.full_width -%}
|
@@ -227,8 +231,12 @@ layout: base
|
|
227
231
|
</div> {%- comment -%} end grid {%- endcomment -%}
|
228
232
|
</div> {%- comment -%} end page__viewport {%- endcomment -%}
|
229
233
|
{%- endif -%}
|
234
|
+
|
235
|
+
{%- if _lightbox == true -%}
|
236
|
+
<div class="modal d-print-none js-page-gallery-modal"><div class="gallery"></div></div>
|
237
|
+
{%- endif -%}
|
230
238
|
{%- if _header != false -%}
|
231
|
-
<div class="page__search-
|
239
|
+
<div class="modal modal--overflow page__search-modal d-print-none js-page-search-modal">{%- include search.html -%}</div>
|
232
240
|
{%- endif -%}
|
233
241
|
</div>
|
234
242
|
|
@@ -237,25 +245,30 @@ layout: base
|
|
237
245
|
{%- include scripts/lib/scroll-to.js -%}
|
238
246
|
{%- include scripts/lib/affix.js -%}
|
239
247
|
{%- include scripts/lib/toc.js -%}
|
248
|
+
{%- include scripts/lib/modal.js -%}
|
249
|
+
{%- if _lightbox == true -%}
|
250
|
+
{%- include scripts/lib/gallery.js -%}
|
251
|
+
{%- include scripts/components/lightbox.js -%}
|
252
|
+
{%- endif -%}
|
240
253
|
{%- include scripts/page.js -%}
|
241
254
|
</script>
|
242
255
|
|
243
256
|
{%- if page.sidebar -%}
|
244
|
-
<script>
|
245
|
-
{%- include scripts/components/sidebar.js -%}
|
246
|
-
</script>
|
257
|
+
<script>{%- include scripts/components/sidebar.js -%}</script>
|
247
258
|
{%- endif -%}
|
248
259
|
|
249
260
|
{%- if page.aside -%}
|
250
261
|
<script>
|
251
262
|
/* toc must before affix, since affix need to konw toc' height. */
|
252
|
-
{%- if page.aside.toc -%}
|
253
|
-
{%- include scripts/aside/toc.js -%}
|
254
|
-
{%- endif -%}
|
263
|
+
{%- if page.aside.toc -%}{%- include scripts/aside/toc.js -%}{%- endif -%}
|
255
264
|
{%- include scripts/aside/affix.js -%}
|
256
265
|
</script>
|
257
266
|
{%- endif -%}
|
258
267
|
|
268
|
+
{%- if _header != false -%}
|
269
|
+
<script>{%- include scripts/components/search/search.js -%}</script>
|
270
|
+
{%- endif -%}
|
271
|
+
|
259
272
|
|
260
273
|
{%- include markdown-enhancements.html -%}
|
261
274
|
{%- include pageview.html -%}
|
data/_sass/common/_reset.scss
CHANGED
@@ -23,7 +23,6 @@
|
|
23
23
|
**/
|
24
24
|
|
25
25
|
html {
|
26
|
-
height: 100%;
|
27
26
|
font-size: map-get($base, font-size-root);
|
28
27
|
-webkit-text-size-adjust: 100%; /* 1 */
|
29
28
|
@media print {
|
@@ -34,15 +33,6 @@ html {
|
|
34
33
|
body {
|
35
34
|
padding: 0;
|
36
35
|
margin: 0;
|
37
|
-
}
|
38
|
-
|
39
|
-
@include block-elements() {
|
40
|
-
padding: 0;
|
41
|
-
margin: map-get($spacers, 2) 0;
|
42
|
-
}
|
43
|
-
|
44
|
-
body {
|
45
|
-
height: 100%;
|
46
36
|
font: map-get($base, font-weight) #{map-get($base, font-size)}/#{map-get($base, line-height)} map-get($base, font-family);
|
47
37
|
::-moz-selection {
|
48
38
|
background: $select-color;
|
@@ -55,6 +45,11 @@ body {
|
|
55
45
|
}
|
56
46
|
}
|
57
47
|
|
48
|
+
@include block-elements() {
|
49
|
+
padding: 0;
|
50
|
+
margin: map-get($spacers, 2) 0;
|
51
|
+
}
|
52
|
+
|
58
53
|
input, textarea, select, button {
|
59
54
|
font: map-get($base, font-weight) #{map-get($base, font-size)}/#{map-get($base, line-height)} map-get($base, font-family);
|
60
55
|
color: $text-color;
|
@@ -8,8 +8,8 @@ $base: (
|
|
8
8
|
font-size-xl: 1.5rem,
|
9
9
|
font-size-lg: 1.25rem,
|
10
10
|
font-size: 1rem,
|
11
|
-
font-size-sm: .
|
12
|
-
font-size-xs: .
|
11
|
+
font-size-sm: .85rem,
|
12
|
+
font-size-xs: .7rem,
|
13
13
|
|
14
14
|
font-size-h1-xl: 3.5rem,
|
15
15
|
font-size-h2-xl: 2.5rem,
|
@@ -39,12 +39,12 @@ $base: (
|
|
39
39
|
font-size-h5-sm: 1rem,
|
40
40
|
font-size-h6-sm: 1rem,
|
41
41
|
|
42
|
-
font-size-h1-xs:
|
43
|
-
font-size-h2-xs:
|
44
|
-
font-size-h3-xs: .
|
45
|
-
font-size-h4-xs: .
|
46
|
-
font-size-h5-xs: .
|
47
|
-
font-size-h6-xs: .
|
42
|
+
font-size-h1-xs: 1.05rem,
|
43
|
+
font-size-h2-xs: 1rem,
|
44
|
+
font-size-h3-xs: .95rem,
|
45
|
+
font-size-h4-xs: .9rem,
|
46
|
+
font-size-h5-xs: .85rem,
|
47
|
+
font-size-h6-xs: .85rem,
|
48
48
|
|
49
49
|
font-weight: 400,
|
50
50
|
font-weight-bold: 700,
|
@@ -71,11 +71,11 @@ $spacers: (
|
|
71
71
|
5: map-get($base, spacer) * 3
|
72
72
|
);
|
73
73
|
|
74
|
-
$z-
|
74
|
+
$z-indexes: (
|
75
75
|
actions: 996,
|
76
76
|
mask: 997,
|
77
77
|
sidebar: 998,
|
78
|
-
|
78
|
+
modal: 999
|
79
79
|
);
|
80
80
|
|
81
81
|
$layout: (
|
@@ -1,8 +1,26 @@
|
|
1
|
-
@mixin overflow($overflow: auto) {
|
1
|
+
@mixin overflow($overflow: auto, $direction: default) {
|
2
|
+
@if $direction == default {
|
3
|
+
overflow: $overflow;
|
4
|
+
} @else if $direction == "x" {
|
5
|
+
@if $overflow == auto {
|
6
|
+
overflow: hidden;
|
7
|
+
}
|
8
|
+
overflow-x: $overflow;
|
9
|
+
} @else if $direction == "y" {
|
10
|
+
@if $overflow == auto {
|
11
|
+
overflow: hidden;
|
12
|
+
}
|
13
|
+
overflow-y: $overflow;
|
14
|
+
}
|
2
15
|
@if $overflow == auto {
|
3
|
-
overflow: auto;
|
4
16
|
-webkit-overflow-scrolling: touch;
|
5
|
-
} @else {
|
6
|
-
overflow: $overflow;
|
7
17
|
}
|
18
|
+
}
|
19
|
+
|
20
|
+
.of-auto {
|
21
|
+
@include overflow(auto);
|
22
|
+
}
|
23
|
+
|
24
|
+
.of-hidden {
|
25
|
+
@include overflow(hidden);
|
8
26
|
}
|