mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-blog.git
synced 2026-09-04 20:55:41 +00:00
Compare commits
5 commits
b50722b493
...
d6cbb8ba3d
| Author | SHA1 | Date | |
|---|---|---|---|
| d6cbb8ba3d | |||
|
|
aa62d73f0a | ||
|
|
8b8ca8cbc6 | ||
| 08c4f13d54 | |||
| cbad40b5cd |
5 changed files with 31 additions and 13 deletions
|
|
@ -4,9 +4,9 @@
|
||||||
✨SanYeCao Blog✨<br>
|
✨SanYeCao Blog✨<br>
|
||||||
🌊Lightweight / Fast / Beautiful🌊<br><br>
|
🌊Lightweight / Fast / Beautiful🌊<br><br>
|
||||||
Built With<br>
|
Built With<br>
|
||||||
<img alt="Static Badge" src="https://img.shields.io/badge/Astro-6.0-purple">
|
<img alt="Static Badge" src="https://img.shields.io/badge/Astro-6.0-purple?style=for-the-badge">
|
||||||
<img alt="Static Badge" src="https://img.shields.io/badge/Nodejs-24-green">
|
<img alt="Static Badge" src="https://img.shields.io/badge/Nodejs-24-green?style=for-the-badge">
|
||||||
<img alt="Static Badge" src="https://img.shields.io/badge/Heart-♥️-pink">
|
<img alt="Static Badge" src="https://img.shields.io/badge/Heart-♥️-pink?style=for-the-badge">
|
||||||
<br>
|
<br>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,13 @@
|
||||||
✨三叶草Blog✨<br>
|
✨三叶草Blog✨<br>
|
||||||
🌊轻度/快速/美观🌊<br><br>
|
🌊轻度/快速/美观🌊<br><br>
|
||||||
Built With<br>
|
Built With<br>
|
||||||
<img alt="Static Badge" src="https://img.shields.io/badge/Astro-6.0-purple">
|
<img alt="Static Badge" src="https://img.shields.io/badge/Astro-6.0-purple?style=for-the-badge">
|
||||||
<img alt="Static Badge" src="https://img.shields.io/badge/Nodejs-24-green">
|
<img alt="Static Badge" src="https://img.shields.io/badge/Nodejs-24-green?style=for-the-badge">
|
||||||
<img alt="Static Badge" src="https://img.shields.io/badge/Heart-♥️-pink">
|
<img alt="Static Badge" src="https://img.shields.io/badge/Heart-♥️-pink?style=for-the-badge">
|
||||||
<br>
|
<br>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
## 😋 特性
|
## 😋 特性
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
|
||||||
|
|
@ -318,7 +318,7 @@ $$
|
||||||
|
|
||||||
```c
|
```c
|
||||||
ThreadNode *FirstNode(ThreadNode *p) { // 这是第二步,第一步是下面那个函数
|
ThreadNode *FirstNode(ThreadNode *p) { // 这是第二步,第一步是下面那个函数
|
||||||
while(p->ltag==0) p = p->lchild; // 不断向左子树深入,直到找到最左的节点,换言之不存在左孩子的节点
|
while(p->ltag==0) p = p->lchild; // 不断向左子树深入,直到找到最左的节点,换言之不存在左孩子的节点
|
||||||
return p; // 这个节点就是我们要找的后继
|
return p; // 这个节点就是我们要找的后继
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -344,7 +344,7 @@ $$
|
||||||
|
|
||||||
```c
|
```c
|
||||||
ThreadNode *LastNode(ThreadNode *p){ // 这是第二步,第一步是下面那个函数
|
ThreadNode *LastNode(ThreadNode *p){ // 这是第二步,第一步是下面那个函数
|
||||||
while(p->rtag==0) p = p->rchild; // 不断向右子树深入,直到找到最靠右的节点,即不存在右孩子的节点
|
while(p->rtag==0) p = p->rchild; // 不断向右子树深入,直到找到最靠右的节点,即不存在右孩子的节点
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,24 @@ const {
|
||||||
<script is:inline>
|
<script is:inline>
|
||||||
function addCodeCopyButtons() {
|
function addCodeCopyButtons() {
|
||||||
document.querySelectorAll("pre").forEach((pre) => {
|
document.querySelectorAll("pre").forEach((pre) => {
|
||||||
if (pre.querySelector(":scope > .code-copy-button")) return;
|
|
||||||
|
|
||||||
const code = pre.querySelector("code");
|
const code = pre.querySelector("code");
|
||||||
if (!code) return;
|
if (!code) return;
|
||||||
|
|
||||||
|
/* 已经处理过则跳过 */
|
||||||
|
if (
|
||||||
|
pre.parentElement?.classList.contains("code-block-wrapper")
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 创建外层容器 */
|
||||||
|
const wrapper = document.createElement("div");
|
||||||
|
wrapper.className = "code-block-wrapper";
|
||||||
|
|
||||||
|
pre.parentNode?.insertBefore(wrapper, pre);
|
||||||
|
wrapper.appendChild(pre);
|
||||||
|
|
||||||
|
/* 创建复制按钮 */
|
||||||
const button = document.createElement("button");
|
const button = document.createElement("button");
|
||||||
button.className = "code-copy-button";
|
button.className = "code-copy-button";
|
||||||
button.type = "button";
|
button.type = "button";
|
||||||
|
|
@ -63,6 +76,7 @@ const {
|
||||||
icon.setAttribute("aria-hidden", "true");
|
icon.setAttribute("aria-hidden", "true");
|
||||||
|
|
||||||
button.appendChild(icon);
|
button.appendChild(icon);
|
||||||
|
wrapper.appendChild(button);
|
||||||
|
|
||||||
button.addEventListener("click", async () => {
|
button.addEventListener("click", async () => {
|
||||||
const text = code.textContent ?? "";
|
const text = code.textContent ?? "";
|
||||||
|
|
@ -74,6 +88,7 @@ const {
|
||||||
textarea.value = text;
|
textarea.value = text;
|
||||||
textarea.style.position = "fixed";
|
textarea.style.position = "fixed";
|
||||||
textarea.style.opacity = "0";
|
textarea.style.opacity = "0";
|
||||||
|
textarea.style.pointerEvents = "none";
|
||||||
|
|
||||||
document.body.appendChild(textarea);
|
document.body.appendChild(textarea);
|
||||||
textarea.select();
|
textarea.select();
|
||||||
|
|
@ -93,8 +108,6 @@ const {
|
||||||
button.classList.remove("copied");
|
button.classList.remove("copied");
|
||||||
}, 1500);
|
}, 1500);
|
||||||
});
|
});
|
||||||
|
|
||||||
pre.appendChild(button);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
pre {
|
.code-block-wrapper {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.code-block-wrapper pre {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue