hexo-theme-stellar 1.16.2 → 1.17.1

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 (74) hide show
  1. package/_config.yml +13 -5
  2. package/_data/widgets.yml +4 -1
  3. package/languages/en.yml +5 -0
  4. package/languages/zh-CN.yml +5 -0
  5. package/languages/zh-TW.yml +5 -0
  6. package/layout/404.ejs +1 -1
  7. package/layout/_partial/cover/wiki_cover.ejs +1 -1
  8. package/layout/_partial/main/article/article_footer.ejs +2 -2
  9. package/layout/_partial/main/post_list/paginator.ejs +5 -9
  10. package/layout/_partial/main/post_list/post_card.ejs +1 -1
  11. package/layout/_partial/main/post_list/wiki_card.ejs +1 -1
  12. package/layout/_partial/plugins/comments/layout.ejs +1 -1
  13. package/layout/_partial/scripts/index.ejs +9 -0
  14. package/layout/_partial/sidebar/index.ejs +3 -3
  15. package/layout/_partial/{sidebar/widgets → widgets}/ghissues.ejs +2 -2
  16. package/layout/_partial/{sidebar/widgets → widgets}/ghrepo.ejs +2 -2
  17. package/layout/_partial/{sidebar/widgets → widgets}/ghuser.ejs +3 -3
  18. package/layout/_partial/{sidebar/widgets → widgets}/markdown.ejs +2 -2
  19. package/layout/_partial/{sidebar/widgets → widgets}/recent.ejs +5 -6
  20. package/layout/_partial/{sidebar/widgets → widgets}/related.ejs +2 -2
  21. package/layout/_partial/widgets/search.ejs +31 -0
  22. package/layout/_partial/{sidebar/widgets → widgets}/tagcloud.ejs +2 -2
  23. package/layout/_partial/{sidebar/widgets → widgets}/timeline.ejs +2 -2
  24. package/layout/_partial/{sidebar/widgets → widgets}/toc.ejs +2 -2
  25. package/layout/page.ejs +1 -1
  26. package/layout/post.ejs +1 -1
  27. package/layout/wiki.ejs +1 -1
  28. package/package.json +1 -1
  29. package/scripts/generators/search.js +103 -0
  30. package/source/css/_common/base.styl +1 -1
  31. package/source/css/_common/highlight.styl +5 -5
  32. package/source/css/_common/span.styl +1 -0
  33. package/source/css/_layout/index.styl +1 -0
  34. package/source/css/_layout/list.styl +1 -1
  35. package/source/css/_layout/md.styl +12 -13
  36. package/source/css/_layout/pages/error.styl +2 -2
  37. package/source/css/_layout/partial/article-footer.styl +4 -4
  38. package/source/css/_layout/partial/paginator.styl +16 -5
  39. package/source/css/_layout/partial/related.styl +6 -14
  40. package/source/css/_layout/sidebar/footer.styl +1 -3
  41. package/source/css/_layout/sidebar/header.styl +112 -0
  42. package/source/css/_layout/sidebar/sidebar.styl +3 -115
  43. package/source/css/_layout/tag-plugins/about.styl +1 -1
  44. package/source/css/_layout/tag-plugins/checkbox.styl +1 -1
  45. package/source/css/_layout/tag-plugins/copy.styl +1 -1
  46. package/source/css/_layout/tag-plugins/emoji.styl +1 -1
  47. package/source/css/_layout/tag-plugins/frame.styl +5 -5
  48. package/source/css/_layout/tag-plugins/inline-labels.styl +1 -1
  49. package/source/css/_layout/tag-plugins/link.styl +6 -6
  50. package/source/css/_layout/tag-plugins/mark.styl +3 -4
  51. package/source/css/_layout/tag-plugins/navbar.styl +1 -1
  52. package/source/css/_layout/tag-plugins/note.styl +7 -7
  53. package/source/css/_layout/tag-plugins/poetry.styl +2 -2
  54. package/source/css/_layout/tag-plugins/quot.styl +7 -7
  55. package/source/css/_layout/tag-plugins/tabs.styl +1 -1
  56. package/source/css/_layout/tag-plugins/timeline.styl +3 -3
  57. package/source/css/_layout/widgets/ghrepo.styl +34 -0
  58. package/source/css/_layout/widgets/ghuser.styl +95 -0
  59. package/source/css/_layout/widgets/recent.styl +15 -0
  60. package/source/css/_layout/widgets/related.styl +8 -0
  61. package/source/css/_layout/widgets/search.styl +3 -0
  62. package/source/css/_layout/widgets/tagcloud.styl +8 -0
  63. package/source/css/_layout/widgets/timeline.styl +17 -0
  64. package/source/css/_layout/{sidebar → widgets}/toc_blog.styl +1 -1
  65. package/source/css/_layout/{sidebar → widgets}/toc_common.styl +7 -4
  66. package/source/css/_layout/{sidebar → widgets}/toc_wiki.styl +3 -7
  67. package/source/css/_layout/widgets/widgets.styl +60 -0
  68. package/source/css/_plugins/index.styl +4 -0
  69. package/source/css/_plugins/search/local-search.styl +89 -0
  70. package/source/js/main.js +42 -6
  71. package/source/js/search/local-search.js +153 -0
  72. package/source/css/_layout/sidebar/ghrepo.styl +0 -36
  73. package/source/css/_layout/sidebar/ghuser.styl +0 -98
  74. package/source/css/_layout/sidebar/widgets.styl +0 -106
