From 3d3bb1411c889e0d05dbf250d6c891d687912130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BB=91?= <1395348685z@gmail.com> Date: Sun, 11 Apr 2021 00:46:18 +0800 Subject: [PATCH] Separate third party inline scripts (#241) --- _config.yml | 1 + layout/_layout.njk | 8 +- layout/_partials/head/head-unique.njk | 17 +-- layout/_partials/head/head.njk | 2 +- .../analytics/baidu-analytics.njk | 11 +- .../analytics/google-analytics.njk | 27 +---- layout/_third-party/analytics/growingio.njk | 8 +- layout/_third-party/chat/chatra.njk | 23 +--- layout/_third-party/comments/changyan.njk | 17 +-- layout/_third-party/comments/disqus.njk | 41 +------ layout/_third-party/comments/disqusjs.njk | 20 +--- layout/_third-party/comments/gitalk.njk | 29 +---- layout/_third-party/comments/isso.njk | 12 +- layout/_third-party/comments/livere.njk | 18 +-- layout/_third-party/comments/utterances.njk | 16 +-- layout/_third-party/math/index.njk | 16 ++- layout/_third-party/math/katex.njk | 5 +- layout/_third-party/math/mathjax.njk | 35 +----- layout/_third-party/nprogress.njk | 22 +--- layout/_third-party/quicklink.njk | 19 +--- layout/_third-party/rating.njk | 23 +--- layout/_third-party/search/algolia-search.njk | 2 +- layout/_third-party/search/localsearch.njk | 2 +- layout/_third-party/statistics/firestore.njk | 64 +---------- .../statistics/lean-analytics.njk | 99 +---------------- layout/_third-party/tags/mermaid.njk | 25 +---- layout/_third-party/tags/pdf.njk | 26 +---- scripts/filters/minify.js | 105 ++++++++++++++++-- scripts/helpers/engine.js | 8 ++ scripts/helpers/next-config.js | 14 +++ source/js/config.js | 60 ++++++++++ source/js/load-config.js | 15 --- source/js/pjax.js | 4 +- .../third-party/analytics/baidu-analytics.js | 7 ++ .../third-party/analytics/google-analytics.js | 35 ++++++ source/js/third-party/analytics/growingio.js | 10 ++ source/js/third-party/chat/chatra.js | 10 ++ source/js/third-party/comments/changyan.js | 20 ++++ source/js/third-party/comments/disqus.js | 39 +++++++ source/js/third-party/comments/disqusjs.js | 18 +++ source/js/third-party/comments/gitalk.js | 24 ++++ source/js/third-party/comments/isso.js | 15 +++ source/js/third-party/comments/livere.js | 19 ++++ source/js/third-party/comments/utterances.js | 17 +++ source/js/third-party/math/katex.js | 7 ++ source/js/third-party/math/mathjax.js | 36 ++++++ source/js/third-party/nprogress.js | 20 ++++ source/js/third-party/quicklink.js | 44 ++++++++ source/js/third-party/rating.js | 22 ++++ .../search}/algolia-search.js | 0 .../{ => third-party/search}/local-search.js | 0 source/js/third-party/statistics/firestore.js | 63 +++++++++++ .../third-party/statistics/lean-analytics.js | 102 +++++++++++++++++ source/js/third-party/tags/mermaid.js | 25 +++++ source/js/third-party/tags/pdf.js | 23 ++++ source/js/utils.js | 67 ++++++++--- 56 files changed, 871 insertions(+), 546 deletions(-) create mode 100644 source/js/config.js delete mode 100644 source/js/load-config.js create mode 100644 source/js/third-party/analytics/baidu-analytics.js create mode 100644 source/js/third-party/analytics/google-analytics.js create mode 100644 source/js/third-party/analytics/growingio.js create mode 100644 source/js/third-party/chat/chatra.js create mode 100644 source/js/third-party/comments/changyan.js create mode 100644 source/js/third-party/comments/disqus.js create mode 100644 source/js/third-party/comments/disqusjs.js create mode 100644 source/js/third-party/comments/gitalk.js create mode 100644 source/js/third-party/comments/isso.js create mode 100644 source/js/third-party/comments/livere.js create mode 100644 source/js/third-party/comments/utterances.js create mode 100644 source/js/third-party/math/katex.js create mode 100644 source/js/third-party/math/mathjax.js create mode 100644 source/js/third-party/nprogress.js create mode 100644 source/js/third-party/quicklink.js create mode 100644 source/js/third-party/rating.js rename source/js/{ => third-party/search}/algolia-search.js (100%) rename source/js/{ => third-party/search}/local-search.js (100%) create mode 100644 source/js/third-party/statistics/firestore.js create mode 100644 source/js/third-party/statistics/lean-analytics.js create mode 100644 source/js/third-party/tags/mermaid.js create mode 100644 source/js/third-party/tags/pdf.js diff --git a/_config.yml b/_config.yml index 8fa4fd21d..cf87e8be6 100644 --- a/_config.yml +++ b/_config.yml @@ -553,6 +553,7 @@ quicklink: # For more flexibility you can add some patterns (RegExp, Function, or Array) to ignores. # See: https://github.com/GoogleChromeLabs/quicklink#custom-ignore-patterns + # This option is deprecated. Use `CONFIG.quicklink.ignores` in your custom scripts instead. ignores: diff --git a/layout/_layout.njk b/layout/_layout.njk index 8334c5a93..b1475a209 100644 --- a/layout/_layout.njk +++ b/layout/_layout.njk @@ -4,7 +4,7 @@ {{ partial('_partials/head/head.njk', {}, {cache: theme.cache.enable}) }} {%- include '_partials/head/head-unique.njk' -%}