1.更换gravatar头像为国内镜像

教程:

打开Typecho安装目录中的config.inc.php文件中添加一行代码

 /** 默认头像源 */
define('__TYPECHO_GRAVATAR_PREFIX__', 'https://sdn.geekzu.org/avatar/');

这里用的是geekzu的镜像,如有更好的可以自行替换

2.彩色标签云:

教程:

handsome主题后台,添加JavaScript和pjax回调函数

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;
});

转载:https://www.xcnte.com/archives/710/

3.Typecho下实现一键评论打卡功能

教程:

首先在后台-->设置外观-->开发者设置-->自定义JavaScript加入以下代码: PJAX回调函数也加入这个代码

function a(a, b, c) {
        if (document.selection) a.focus(), sel = document.selection.createRange(), c ? sel.text = b + sel.text + c : sel.text = b, a.focus();
        else if (a.selectionStart || "0" == a.selectionStart) {
            var l = a.selectionStart,
                m = a.selectionEnd,
                n = m;
            c ? a.value = a.value.substring(0, l) + b + a.value.substring(l, m) + c + a.value.substring(m, a.value.length) : a.value = a.value.substring(0, l) + b + a.value.substring(m, a.value.length);
            c ? n += b.length + c.length : n += b.length - m + l;
            l == m && c && (n -= c.length);
            a.focus();
            a.selectionStart = n;
            a.selectionEnd = n
        } else a.value += b + c, a.focus()
}
var b = (new Date).toLocaleTimeString(),
        c = document.getElementById("comment") || 0;
window.SIMPALED = {};
window.SIMPALED.Editor = {
    daka: function() {
        a(c, "滴!学生卡!打卡时间:" + b, ",请上车的乘客系好安全带~")
    },
    zan: function() {
        a(c, " 写得好好哟,我要给你生猴子!::funny:04:: ")
    },
    cai: function() {
        a(c, "骚年,我怀疑你写了一篇假的文章!::funny:03:: ")
    }
};

打开主题目录的component/comments.php里面的126行到144行附近:

                <div class="comment-form-comment form-group">
                    <label for="comment"><?php _me("评论") ?>
                        <span class="required text-danger">*</span></label>
                    <textarea id="comment" class="textarea form-control OwO-textarea" name="text" rows="5" placeholder="<?php _me("说点什么吧……") ?>" onkeydown="if(event.ctrlKey&&event.keyCode==13){document.getElementById('submit').click();return false};"><?php $this->remember('text'); ?></textarea>
                    <div class="OwO" style="display: inline;"></div>
                                        <div class="OwO" title="打卡" style="display: inline;" onclick="javascript:SIMPALED.Editor.daka();this.style.display='none'"><div class="OwO-logo"><i class="fontello-pencil"></i><span class="OwOlogotext">打卡</span></div></div>
          <div class="OwO" title="赞" style="display: inline;" onclick="javascript:SIMPALED.Editor.zan();this.style.display='none'"><div class="OwO-logo"><i class="glyphicon glyphicon-thumbs-up"></i><span class="OwOlogotext"></span></div></div>
      <div class="OwO" title="踩" style="display: inline;" onclick="javascript:SIMPALED.Editor.cai();this.style.display='none'"><div class="OwO-logo"><i class="glyphicon glyphicon-thumbs-down"></i><span class="OwOlogotext"></span></div></div>
                    <div class="secret_comment" id="secret_comment" data-toggle="tooltip"
                    data-original-title="<?php _me("开启该功能,您的评论仅作者和评论双方可见") ?>">
                        <label class="secret_comment_label control-label"><?php _me("私密评论") ?></label>
                        <div class="secret_comment_check">
                            <label class="i-switch i-switch-sm bg-dark m-b-ss m-r">
                                <input type="checkbox" id="secret_comment_checkbox">
                                <i></i>
                            </label>
                        </div>
                    </div>
                </div>

在后台-->设置外观-->开发者设置-->自定义CSS加入以下代码:

.secret_comment {
    top: 5px;
}
.OwO.OwO-open .OwO-body {
    display:table
}

转载:http://www.lxzzz.cn/491.html

4.地址栏变化

教程:

将以下代码添加至后台-开发者设置-自定义JavaScript

jQuery(document).ready(function(){function d(){document.title=document[b]?"(๐•̆ ·̭ •̆๐)  爱我别走!":a}var b,c,a=document.title;"undefined"!=typeof document.hidden?(b="hidden",c="visibilitychange"):"undefined"!=typeof document.mozHidden?(b="mozHidden",c="mozvisibilitychange"):"undefined"!=typeof document.webkitHidden&&(b="webkitHidden",c="webkitvisibilitychange"),("undefined"!=typeof document.addEventListener||"undefined"!=typeof document[b])&&document.addEventListener(c,d,!1)});

5.复制提醒

教程:

将以下代码添加至后台-开发者设置-自定义JavaScript

document.body.oncopy=function(){layer.msg('复制成功,若要转载请务必保留原文链接!');};
最后修改:2021 年 07 月 16 日 01 : 45 AM
如果觉得我的文章对你有用,请随意赞赏