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