搬运于
新建文件[BlogRoot]\source\js\kslink.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
| var leonus = { linkCom: e => { var t = document.querySelector(".el-textarea__inner"); "bf" == e ? (t.value = "```yml\n", t.value += "- name: \n link: \n avatar: \n descr: \n siteshot: ", t.value += "\n```", t.setSelectionRange(15, 15)) : (t.value = "站点名称:\n站点地址:\n头像链接:\n站点描述:\n站点截图:", t.setSelectionRange(5, 5)), t.focus() }, owoBig: () => { if (!document.getElementById("post-comment") || document.body.clientWidth < 768) return; let e = 1, t = "", o = document.createElement("div"), n = document.querySelector("body"); o.id = "owo-big", n.appendChild(o), new MutationObserver((l => { for (let a = 0; a < l.length; a++) { let i = l[a].addedNodes, s = ""; if (2 == i.length && "OwO-body" == i[1].className) s = i[1]; else { if (1 != i.length || "tk-comment" != i[0].className) continue; s = i[0] } s.onmouseover = l => { e && ("OwO-body" == s.className && "IMG" == l.target.tagName || "tk-owo-emotion" == l.target.className) && (e = 0, t = setTimeout((() => { let e = 3 * l.path[0].clientHeight, t = 3 * l.path[0].clientWidth, a = l.x - l.offsetX - (t - l.path[0].clientWidth) / 2, i = l.y - l.offsetY; a + t > n.clientWidth && (a -= a + t - n.clientWidth + 10), a < 0 && (a = 10), o.style.cssText = `display:flex; height:${e}px; width:${t}px; left:${a}px; top:${i}px;`, o.innerHTML = `<img src="${l.target.src}">` }), 300)) }, s.onmouseout = () => { o.style.display = "none", e = 1, clearTimeout(t) } } })).observe(document.getElementById("post-comment"), { subtree: !0, childList: !0 }) }, };
|
新建文件[BlogRoot]\source\css\kslink.css,并写入如下代码,颜色可以换成你自己喜欢的:
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
|
.addBtn { display: flex; justify-content: center; flex-wrap: wrap; } .addBtn button { transition: .2s; display: flex; margin: 5px auto; color: var(--global-bg); padding: 15px; border-radius: 40px; background: var(--search-result-title); align-items: center; }
button { padding: 0; outline: 0; border: none; background: 0 0; cursor: pointer; touch-action: manipulation; } .fa-solid, .fas { font-family: "Font Awesome 6 Free"; font-weight: 900; } .addBtn i { font-size: 1.3rem; margin-right: 10px; } .addBtn button:hover { background: var(--theme-color); color: #fff; }
|
为了节省DOM规模,仅在你的友链页面(例如[BlogRoot]\source\link\index.md)对应的md文件最后,引入以上两个文件以及定义按钮元素:
1 2 3
| <div class="addBtn"><button onclick="leonus.linkCom()"><i class="fa-solid fa-circle-plus"></i>快速申请 (默认样式)</button> <button onclick="leonus.linkCom("bf")"><i class="fa-solid fa-circle-plus"></i>快速申请 (Butterfly)</button></div> <link rel="stylesheet" href="/css/kslink.css"> <script src="/js/kslink.js"></script>
|
最后hexo三件套
1
| hexo cl && hexo g && hexo s
|