首先祝大家元宵节快乐啊,其实这个东西也不是什么新奇玩意儿了。
很多网站都有这个东西,例如百度:
但是就输出这么个东西明显不够高级的样子,上午访问小小的小的博客,发现他的主题自带的输出还是蛮有意思的:
既然如此,俺就不如直接抄过来了:
<script> // 消除控制台打印 var HoldLog = console.log; console.log = function() {} ; let now1 = new Date(); queueMicrotask( () => { const Log = function() { HoldLog.apply(console, arguments); }; //在恢复前输出日志 const grt = new Date("08/10/2009 00:00:00"); //此处修改你的建站时间或者网站上线时间 now1.setTime(now1.getTime() + 250); const days = (now1 - grt) / 1000 / 60 / 60 / 24; const dnum = Math.floor(days); const ascll = [`欢迎访问obaby@mars!`, `爱自己,每天都要开开心心的哦`, ` ██████ ██████ █████ ██████ ██ ██ ██████ ███ ███ █████ ██████ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ████ ██ ██ ██ ██ ██ ██ ██ ██████ ███████ ██████ ████ ██ ██ ██ ██ ████ ██ ███████ ██████ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ██ ██████ ██ █ ████ ██ ██ ██ ██ ██ ██ ███████ `, "已上线", dnum, "天", "©2025 By obaby@mars V1.8.16", ]; const ascll2 = [`NCC2-036`, `调用前置摄像头拍照成功,识别为【小笨蛋】.`, `Photo captured: `, `🤪`]; setTimeout(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:#425AEF", "", "color:#ff4f87", "color:#425AEF", "", "color:#425AEF", "")); setTimeout(Log.bind(console, `%c ${ascll2[0]} %c ${ascll2[1]} %c \n${ascll2[2]} %c\n${ascll2[3]}\n`, "color:white; background-color:#4fd953", "", "", 'background:url("https://npm.elemecdn.com/anzhiyu-blog@1.1.6/img/post/common/tinggge.gif") no-repeat;font-size:450%')); setTimeout(Log.bind(console, "%c WELCOME %c 你好,小笨蛋.", "color:white; background-color:#4f90d9", "")); setTimeout(console.warn.bind(console, "%c ⚡ Powered by obaby@mars %c 你正在访问 小妖精 的博客.", "color:white; background-color:#f0ad4e", "")); setTimeout(console.warn.bind(console, "%c ❶ Blog: %c https://oba.by", "color:white; background-color:#ff7aa4", "")); setTimeout(console.warn.bind(console, "%c ❷ Blog: %c https://nai.dog", "color:white; background-color:#ff7aa4", "")); setTimeout(console.warn.bind(console, "%c ❸ Blog: %c https://zhongxiaojie.com", "color:white; background-color:#ff7aa4", "")); setTimeout(console.warn.bind(console, "%c ❹ Blog: %c https://h4ck.org.cn", "color:white; background-color:#ff7aa4", "")); setTimeout(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", "")); } ); </script>
至于怎么生成上面的 ascii 字符串,可以使用下面的两个链接:
https://patorjk.com/software/taag/
http://www.network-science.de/ascii/
把上面的代码找个 js 文件写进而去,在页面 header 里面引用即可(我直接将代码添加到了 wp 的页面小工具内)。实际效果:
当然也可以直接 F12 打开开发者工具查看具体效果。嘎嘎。