@@ -0,0 +1,153 @@
1
+ // A local search script with the help of
2
+ // [hexo-generator-search](https://github.com/PaicHyperionDev/hexo-generator-search)
3
+ // Copyright (C) 2015
4
+ // Joseph Pan <http://github.com/wzpan>
5
+ // Shuhao Mao <http://github.com/maoshuhao>
6
+ // This library is free software; you can redistribute it and/or modify
7
+ // it under the terms of the GNU Lesser General Public License as
8
+ // published by the Free Software Foundation; either version 2.1 of the
9
+ // License, or (at your option) any later version.
10
+ //
11
+ // This library is distributed in the hope that it will be useful, but
12
+ // WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ // Lesser General Public License for more details.
15
+ //
16
+ // You should have received a copy of the GNU Lesser General Public
17
+ // License along with this library; if not, write to the Free Software
18
+ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
+ // 02110-1301 USA
20
+ //
21
+ // Modified by:
22
+ // Pieter Robberechts <http://github.com/probberechts>
23
+
24
+ /*exported searchFunc*/
25
+ var searchFunc = function(path, filter, searchId, contentId) {
26
+
27
+ function stripHtml(html) {
28
+ html = html.replace(/<style([\s\S]*?)<\/style>/gi, "");
29
+ html = html.replace(/<script([\s\S]*?)<\/script>/gi, "");
30
+ html = html.replace(/<figure([\s\S]*?)<\/figure>/gi, "");
31
+ html = html.replace(/<\/div>/ig, "\n");
32
+ html = html.replace(/<\/li>/ig, "\n");
33
+ html = html.replace(/<li>/ig, " * ");
34
+ html = html.replace(/<\/ul>/ig, "\n");
35
+ html = html.replace(/<\/p>/ig, "\n");
36
+ html = html.replace(/<br\s*[\/]?>/gi, "\n");
37
+ html = html.replace(/<[^>]+>/ig, "");
38
+ return html;
39
+ }
40
+
41
+ function getAllCombinations(keywords) {
42
+ var i, j, result = [];
43
+
44
+ for (i = 0; i < keywords.length; i++) {
45
+ for (j = i + 1; j < keywords.length + 1; j++) {
46
+ result.push(keywords.slice(i, j).join(" "));
47
+ }
48
+ }
49
+ return result;
50
+ }
51
+
52
+ $.ajax({
53
+ url: path,
54
+ dataType: "json",
55
+ success: function(jsonResponse) {
56
+ var datas = jsonResponse;
57
+ var $input = document.getElementById(searchId);
58
+ if (!$input) { return; }
59
+ var $resultContent = document.getElementById(contentId);
60
+
61
+ $input.addEventListener("input", function(){
62
+ var resultList = [];
63
+ var keywords = getAllCombinations(this.value.trim().toLowerCase().split(" "))
64
+ .sort(function(a,b) { return b.split(" ").length - a.split(" ").length; });
65
+ $resultContent.innerHTML = "";
66
+ if (this.value.trim().length <= 0) {
67
+ return;
68
+ }
69
+ // perform local searching
70
+ datas.forEach(function(data) {
71
+ var matches = 0;
72
+ if (!data.title || data.title.trim() === "") {
73
+ return;
74
+ }
75
+ if (filter && !data.url.includes(filter)) {
76
+ return;
77
+ }
78
+ var dataTitle = data.title.trim().toLowerCase();
79
+ var dataTitleLowerCase = dataTitle.toLowerCase();
80
+ var dataContent = stripHtml(data.content.trim());
81
+ var dataContentLowerCase = dataContent.toLowerCase();
82
+ var dataUrl = data.url;
83
+ var indexTitle = -1;
84
+ var indexContent = -1;
85
+ var firstOccur = -1;
86
+ // only match artiles with not empty contents
87
+ if (dataContent !== "") {
88
+ keywords.forEach(function(keyword) {
89
+ indexTitle = dataTitleLowerCase.indexOf(keyword);
90
+ indexContent = dataContentLowerCase.indexOf(keyword);
91
+
92
+ if( indexTitle >= 0 || indexContent >= 0 ){
93
+ matches += 1;
94
+ if (indexContent < 0) {
95
+ indexContent = 0;
96
+ }
97
+ if (firstOccur < 0) {
98
+ firstOccur = indexContent;
99
+ }
100
+ }
101
+ });
102
+ }
103
+ // show search results
104
+ if (matches > 0) {
105
+ var searchResult = {};
106
+ searchResult.rank = matches;
107
+ searchResult.str = "<li><a href='"+ dataUrl +"'><span class='search-result-title'>"+ dataTitle +"</span>";
108
+ if (firstOccur >= 0) {
109
+ // cut out 100 characters
110
+ var start = firstOccur - 20;
111
+ var end = firstOccur + 80;
112
+
113
+ if(start < 0){
114
+ start = 0;
115
+ }
116
+
117
+ if(start == 0){
118
+ end = 100;
119
+ }
120
+
121
+ if(end > dataContent.length){
122
+ end = dataContent.length;
123
+ }
124
+
125
+ var matchContent = dataContent.substring(start, end);
126
+
127
+ // highlight all keywords
128
+ var regS = new RegExp(keywords.join("|"), "gi");
129
+ matchContent = matchContent.replace(regS, function(keyword) {
130
+ return "<span class=\"search-keyword\">"+keyword+"</span>";
131
+ });
132
+
133
+ searchResult.str += "<p class=\"search-result-content\">" + matchContent +"...</p>";
134
+ }
135
+ searchResult.str += "</a></li>";
136
+ resultList.push(searchResult);
137
+ }
138
+ });
139
+ if (resultList.length) {
140
+ resultList.sort(function(a, b) {
141
+ return b.rank - a.rank;
142
+ });
143
+ var result ="<ul class=\"search-result-list\">";
144
+ for (var i = 0; i < resultList.length; i++) {
145
+ result += resultList[i].str;
146
+ }
147
+ result += "</ul>";
148
+ $resultContent.innerHTML = result;
149
+ }
150
+ });
151
+ }
152
+ });
153
+ };
@@ -1,36 +0,0 @@
1
- .widget-wrap#repo-info
2
- .widget-body
3
- a.repo
4
- display: block
5
- padding: 0.75rem 0.5rem
6
- color: var(--text-p2)
7
- background: var(--card)
8
- border-radius: $border-block
9
- box-shadow: $boxshadow-card
10
- trans2 box-shadow transform
11
- >div+div
12
- margin-top: 0.5rem
13
- span
14
- color: var(--text-p2)
15
- &:hover
16
- box-shadow: $boxshadow-card-float
17
- transform: translateY(-1px)
18
- a.repo
19
- svg
20
- margin-right: 4px
21
- .flex-row
22
- display: flex
23
- align-items: center
24
- .repo-name
25
- font-size: $fs-14
26
- font-weight: 700
27
- color: var(--text-p1)
28
- .repo-desc
29
- font-size: $fs-13
30
- margin-left: 2px
31
- margin-right: 2px
32
- .grid
33
- font-size: $fs-13
34
- display: grid
35
- grid-gap: 2px
36
- grid-template-columns: repeat(auto-fill, "calc((100% - 2 * %s) / 3)" % 2px)
@@ -1,98 +0,0 @@
1
- .widget-wrap#github-user
2
- .widget-header+.widget-body
3
- margin: 0.75rem 0
4
- .widget-wrap#github-user .widget-body
5
- text-align: center
6
- background: var(--card)
7
- border-radius: $border-card
8
- padding: 1rem
9
- box-shadow: $boxshadow-card
10
-
11
- .widget-wrap#github-user .widget-body .avatar
12
- display: block
13
- border-radius: 100%
14
- margin: 1rem auto 1.25rem auto
15
- max-width: 75%
16
- overflow: hidden
17
- img
18
- display: block
19
- @media screen and (max-width: $device-tablet)
20
- max-width: 50%
21
-
22
- .widget-wrap#github-user .widget-body .username
23
- font-weight: 900
24
- font-size: $fs-h2
25
- color: var(--text-p0)
26
- margin: 0.5rem 0
27
-
28
- .widget-wrap#github-user .widget-body .bio
29
- font-size: $fs-13
30
- margin: 0.5rem 0
31
-
32
- .widget-wrap#github-user .widget-body .follow
33
- font-weight: 500
34
- border-radius: 64px
35
- padding: 0.5rem 1rem
36
- background: $color-theme
37
- color: var(--card)
38
- font-size: 1rem
39
- align-self: stretch
40
- text-align: center
41
- line-height: 1.5
42
- display: flex
43
- align-items: center
44
- justify-content: center
45
- trans1: background
46
- svg
47
- margin-right: 6px
48
- &:hover
49
- background: $color-hover
50
-
51
- .widget-wrap#github-user .widget-body .menu
52
- margin-bottom: 0
53
- background: none
54
- a:hover
55
- box-shadow: none
56
- background: var(--block)
57
- a.active
58
- box-shadow: none
59
- position: relative
60
- &:after
61
- content: ''
62
- position: absolute
63
- height: 3px
64
- bottom: 0
65
- width: 32px
66
- left: 'calc(50% - 0.5 * %s)' % @width
67
- border-radius: 4px
68
- background: $color-theme
69
-
70
- .widget-wrap#github-user .widget-body .buttons
71
- margin: 1rem 0
72
- align-self: stretch
73
- display: grid
74
- grid-gap: 2px
75
- grid-template-columns: repeat(auto-fill, "calc((100% - 2 * %s) / 3)" % 2px)
76
-
77
- .widget-wrap#github-user .widget-body .btn
78
- display: flex
79
- flex-direction: column
80
- align-items: center
81
- color: inherit
82
- border: 1px solid transparent
83
- border-radius: 4px
84
- padding: 0.25rem 0
85
- trans1: background
86
- &:hover
87
- background: var(--block)
88
-
89
-
90
- .widget-wrap#github-user .widget-body .buttons .btn .title
91
- font-size: 1rem
92
- font-weight: 700
93
-
94
-
95
- .widget-wrap#github-user .widget-body .buttons .btn .desc
96
- font-size: $fs-12
97
- color: var(--text-p3)
98
- font-weight: 500
@@ -1,106 +0,0 @@
1
- .widgets .loading-wrap
2
- margin: 0.5rem 0
3
-
4
- .l_left .widgets
5
- overflow: scroll
6
- flex-grow: 1
7
- scrollbar-width: none
8
- scrollbar(0, 0)
9
- z-index: 1
10
- line-height: 1.2
11
- .widget-wrap
12
- margin: 1rem 0 2rem
13
- .widget-header
14
- padding-left: var(--gap-l)
15
- padding-right: var(--gap-l)
16
- display: flex
17
- justify-content: space-between
18
- align-items: center
19
- font-weight: 500
20
- position: sticky
21
- top: -2px
22
- background: var(--site-bg)
23
- padding-top: 2px
24
- z-index 1
25
- .item
26
- display: block
27
- >span
28
- margin: 0.25rem 0
29
- text-align: left
30
- &:empty
31
- display: none
32
- .cap-action
33
- hover-block 4px 4px
34
- line-height: 0
35
- color: var(--text-meta)
36
- trans2: color background
37
- .icon
38
- fill: var(--text-meta)
39
- &:hover
40
- color: $color-hover
41
- .icon
42
- fill: $color-hover
43
-
44
- .widget-body
45
- margin: 0.5rem var(--gap-l)
46
- color: var(--text-p1)
47
- p
48
- margin-top: .5em
49
- margin-bottom: .5em
50
- line-height: 1.5
51
- .widget-header+.widget-body
52
- margin-top: 0
53
- .widget-wrap+.widget-wrap .widget-header
54
- margin-top: 3rem
55
-
56
-
57
- .l_left .widgets
58
- .widget-wrap#recent .widget-body
59
- display: flex
60
- flex-direction: column
61
- align-items: flex-start
62
- margin-top: 0.25rem
63
- a
64
- line-height: 1.2
65
- font-size: $fs-13
66
- margin: 0.25rem 0
67
- padding: 2px 0
68
- .title
69
- font-size: $fs-13
70
- color: var(--text-p2)
71
- &:hover
72
- color: $color-hover
73
- .widget-wrap#related .widget-body a
74
- margin-top: 0.5rem
75
- margin-bottom: 1rem
76
- .title
77
- font-weight: 700
78
- font-size: $fs-14
79
- .excerpt
80
- -webkit-line-clamp: 3
81
-
82
- .widget-wrap#tagcloud .widget-body
83
- margin-top: 0.25rem
84
- a
85
- word-break: break-word
86
- color: var(--text-p2)
87
- line-height: 1.5
88
- &:hover
89
- color: $color-hover
90
-
91
- .widget-wrap#timeline .widget-body
92
- margin-top: 0.5rem
93
- .tag-plugin.timeline .timenode
94
- .header
95
- margin-bottom: 0.5rem
96
- txt-ellipsis()
97
- .user-info
98
- background: var(--block)
99
- &:hover
100
- background: $color-hover
101
- color: var(--card)
102
- &:before
103
- display: none
104
- &+.timenode
105
- margin-top: 0.75rem
106
-