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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -1
  3. data/README.md +11 -12
  4. data/_includes/article-footer/author-profile.html +1 -1
  5. data/_includes/article-list.html +3 -3
  6. data/_includes/extensions/codepen.html +4 -0
  7. data/_includes/extensions/youtube.html +1 -1
  8. data/_includes/scripts/article.js +1 -1
  9. data/_includes/scripts/{search-data.js → components/search/search-data.js} +0 -0
  10. data/_includes/scripts/{search.js → components/search/search.js} +0 -0
  11. data/_includes/scripts/lib/affix.js +83 -86
  12. data/_includes/scripts/lib/{scroll.js → scroll-to.js} +0 -0
  13. data/_includes/scripts/lib/swiper.js +150 -0
  14. data/_includes/scripts/lib/toc.js +83 -82
  15. data/_includes/scripts/variables.html +1 -1
  16. data/_includes/search.html +1 -1
  17. data/_includes/sharing-providers/addthis.html +9 -0
  18. data/_includes/sharing.html +3 -1
  19. data/_layouts/article.html +3 -1
  20. data/_layouts/landing.html +1 -1
  21. data/_layouts/page.html +19 -10
  22. data/_sass/additional/_alert.scss +4 -4
  23. data/_sass/common/_classes.scss +1 -1
  24. data/_sass/common/_function.scss +8 -0
  25. data/_sass/common/_print.scss +20 -0
  26. data/_sass/common/_reset.scss +5 -2
  27. data/_sass/common/_variables.scss +2 -4
  28. data/_sass/common/classes/_clickable.scss +21 -0
  29. data/_sass/common/classes/_display.scss +14 -3
  30. data/_sass/common/classes/_grid.scss +25 -76
  31. data/_sass/common/classes/_media.scss +2 -2
  32. data/_sass/common/classes/_pseudo.scss +8 -1
  33. data/_sass/common/classes/_shadow.scss +2 -2
  34. data/_sass/common/components/_button.scss +1 -7
  35. data/_sass/common/components/_card.scss +2 -2
  36. data/_sass/common/components/_hero.scss +1 -1
  37. data/_sass/common/components/_item.scss +14 -9
  38. data/_sass/common/components/_swiper.scss +45 -0
  39. data/_sass/common/components/_toc.scss +9 -9
  40. data/_sass/components/_article-content.scss +35 -17
  41. data/_sass/components/_article-header.scss +1 -1
  42. data/_sass/components/_article-info.scss +2 -2
  43. data/_sass/components/_article-list.scss +2 -2
  44. data/_sass/components/_author-profile.scss +7 -7
  45. data/_sass/components/_extensions.scss +8 -2
  46. data/_sass/components/_footer.scss +4 -4
  47. data/_sass/components/_header.scss +1 -1
  48. data/_sass/components/_search.scss +6 -6
  49. data/_sass/components/_tags.scss +1 -2
  50. data/_sass/custom.scss +0 -0
  51. data/_sass/layout/_404.scss +2 -2
  52. data/_sass/layout/_archive.scss +1 -1
  53. data/_sass/layout/_article.scss +5 -5
  54. data/_sass/layout/_articles.scss +1 -2
  55. data/_sass/layout/_home.scss +1 -1
  56. data/_sass/layout/_page.scss +12 -1
  57. data/assets/css/main.scss +5 -1
  58. data/assets/search.js +1 -1
  59. metadata +11 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a289b47d206254efdcf0ec13b4742d243a955fa
4
- data.tar.gz: 45a185a5d48104725984416c8dc933a1b396874a
3
+ metadata.gz: d9461f40245b05bcb682f05f1169e055c189bfb8
4
+ data.tar.gz: 45b6326fe6248389591323ca8ee0c9291b65f96c
5
5
  SHA512:
6
- metadata.gz: 6e9f7f16c8755e9764a9fdc09bdcd61d584b6f72a69f3f2b56f2801f74c094d42dfe542cfb2d2b5e81ca95cd53a81bf46a4ee3bcc4841c18e141ef9ae461638f
7
- data.tar.gz: 93fd25d5153d4d2e4321ccc0e43542943db65d4e68e9de7bbc7a5d870ed05cd59fab02af97f50108d5d3b44478e41e0abd44d10db2e89b7cf0e7aa0d52e254a5
6
+ metadata.gz: 1e67d61e7806f62de0d53de3c22eb26fa0007ad0d6f12fc1e7e1aa24a9017e7ba80fa74e2fe419674d2b4c357a58b454fb65f5057b4d5d5e26ff18ccce149c53
7
+ data.tar.gz: 29ae740535d3211c676ffdfdd692f9c942164833d57b26363f3e2c97c57cca24b0b2c6c2f969d5efb8888ed9c0ec873b4662d39dccb038c06cecfad10d329fa3
@@ -1,6 +1,15 @@
1
1
  # Change Log
