From f73bd860bb566be9684876c68f6c55fd1940fddf Mon Sep 17 00:00:00 2001 From: Yehonal Date: Sun, 23 Dec 2018 11:18:54 +0100 Subject: Implemented new js search method (faster) # Conflicts: # _includes/git-wiki/components/search/se_js.html --- _config.yml.dist | 3 +- _includes/git-wiki/components/search/se_js.html | 19 +++------- .../git-wiki/components/search/se_js_rss.html | 21 +++++++++++ _sass/git-wiki-style.scss | 4 +++ assets/js/simple-jekyll-search.min.js | 6 ++++ searchdata.js | 41 ++++++++++++++++++++++ sitemap_full.xml | 2 +- 7 files changed, 80 insertions(+), 16 deletions(-) create mode 100644 _includes/git-wiki/components/search/se_js_rss.html create mode 100644 assets/js/simple-jekyll-search.min.js create mode 100644 searchdata.js diff --git a/_config.yml.dist b/_config.yml.dist index bdb7142..a6b30e6 100644 --- a/_config.yml.dist +++ b/_config.yml.dist @@ -33,7 +33,8 @@ use_github_wiki: false # service to edit github markdown pages easily use_prose_io: true # Select search_engine component from: -# - js: it uses a built in javascript component that uses generated sitemap_full.xml to search inside your wiki +# - js: it uses a built in javascript component that uses generated js object +# - js_rss: it uses a built in javascript component that uses generated sitemap_full.xml to search inside your wiki with lunr library (slow and experimental) # - github : it uses internal github repository search # - google : it uses cse search bar, you need to configure google_cse_token # diff --git a/_includes/git-wiki/components/search/se_js.html b/_includes/git-wiki/components/search/se_js.html index 056dd87..85e168c 100644 --- a/_includes/git-wiki/components/search/se_js.html +++ b/_includes/git-wiki/components/search/se_js.html @@ -1,16 +1,7 @@
-
- -
+ +
- - + + + diff --git a/_includes/git-wiki/components/search/se_js_rss.html b/_includes/git-wiki/components/search/se_js_rss.html new file mode 100644 index 0000000..d61d976 --- /dev/null +++ b/_includes/git-wiki/components/search/se_js_rss.html @@ -0,0 +1,21 @@ +
+
+ +
+
+ \ No newline at end of file diff --git a/_sass/git-wiki-style.scss b/_sass/git-wiki-style.scss index 78efd6b..b9072d1 100644 --- a/_sass/git-wiki-style.scss +++ b/_sass/git-wiki-style.scss @@ -344,3 +344,7 @@ footer { .post-item { margin-bottom: 50px; } + +#results-container li { + list-style-type: none; +} \ No newline at end of file diff --git a/assets/js/simple-jekyll-search.min.js b/assets/js/simple-jekyll-search.min.js new file mode 100644 index 0000000..465a69f --- /dev/null +++ b/assets/js/simple-jekyll-search.min.js @@ -0,0 +1,6 @@ +/*! + * Simple-Jekyll-Search v1.7.2 (https://github.com/christian-fei/Simple-Jekyll-Search) + * Copyright 2015-2018, Christian Fei + * Licensed under the MIT License. + */ +!function(){"use strict";var f={load:function w(t,e){var n=function r(){return window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP")}();n.open("GET",t,!0),n.onreadystatechange=function i(e,n){return function(){if(4===e.readyState&&200===e.status)try{n(null,JSON.parse(e.responseText))}catch(t){n(t,null)}}}(n,e),n.send()}};(function y(t){if(!function e(t){return!!t&&"undefined"!=typeof t.required&&t.required instanceof Array}(t))throw new Error("-- OptionsValidator: required options missing");if(!(this instanceof y))return new y(t);var r=t.required;this.getRequiredOptions=function(){return r},this.validate=function(e){var n=[];return r.forEach(function(t){"undefined"==typeof e[t]&&n.push(t)}),n}});var n=function g(t,e){var n=e.length,r=t.length;if(n{title}',templateMiddleware:Function.prototype,sortMiddleware:function(){return 0},noResultsText:"No results found",limit:10,fuzzy:!1,exclude:[]},n=["searchInput","resultsContainer","json"],r=function y(e){if(!function n(t){return!!t&&"undefined"!=typeof t.required&&t.required instanceof Array}(e))throw new Error("-- OptionsValidator: required options missing");if(!(this instanceof y))return new y(e);var r=e.required;this.getRequiredOptions=function(){return r},this.validate=function(e){var n=[];return r.forEach(function(t){"undefined"==typeof e[t]&&n.push(t)}),n}}({required:n});function i(t){o.success(t),l.put(t),function e(){o.searchInput.addEventListener("keyup",function(t){(function e(t){return-1===[13,16,20,37,38,39,40,91].indexOf(t)})(t.which)&&(u(),c(t.target.value))})}()}function u(){o.resultsContainer.innerHTML=""}function a(t){o.resultsContainer.innerHTML+=t}function c(t){(function e(t){return t&&0{title}', + noResultsText: 'No results found', + limit: 10, + fuzzy: false, + exclude: [] + }) + diff --git a/sitemap_full.xml b/sitemap_full.xml index 2a979f8..5118304 100644 --- a/sitemap_full.xml +++ b/sitemap_full.xml @@ -5,7 +5,7 @@ sitemap: false -{% if site.search_engine == "js" %} +{% if site.search_engine == "js_rss" %} {{ site.name | xml_escape }} {{ site.description | xml_escape }} {{ site.url }} -- cgit