From d9e677d6cd90b9c868d505f5177868090dbf1842 Mon Sep 17 00:00:00 2001 From: Kurococ Liu <21096362+KurococLiu@users.noreply.github.com> Date: Sun, 23 Oct 2022 09:46:21 +0800 Subject: =?UTF-8?q?:+1:=20Perf:=20=E4=BC=98=E5=8C=96Gravatar=E5=9B=BD?= =?UTF-8?q?=E5=86=85=E9=95=9C=E5=83=8F=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/Comments.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/Comments.php b/libs/Comments.php index 0d3b3b1..c31dc7d 100644 --- a/libs/Comments.php +++ b/libs/Comments.php @@ -42,7 +42,7 @@ Class Comments { { //MD5 EMail $email = md5($email); - $avatar = 'https://gravatar.loli.net/avatar/' . $email . '?s=' . $size; + $avatar = 'https://cravatar.cn/avatar/' . $email . '?s=' . $size; return $avatar; } -- cgit v1.2.3 From f142d61f01fc57cf7befe2cc71cc8a3f8b0fdc82 Mon Sep 17 00:00:00 2001 From: Kurococ Liu <21096362+KurococLiu@users.noreply.github.com> Date: Sun, 23 Oct 2022 12:58:52 +0800 Subject: =?UTF-8?q?:newspaper:=20=20Add:=20=E5=8A=A0=E5=85=A5preconnect?= =?UTF-8?q?=E3=80=81=E5=AD=97=E6=95=B0=E7=BB=9F=E8=AE=A1=EF=BC=8CReadme?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=85=AC=E7=9B=8ACDN=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++++++ includes/head.php | 8 +++++++- libs/Matcha.php | 36 +++++++++++++++++++++++++++++++++++- libs/Options.php | 12 ++++++++++++ 4 files changed, 62 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7f38233..ec0e802 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,14 @@ Matcha 主题采用[语义化版本 2.0.0](https://semver.org/lang/zh-CN/) 标 [Pixabay 用户 - OpenClipart-Vectors](https://pixabay.com/zh/vectors/screaming-surprised-smiley-emotion-146426/):提供 404 页面使用的矢量图 + +#### 公益CDN + +[Cravatar](https://cravatar.cn/) | +[cdnjs](https://cdnjs.cloudflare.com/) | +[字节跳动静态资源公共库](https://cdn.bytedance.com/) + + --- Copyright © 2022 SumiMakito, memset0 & Eltrac, under GPL v3.0 License. diff --git a/includes/head.php b/includes/head.php index 19f0ab2..4c02fad 100644 --- a/includes/head.php +++ b/includes/head.php @@ -3,9 +3,15 @@ + - + + + + + + options->favicon){ ?> diff --git a/libs/Matcha.php b/libs/Matcha.php index 1ec3c39..fd6135b 100644 --- a/libs/Matcha.php +++ b/libs/Matcha.php @@ -12,6 +12,7 @@ class Matcha * 包括 css 引用、标题 */ public static function head() { + Matcha::preconnect(); Matcha::linkCSS(); Matcha::iconfont(); Helper::options()->customHead(); @@ -68,7 +69,32 @@ class Matcha echo '" />'; } } - + + /** + * 输出 preconnect 标签 + */ + public static function preconnect() { + if(isset(Helper::options()->StaticCDN) && Helper::options()->StaticCDN!='local'){ + if(Helper::options()->StaticCDN=='bytedance'){ + $src_link = array( + '//lf3-cdn-tos.bytecdntp.com/', + '//lf9-cdn-tos.bytecdntp.com/', + '//lf26-cdn-tos.bytecdntp.com/', + ); + } + elseif(Helper::options()->StaticCDN=='cdnjs'){ + $src_link = array( + '://cdnjs.cloudflare.com/', + ); + } + echo ''; + foreach($src_link as $value){ + echo ''; + } + + } + } + /** * 引用 iconfont */ @@ -290,6 +316,14 @@ class Matcha */ static public function footerInfo() { + //字数统计 + if (Helper::options()->EnableWordsCounter=='able') { + + echo '
'; + echo '一共书写了'; + WordsCounter_Plugin::allOfCharacters(); + echo '字'; + } //备案号 if (Helper::options()->icpNum!='') { echo '
'; diff --git a/libs/Options.php b/libs/Options.php index fde322b..04384c0 100644 --- a/libs/Options.php +++ b/libs/Options.php @@ -133,6 +133,18 @@ function themeConfig($form) { ') ); $form->addInput($EnableBusuanzi->addRule('required', _t('此处必须设置'))); + //启用字数统计 + $EnableWordsCounter = new Typecho_Widget_Helper_Form_Element_Radio('EnableWordsCounter', array( + 'able' => _t('启用'), + 'disable' => _t('停用'), + ), + 'able', + _t('是否启用 字数统计 功能'), + _t(' + 字数统计是一个基于WordsCounter插件统计全站字数的,默认启用 + ') + ); + $form->addInput($EnableWordsCounter->addRule('required', _t('此处必须设置'))); /** * 自定义 & 开发者设置 -- cgit v1.2.3 From 885647d86dc02d4be65adae0b3a97f5d5f1c58db Mon Sep 17 00:00:00 2001 From: Kurococ Liu <21096362+KurococLiu@users.noreply.github.com> Date: Sun, 23 Oct 2022 14:55:58 +0800 Subject: =?UTF-8?q?:book:=20Doc:=20=E6=9B=B4=E8=BF=9B=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ec0e802..4046411 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ Matcha 主题采用[语义化版本 2.0.0](https://semver.org/lang/zh-CN/) 标 - [BracketDown](https://github.com/BigCoke233/typecho-plugin-BracketDown):语法拓展插件,如果想要在文章里使用短代码就需要安装这个插件 - [CopyDog](https://github.com/BigCoke233/typecho-plugin-CopyDog):版权狗插件,可以在文章末尾生成一个显示版权信息的卡片 - [ExSearch](https://github.com/AlanDecode/Typecho-Plugin-ExSearch):搜索增强插件 _1.2.0-beta.1 及以后版本支持_ +- [WordsCounter](https://github.com/elatisy/Typecho_WordsCounter):字数统计插件,可以统计全站的字数 ## 鸣谢 -- cgit v1.2.3 From 8c3233cb669541430f7b71b955c4fbe4981c5862 Mon Sep 17 00:00:00 2001 From: Kurococ Liu <21096362+KurococLiu@users.noreply.github.com> Date: Tue, 1 Nov 2022 12:48:18 +0800 Subject: =?UTF-8?q?:bug:=20Fix:=20=E4=BF=AE=E6=AD=A3=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E6=96=87=E5=AD=97=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions.php b/functions.php index 54773b7..b27e409 100644 --- a/functions.php +++ b/functions.php @@ -28,7 +28,7 @@ function themeFields($layout) false => _t('关闭')), false, _t('是否开启文章目录'), - _t('解析文章目录展示在文章页面左侧,代替侧边栏的位置')); + _t('解析文章目录展示在文章页面右侧,代替侧边栏的位置')); $layout->addItem($showTOC); $thumbnail = new Typecho_Widget_Helper_Form_Element_Text('thumbnail', NULL, -- cgit v1.2.3 From 7d43a015736099c950e2edd16fe4cd3788a83b80 Mon Sep 17 00:00:00 2001 From: Kurococ Liu <21096362+KurococLiu@users.noreply.github.com> Date: Tue, 1 Nov 2022 13:04:56 +0800 Subject: =?UTF-8?q?:bug:=20Fix:=20=E9=BB=98=E8=AE=A4=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E5=AD=97=E6=95=B0=E7=BB=9F=E8=AE=A1=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/Options.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/Options.php b/libs/Options.php index 04384c0..65cbcce 100644 --- a/libs/Options.php +++ b/libs/Options.php @@ -138,10 +138,10 @@ function themeConfig($form) { 'able' => _t('启用'), 'disable' => _t('停用'), ), - 'able', + 'disable', _t('是否启用 字数统计 功能'), _t(' - 字数统计是一个基于WordsCounter插件统计全站字数的,默认启用 + 字数统计是一个基于WordsCounter插件统计全站字数的 ') ); $form->addInput($EnableWordsCounter->addRule('required', _t('此处必须设置'))); -- cgit v1.2.3 From 6083c3a1ecffdd15be09ffebfd1f1266e00cb51e Mon Sep 17 00:00:00 2001 From: Kurococ Liu <21096362+KurococLiu@users.noreply.github.com> Date: Tue, 1 Nov 2022 13:15:27 +0800 Subject: =?UTF-8?q?:bug:=20Fix:=20=E4=BF=AE=E6=AD=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E5=8F=8A=E6=B3=A8=E9=87=8A=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc.md | 2 +- libs/Comments.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc.md b/doc.md index 6cad170..77bb1dd 100644 --- a/doc.md +++ b/doc.md @@ -34,7 +34,7 @@ A:大概率不能,Matcha 主题的定位一直是个人独立博客主题。 Q:我好像遇到了 bug,我该怎么办?
A:不是任何问题都是 bug,你需要在将这个 bug 提交给作者之前做一些简单的确认: -1. 清除浏览器或 CDN 缓存,刷新,或是尝试 Ctrl + F15; +1. 清除浏览器或 CDN 缓存,刷新,或是尝试 Ctrl + F5; 2. 如果你修改或者添加了一些代码,还原他们,看看问题会不会复现; 3. 关闭所有的插件,看看问题会不会复现; 4. 切换成其他主题,看看问题会不会复现。 diff --git a/libs/Comments.php b/libs/Comments.php index c31dc7d..52a7c6a 100644 --- a/libs/Comments.php +++ b/libs/Comments.php @@ -36,7 +36,7 @@ Class Comments { } /** - * 获取 Gravatar 头像链接 + * 获取 Cravatar 头像链接 */ public static function gravatar($email, int $size = 100, int $useCDN = NULL) { -- cgit v1.2.3 From a6c41081a273a023c48779f15f63dcd1b1b87517 Mon Sep 17 00:00:00 2001 From: Kurococ Liu <21096362+KurococLiu@users.noreply.github.com> Date: Fri, 4 Nov 2022 17:15:08 +0800 Subject: =?UTF-8?q?:+1:=20Perf:=20=E9=80=82=E9=85=8DISO=20639-3=E6=A0=87?= =?UTF-8?q?=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/head.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/head.php b/includes/head.php index 4c02fad..ccadbf9 100644 --- a/includes/head.php +++ b/includes/head.php @@ -1,6 +1,6 @@ - + -- cgit v1.2.3