MENU

主题代码

2021 年 01 月 24 日 • 网络阅读设置

适用于Cuteen主题


网站运行时间

footer.php下46行左右
插入

    <!--网站运行时长 -->
<p><span id = "runtime_span" style="font-size:14px"></span></p>
<script type = "text/javascript">
function show_runtime()
{window.setTimeout("show_runtime()",1000);X=new 
Date("5/31/2020 17:12:48"); //初始建站时间修改此处
Y=new Date();T=(Y.getTime()-X.getTime());M=24*60*60*1000;
a=T/M;A=Math.floor(a);b=(a-A)*24;B=Math.floor(b);c=(b-B)*60;C=Math.floor((b-B)*60);D=Math.floor((c-C)*60);
runtime_span.innerHTML="风雨中度过了"+A+"天"+B+"小时"+C+"分"+D+"秒"}show_runtime();
</script>

顶部文字抖动

hero.php 中删除17-21行后
插入

        <!-- <p id="subheading" class="mt-3 h5 text-white d-flex">
        <<!-- ?= Ctx::HeroTitle($this)[1] ?> -->
    <!-- </p> -->
    <p id="chakhsu" class="mt-3 h5 text-white d-flex"></p>
</div>
<?= Ctx::waveHeader() ?>
    </header>
    
    <script>
var chakhsu = function(r) {
    function t() {
        return b[Math.floor(Math.random() * b.length)]
    }

    function e() {
        return String.fromCharCode(94 * Math.random() + 33)
    }

    function n(r) {
        for (var n = document.createDocumentFragment(), i = 0; r > i; i++) {
            var l = document.createElement("span");
            l.textContent = e(),
            l.style.color = t(),
            n.appendChild(l)
        }
        return n
    }

    function i() {
        var t = o[c.skillI];
        c.step ? c.step--:(c.step = g, c.prefixP < l.length ? (c.prefixP >= 0 && (c.text += l[c.prefixP]), c.prefixP++) : "forward" === c.direction ? c.skillP < t.length ? (c.text += t[c.skillP], c.skillP++) : c.delay ? c.delay--:(c.direction = "backward", c.delay = a) : c.skillP > 0 ? (c.text = c.text.slice(0, -1), c.skillP--) : (c.skillI = (c.skillI + 1) % o.length, c.direction = "forward")),
        r.textContent = c.text,
        r.appendChild(n(c.prefixP < l.length ? Math.min(s, s + c.prefixP) : Math.min(s, t.length - c.skillP))),
        setTimeout(i, d)
    }
    var l = "",
    o = ["一 祝福我未曾谋面的TA", ].map(function(r) {
        return r + ""
    }),
    a = 2,
    g = 1,
    s = 5,
    d = 75,
    b = ["rgb(110,64,170)", "rgb(150,61,179)", "rgb(191,60,175)", "rgb(228,65,157)", "rgb(254,75,131)", "rgb(255,94,99)", "rgb(255,120,71)", "rgb(251,150,51)", "rgb(226,183,47)", "rgb(198,214,60)", "rgb(175,240,91)", "rgb(127,246,88)", "rgb(82,246,103)", "rgb(48,239,130)", "rgb(29,223,163)", "rgb(26,199,194)", "rgb(35,171,216)", "rgb(54,140,225)", "rgb(76,110,219)", "rgb(96,84,200)"],
    c = {
        text: "",
        prefixP: -s,
        skillI: 0,
        skillP: 0,
        direction: "forward",
        delay: a,
        step: g
    };
    i()
};
chakhsu(document.getElementById('chakhsu'));

自定义设置-自定义Css样式 下加入

        /**抖音文字**/
        .tiktok{
text-shadow: -2px 0 rgba(0, 255, 255, .5), 2px 0 rgba(255, 0, 0, .5);
animation: shake-it .5s reverse infinite cubic-bezier(0.68, -0.55, 0.27, 1.55);
        }
        @keyframes shake-it{
0%{
    text-shadow: 0 0 rgba(0, 255, 255, .5), 0 0 rgba(255, 0, 0, .5);
}
25%{
    text-shadow: -2px 0 rgba(0, 255, 255, .5), 2px 0 rgba(255, 0, 0, .5);
}
50%{
    text-shadow: -5px 0 rgba(0, 255, 255, .5), 3px 0 rgba(255, 0, 0, .5);
}
100%{
    text-shadow: 3px 0 rgba(0, 255, 255, .5), 5px 0 rgba(255, 0, 0, .5);
}
        }

