控制台样式自定义

新建js文件source\js\console.js,并写入如下代码:

var now1 = new Date();

function createtime1() {
// 建站时间
var grt = new Date("01/01/2019 00:00:00");
now1.setTime(now1.getTime() + 250);
var days = (now1 - grt) / 1000 / 60 / 60 / 24;
var dnum = Math.floor(days);
// ANSI 阴影
// http://patorjk.com/software/taag/#p=display&f=ANSI%20Shadow&t=zaixiaziyang
var ascll = [
`欢迎来到在下子阳の小家!`,
`Future is now 🍭🍭🍭`,
`
███████╗ █████╗ ██╗██╗ ██╗██╗ █████╗ ███████╗██╗██╗ ██╗ █████╗ ███╗ ██╗ ██████╗
╚══███╔╝██╔══██╗██║╚██╗██╔╝██║██╔══██╗╚══███╔╝██║╚██╗ ██╔╝██╔══██╗████╗ ██║██╔════╝
███╔╝ ███████║██║ ╚███╔╝ ██║███████║ ███╔╝ ██║ ╚████╔╝ ███████║██╔██╗ ██║██║ ███╗
███╔╝ ██╔══██║██║ ██╔██╗ ██║██╔══██║ ███╔╝ ██║ ╚██╔╝ ██╔══██║██║╚██╗██║██║ ██║
███████╗██║ ██║██║██╔╝ ██╗██║██║ ██║███████╗██║ ██║ ██║ ██║██║ ╚████║╚██████╔╝
╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝
`,
"小站已经苟活",
dnum,
"天啦!",
"©2023 By zaixiaziyang",
];

setTimeout(
console.log.bind(
console,
`\n%c${ascll[0]} %c ${ascll[1]} %c ${ascll[2]} %c${ascll[3]}%c ${ascll[4]}%c ${ascll[5]}\n\n%c ${ascll[6]}\n`,
"color:#39c5bb",
"",
"color:#39c5bb",
"color:#39c5bb",
"",
"color:#39c5bb",
""
)
);
}

createtime1();

function createtime2() {
var ascll2 = [`NCC2-036`, `调用前置摄像头拍照成功,识别为「大聪明」`, `Photo captured: `, ` 🤪 `];

setTimeout(
console.log.bind(
console,
`%c ${ascll2[0]} %c ${ascll2[1]} %c \n${ascll2[2]} %c\n${ascll2[3]}`,
"color:white; background-color:#10bcc0",
"",
"",
'background:url("https://unpkg.zhimg.com/anzhiyu-assets@latest/image/common/tinggge.gif") no-repeat;font-size:450%'
)
);

setTimeout(console.log.bind(console, "%c WELCOME %c 欢迎光临,大聪明", "color:white; background-color:#23c682", ""));

setTimeout(
console.warn.bind(
console,
"%c ⚡ Powered by zaixiaziyang %c 你正在访问在下子阳の小家",
"color:white; background-color:#f0ad4e",
""
)
);

setTimeout(console.log.bind(console, "%c W23-12 %c 系统监测到你已打开控制台", "color:white; background-color:#4f90d9", ""));
setTimeout(
console.warn.bind(console, "%c S013-782 %c 你现在正处于监控中", "color:white; background-color:#d9534f", "")
);
}
createtime2();

// 重写console方法
console.log = function () { };
console.error = function () { };
console.warn = function () { };

在主题配置文件_config.butterfly.yml中引入该js文件

inject: 
bottom:
+ - <script async src="/js/console.js"></script>

项目启动自定义字符画

替换主题源码: themes\butterfly\scripts\events\welcome.js

const logger = require('hexo-log')()

hexo.on('ready', () => {
const { version } = require('../../package.json')
logger.info(`
======================================================================

██████ ██ ██ ████████ ████████ ███████ ██████ ███████ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ██ ██ ██ █████ ██████ █████ ██ ████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██████ ██ ██ ███████ ██ ██ ██ ███████ ██

主题版本:${version}
======================================================================`)
})

帧率显示

  • 新建文件source\js\title.js并写入如下代码:
    //动态标题
    var OriginTitile = document.title;
    var titleTime;
    document.addEventListener('visibilitychange', function () {
    if (document.hidden) {
    //离开当前页面时标签显示内容
    document.title = '👀我发现了你没有在看我~';
    clearTimeout(titleTime);
    } else {
    //返回当前页面时标签显示内容
    document.title = '🐖抓到你啦~';
    //两秒后变回正常标题
    titleTime = setTimeout(function () {
    document.title = OriginTitile;
    }, 2000);
    }
    });

在主题配置文件_config.butterfly.yml引入该文件:

inject: 
bottom:
+ - <script async src="/js/title.js"></script>

字数统计显示w而不是k

开启字数统计之后,在博客根目录终端依次运行以下命令:

# 卸载旧的依赖
npm un hexo-wordcount --save
# 安装新的依赖
npm i hexo-wordcount-fomal --save

文章加密插件

在根目录执行以下命令

npm install --save hexo-blog-encrypt

Front matter配置方法

---
title: Hello World
tags:
- 作为日记加密
date: 2023-01-01 20:00:00
password: mikemessi
abstract: 有东西被加密了, 请输入密码查看.
message: 您好, 这里需要密码.
theme: xray
wrong_pass_message: 抱歉, 这个密码看着不太对, 请再试试.
wrong_hash_message: 抱歉, 这个文章不能被校验, 不过您还是能看看解密后的内容.
---

配置文件_config.yml中针对tags的加密

# Security
encrypt: # hexo-blog-encrypt
abstract: 有东西被加密了, 请输入密码查看.
message: 您好, 这里需要密码.
tags:
- {name: tagName, password: 密码A}
- {name: tagName, password: 密码B}
theme: xray
wrong_pass_message: 抱歉, 这个密码看着不太对, 请再试试.
wrong_hash_message: 抱歉, 这个文章不能被校验, 不过您还是能看看解密后的内容.