jekyll-theme-gaeblogx 1.0.6 → 1.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 544c3b6af085fa63c3600b21106a8d929ecb0159
4
- data.tar.gz: d75435a93a8c0bf4be09990c08aea8f459d87dba
2
+ SHA256:
3
+ metadata.gz: ee5475293b588cc17ee3d4d40fa4f6fd52c3f7143bebc1e7c3b5a57ef5ef360f
4
+ data.tar.gz: 1fa715906f4eaf44565efbc7aaf2229a44f1034a2d987dd461d8bded350a894f
5
5
  SHA512:
6
- metadata.gz: c90c78e97feb704f8043cb70bb42faebdbd825b31e68257b3140a1f08acbcd947ad64306dd52659a2e76f8da70c2933a7d397d839bceac24db8b439ccc322ab5
7
- data.tar.gz: 1e1d98c497d172cea62a587127118eede9f94845ea5c3c144bccb245362bae83ea8a7f85a583c0a121c1b1c009e851f53764ed9567a1c49fa8c8aba723956e75
6
+ metadata.gz: fc35875bdfb49b343db7dce5590050697c64d1cc8d19a4d2594786839cac001b37dcc54df01ca43afa3d21d6504ce81da6ab09f2e6d4b9c8ad0b43d3c1188a8f
7
+ data.tar.gz: 489b4171d36ea5a27ffcfc9d350084dae5882e6554d67a36374301f43b2b17679e4886e452d853bb53f8efe7504dd1c8d83822ab4432d41dabd15aeb11d3be3a
data/README.md CHANGED
@@ -5,7 +5,7 @@ My personal blog Github Page: https://github.com/SeraphRoy/SeraphRoy.github.io
5
5
  ## Major features
6
6
 
7
7
  - Categories, Tags, Archives
8
- - Site-wide search provided by Algolia and Simple Jekyll Search
8
+ - Site-wide search provided by Algolia and [Simple-Blog-Search](https://github.com/SeraphRoy/SimpleBlogSearch)
9
9
  - Clean responsive design
10
10
  - Disqus Comments and Google Analytics support
11
11
  - SEO best practices via Jekyll SEO Tag
@@ -1,4 +1,4 @@
1
- <script src="https://cdn.jsdelivr.net/npm/instantsearch.js/dist/instantsearch.min.js"></script>
1
+ <script src="https://cdn.jsdelivr.net/npm/instantsearch.js@2.10.4/dist/instantsearch.min.js"></script>
2
2
  <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.20.1/moment.min.js"></script>
3
3
  <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.3.3/dist/instantsearch.min.css">
4
4
  <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.3.3/dist/instantsearch-theme-algolia.min.css">
@@ -30,4 +30,4 @@
30
30
  </p>
31
31
  </div>
32
32
  </footer>
33
- <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
33
+ <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
@@ -5,21 +5,22 @@
5
5
  <div id="site_search">
6
6
  <input type="text" id="search_box" placeholder="Search..." >
7
7
  </div>
8
-
9
- <ul class="content-ul" id="search_results" recent></ul>
8
+ <div id="search_results"></div>
10
9
 
11
10
  <link rel="stylesheet" type="text/css" href="{{ site.url }}/assets/stylesheets/main.css">
12
11
  <script type="text/javascript" src="{{ site.url }}/assets/js/search.js"></script>
13
- <script src="{{ site.url }}/assets/js/jekyll-search.min.js"></script>
12
+ <script type="text/javascript" src="{{ site.url }}/assets/js/node_modules/simpleblogsearch/index.js"></script>
13
+
14
+ <script>
15
+ SimpleBlogSearch({
16
+ searchDataPath: '{{ site.baseurl }}/assets/search_data.json',
17
+ dataType: 'json',
18
+ processDataFunc: function(data){ return data },
19
+ searchInputID: 'search_box',
20
+ resultsDivID: 'search_results',
21
+ resultULClass: 'content-ul search-ul content-side',
22
+ highlightKeywordClass: 'search_keyword',
23
+ limit: 4,
14
24
 
15
- <script type="text/javascript">
16
- SimpleJekyllSearch({
17
- searchInput: document.getElementById('search_box'),
18
- resultsContainer: document.getElementById('search_results'),
19
- json: '{{ site.baseurl }}/assets/search_data.json',
20
- searchResultTemplate: '<li><a href="{url}" title="{desc}">{title}</a></li>',
21
- noResultsText: 'No results found',
22
- limit: 10,
23
- fuzzy: false,
24
- })
25
+ });
25
26
  </script>
data/_layouts/home.html CHANGED
@@ -54,7 +54,43 @@ layout: default
54
54
  <span class="previous disable"><i class="fa fa-angle-double-left"></i></span>
55
55
  <span class="previous disable"><i class="fa fa-angle-left"></i></span>
56
56
  {% endif %}
57
- <span class="page_number ">{{ paginator.page }}/{{ paginator.total_pages }}</span>
57
+ <span class="page_number">
58
+ <script>
59
+ function isNum(val){
60
+ if(val === "" || val ==null){
61
+ return false;
62
+ }
63
+ if(!isNaN(val)){
64
+ return true;
65
+ }
66
+ else{
67
+ return false;
68
+ }
69
+ }
70
+ </script>
71
+ <script>
72
+ function onPressEnter(){
73
+ var pageid = document.getElementById("page_jumper_input").value
74
+ if(isNum(pageid)==false){
75
+ alert("Invalid Page Number!")
76
+ return
77
+ }
78
+ number = parseInt(pageid)
79
+ minn = 1
80
+ maxn = {{paginator.total_pages}}
81
+ if(number < minn)
82
+ number = minn
83
+ if(number > maxn)
84
+ number = maxn
85
+ if(number == 1)
86
+ location.href='/'
87
+ else
88
+ location.href='/page'+number.toString()
89
+ }
90
+ </script>
91
+ <input id="page_jumper_input" onkeydown="if(event.keyCode==13) {onPressEnter()}"
92
+ placeholder="{{ paginator.page }}">/{{ paginator.total_pages }}
93
+ </span>
58
94
  {% if paginator.next_page %}
59
95
  <a href="{{ paginator.next_page_path }}" class="next"><i class="fa fa-angle-right"></i></a>
60
96
  <a href="{{ site.baseurl }}/page{{ paginator.total_pages }}" class="next"><i class="fa fa-angle-double-right"></i></a>
data/_sass/_index.scss CHANGED
@@ -72,6 +72,12 @@
72
72
  .page_number {
73
73
  padding: 0 5px;
74
74
  }
75
+ #page_jumper_input {
76
+ text-align: right;
77
+ width: 4%;
78
+ font-size: 100%;
79
+ background-color: white;
80
+ }
75
81
  .disable {
76
82
  color: #cbcbcb;
77
83
  }