头像呼吸光环

自定义设置-自定义Css样式 下加入

.friends-img.mr-2.lazy.loaded:hover{
        transform:rotate(360deg);
        }
         
        .comment-avatar:hover{
        transform:rotate(360deg);
        }

        .sidebar-comment-avatar.mr-1:hover{
        transform:rotate(360deg);
        }
         
        .friends-img.mr-2.lazy.loaded,.comment-            avatar,.sidebar-comment-avatar.mr-1 {
border-radius: 50%;
animation: light 4s ease-in-out infinite;
transition: all 0.5s;
        }
         
        @keyframes light {
0% {
    box-shadow: 0 0 4px #ff1354;
}

25% {
box-shadow: 0 0 16px #1ebbff;
}

50% {
box-shadow: 0 0 4px #0ed39f;
}

75% {
box-shadow: 0 0 16px #4fe7f4;
}

100% {
box-shadow: 0 0 4px #f35444;
}
        }

添加文章阅读时长

<div class="T-time">您阅读这篇文章共花了:<span class="T-time" id="stime"></span></div><script language="JavaScript">var ss=0,mm=0,hh=0;function TimeGo(){ss++;if(ss>=60){mm+=1;ss=0}if(mm>=60){hh+=1;mm=0}ss_str=(ss<10?"0"+ss:ss);mm_str=(mm<10?"0"+mm:mm);tMsg=""+hh+"小时"+mm_str+"分"+ss_str+"秒";document.getElementById("stime").innerHTML=tMsg;setTimeout("TimeGo()",1000)}TimeGo();</script>

将代码放置post.php文件中,大致位置在37行</article>//38行<hr>下添加即可
如果需要分割线的话,自行在前后添加<hr>标签。


开启emoji表情

打开数据库 左边选择网站的文件目录 最上方选择SQL 后粘贴下面代码 然后点执行

alter table typecho_comments convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_contents convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_fields convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_metas convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_options convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_relationships convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_users convert to character set utf8mb4 collate utf8mb4_general_ci;

最后进入到typecho网站根目录,找到 config.inc.php 文件,跳转到约60行左右,好像都是在文件底部

  'charset' => 'utf8mb4',  # 修改编码为 utf8mb4

emoji表情

????????????????☺??????????????????????????????????????
emoji人物
????????????????????????????????????????
emoji手势
???☝??✌✋???✊????✍
emoji日常
?????????????????????????????????
emoji手机
?????☎???
emoji公共
♻???♿?????⚠?⛔????????
emoji动物
?????????????????????????????????????????????????????????????????????????????????
emoji植物
???????????????????
emoji自然
????????????????☀??⭐??☁⛅☔⚡❄???
emoji饮食
????????????????????????????????????????????????????☕????????
emoji文体
????????⚽⚾??????⛳?????????????????
emoji恐怖
?????☠????
emoji旅游
????????????????????⛪⛲??????????????????????????????????????⛽????⚓⛵??✈????????????
emoji物品
????????⌛⏳⌚⏰????????????☎????????????????????????????????????????????✉???????????✏✒???????????????✂??????????????????
emoji标志
♠♥♦♣????????????♨???✡✝????⭕✅☑✔✖❌❎➕➖➗➰➿〽✳✴❇‼⁉❓❔❕❗©®™???????????????ℹ?Ⓜ?????????????????????㊗㊙??▪▫◻◼◽◾⬛⬜?????????⚪⚫??
emoji生肖
????????????
emoji星座
♈♉♊♋♌♍♎♏♐♑♒♓⛎
emoji钟表
????????????????????????⌛⏳⌚⏰⏱⏲?
emoji心形
?❤????????????❣
emoji花草
???????????
emoji树叶
?????
emoji月亮
?????????????
emoji水果
?????????????
emoji钱币
???????
emoji交通
?????????????????????????????⛽????⚓⛵???✈??????
emoji建筑
??????????????????⛪???
emoji办公
??☎???????????????????????????????????✉???????????✏✒???????????????✂?????
emoji箭头
⬆↗➡↘⬇↙⬅↖↕↔↩↪⤴⤵???????


