Typecho

1. 修改了比较童趣的标签样式

<script type="text/javascript">    
        /*html5-title*/
        (function() {
            var RelTitle = document.title;
            'use strict';
            // Set the name of the "hidden" property and the change event for visibility
            var hidden, visibilityChange;
            if (typeof document.hidden !== "undefined") {
              hidden = "hidden";
              visibilityChange = "visibilitychange";
            } else if (typeof document.mozHidden !== "undefined") { // Firefox up to v17
              hidden = "mozHidden";
              visibilityChange = "mozvisibilitychange";
            } else if (typeof document.webkitHidden !== "undefined") { // Chrome up to v32, Android up to v4.4, Blackberry up to v10
              hidden = "webkitHidden";
              visibilityChange = "webkitvisibilitychange";
            }
        
            // If the page is hidden, change the title;
            function handleVisibilityChange() {
              if (document[hidden]) {
                document.title = '( •̀ .̫ •́ )✧发现未知怪獸一枚';
              } else {
                document.title = RelTitle;
              }
            }
        
            // Warn if the browser doesn't support addEventListener or the Page Visibility API
            if (typeof document.addEventListener === "undefined" || typeof document[hidden] === "undefined") {
              console.log("This demo requires a modern browser that supports the Page Visibility API.");
            } else {
              // Handle page visibility change
              document.addEventListener(visibilityChange, handleVisibilityChange, false);
            }
        })();
    </script>

2. 修改了手端相册图片间距 1px 修改了handsome.min.css

3. 添加进度条和JS倒计时,但偶尔刷加载不上,需要刷新暂时未找到原因.完善后再分享吧.修改了core.min.js

4. 修改了伪静态文件,补全www.(弃用了,改用301跳转了。因为现在普及了HTTPS,静态规则跳转可能出现证书问题。)

if ($http_host ~* "^guaishow.cn"){
    set $rule_0 1$rule_0;
}
if ($rule_0 = "1"){
    rewrite ^/(.*)$ https://www.guaishow.cn/$1 permanent;
}

5.生成当前文章标签

在当前文章内容尾部添加该文章的标签,在主题目录下的post.php文件中的适当地方加入以下代码。

<!--生成当前文章标签-->
标签:<?php $this->tags(',', true, 'no tag'); ?>

6.首页文章列表头图悬停放大并将超出范围隐藏

/*首页文章列表头图悬停放大并将超出范围隐藏*/
.index-post-img {
    overflow: hidden;
}

.index-post-img .item-thumb {
    transition: all 0.3s;
}

.index-post-img .item-thumb:hover {
    transform: scale(1.1)
}
/*超链颜色*/
.app-content a:hover{
    color:#181818
}

该部分仅登录用户可见

8.隐藏不显示某一个特定分类

找到你typecho主题对应的首页分类所在的php文件,本文以handsome主题为例,其文件为 /usr/themes/handsome/component/aside.php

<?php $this->widget('Handsome_Widget_Metas_Category_List')->listCategories('wrapClass=nav nav-sub dk&childClass=child-nav'); ?>
                    <?php
                    $this->widget('Widget_Metas_Category_List')->to($categorys);
//                    echo Content::returnCategories($categorys)
                    ?>

替换代码

<?php $this->widget('Handsome_Widget_Metas_Category_List','ignore=1')->listCategories('wrapClass=nav nav-sub dk&childClass=child-nav'); ?>
                    <?php
                    $this->widget('Widget_Metas_Category_List','ignore=1')->to($categorys);
//                    echo Content::returnCategories($categorys)
                    ?>

其中ignore=1中的数字为你希望隐藏的分类mid

Last modification:November 18, 2021
如果觉得我的文章对你有用,请帮忙点一下上面的广告