jekyll-text-theme 2.2.2 → 2.2.3
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 +10 -1
- data/README.md +11 -12
- data/_includes/article-footer/author-profile.html +1 -1
- data/_includes/article-list.html +3 -3
- data/_includes/extensions/codepen.html +4 -0
- data/_includes/extensions/youtube.html +1 -1
- data/_includes/scripts/article.js +1 -1
- data/_includes/scripts/{search-data.js → components/search/search-data.js} +0 -0
- data/_includes/scripts/{search.js → components/search/search.js} +0 -0
- data/_includes/scripts/lib/affix.js +83 -86
- data/_includes/scripts/lib/{scroll.js → scroll-to.js} +0 -0
- data/_includes/scripts/lib/swiper.js +150 -0
- data/_includes/scripts/lib/toc.js +83 -82
- data/_includes/scripts/variables.html +1 -1
- data/_includes/search.html +1 -1
- data/_includes/sharing-providers/addthis.html +9 -0
- data/_includes/sharing.html +3 -1
- data/_layouts/article.html +3 -1
- data/_layouts/landing.html +1 -1
- data/_layouts/page.html +19 -10
- data/_sass/additional/_alert.scss +4 -4
- data/_sass/common/_classes.scss +1 -1
- data/_sass/common/_function.scss +8 -0
- data/_sass/common/_print.scss +20 -0
- data/_sass/common/_reset.scss +5 -2
- data/_sass/common/_variables.scss +2 -4
- data/_sass/common/classes/_clickable.scss +21 -0
- data/_sass/common/classes/_display.scss +14 -3
- data/_sass/common/classes/_grid.scss +25 -76
- data/_sass/common/classes/_media.scss +2 -2
- data/_sass/common/classes/_pseudo.scss +8 -1
- data/_sass/common/classes/_shadow.scss +2 -2
- data/_sass/common/components/_button.scss +1 -7
- data/_sass/common/components/_card.scss +2 -2
- data/_sass/common/components/_hero.scss +1 -1
- data/_sass/common/components/_item.scss +14 -9
- data/_sass/common/components/_swiper.scss +45 -0
- data/_sass/common/components/_toc.scss +9 -9
- data/_sass/components/_article-content.scss +35 -17
- data/_sass/components/_article-header.scss +1 -1
- data/_sass/components/_article-info.scss +2 -2
- data/_sass/components/_article-list.scss +2 -2
- data/_sass/components/_author-profile.scss +7 -7
- data/_sass/components/_extensions.scss +8 -2
- data/_sass/components/_footer.scss +4 -4
- data/_sass/components/_header.scss +1 -1
- data/_sass/components/_search.scss +6 -6
- data/_sass/components/_tags.scss +1 -2
- data/_sass/custom.scss +0 -0
- data/_sass/layout/_404.scss +2 -2
- data/_sass/layout/_archive.scss +1 -1
- data/_sass/layout/_article.scss +5 -5
- data/_sass/layout/_articles.scss +1 -2
- data/_sass/layout/_home.scss +1 -1
- data/_sass/layout/_page.scss +12 -1
- data/assets/css/main.scss +5 -1
- data/assets/search.js +1 -1
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9461f40245b05bcb682f05f1169e055c189bfb8
|
4
|
+
data.tar.gz: 45b6326fe6248389591323ca8ee0c9291b65f96c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e67d61e7806f62de0d53de3c22eb26fa0007ad0d6f12fc1e7e1aa24a9017e7ba80fa74e2fe419674d2b4c357a58b454fb65f5057b4d5d5e26ff18ccce149c53
|
7
|
+
data.tar.gz: 29ae740535d3211c676ffdfdd692f9c942164833d57b26363f3e2c97c57cca24b0b2c6c2f969d5efb8888ed9c0ec873b4662d39dccb038c06cecfad10d329fa3
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## 2.2.
|
3
|
+
## 2.2.3 (2018-11-11)
|
4
|
+
|
5
|
+
### Enhancements
|
6
|
+
|
7
|
+
- Add Swiper component
|
8
|
+
- Special stylesheets for print
|
9
|
+
- Add AddThis sharing service (@liao961120)
|
10
|
+
- Add extensions for demos (CodePen)
|
11
|
+
|
12
|
+
## 2.2.2 (2018-10-21)
|
4
13
|
|
5
14
|
### Enhancements
|
6
15
|
|
data/README.md
CHANGED
@@ -15,22 +15,21 @@ TeXt is a super customizable Jekyll theme for personal site, team site, blog, pr
|
|
15
15
|
## Features
|
16
16
|
|
17
17
|
- Responsive
|
18
|
+
- Semantic HTML
|
18
19
|
- Skins
|
19
20
|
- Highlight Theme
|
20
|
-
- Table of contents
|
21
|
-
- Authors
|
22
21
|
- Multi-language support
|
23
22
|
- Search
|
24
|
-
-
|
25
|
-
-
|
26
|
-
-
|
27
|
-
-
|
28
|
-
-
|
29
|
-
-
|
30
|
-
-
|
31
|
-
-
|
32
|
-
-
|
33
|
-
-
|
23
|
+
- Table of contents
|
24
|
+
- Authors (Email, Facebook, Twitter, Linkedin, Weibo, Zhihu, etc)
|
25
|
+
- Additional styles (alert, tag, image, icon, button, grid, etc)
|
26
|
+
- Extensions (audios, videos, slides, demos)
|
27
|
+
- Markdown enhancements ([MathJax](https://www.mathjax.org/), [mermaid](https://mermaidjs.github.io/), [chartjs](http://www.chartjs.org/))
|
28
|
+
- Sharing ([AddToAny](https://www.addtoany.com/), [AddThis](https://www.addthis.com/))
|
29
|
+
- Comments ([Disqus](https://disqus.com/), [Gitalk](https://gitalk.github.io/))
|
30
|
+
- Pageview ([LeanCloud](https://leancloud.cn/))
|
31
|
+
- Analytics ([Google Analytics](https://analytics.google.com/analytics/web/))
|
32
|
+
- RSS ([jekyll-feed](https://github.com/jekyll/jekyll-feed))
|
34
33
|
|
35
34
|
## Skins
|
36
35
|
|
@@ -13,7 +13,7 @@
|
|
13
13
|
{%- endif -%}
|
14
14
|
{%- include snippets/get-nav-url.html path=_author.avatar -%}
|
15
15
|
{%- assign _author_avatar = __return -%}
|
16
|
-
<img itemprop="image" src="{{ _author_avatar }}" />
|
16
|
+
<img class="author-profile__avatar" itemprop="image" src="{{ _author_avatar }}" />
|
17
17
|
{%- if _author.url -%}
|
18
18
|
</a>
|
19
19
|
{%- endif -%}
|
data/_includes/article-list.html
CHANGED
@@ -90,7 +90,7 @@
|
|
90
90
|
{%- assign _currentdate = _article.date | date: '%Y' -%}
|
91
91
|
{%- if _currentdate != _date -%}
|
92
92
|
{%- unless forloop.first -%}</ul></section>{%- endunless -%}
|
93
|
-
<section><h2 class="article-list__group-header">{{ _currentdate }}</h2><ul>
|
93
|
+
<section><h2 class="article-list__group-header">{{ _currentdate }}</h2><ul class="items">
|
94
94
|
{%- assign _date = _currentdate -%}
|
95
95
|
{%- endif -%}
|
96
96
|
{%- endif -%}
|
@@ -105,7 +105,7 @@
|
|
105
105
|
|
106
106
|
{%- elsif include.type == 'grid' -%}
|
107
107
|
{%- if include.size == 'sm' -%}
|
108
|
-
<div class="cell cell--
|
108
|
+
<div class="cell cell--12 cell--md-4 cell--lg-3">
|
109
109
|
<div class="card">
|
110
110
|
{%- if _article.cover -%}
|
111
111
|
<div class="card__image">
|
@@ -121,7 +121,7 @@
|
|
121
121
|
</div>
|
122
122
|
{%- else -%}
|
123
123
|
|
124
|
-
<div class="cell cell--
|
124
|
+
<div class="cell cell--12 cell--md-6 cell--lg-4">
|
125
125
|
<div class="card card--flat">
|
126
126
|
{%- if _article.cover -%}
|
127
127
|
<div class="card__image"><img src="{{ _article_cover }}" /></div>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
});
|
15
15
|
$articleContent.find('h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]').each(function() {
|
16
16
|
$this = $(this);
|
17
|
-
$this.append($('<a class="anchor" aria-hidden="true"></a>').html('<i class="fas fa-anchor"></i>'));
|
17
|
+
$this.append($('<a class="anchor d-print-none" aria-hidden="true"></a>').html('<i class="fas fa-anchor"></i>'));
|
18
18
|
});
|
19
19
|
$articleContent.on('click', '.anchor', function() {
|
20
20
|
$scroll.scrollToAnchor('#' + $(this).parent().attr('id'), 400);
|
File without changes
|
File without changes
|
@@ -1,100 +1,97 @@
|
|
1
1
|
(function() {
|
2
2
|
var SOURCES = window.TEXT_VARIABLES.sources;
|
3
3
|
window.Lazyload.js(SOURCES.jquery, function() {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
function affix(options) {
|
5
|
+
var $root = this, $window = $(window), $scrollTarget, $scroll,
|
6
|
+
offsetBottom = 0, scrollTarget = window, scroll = window.document, disabled = false, isOverallScroller = true,
|
7
|
+
rootTop, rootLeft, rootHeight, scrollBottom, rootBottomTop,
|
8
|
+
hasInit = false, curState;
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
isOverallScroller = window.isOverallScroller($scrollTarget[0]);
|
19
|
-
$scroll = $(scroll);
|
20
|
-
}
|
21
|
-
function initData() {
|
22
|
-
top();
|
23
|
-
rootHeight = $root.outerHeight();
|
24
|
-
rootTop = $root.offset().top + (isOverallScroller ? 0 : $scrollTarget.scrollTop());
|
25
|
-
rootLeft = $root.offset().left;
|
26
|
-
}
|
27
|
-
function calc(needInitData) {
|
28
|
-
needInitData && initData();
|
29
|
-
scrollBottom = $scroll.outerHeight() - offsetBottom - rootHeight;
|
30
|
-
rootBottomTop = scrollBottom - rootTop;
|
31
|
-
}
|
32
|
-
function top() {
|
33
|
-
if (curState !== 'top') {
|
34
|
-
$root.removeClass('fixed').css({
|
35
|
-
left: 0,
|
36
|
-
top: 0
|
37
|
-
});
|
38
|
-
curState = 'top';
|
10
|
+
function setOptions(options) {
|
11
|
+
var _options = options || {};
|
12
|
+
_options.offsetBottom && (offsetBottom = _options.offsetBottom);
|
13
|
+
_options.scrollTarget && (scrollTarget = _options.scrollTarget);
|
14
|
+
_options.scroll && (scroll = _options.scroll);
|
15
|
+
_options.disabled !== undefined && (disabled = _options.disabled);
|
16
|
+
$scrollTarget = $(scrollTarget);
|
17
|
+
isOverallScroller = window.isOverallScroller($scrollTarget[0]);
|
18
|
+
$scroll = $(scroll);
|
39
19
|
}
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
$root.
|
44
|
-
|
45
|
-
top: 0
|
46
|
-
});
|
47
|
-
curState = 'fixed';
|
20
|
+
function preCalc() {
|
21
|
+
top();
|
22
|
+
rootHeight = $root.outerHeight();
|
23
|
+
rootTop = $root.offset().top + (isOverallScroller ? 0 : $scrollTarget.scrollTop());
|
24
|
+
rootLeft = $root.offset().left;
|
48
25
|
}
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
left: 0,
|
54
|
-
top: rootBottomTop + 'px'
|
55
|
-
});
|
56
|
-
curState = 'bottom';
|
26
|
+
function calc(needPreCalc) {
|
27
|
+
needPreCalc && preCalc();
|
28
|
+
scrollBottom = $scroll.outerHeight() - offsetBottom - rootHeight;
|
29
|
+
rootBottomTop = scrollBottom - rootTop;
|
57
30
|
}
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
bottom();
|
31
|
+
function top() {
|
32
|
+
if (curState !== 'top') {
|
33
|
+
$root.removeClass('fixed').css({
|
34
|
+
left: 0,
|
35
|
+
top: 0
|
36
|
+
});
|
37
|
+
curState = 'top';
|
38
|
+
}
|
67
39
|
}
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
40
|
+
function fixed() {
|
41
|
+
if (curState !== 'fixed') {
|
42
|
+
$root.addClass('fixed').css({
|
43
|
+
left: rootLeft + 'px',
|
44
|
+
top: 0
|
45
|
+
});
|
46
|
+
curState = 'fixed';
|
47
|
+
}
|
48
|
+
}
|
49
|
+
function bottom() {
|
50
|
+
if (curState !== 'bottom') {
|
51
|
+
$root.removeClass('fixed').css({
|
52
|
+
left: 0,
|
53
|
+
top: rootBottomTop + 'px'
|
54
|
+
});
|
55
|
+
curState = 'bottom';
|
56
|
+
}
|
57
|
+
}
|
58
|
+
function setState() {
|
59
|
+
var scrollTop = $scrollTarget.scrollTop();
|
60
|
+
if (scrollTop >= rootTop && scrollTop <= scrollBottom) {
|
61
|
+
fixed();
|
62
|
+
} else if (scrollTop < rootTop) {
|
63
|
+
top();
|
64
|
+
} else {
|
65
|
+
bottom();
|
66
|
+
}
|
67
|
+
}
|
68
|
+
function init() {
|
69
|
+
if(!hasInit) {
|
70
|
+
var interval, timeout;
|
71
|
+
calc(true); setState();
|
72
|
+
// run calc every 100 millisecond
|
73
|
+
interval = setInterval(function() {
|
74
|
+
calc();
|
75
|
+
}, 100);
|
76
|
+
timeout = setTimeout(function() {
|
82
77
|
clearInterval(interval);
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
78
|
+
}, 45000);
|
79
|
+
window.pageLoad.then(function() {
|
80
|
+
setTimeout(function() {
|
81
|
+
clearInterval(interval);
|
82
|
+
clearTimeout(timeout);
|
83
|
+
}, 3000);
|
84
|
+
});
|
85
|
+
$scrollTarget.on('scroll', function() {
|
86
|
+
disabled || setState();
|
87
|
+
});
|
88
|
+
$window.on('resize', function() {
|
89
|
+
disabled || (calc(true), setState());
|
90
|
+
});
|
91
|
+
hasInit = true;
|
92
|
+
}
|
93
93
|
}
|
94
|
-
}
|
95
94
|
|
96
|
-
function affix(options) {
|
97
|
-
$root = this;
|
98
95
|
setOptions(options);
|
99
96
|
if (!disabled) {
|
100
97
|
init();
|
File without changes
|
@@ -0,0 +1,150 @@
|
|
1
|
+
(function() {
|
2
|
+
var SOURCES = window.TEXT_VARIABLES.sources;
|
3
|
+
window.Lazyload.js(SOURCES.jquery, function() {
|
4
|
+
function swiper(options) {
|
5
|
+
var $window = $(window), $root = this, $swiperWrapper, $swiperButtonPrev, $swiperButtonNext,
|
6
|
+
initialSlide, width, height, animation,
|
7
|
+
rootWidth, rootHeight, count, curIndex, translateX, CRITICAL_ANGLE = Math.PI / 4;
|
8
|
+
|
9
|
+
function setOptions(options) {
|
10
|
+
var _options = options || {};
|
11
|
+
initialSlide = _options.initialSlide || 0;
|
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
|
+
}
|
21
|
+
|
22
|
+
function init() {
|
23
|
+
$swiperWrapper = $root.find('.swiper__wrapper');
|
24
|
+
$swiperButtonPrev = $root.find('.swiper__button--prev');
|
25
|
+
$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
|
+
animation && $swiperWrapper.addClass('swiper__wrapper--animation');
|
34
|
+
}
|
35
|
+
|
36
|
+
function preCalc() {
|
37
|
+
rootWidth = $root.width();
|
38
|
+
rootHeight = $root.height();
|
39
|
+
translateX = getTranslateXFromCurIndex();
|
40
|
+
}
|
41
|
+
|
42
|
+
var calc = (function() {
|
43
|
+
var preAnimation;
|
44
|
+
return function (needPreCalc, params) {
|
45
|
+
needPreCalc && preCalc();
|
46
|
+
var _animation = (params && params.animation !== undefined) ? params.animation : animation;
|
47
|
+
if (preAnimation === undefined || preAnimation !== _animation) {
|
48
|
+
preAnimation = _animation ? $swiperWrapper.addClass('swiper__wrapper--animation') :
|
49
|
+
$swiperWrapper.removeClass('swiper__wrapper--animation');
|
50
|
+
}
|
51
|
+
$swiperWrapper.css('transform', 'translate(' + translateX + 'px, 0)');
|
52
|
+
if (curIndex <= 0) {
|
53
|
+
$swiperButtonPrev.addClass('disabled');
|
54
|
+
} else if (curIndex < count - 1) {
|
55
|
+
$swiperButtonPrev.removeClass('disabled');
|
56
|
+
$swiperButtonNext.removeClass('disabled');
|
57
|
+
} else {
|
58
|
+
$swiperButtonNext.addClass('disabled');
|
59
|
+
}
|
60
|
+
};
|
61
|
+
})();
|
62
|
+
|
63
|
+
function getTranslateXFromCurIndex() {
|
64
|
+
return curIndex <= 0 ? 0 : - rootWidth * curIndex;
|
65
|
+
}
|
66
|
+
|
67
|
+
function moveToIndex(index ,params) {
|
68
|
+
curIndex = index;
|
69
|
+
translateX = getTranslateXFromCurIndex();
|
70
|
+
calc(false, params);
|
71
|
+
}
|
72
|
+
|
73
|
+
function move(type) {
|
74
|
+
var nextIndex = curIndex, unstableTranslateX;
|
75
|
+
if (type === 'prev') {
|
76
|
+
nextIndex > 0 && nextIndex--;
|
77
|
+
} else if (type === 'next') {
|
78
|
+
nextIndex < count - 1 && nextIndex++;
|
79
|
+
}
|
80
|
+
if (type === 'cur') {
|
81
|
+
moveToIndex(curIndex, { animation: true });
|
82
|
+
return;
|
83
|
+
}
|
84
|
+
unstableTranslateX = translateX % rootWidth !== 0;
|
85
|
+
if (nextIndex !== curIndex || unstableTranslateX) {
|
86
|
+
unstableTranslateX ? moveToIndex(nextIndex, { animation: true }) : moveToIndex(nextIndex);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
setOptions(options);
|
91
|
+
calc(true);
|
92
|
+
|
93
|
+
$swiperButtonPrev.on('click', function() {
|
94
|
+
move('prev');
|
95
|
+
});
|
96
|
+
$swiperButtonNext.on('click', function() {
|
97
|
+
move('next');
|
98
|
+
});
|
99
|
+
$window.on('resize', function() {
|
100
|
+
translateX = getTranslateXFromCurIndex();
|
101
|
+
calc(true, { animation: false });
|
102
|
+
});
|
103
|
+
|
104
|
+
(function() {
|
105
|
+
var pageX, pageY, velocityX, preTranslateX = translateX, timeStamp, touching;
|
106
|
+
$swiperWrapper.on('touchstart', function(e) {
|
107
|
+
var point = e.touches ? e.touches[0] : e;
|
108
|
+
pageX = point.pageX;
|
109
|
+
pageY = point.pageY;
|
110
|
+
velocityX = 0;
|
111
|
+
preTranslateX = translateX;
|
112
|
+
});
|
113
|
+
$swiperWrapper.on('touchmove', function(e) {
|
114
|
+
var point = e.touches ? e.touches[0] : e;
|
115
|
+
var deltaX = point.pageX - pageX;
|
116
|
+
var deltaY = point.pageY - pageY;
|
117
|
+
velocityX = deltaX / (e.timeStamp - timeStamp);
|
118
|
+
timeStamp = e.timeStamp;
|
119
|
+
if (e.cancelable && Math.abs(Math.atan(deltaY / deltaX)) < CRITICAL_ANGLE) {
|
120
|
+
touching = true;
|
121
|
+
translateX += deltaX;
|
122
|
+
calc(false, { animation: false });
|
123
|
+
}
|
124
|
+
pageX = point.pageX;
|
125
|
+
pageY = point.pageY;
|
126
|
+
});
|
127
|
+
$swiperWrapper.on('touchend', function() {
|
128
|
+
touching = false;
|
129
|
+
var deltaX = translateX - preTranslateX;
|
130
|
+
var distance = deltaX + velocityX * rootWidth;
|
131
|
+
if (Math.abs(distance) > rootWidth / 2) {
|
132
|
+
distance > 0 ? move('prev') : move('next');
|
133
|
+
} else {
|
134
|
+
move('cur');
|
135
|
+
}
|
136
|
+
});
|
137
|
+
$root.on('touchmove', function(e) {
|
138
|
+
if (e.cancelable & touching) {
|
139
|
+
e.preventDefault();
|
140
|
+
}
|
141
|
+
});
|
142
|
+
})();
|
143
|
+
|
144
|
+
return {
|
145
|
+
setOptions: setOptions
|
146
|
+
};
|
147
|
+
}
|
148
|
+
$.fn.swiper = swiper;
|
149
|
+
});
|
150
|
+
})();
|