按钮展示

插入选项卡##

插入折叠面板##
[acc status="" title=" 标题一"]
标题二[/acc]

插入按钮##
标题

插入信息条##
[quote color="primary"]标题[/quote]

插入信息面板##
[card title="标题一" color="primary"]标题二[/card]

插入进度条##
[progress value="90" color="bg-primary" start="progress-bar-animated"]标题[/progress]

插入画廊##

[photos*]
![图片描述](图片链接)
![图片描述](图片链接)
[/photos*]

把上面的*去掉

按钮样式的链接

按钮样式的链接
提示及警告框

提示标题

提示内容

提示标题

提示内容

提示标题

提示内容

提示标题

提示内容

下载文件
文件名称
插入短代码 - 标签
插入短代码 - 标签
插入短代码 - 标签
插入短代码 - 标签
插入短代码 - 标签
插入短代码 - 标签
插入短代码 - 标签
插入短代码 - 内容回复可见
此处内容需要评论回复后方可阅读

插入短代码 - 标签卡
标签页 1
标签页 2
标签页 3

插入短代码 - 折叠框

折叠框标题

插入短代码 - 折叠框


插入短代码 - Github Repo

头像不显示

config.inc.php添加

/** Gravatar头像源*/
define('__TYPECHO_GRAVATAR_PREFIX__', 'https://gravatar.loli.net/avatar/');

图片阴影

只需在图片 Url 后面加上#shadow即可。

首页跳动文字

<div id="chakhsu">    </div>    <script>        var chakhsu = function(r) {            function t() {                return b[Math.floor(Math.random() * b.length)]            }              function e() {                return String.fromCharCode(94 * Math.random() + 33)            }              function n(r) {                for (var n = document.createDocumentFragment(), i = 0; r > i; i++) {                    var l = document.createElement("span");                    l.textContent = e(),                        l.style.color = t(),                        n.appendChild(l)                }                return n            }              function i() {                var t = o[c.skillI];                c.step ? c.step-- : (c.step = g, c.prefixP < l.length ? (c.prefixP >= 0 && (c.text += l[c.prefixP]), c.prefixP++) : "forward" === c.direction ? c.skillP < t.length ? (c.text += t[c.skillP], c.skillP++) : c.delay ? c.delay-- : (c.direction = "backward", c.delay = a) : c.skillP > 0 ? (c.text = c.text.slice(0, -1), c.skillP--) : (c.skillI = (c.skillI + 1) % o.length, c.direction = "forward")),                    r.textContent = c.text,                    r.appendChild(n(c.prefixP < l.length ? Math.min(s, s + c.prefixP) : Math.min(s, t.length - c.skillP))),                    setTimeout(i, d)            }            var l = "— ",                o = ["祝福我未曾谋面的 TA" , ].map(function(r) {                    return r + ""                }),                a = 2,                g = 1,                s = 5,                d = 75,                b = ["rgb(110,64,170)", "rgb(150,61,179)", "rgb(191,60,175)", "rgb(228,65,157)", "rgb(254,75,131)", "rgb(255,94,99)", "rgb(255,120,71)", "rgb(251,150,51)", "rgb(226,183,47)", "rgb(198,214,60)", "rgb(175,240,91)", "rgb(127,246,88)", "rgb(82,246,103)", "rgb(48,239,130)", "rgb(29,223,163)", "rgb(26,199,194)", "rgb(35,171,216)", "rgb(54,140,225)", "rgb(76,110,219)", "rgb(96,84,200)"],                c = {                    text: "",                    prefixP: -s,                    skillI: 0,                    skillP: 0,                    direction: "forward",                    delay: a,                    step: g                };            i()        };        chakhsu(document.getElementById('chakhsu'));    </script>

加载耗时

主题 functions.php 文件加入下列代码

 
 /**
  * 加载时间
  * 
 @return
  bool
  */
 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;
 }

在主题 footer.php 合适位置添加以下代码

加载耗时:<?php echo timer_stop ();?>
最后编辑于: 2021 年 12 月 06 日
添加新评论

已有 2 条评论
  1. liang liang

    其他主题能用吗@(呵呵)

    1. @liang建议你是先备份,然后去测试一下