2
2
 
3
- ## 2.2.2 (2018-11-21)
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
- - Semantic HTML
25
- - RSS([jekyll-feed](https://github.com/jekyll/jekyll-feed))
26
- - Contact information (Email, Facebook, Twitter, Linkedin, Weibo, Zhihu, etc)
27
- - Mathematical formula ([MathJax](https://www.mathjax.org/))
28
- - Flowchart, Sequence diagram, Gantt diagram ([mermaid](https://mermaidjs.github.io/))
29
- - Line Chart, Bar Chart, Radar Chart, Pie Chart ([chartjs](http://www.chartjs.org/))
30
- - Page views ([LeanCloud](https://leancloud.cn/))
31
- - Share ([AddToAny](https://www.addtoany.com/))
32
- - Comments ([Disqus](https://disqus.com/))
33
- - Google Analytics
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 -%}
@@ -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--3 cell--md-4 cell--sm-12">
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--4 cell--md-6 cell--sm-12">
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>
@@ -0,0 +1,4 @@
1
+ <div class="extensions extensions--demo">
2
+ <iframe src='//codepen.io/{{ include.user }}/embed/{{ include.hash }}/?theme-id=0&default-tab={{ include.default_tab | default: result }}'
3
+ frameborder="0" scrolling="no" allowfullscreen></iframe>
4
+ </div>
@@ -1,4 +1,4 @@
1
1
  <div class="extensions extensions--video">
2
- <iframe src="https://www.youtube.com/embed/{{ include.id }}?showinfo=0"
2
+ <iframe src="https://www.youtube.com/embed/{{ include.id }}?rel=0&showinfo=0"
3
3
  frameborder="0" scrolling="no" allowfullscreen></iframe>
4
4
  </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);
@@ -1,100 +1,97 @@
1
1
  (function() {
2
2
  var SOURCES = window.TEXT_VARIABLES.sources;
3
3
  window.Lazyload.js(SOURCES.jquery, function() {
4
- var $window = $(window), $root, $scrollTarget, $scroller, $scroll;
5
- var rootTop, rootLeft, rootHeight, scrollBottom, rootBottomTop;
6
- var offsetBottom = 0, disabled = false, scrollTarget = window, scroller = 'html, body', scroll = window.document;
7
- var hasInit = false, isOverallScroller = true, curState;
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
- function setOptions(options) {
10
- var _options = options || {};
11
- _options.offsetBottom && (offsetBottom = _options.offsetBottom);
12
- _options.scrollTarget && (scrollTarget = _options.scrollTarget);
13
- _options.scroller && (scroller = _options.scroller);
14
- _options.scroll && (scroll = _options.scroll);
15
- _options.disabled !== undefined && (disabled = _options.disabled);
16
- $scrollTarget = $(scrollTarget);
17
- $scroller = $(scroller);
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
- function fixed() {
42
- if (curState !== 'fixed') {
43
- $root.addClass('fixed').css({
44
- left: rootLeft + 'px',
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
- function bottom() {
51
- if (curState !== 'bottom') {
52
- $root.removeClass('fixed').css({
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
- function setState() {
60
- var scrollTop = $scrollTarget.scrollTop();
61
- if (scrollTop >= rootTop && scrollTop <= scrollBottom) {
62
- fixed();
63
- } else if (scrollTop < rootTop) {
64
- top();
65
- } else {
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
- function init() {
70
- if(!hasInit) {
71
- var interval, timeout;
72
- calc(true); setState();
73
- // run calc every 100 millisecond
74
- interval = setInterval(function() {
75
- calc();
76
- }, 100);
77
- timeout = setTimeout(function() {
78
- clearInterval(interval);
79
- }, 45000);
80
- window.pageLoad.then(function() {
81
- setTimeout(function() {
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
- clearTimeout(timeout);
84
- }, 3000);
85
- });
86
- $scrollTarget.on('scroll', function() {
87
- disabled || setState();
88
- });
89
- $window.on('resize', function() {
90
- disabled || (calc(true), setState());
91
- });
92
- hasInit = true;
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();
@@ -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
+ })();