Handsome主题(版本号6.0.0
)修改调整,备忘。
忘了都从哪儿搜集来的,有侵权请联系我。
标题居中
将以下代码添加至
自定义CSS
(控制台
-外观
-设置外观
-开发者设置
-自定义CSS
)。/*文章标题居中*/
.panel h2{
text-align: center;
}
.panel-small h2{
text-align: center;
}
.panel-picture h3{
text-align: center;
}
.post-item-foot-icon{
text-align: center;
}
首页文章列表悬停上浮
自定义CSS
(控制台
-外观
-设置外观
-开发者设置
-自定义CSS
)。/*首页文章列表悬停上浮-大头图*/
.blog-post .panel:not(article) {
transition: all 0.3s;
}
.blog-post .panel:not(article):hover {
transform: translateY(-10px);
box-shadow: 0 8px 10px rgba(73, 90, 47, 0.47);
}
/*首页文章列表悬停上浮-图片版式*/
.blog-post .panel-picture:not(article) {
transition: all 0.3s;
}
.blog-post .panel-picture:not(article):hover {
transform: translateY(-10px);
box-shadow: 0 8px 10px rgba(73, 90, 47, 0.47);
}
/*首页文章列表悬停上浮-小头图*/
.blog-post .panel-small:not(article) {
transition: all 0.3s;
}
.blog-post .panel-small:not(article):hover {
transform: translateY(-10px);
box-shadow: 0 8px 10px rgba(73, 90, 47, 0.47);
}
复制弹窗提醒
压缩包
(下载地址)将
layer
文件夹解压缩至Typecho根目录/usr/js/
文件夹。将以下代码复制添加至
自定义JavaScript
(控制台
-外观
-设置外观
-开发者设置
-自定义尾部HTML代码
)。<script src="https://you-domain/usr/js/layer/layer.js"></script>
将以下代码复制添加至自定义JavaScript
(控制台
-外观
-设置外观
-开发者设置
-自定义JavaScript
)。
<!--复制弹框-->
document.body.oncopy = function() {layer.msg('复制成功,转载请保留本文链接!');};
彩色标签云
自定义JavaScript
(控制台
-外观
-设置外观
-开发者设置
-自定义JavaScript
)。<!--彩色标签云-->
let tags = document.querySelectorAll("#tag_cloud-2 a");
let colorArr = ["#428BCA", "#AEDCAE", "#ECA9A7", "#DA99FF", "#FFB380", "#D9B999"];
tags.forEach(tag => {
tagsColor = colorArr[Math.floor(Math.random() * colorArr.length)];
tag.style.backgroundColor = tagsColor;
});
版权声明
版权属于:Yves X
原文链接:https://github.com/Yves-X/Copyright-for-Typecho
转载时须注明出处及本声明
下载Copyright-for-Typecho
,解压缩至Typecho根目录/usr/plugins
内,文件夹更名为Copyright
。在控制台
-插件
中启用Copyright
插件。
网站加载耗时
将以下代码添加至
Typecho根目录/usr/themes/handsome/functions.php
末尾。//加载耗时
function timer_start() {
global $timestart;
$mtime = explode( ' ', microtime() );
$timestart = $mtime[1] + $mtime[0];
return true;
}
timer_start();
function timer_stop( $display = 0, $precision = 3 ) {
global $timestart, $timeend;
$mtime = explode( ' ', microtime() );
$timeend = $mtime[1] + $mtime[0];
$timetotal = number_format( $timeend - $timestart, $precision );
$r = $timetotal < 1 ? $timetotal * 1000 . " ms" : $timetotal . " s";
if ( $display ) {
echo $r;
}
return $r;
}
将以下代码添加至Typecho根目录/usr/themes/handsome/component/sidebar.php
合适位置。
<li class="list-group-item text-second"><span class="blog-info-icons"> <i data-feather="clock"></i></span>
<span class="badge
pull-right"><?php echo timer_stop();?></span><?php _me("加载耗时") ?></li>
访客总数统计
将以下代码添加至
Typecho根目录/usr/themes/handsome/functions.php
末尾。//总访问量
function theAllViews()
{
$db = Typecho_Db::get();
$row = $db->fetchAll('SELECT SUM(VIEWS) FROM `typecho_contents`');
echo number_format($row[0]['SUM(VIEWS)']);
}
将以下代码添加至Typecho根目录/usr/themes/handsome/component/sidebar.php
合适位置。
<li class="list-group-item text-second"> <span class="blog-info-icons"> <i data-feather="users"></i></span>
<span class="badge
pull-right"><?php echo theAllViews();?></span><?php _me("访客总数") ?></li>
开启gzip压缩
去除顶部博客名称,心情文字居中
Typecho根目录/usr/themes/handsome/index.php
文件,。删除以下代码去除顶部博客名称
<h1 class="m-n font-thin h3 text-black l-h"><?php $this->options->title(); ?></h1>
修改以下代码使心情文字居中
<header class="bg-light lter wrapper-md">
修改为
<header class="bg-light lter wrapper-md" style="text-align:center">
去除文章底部修改日期及版权说明
Typecho根目录/usr/themes/handsome/libs/Content.php
文件,大概在690
行附近。删除以下代码
return '
<div class="show-foot">
<div class="notebook">
<i class="fontello fontello-clock-o"></i>
<span>' . _mt("最后修改") . ':' . date(_mt("Y 年 m 月 d 日 h : i A"), $time + $obj) . '</span>
</div>
<div class="copyright" data-toggle="tooltip" data-html="true" data-original-title="' . $interpretation . '"><span>© ' . $content . '</span>
</div>
</div>
';
修复搜索框按钮
Typecho根目录/usr/themes/handsome/component/headnav.php
文件42
行:<span id="search_submit" class="transparent input-group-btn">
改为
<span id="search_submit" class="transparent input-group-btn" onclick=jumpForSearch(search_input.value)>
文件的最后面添加如下代码:
<!--/开始修复搜索按钮-->
<script type="text/javascript">
function jumpForSearch(search_ct){
if(search_ct.length>0){
$.pjax({
url: "https://"+document.domain+'/search/'+search_ct,
container: '#content',
fragment: '#content',
timeout: 8000
});
}
}
</script>
<!--/修复搜索按钮结束-->
网站底部增加sitemap链接
Typecho根目录/usr/themes/handsome/component/footer.php
文件,搜索Powered by
,在前面加上<a target="_blank" href="https://your-domain/sitemap.xml">sitemap</a> |
注意,将https://your-domain/sitemap.xml
改为你的sitemap地址
修改后如下:
<a target="_blank" href="https://your-domain/sitemap.xml">sitemap</a> | Powered by*******************
Typecho 后台菜单优化
Typecho后台的顶部父菜单在某些手机浏览器下无法达到触摸后展开子菜单,而是直接点开了父菜单链接。
只需要把父菜单链接去掉就行。
Typecho根目录\var\Widget\Menu.php
文件,310行左右<a href=\"{$node[2]}\">{$node[0]}</a>
修改为
<a href=\"#\">{$node[0]}</a>
文章作者:Vann
本文链接:https://blog.imvann.com/1.html
转载请注明本文链接