diff options
| -rw-r--r-- | README.md | 9 | ||||
| -rw-r--r-- | doc.md | 2 | ||||
| -rw-r--r-- | functions.php | 2 | ||||
| -rw-r--r-- | includes/head.php | 10 | ||||
| -rw-r--r-- | libs/Comments.php | 4 | ||||
| -rw-r--r-- | libs/Matcha.php | 36 | ||||
| -rw-r--r-- | libs/Options.php | 12 |
7 files changed, 68 insertions, 7 deletions
@@ -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):字数统计插件,可以统计全站的字数 ## 鸣谢 @@ -93,6 +94,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. @@ -34,7 +34,7 @@ A:大概率不能,Matcha 主题的定位一直是个人独立博客主题。 Q:我好像遇到了 bug,我该怎么办?<br /> A:不是任何问题都是 bug,你需要在将这个 bug 提交给作者之前做一些简单的确认: -1. 清除浏览器或 CDN 缓存,刷新,或是尝试 Ctrl + F15; +1. 清除浏览器或 CDN 缓存,刷新,或是尝试 Ctrl + F5; 2. 如果你修改或者添加了一些代码,还原他们,看看问题会不会复现; 3. 关闭所有的插件,看看问题会不会复现; 4. 切换成其他主题,看看问题会不会复现。 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, diff --git a/includes/head.php b/includes/head.php index 19f0ab2..ccadbf9 100644 --- a/includes/head.php +++ b/includes/head.php @@ -1,11 +1,17 @@ <?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?> <!DOCTYPE HTML> -<html> +<html lang="zh-cmn-Hans-CN"> <head> <meta charset="<?php $this->options->charset(); ?>"> + <!-- IE 8浏览器的页面渲染方式 & 默认使用极速内核:针对国内浏览器产商 --> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="renderer" content="webkit"> - <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> + <!-- 自适应 --> + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no"> + <!-- 关闭百度转码 --> + <meta http-equiv="x-dns-prefetch-control" content="on"> + <meta http-equiv="Cache-Control" content="no-transform"> + <meta http-equiv="Cache-Control" content="no-siteapp"> <?php //设置 favicon if($this->options->favicon){ ?> <link rel="icon" type="image/x-icon" href="<?php $this->options->favicon(); ?>"> diff --git a/libs/Comments.php b/libs/Comments.php index 0d3b3b1..52a7c6a 100644 --- a/libs/Comments.php +++ b/libs/Comments.php @@ -36,13 +36,13 @@ Class Comments { } /** - * 获取 Gravatar 头像链接 + * 获取 Cravatar 头像链接 */ public static function gravatar($email, int $size = 100, int $useCDN = NULL) { //MD5 EMail $email = md5($email); - $avatar = 'https://gravatar.loli.net/avatar/' . $email . '?s=' . $size; + $avatar = 'https://cravatar.cn/avatar/' . $email . '?s=' . $size; return $avatar; } 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 '<link rel="preconnect" href="'.$value.'" />'; + } + + } + } + /** * 引用 iconfont */ @@ -290,6 +316,14 @@ class Matcha */ static public function footerInfo() { + //字数统计 + if (Helper::options()->EnableWordsCounter=='able') { + + echo '<br />'; + echo '一共书写了'; + WordsCounter_Plugin::allOfCharacters(); + echo '字'; + } //备案号 if (Helper::options()->icpNum!='') { echo '<br />'; diff --git a/libs/Options.php b/libs/Options.php index 6b1d6f5..bfe0322 100644 --- a/libs/Options.php +++ b/libs/Options.php @@ -146,6 +146,18 @@ function themeConfig($form) { ') ); $form->addInput($EnableBusuanzi->addRule('required', _t('此处必须设置'))); + //启用字数统计 + $EnableWordsCounter = new Typecho_Widget_Helper_Form_Element_Radio('EnableWordsCounter', array( + 'able' => _t('启用'), + 'disable' => _t('停用'), + ), + 'disable', + _t('是否启用 <a rel="nofollow" target="_blank" href="https://github.com/elatisy/Typecho_WordsCounter">字数统计</a> 功能'), + _t(' + <a rel="nofollow" target="_blank" href="https://github.com/elatisy/Typecho_WordsCounter">字数统计</a>是一个基于WordsCounter插件统计全站字数的 + ') + ); + $form->addInput($EnableWordsCounter->addRule('required', _t('此处必须设置'))); /** * 自定义 & 开发者设置 |
