diff --git a/_config.yml b/_config.yml index 39b1517..4aa95e5 100644 --- a/_config.yml +++ b/_config.yml @@ -158,11 +158,6 @@ defaults: - label: Home url: / - - - scope: - path: assets/data - values: - layout: compress sass: diff --git a/_includes/disqus.html b/_includes/disqus.html index 3164122..692ca23 100644 --- a/_includes/disqus.html +++ b/_includes/disqus.html @@ -11,7 +11,7 @@

Comments powered by Disqus.

- + - - {% endif %} - {% endif %} - + - + - + - {% if page.layout == 'home' or page.layout == 'post' %} - - {% if site.google_analytics.pv.enabled %} - - - - {% endif %} - {% endif %} + - {% if site.toc and page.toc and page.layout == 'post' %} - - - - {% endif %} - - - - - {% if jekyll.environment == 'production' %} - - {% endif %} + {% include js-selector.html %} \ No newline at end of file diff --git a/_includes/js-selector.html b/_includes/js-selector.html new file mode 100644 index 0000000..390ae51 --- /dev/null +++ b/_includes/js-selector.html @@ -0,0 +1,45 @@ + + +{% if page.layout == 'home' %} + + + +{% elsif page.layout == 'post' %} + + {% if site.toc and page.toc %} + + {% else %} + + {% endif %} + + {% if page.math %} + + + + {% endif %} + +{% elsif page.layout == 'page' %} + + {% if page.title == 'Categories' %} + + {% else %} + + {% endif %} + +{% else %} + + + +{% endif %} + + + +{% if jekyll.environment == 'production' %} + +{% endif %} diff --git a/_includes/search-loader.html b/_includes/search-loader.html index f78891c..af7ebb1 100644 --- a/_includes/search-loader.html +++ b/_includes/search-loader.html @@ -5,7 +5,6 @@ © 2017-2019 Cotes Chung MIT License --> - {% capture result_elem %}
@@ -20,11 +19,13 @@ {% capture not_found %}

Oops! No result founds.

{% endcapture %} + + diff --git a/tools/js-compress.sh b/tools/js-compress.sh deleted file mode 100755 index f416c76..0000000 --- a/tools/js-compress.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -# -# A development tool that use yuicompressor to compress JS files. -# -# -# Requirement: -# - wget -# - JRE -# - yuicompressor › https://github.com/yui/yuicompressor -# -# -# Usage: bash /path/to/js-compress.sh -# -# Process: -# input: /path/to/js/source.js --> output: /path/to/js/dist/source.min.js -# -# v2.0 -# https://github.com/cotes2020/jekyll-theme-chirpy -# © 2020 Cotes Chung -# MIT Licensed - - -set -eu - -PROJ_HOME=$(dirname $(dirname $(realpath "$0"))) - -YUICOMPRESSOR_SRC=https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.jar -YUICOMPRESSOR=${PROJ_HOME}/tools/package/yuicompressor-2.4.8.jar -JS_ROOT=${PROJ_HOME}/assets/js/ -JS_SRC=${JS_ROOT}_src # JS source files -JS_DEST=${JS_ROOT}dist # Compressed output directory -PREFIX_LEN=${#JS_ROOT} # To beautify the log - - -function init() { - if [[ ! -f $YUICOMPRESSOR ]]; then - if [[ ! -d "${PROJ_HOME}/tools/package/" ]]; then - mkdir -p "${PROJ_HOME}/tools/package/" - fi - wget "$YUICOMPRESSOR_SRC" -P "${PROJ_HOME}/tools/package/" -q - fi -} - -function compress() { - # $1 is the source dir - # $2 is the destination dir - # $3 is the sub dir of source dir, nullable - if [[ -z ${3:+unset} ]] - then - sub_dir="" - else - sub_dir="$3/" - fi - - for item in $(ls $1) - do - src="$1/$item" - if [[ -d "$src" ]]; then - compress $src $2 $item # recursion - else - - if [[ -z $(git status $src -s) ]]; then - continue - fi - - if [[ ! -d "$2/${sub_dir}" ]]; then - mkdir -p $2/${sub_dir} - fi - output=$2/${sub_dir}${item%.*}.min.js - echo "java -jar $(basename $YUICOMPRESSOR) ${src:$PREFIX_LEN} -o ${output:$PREFIX_LEN}" - java -jar $YUICOMPRESSOR $src -o $output - fi - done - - sub_dir="" # clean up for next recursion. -} - -init - -compress $JS_SRC $JS_DEST