急哭前言
在网上冲浪的时候找到了这个API:

利用这个网站就可以为你或者你的好友生成一个摸头动态头像,就像这样:

这种头像颇具有一种恶搞的氛围,与现在的你已急哭非常贴合,很适合作为彩蛋藏在网站里。于是用AIAI太好用了你们知道吧(写了段JS代码来实现一个效果
急哭效果
打开你的游览器控制台,输入motou(true),查看博客信息栏头像的变化。
再次输入motou(false)恢复原样。

急哭教程
打开上述的API网址:
点击试一试,出现页面之后输入你的QQ号,再点击下拉框选择transparent(透明),最后再点击发送。下面会出现你的头像动图,有一个复制按钮,点击一下复制。
还有一种更简单的办法,将你的QQ号替换下方链接的你的QQ号字样:
1
| https://uapis.cn/api/v1/image/motou?qq=你的QQ号&bg_color=transparent
|

在source/js目录下创建一个文件custom.js(如果有了就不用管),输入以下内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
| (function () { const TARGET_IMG_URL = "https://i.p-i.vip/68/20260219-6996f13605e77.gif"; const STORAGE_KEY_STATUS = "hexo_motou_active"; const STORAGE_KEY_ORIGIN = "hexo_motou_origin_src";
function getAvatarElement() { return document.querySelector('.aside-content .card-widget .avatar-img img'); }
function enableMotou() { const img = getAvatarElement(); if (img) { if (!localStorage.getItem(STORAGE_KEY_ORIGIN)) { localStorage.setItem(STORAGE_KEY_ORIGIN, img.src); } img.src = TARGET_IMG_URL; localStorage.setItem(STORAGE_KEY_STATUS, "true"); console.log("🤪 [Motou] 摸头模式已开启!作者已急哭(* ̄︿ ̄)"); } else { console.error("❌ [Motou] 未找到头像元素。请确认是否在首页,且侧边栏已加载。"); } }
function disableMotou() { const img = getAvatarElement(); const originSrc = localStorage.getItem(STORAGE_KEY_ORIGIN);
if (img && originSrc) { img.src = originSrc; localStorage.removeItem(STORAGE_KEY_STATUS); localStorage.removeItem(STORAGE_KEY_ORIGIN); console.log("😇 [Motou] 摸头模式已关闭!作者没急哭!(゜▽^*))"); } else if (!originSrc) { console.warn("⚠️ [Motou] 未找到原始头像记录,可能从未开启过或记录已丢失。"); } }
function runMotouCheck() { if (localStorage.getItem(STORAGE_KEY_STATUS) !== "true") { return; }
const img = getAvatarElement(); if (img && img.src !== TARGET_IMG_URL) { if (!localStorage.getItem(STORAGE_KEY_ORIGIN) && img.src !== TARGET_IMG_URL) { localStorage.setItem(STORAGE_KEY_ORIGIN, img.src); } img.src = TARGET_IMG_URL; console.log("🔄 [Motou] PJAX 检测到模式开启,作者又被急哭 ( ̄︿ ̄ )"); } }
function initMotou() { if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', runMotouCheck); } else { setTimeout(runMotouCheck, 800); }
document.addEventListener('pjax:complete', function () { setTimeout(runMotouCheck, 500); }); }
window.motou = function (status) { if (status === true || status === "true") { enableMotou(); } else if (status === false || status === "false") { disableMotou(); } else { console.log("📖 用法说明:\n - 开启:motou(true) 或 motou('true')\n - 关闭:motou(false) 或 motou('false')"); } };
initMotou();
})();
|
要将其中的TARGET_IMG_URL里的内容替换为你生成的摸头头像图片地址。
最后不要忘记在主题配置文件里的inject中引用:
1 2 3 4
| inject: bottom: + - <script src="/js/custom.js"></script>
|
大功告成!
急哭后续
其实说出来的彩蛋就不算真正的彩蛋了,不过还是想放出来嘻嘻(>▽<)
每日一图