data/_sass/_page.scss CHANGED
@@ -150,6 +150,55 @@
150
150
  padding-left: 20px;
151
151
  }
152
152
  }
153
+ .search-ul {
154
+ line-height: 1.8;
155
+ margin: 0;
156
+ list-style: none;
157
+ padding: 0;
158
+ li {
159
+ font-size: 14px;
160
+ a {
161
+ display: block;
162
+ width: 100%;
163
+ padding: 2px 0;
164
+ border-bottom: 1px solid #eee;
165
+ &:hover {
166
+ background-color: #dbdfee;
167
+ .badge {
168
+ background-color: #dbdfee;
169
+ transform: scale(1.2) rotate(360deg);
170
+ }
171
+ }
172
+ .name {
173
+ padding-left: 15px;
174
+ }
175
+ .badge {
176
+ display: block;
177
+
178
+ // width: 20px;
179
+ float: right;
180
+ text-align: center;
181
+ margin-right: 15px;
182
+ margin-top: 3px;
183
+ padding: 0 10px;
184
+ font-size: 12px;
185
+ color: #fff;
186
+ background-color: #bbb;
187
+ border-radius: 50%;
188
+ transition: 0.5s ease-in-out;
189
+ }
190
+ }
191
+ .keyword {
192
+ background-color: #dbdfee;
193
+ }
194
+ &:last-of-type a {
195
+ border: none;
196
+ }
197
+ }
198
+ }
199
+ .search_keyword {
200
+ color: #2a7ae2;
201
+ }
153
202
  }
154
203
  }
