From 3248343c22e92ff93808cff455daebb461165fa9 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 31 Dec 2019 23:17:27 +0800 Subject: [PATCH] A super huge improvement in search. - Added a cleanup button within input form. - Optimized TopBar responsive effect(for search layout). - Redesign the search results layout. --- _includes/panel.html | 31 +- _includes/related-posts.html | 2 +- _includes/search-loader.html | 27 ++ _includes/search-results.html | 13 +- _includes/search.html | 13 - _includes/sidebar.html | 8 +- _includes/topbar.html | 9 +- _includes/trending-tags.html | 26 ++ _layouts/default.html | 4 +- _layouts/home.html | 2 +- _layouts/post.html | 12 +- assets/css/main.scss | 306 ++++++++++++------ assets/css/post.scss | 18 +- assets/js/_src/_commons/search-display.js | 192 +++++++---- assets/js/_src/_commons/topbar-switch.js | 14 +- assets/js/_src/toc.js | 6 +- assets/js/dist/_commons/search-display.min.js | 2 +- assets/js/dist/_commons/topbar-switch.min.js | 2 +- assets/js/dist/toc.min.js | 2 +- assets/lib/simple-jekyll-search-1.7.1.min.js | 6 - search.json | 4 +- 21 files changed, 452 insertions(+), 247 deletions(-) create mode 100644 _includes/search-loader.html delete mode 100644 _includes/search.html create mode 100644 _includes/trending-tags.html delete mode 100644 assets/lib/simple-jekyll-search-1.7.1.min.js diff --git a/_includes/panel.html b/_includes/panel.html index 27c7e49..feafb87 100644 --- a/_includes/panel.html +++ b/_includes/panel.html @@ -4,7 +4,7 @@ MIT License --> -
+
{% assign lastmod_list = "" | split: "" %} @@ -43,37 +43,18 @@ {% endif %}
-

{{- site.data.label.panel.trending_tags -}}

-
- {% capture tags_array %} - {% for tag in site.tags %} - {{ tag[1] | size }}:{{ tag[0] | replace: ' ', '-' }} - {% endfor %} - {% endcapture %} + {% include trending-tags.html %} +
+
- {% assign MAX = 10 %} - {% assign count = 0 %} - {% assign trends = tags_array | split: " " | sort | reverse %} - - {% for trend in trends %} - {% assign count = count | plus: 1 %} - {% assign tag = trend | split: ":" | last %} - - {% if count >= MAX %} - {% break %} - {% endif %} - {% endfor %} - -
-
{% if page.layout == 'post' and site.toc and page.toc %} -
+

{{- site.data.label.panel.toc -}}

@@ -81,4 +62,4 @@
{% endif %} -
\ No newline at end of file + diff --git a/_includes/related-posts.html b/_includes/related-posts.html index 175e122..e5bf055 100644 --- a/_includes/related-posts.html +++ b/_includes/related-posts.html @@ -52,7 +52,7 @@
{{ post.date | date: POST_DATE }} - + {{ post.date | date_to_xmlschema }}

{{ post.title }}

diff --git a/_includes/search-loader.html b/_includes/search-loader.html new file mode 100644 index 0000000..c840a06 --- /dev/null +++ b/_includes/search-loader.html @@ -0,0 +1,27 @@ + + + +{% capture result_elem %} +
+ {title} + +

{snippet}

+
+{% endcapture %} + + \ No newline at end of file diff --git a/_includes/search-results.html b/_includes/search-results.html index d9a87f6..d6d6157 100644 --- a/_includes/search-results.html +++ b/_includes/search-results.html @@ -3,13 +3,12 @@ © 2017-2019 Cotes Chung MIT License --> -
-
-
-

Search Results

-
-
    -
    +
    +
    +
    +

    Trending Tags

    + {% include trending-tags.html %}
    +
    \ No newline at end of file diff --git a/_includes/search.html b/_includes/search.html deleted file mode 100644 index 04ee7c3..0000000 --- a/_includes/search.html +++ /dev/null @@ -1,13 +0,0 @@ - - - \ No newline at end of file diff --git a/_includes/sidebar.html b/_includes/sidebar.html index eb52b06..c0e29aa 100644 --- a/_includes/sidebar.html +++ b/_includes/sidebar.html @@ -4,8 +4,8 @@ MIT License --> -