155
204
  @media screen and (max-width:1200px) and (min-width: 770px) {
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Baby Pepper
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,50 @@
1
+ # SimpleBlogSearch
2
+
3
+ A small library that does searching in your static blog contents. In theory should
4
+ work with any blog generator like Jekyll and Hexo as long as it generates
5
+ data for all of your blog posts.
6
+
7
+ This is motivated by [hexo-theme-freemind](https://github.com/wzpan/hexo-theme-freemind/blob/master/source/js/search.js),
8
+ and [Simple-Jekyll-Search](https://github.com/christian-fei/Simple-Jekyll-Search).
9
+ The hexo one is just too buggy and lacks features I want, so I end up rewriting it
10
+ to fit my needs. The codes currently are very simple and don't support as many features
11
+ as Simple-Jekyll-Search, so I think the best thing to do is to have
12
+ Simple-Jekyll-Search integrate the functionalities that are useful.
13
+
14
+ ## Features
15
+
16
+ - Custom data processing function to make it work with any static blog generator
17
+ - Search in post contents and title
18
+ - Highlight matched contents
19
+ - Regex support
20
+ - Skip math sections
21
+
22
+ ## Installation
23
+
24
+ `npm install simpleblogsearch`
25
+
26
+ ## Demo
27
+
28
+ See [my own blog](https://www.gaeblogx.com).
29
+
30
+ ## Usage
31
+
32
+ Add the following script to your html file (change parameters accordingly):
33
+
34
+ ```
35
+ <script>
36
+ SimpleBlogSearch({
37
+ searchDataPath: '{{ site.baseurl }}/assets/search_data.json',
38
+ dataType: 'json',
39
+ processDataFunc: function(data){ return data },
40
+ searchInputID: 'search_box',
41
+ resultsDivID: 'search_results',
42
+ resultULClass: 'content-ul search-ul content-side',
43
+ highlightKeywordClass: 'search_keyword',
44
+ limit: 4,
45
+
46
+ });
47
+ </script>
48
+ ```
49
+
50
+ See [my own theme](https://github.com/SeraphRoy/GaeBlogx) as an example.
@@ -0,0 +1,104 @@
1
+ 'use strict';
2
+
3
+ var SimpleBlogSearch = function(args) {
4
+ 'use strict';
5
+ $.ajax({
6
+ url: args.searchDataPath,
7
+ dataType: args.dataType,
8
+ success: function( response ) {
9
+ // get the contents from search data
10
+ var datas = args.processDataFunc(response);
11
+ var $input = document.getElementById(args.searchInputID);
12
+ if (!$input) return;
13
+ var $resultContent = document.getElementById(args.resultsDivID);
14
+ if ($("#" + args.searchInputID).length > 0) {
15
+ $input.addEventListener('input', function () {
16
+ var str = `<ul class="${args.resultULClass}">`;
17
+ var keywordRegex = new RegExp(this.value.toLowerCase(), "g")
18
+ $resultContent.innerHTML = "";
19
+ if (this.value.trim().length <= 0) {
20
+ return;
21
+ }
22
+ // perform local searching
23
+ var count = 0
24
+ datas.some(function (data) {
25
+ var isMatch = false;
26
+ var content_index = [];
27
+ if (!data.title || data.title.trim() === '') {
28
+ data.title = "Untitled";
29
+ }
30
+ var data_title = data.title.trim().toLowerCase();
31
+ var data_content = data.content.trim().replace(/(\r\n\t|\n|\r\t|\s)+/gm, " ")
32
+ var data_content_lowercase = data_content.toLowerCase()
33
+ var data_url = data.url;
34
+ var index_content = -1;
35
+ var first_occur = -1;
36
+ // only match artiles with not empty contents
37
+ if (data_content_lowercase !== '') {
38
+ var matchTitles = data_title.match(keywordRegex)
39
+ var matchContents = data_content_lowercase.match(keywordRegex)
40
+ if (matchTitles != null) {
41
+ isMatch = true
42
+ }
43
+ if (matchContents != null) {
44
+ isMatch = true
45
+ index_content = data_content_lowercase.indexOf(matchContents[0]);
46
+ }
47
+ if (index_content < 0) {
48
+ index_content = 0
49
+ }
50
+ first_occur = index_content
51
+ }
52
+
53
+ // show search results
54
+ if (isMatch) {
55
+ str += `<li><a href='${data_url}'>${data.title}</a>`;
56
+ var content = data.content.trim();
57
+ if (first_occur >= 0) {
58
+ // cut out 100 characters
59
+ var start = first_occur - 20;
60
+ var end = first_occur + 80;
61
+
62
+ if (start < 0) {
63
+ start = 0;
64
+ }
65
+
66
+ if (start == 0) {
67
+ end = 100;
68
+ }
69
+
70
+ if (end > data_content.length) {
71
+ end = data_content.length;
72
+ }
73
+ var match_content = data_content.substring(start, end);
74
+
75
+
76
+ // highlight search result
77
+ if (matchContents != null) {
78
+ var regStr;
79
+ if (match_content.toLowerCase().includes(matchContents[0])) {
80
+ regStr = matchContents[0]
81
+ } else {
82
+ regStr = match_content.substring(20)
83
+ }
84
+ var reg = new RegExp(regStr.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), "gi");
85
+ match_content = match_content.replace(reg,
86
+ `<em class="${args.highlightKeywordClass}">${regStr}</em>`);
87
+ }
88
+
89
+ str += `<p class="${args.resultParagraphClass}">${match_content}...</p>`
90
+ }
91
+ str += "</li>";
92
+ count += 1;
93
+ }
94
+ return count == args.limit;
95
+ });
96
+ str += "</ul>";
97
+ $resultContent.innerHTML = str;
98
+ });
99
+ }
100
+ }
101
+ });
102
+ }
103
+
104
+ module.exports = SimpleBlogSearch;
@@ -0,0 +1,55 @@
1
+ {
2
+ "_from": "simpleblogsearch",
3
+ "_id": "simpleblogsearch@0.0.7",
4
+ "_inBundle": false,
5
+ "_integrity": "sha512-Qu1C+/H/nyInxpSS1GRTcC0FJVKoNQaWnKoRW+nVz05WElUSlLU95s4zB09nSEoUCl9vHUG4dwOyk3Gsn5ByGQ==",
6
+ "_location": "/simpleblogsearch",
7
+ "_phantomChildren": {},
8
+ "_requested": {
9
+ "type": "tag",
10
+ "registry": true,
11
+ "raw": "simpleblogsearch",
12
+ "name": "simpleblogsearch",
13
+ "escapedName": "simpleblogsearch",
14
+ "rawSpec": "",
15
+ "saveSpec": null,
16
+ "fetchSpec": "latest"
17
+ },
18
+ "_requiredBy": [
19
+ "#USER",
20
+ "/"
21
+ ],
22
+ "_resolved": "https://registry.npmjs.org/simpleblogsearch/-/simpleblogsearch-0.0.7.tgz",
23
+ "_shasum": "ee6aeae76249ab4ab3c8f23b9862f8efc7e1a8cb",
24
+ "_spec": "simpleblogsearch",
25
+ "_where": "/Users/yanxichen/Documents/GaeBlogx",
26
+ "author": {
27
+ "name": "Yanxi Chen",
28
+ "email": "royxagain@gmail.com",
29
+ "url": "https://www.gaeblogx.com"
30
+ },
31
+ "bugs": {
32
+ "url": "https://github.com/SeraphRoy/SimpleBlogSearch/issues"
33
+ },
34
+ "bundleDependencies": false,
35
+ "deprecated": false,
36
+ "description": "A simple search function for static blog websites like Jekyll.",
37
+ "homepage": "https://github.com/SeraphRoy/SimpleBlogSearch#readme",
38
+ "keywords": [
39
+ "Jekyll",
40
+ "blog",
41
+ "Javascript",
42
+ "Node"
43
+ ],
44
+ "license": "MIT",
45
+ "main": "index.js",
46
+ "name": "simpleblogsearch",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/SeraphRoy/SimpleBlogSearch.git"
50
+ },
51
+ "scripts": {
52
+ "test": "echo \"Error: no test specified\" && exit 1"
53
+ },
54
+ "version": "0.0.7"
55
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "requires": true,
3
+ "lockfileVersion": 1,
4
+ "dependencies": {
5
+ "simpleblogsearch": {
6
+ "version": "0.0.7",
7
+ "resolved": "https://registry.npmjs.org/simpleblogsearch/-/simpleblogsearch-0.0.7.tgz",
8
+ "integrity": "sha512-Qu1C+/H/nyInxpSS1GRTcC0FJVKoNQaWnKoRW+nVz05WElUSlLU95s4zB09nSEoUCl9vHUG4dwOyk3Gsn5ByGQ=="
9
+ }
10
+ }
11
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-gaeblogx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Baby Pepper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-08 00:00:00.000000000 Z
11
+ date: 2019-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -136,6 +136,11 @@ files:
136
136
  - assets/js/lunr.min.js
137
137
  - assets/js/main.js
138
138
  - assets/js/masonry.pkgd.min.js
139
+ - assets/js/node_modules/simpleblogsearch/LICENSE
140
+ - assets/js/node_modules/simpleblogsearch/README.md
141
+ - assets/js/node_modules/simpleblogsearch/index.js
142
+ - assets/js/node_modules/simpleblogsearch/package.json
143
+ - assets/js/package-lock.json
139
144
  - assets/js/pageContent.js
140
145
  - assets/js/search.js
141
146
  - assets/js/smooth-scroll.min.js
@@ -167,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
172
  version: '0'
168
173
  requirements: []
169
174
  rubyforge_project:
170
- rubygems_version: 2.5.1
175
+ rubygems_version: 2.7.7
171
176
  signing_key:
172
177
  specification_version: 4
173
178
  summary: 'Jekyll theme with: tags, categories, archives, and searches'