重写目录样式;适配新域名

This commit is contained in:
anian
2026-07-18 00:48:46 +08:00
parent 048e4336d1
commit 1953fa86c8
15 changed files with 380 additions and 151 deletions
+4
View File
@@ -2,6 +2,10 @@
> 基于原作者v1.2.5代码修改 > 基于原作者v1.2.5代码修改
#### v1.2.5-7补丁
1. 重写作文目录样式
2. 更换域名
#### v1.2.5-7 #### v1.2.5-7
1. 适配新接口(基于新版API-Python) 1. 适配新接口(基于新版API-Python)
2. 更新附录页面、通知书页面 2. 更新附录页面、通知书页面
+3 -3
View File
@@ -104,7 +104,7 @@
</div> </div>
</a> </a>
<a href="https://api.anian.cc" target="_blank"> <a href="https://api.anian.net" target="_blank">
<div class="link-card-default"> <div class="link-card-default">
<div class="decor-circle" style="position: absolute; top: -20px; right: -20px; width: 80px; height: 80px; background: #d8f3dc; border-radius: 50%; opacity: 0.3; transition: all 0.5s ease;"></div> <div class="decor-circle" style="position: absolute; top: -20px; right: -20px; width: 80px; height: 80px; background: #d8f3dc; border-radius: 50%; opacity: 0.3; transition: all 0.5s ease;"></div>
<div style="position: relative; z-index: 1;"> <div style="position: relative; z-index: 1;">
@@ -130,7 +130,7 @@
</div> </div>
</a> </a>
<a href="https://git.anian.cc" target="_blank"> <a href="https://git.anian.net" target="_blank">
<div class="link-card-default"> <div class="link-card-default">
<div class="decor-circle" style="position: absolute; top: -20px; right: -20px; width: 80px; height: 80px; background: #d8f3dc; border-radius: 50%; opacity: 0.3; transition: all 0.5s ease;"></div> <div class="decor-circle" style="position: absolute; top: -20px; right: -20px; width: 80px; height: 80px; background: #d8f3dc; border-radius: 50%; opacity: 0.3; transition: all 0.5s ease;"></div>
<div style="position: relative; z-index: 1;"> <div style="position: relative; z-index: 1;">
@@ -207,7 +207,7 @@
const noticeLink = noticeCard.closest('a'); const noticeLink = noticeCard.closest('a');
noticeLink.onclick = function() { noticeLink.onclick = function() {
// $.cookie('latest_notice_date', combinedDateStr, { path: '/', domain: 'anian.cc', expires: 365 }); // $.cookie('latest_notice_date', combinedDateStr, { path: '/', domain: 'anian.net', expires: 365 });
$.cookie('latest_notice_date', combinedDateStr, { path: '/', expires: 365 }); $.cookie('latest_notice_date', combinedDateStr, { path: '/', expires: 365 });
typeof markAsRead === 'function' && markAsRead(combinedDateStr); typeof markAsRead === 'function' && markAsRead(combinedDateStr);
}; };
+21 -7
View File
@@ -2,55 +2,69 @@
<div class="anian-feed-grid"> <div class="anian-feed-grid">
<div class="anian-feed-card" data-rss-url="https://git.anian.cc/anian/halo-theme-pix/releases.rss"> <div class="anian-feed-card" data-rss-url="https://git.anian.net/anian/halo-theme-pix/releases.rss">
<h3 class="anian-feed-caption">日记簿更新</h3> <h3 class="anian-feed-caption">日记簿更新</h3>
<div class="anian-feed-list-box"> <div class="anian-feed-list-box">
<div class="anian-loading">加载中...</div> <div class="anian-loading">加载中...</div>
</div> </div>
</div> </div>
<div class="anian-feed-card" data-rss-url="https://git.anian.cc/anian/halo-plugin-friends/releases.rss"> <div class="anian-feed-card" data-rss-url="https://git.anian.net/anian/halo-plugin-friends/releases.rss">
<h3 class="anian-feed-caption">朋友圈功能更新</h3> <h3 class="anian-feed-caption">朋友圈功能更新</h3>
<div class="anian-feed-list-box"> <div class="anian-feed-list-box">
<div class="anian-loading">加载中...</div> <div class="anian-loading">加载中...</div>
</div> </div>
</div> </div>
<div class="anian-feed-card" data-rss-url="https://git.anian.cc/anian/halo-plugin-comment/releases.rss"> <div class="anian-feed-card" data-rss-url="https://git.anian.net/anian/halo-plugin-comment/releases.rss">
<h3 class="anian-feed-caption">评论功能更新</h3> <h3 class="anian-feed-caption">评论功能更新</h3>
<div class="anian-feed-list-box"> <div class="anian-feed-list-box">
<div class="anian-loading">加载中...</div> <div class="anian-loading">加载中...</div>
</div> </div>
</div> </div>
<div class="anian-feed-card" data-rss-url="https://git.anian.cc/anian/halo-plugin-photos/releases.rss"> <div class="anian-feed-card" data-rss-url="https://git.anian.net/anian/halo-plugin-photos/releases.rss">
<h3 class="anian-feed-caption">图库功能更新</h3> <h3 class="anian-feed-caption">图库功能更新</h3>
<div class="anian-feed-list-box"> <div class="anian-feed-list-box">
<div class="anian-loading">加载中...</div> <div class="anian-loading">加载中...</div>
</div> </div>
</div> </div>
<div class="anian-feed-card" data-rss-url="https://git.anian.cc/anian/halo-plugin-douban/releases.rss"> <div class="anian-feed-card" data-rss-url="https://git.anian.net/anian/halo-plugin-douban/releases.rss">
<h3 class="anian-feed-caption">课外书功能更新</h3> <h3 class="anian-feed-caption">课外书功能更新</h3>
<div class="anian-feed-list-box"> <div class="anian-feed-list-box">
<div class="anian-loading">加载中...</div> <div class="anian-loading">加载中...</div>
</div> </div>
</div> </div>
<div class="anian-feed-card" data-rss-url="https://git.anian.cc/anian/halo-plugin-dever/releases.rss"> <div class="anian-feed-card" data-rss-url="https://git.anian.net/anian/halo-plugin-dever/releases.rss">
<h3 class="anian-feed-caption">插件开发容器更新</h3> <h3 class="anian-feed-caption">插件开发容器更新</h3>
<div class="anian-feed-list-box"> <div class="anian-feed-list-box">
<div class="anian-loading">加载中...</div> <div class="anian-loading">加载中...</div>
</div> </div>
</div> </div>
<div class="anian-feed-card" data-rss-url="https://git.anian.cc/anian/api-python/releases.rss"> <div class="anian-feed-card" data-rss-url="https://git.anian.net/anian/python-api/releases.rss">
<h3 class="anian-feed-caption">应用接口更新</h3> <h3 class="anian-feed-caption">应用接口更新</h3>
<div class="anian-feed-list-box"> <div class="anian-feed-list-box">
<div class="anian-loading">加载中...</div> <div class="anian-loading">加载中...</div>
</div> </div>
</div> </div>
<div class="anian-feed-card" data-rss-url="https://git.anian.net/anian/anian-tool/releases.rss">
<h3 class="anian-feed-caption">小工具更新</h3>
<div class="anian-feed-list-box">
<div class="anian-loading">加载中...</div>
</div>
</div>
<div class="anian-feed-card" data-rss-url="https://git.anian.net/anian/memos/releases.rss">
<h3 class="anian-feed-caption">备忘录更新</h3>
<div class="anian-feed-list-box">
<div class="anian-loading">加载中...</div>
</div>
</div>
</div> </div>
</div> </div>
+2 -2
View File
@@ -6,12 +6,12 @@
<a href="/friends" class="nav4lite-item"> <a href="/friends" class="nav4lite-item">
<span class="nav4lite-label">朋友圈</span> <span class="nav4lite-label">朋友圈</span>
</a> </a>
<a href="/navigator" class="nav4lite-center-dot" aria-label="查看详情"><i <a href="/navigator" class="nav4lite-center-dot"><i
class="sidebar-more ri-arrow-right-s-line"></i></a> class="sidebar-more ri-arrow-right-s-line"></i></a>
<a href="/books" class="nav4lite-item"> <a href="/books" class="nav4lite-item">
<span class="nav4lite-label">课外书</span> <span class="nav4lite-label">课外书</span>
</a> </a>
<a href="/store" class="nav4lite-item" target="_blank"> <a href="/store" class="nav4lite-item">
<span class="nav4lite-label">储物柜</span> <span class="nav4lite-label">储物柜</span>
</a> </a>
</div> </div>
+1 -1
View File
@@ -11,6 +11,6 @@
<div class="subscribe-divider"></div> <div class="subscribe-divider"></div>
<div class="subscribe-feedback"> <div class="subscribe-feedback">
反馈邮箱:<a href="mailto:support@anian.cc" class="feedback-email">support@anian.cc</a> 反馈邮箱:<a href="mailto:support@anian.net" class="feedback-email">support@anian.net</a>
</div> </div>
</div> </div>
+2 -5
View File
@@ -45,13 +45,13 @@
@media (min-width: 960px) and (max-width: 1359.98px) { @media (min-width: 960px) and (max-width: 1359.98px) {
.listree-box { .listree-box {
margin-left: calc((100vw - 860px) / 2 + 284px); margin-left: calc((100vw - 860px) / 2 + 284px + 50px);
} }
} }
@media (min-width: 1360px) { @media (min-width: 1360px) {
.listree-box { .listree-box {
margin-left: calc((100vw - 1400px) / 2 + 291px); margin-left: calc((100vw - 1400px) / 2 + 291px + 50px);
} }
} }
@@ -584,7 +584,6 @@
} }
} }
/* 豆瓣页:默认不显示翻页按钮,避免初始化前出现蓝色链接文本 */
#douban_pagination { #douban_pagination {
display: none; display: none;
padding: 30px; padding: 30px;
@@ -620,7 +619,6 @@
justify-content: center; justify-content: center;
} }
/* 豆瓣页:内容区域左右间距与分类导航保持一致 */
.douban_page #douban_item { .douban_page #douban_item {
padding: 0; padding: 0;
display: grid; display: grid;
@@ -671,7 +669,6 @@
} }
/* 强制网格单元同高并让卡片内部撑满单元,确保水平分割线对齐 */
.douban_page #douban_item { .douban_page #douban_item {
align-items: stretch !important; align-items: stretch !important;
} }
+41
View File
@@ -129,6 +129,47 @@
background-color: var(--dark-ac-btn); background-color: var(--dark-ac-btn);
} }
.dark .listree-box {
color: var(--light-color);
background: rgb(27 29 48 / 94%);
border-color: var(--dark-border);
box-shadow: 0 18px 48px rgb(0 0 0 / 28%);
}
.dark .toc_nav .listree-btn:hover,
.dark .toc_nav .listree-btn.is-active {
background: transparent;
box-shadow: none;
}
.dark .toc_nav .listree-btn.is-active i {
transform: rotate(90deg);
}
.dark #listree-ol ul {
border-left-color: var(--dark-border);
}
.dark #listree-ol li a {
color: var(--text-color);
}
.dark #listree-ol li a:hover {
color: var(--light-color);
background: rgb(255 255 255 / 7%);
}
.dark #listree-ol>li.current>a,
.dark #listree-ol>li ul li.current>a {
color: var(--dark-ac-btn);
border-left-color: var(--dark-ac-btn);
background: rgb(43 72 255 / 13%);
}
.dark #listree-ol::-webkit-scrollbar-thumb {
background: rgb(43 72 255 / 48%);
}
.dark .uk-dropdown{ .dark .uk-dropdown{
background: var(--dark-border); background: var(--dark-border);
color: #666; color: #666;
+157 -46
View File
@@ -313,6 +313,40 @@ header#masthead {
display: flex; display: flex;
} }
.toc_nav {
display: none;
}
body.toc-ready .toc_nav[aria-hidden="false"] {
display: block;
}
.toc_nav .listree-btn {
border-radius: 8px;
background: transparent;
box-shadow: none;
transition: transform .22s ease;
}
.toc_nav .listree-btn:hover,
.toc_nav .listree-btn.is-active {
background: transparent;
box-shadow: none;
}
.toc_nav .listree-btn:active {
transform: scale(.94);
}
.toc_nav .listree-btn i {
font-size: 20px;
transition: transform .22s ease;
}
.toc_nav .listree-btn.is-active i {
transform: rotate(90deg);
}
.uk-modal-close-full.uk-close { .uk-modal-close-full.uk-close {
bottom: 5%; bottom: 5%;
top: auto; top: auto;
@@ -1334,6 +1368,7 @@ a.close_local {
.moment_cat_nav, .moment_cat_nav,
.posts_cat_nav, .posts_cat_nav,
.photos_cat_nav, .photos_cat_nav,
.douban_cat_nav,
.friends_cat_nav { .friends_cat_nav {
padding: 25px 40px; padding: 25px 40px;
border-bottom: 1px solid var(--pix-background); border-bottom: 1px solid var(--pix-background);
@@ -1342,6 +1377,7 @@ a.close_local {
.moment_cat_nav ul, .moment_cat_nav ul,
.posts_cat_nav ul, .posts_cat_nav ul,
.photos_cat_nav ul, .photos_cat_nav ul,
.douban_cat_nav ul,
.friends_cat_nav ul { .friends_cat_nav ul {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -1356,6 +1392,7 @@ a.close_local {
.moment_cat_nav ul li, .moment_cat_nav ul li,
.posts_cat_nav ul li, .posts_cat_nav ul li,
.photos_cat_nav ul li, .photos_cat_nav ul li,
.douban_cat_nav ul li,
.friends_cat_nav ul li { .friends_cat_nav ul li {
list-style: none; list-style: none;
flex: none; flex: none;
@@ -1364,6 +1401,7 @@ a.close_local {
.moment_cat_nav ul::-webkit-scrollbar, .moment_cat_nav ul::-webkit-scrollbar,
.posts_cat_nav ul::-webkit-scrollbar, .posts_cat_nav ul::-webkit-scrollbar,
.photos_cat_nav ul::-webkit-scrollbar, .photos_cat_nav ul::-webkit-scrollbar,
.douban_cat_nav ul::-webkit-scrollbar,
.friends_cat_nav ul::-webkit-scrollbar { .friends_cat_nav ul::-webkit-scrollbar {
display: none; display: none;
@@ -1374,6 +1412,7 @@ a.close_local {
.moment_cat_nav ul li a, .moment_cat_nav ul li a,
.posts_cat_nav ul li a, .posts_cat_nav ul li a,
.photos_cat_nav ul li a, .photos_cat_nav ul li a,
.douban_cat_nav ul li a,
.friends_cat_nav ul li a { .friends_cat_nav ul li a {
padding: 5px 10px; padding: 5px 10px;
background: #e1e9e5; background: #e1e9e5;
@@ -1388,6 +1427,7 @@ a.close_local {
.moment_cat_nav ul li a:hover, .moment_cat_nav ul li a:hover,
.posts_cat_nav ul li a:hover, .posts_cat_nav ul li a:hover,
.photos_cat_nav ul li a:hover, .photos_cat_nav ul li a:hover,
.douban_cat_nav ul li a:hover,
.friends_cat_nav ul li a:hover { .friends_cat_nav ul li a:hover {
background-color: var(--pix-theme); background-color: var(--pix-theme);
color: #fff !important; color: #fff !important;
@@ -1396,6 +1436,7 @@ a.close_local {
.moment_cat_nav ul li a.active, .moment_cat_nav ul li a.active,
.posts_cat_nav ul li a.active, .posts_cat_nav ul li a.active,
.photos_cat_nav ul li a.active, .photos_cat_nav ul li a.active,
.douban_cat_nav ul li a.active,
.friends_cat_nav ul li a.active { .friends_cat_nav ul li a.active {
background: var(--pix-theme); background: var(--pix-theme);
color: #fff !important; color: #fff !important;
@@ -2268,21 +2309,20 @@ a.go_top.show {
/* 手机端顶部导航栏回到顶部按钮 */ /* 手机端顶部导航栏回到顶部按钮 */
.tool_top { .tool_top {
position: fixed;
bottom: 10%;
opacity: 0; opacity: 0;
transition: all 0.15s; transform: translateY(8px);
font-size: 26px; transition: opacity 0.15s, transform 0.15s;
transform: translateY(20px);
pointer-events: none; pointer-events: none;
color: #000000;
} }
.tool_top.show { .tool_top.show {
opacity: 1; opacity: 1;
transform: translateY(0px); transform: translateY(0);
pointer-events: auto; pointer-events: auto;
color: #000000; }
.tool_top .tool_top_icon {
font-size: 25px;
} }
.footer_nav_box .left_inner { .footer_nav_box .left_inner {
@@ -5974,76 +6014,147 @@ a.change i.ri-refresh-line {
/*toc*/ /*toc*/
.listree-box { .listree-box {
display: none;
position: fixed; position: fixed;
z-index: 999; z-index: 999;
top: 50%; top: 10px;
left: 0; left: 15px;
background-color: var(--toc-color);
color: #fff;
border-radius: 0 10px 10px 0;
}
h3.listree-titles {
float: right;
cursor: default;
padding: 20px 8px 9px 6px;
font-size: 1.01rem;
}
h3.listree-titles a.listree-btn {
color: #fff;
display: block; display: block;
width: 22px; width: 290px;
text-align: center; max-width: calc(100vw - 32px);
max-height: calc(100vh - 124px);
overflow: hidden;
color: #29372f;
background: rgb(255 255 255 / 92%);
border: 1px solid rgb(34 187 109 / 16%);
border-radius: 12px;
box-shadow: 0 18px 48px rgb(23 45 31 / 16%);
backdrop-filter: blur(.7rem);
-webkit-backdrop-filter: blur(.7rem);
opacity: 0;
visibility: hidden;
pointer-events: none;
transform: translate3d(-12px, 8px, 0) scale(.98);
transform-origin: top left;
transition: opacity .24s ease, visibility .24s ease, transform .24s ease;
}
.listree-box.is-open {
opacity: 1;
visibility: visible;
pointer-events: auto;
transform: translate3d(0, 0, 0) scale(1);
} }
#listree-ol { #listree-ol {
max-height: 230px; display: block;
overflow: scroll; max-height: min(58vh, 420px);
overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
float: left; float: none;
height: 100%; height: auto;
min-height: 100px; min-height: 0;
line-height: 1.5; line-height: 1.45;
margin: 20px 0px 20px -10px; margin: 0;
padding-right: 20px; padding: 12px 10px 14px;
align-items: center; list-style: none;
border-right: 1px solid #eeeeef; border: 0;
} }
#listree-ol li { #listree-ol li {
line-height: 1.8; line-height: inherit;
margin-bottom: 6px; margin: 2px 0;
list-style: none; list-style: none;
} }
#listree-ol li a { #listree-ol li a {
color: #fff; display: block;
width: 100%;
box-sizing: border-box;
padding: 7px 10px 7px 12px;
color: #52685b;
border-left: 3px solid transparent;
border-radius: 8px;
font-size: 13px;
line-height: 1.45;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
transition: color .18s ease, background-color .18s ease, border-color .18s ease, transform .18s ease;
}
#listree-ol li a:hover {
color: #15251c;
background: rgb(34 187 109 / 8%);
transform: translateX(2px);
} }
#listree-ol ul { #listree-ol ul {
margin-top: 0px; margin: 3px 0 3px 12px;
padding-left: 10px; padding-left: 10px;
border-left: 1px solid rgb(34 54 41 / 10%);
list-style: none;
}
#listree-ol a.node-name--H1,
#listree-ol a.node-name--H2 {
font-weight: 600;
}
#listree-ol a.node-name--H4,
#listree-ol a.node-name--H5,
#listree-ol a.node-name--H6 {
font-size: 12px;
} }
a#listree-click.current, a#listree-click.current,
#listree-ol>li.current>a, #listree-ol>li.current>a,
#listree-ol>li ul li.current>a { #listree-ol>li ul li.current>a {
color: #f2ff2c; color: var(--toc-color);
border-left-color: var(--toc-color);
background: rgb(34 187 109 / 10%);
font-weight: 700;
}
.listree-box.is-open #listree-ol li {
animation: listreeItemIn .26s ease both;
} }
#listree-ol::-webkit-scrollbar-track { #listree-ol::-webkit-scrollbar-track {
background-color: #fff; background-color: transparent;
} }
#listree-ol::-webkit-scrollbar-thumb { #listree-ol::-webkit-scrollbar-thumb {
background: rgb(199, 201, 204); background: rgb(34 187 109 / 26%);
border-radius: 999px;
} }
#listree-ol::-webkit-scrollbar { #listree-ol::-webkit-scrollbar {
width: 3px; width: 4px;
}
@keyframes listreeItemIn {
from {
opacity: 0;
transform: translateX(-6px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
@media (prefers-reduced-motion: reduce) {
.toc_nav .listree-btn,
.toc_nav .listree-btn i,
.listree-box,
#listree-ol li a {
transition: none;
}
.listree-box.is-open #listree-ol li {
animation: none;
}
} }
.dark .db--container { .dark .db--container {
@@ -6872,4 +6983,4 @@ a#listree-click.current,
font-family: 'MuYao'; font-family: 'MuYao';
src: url('/upload/mu-yao-sui-xin-shou-xie-ti.woff2') format('woff2'); src: url('/upload/mu-yao-sui-xin-shou-xie-ti.woff2') format('woff2');
font-display: swap; font-display: swap;
} }
+32 -15
View File
@@ -303,6 +303,7 @@
.moment_cat_nav, .moment_cat_nav,
.posts_cat_nav, .posts_cat_nav,
.photos_cat_nav, .photos_cat_nav,
.douban_cat_nav,
.friends_cat_nav { .friends_cat_nav {
padding: 15px; padding: 15px;
} }
@@ -742,30 +743,42 @@
} }
/* 手机端文章目录调整 */ /* 手机端文章目录调整 */
h3.listree-titles { .listree-box {
font-size: 0.8rem; left: 40px;
padding: 9px 0; right: 12px;
margin: 0; max-width: 85vw;
display: flex; max-height: calc(100vh - 96px);
align-items: center; margin-left: 0;
justify-content: center; border-radius: 12px;
transform: translate3d(0, -8px, 0) scale(.98);
transform-origin: top center;
} }
#listree-ol li a { .listree-box.is-open {
font-size: 0.8rem; transform: translate3d(0, 0, 0) scale(1);
} }
#listree-ol { #listree-ol {
margin: 10px 0 15px -10px; max-height: min(56vh, 420px);
padding-right: 15px; margin: 0;
padding: 10px 8px 12px;
} }
#listree-ol li { #listree-ol li {
line-height: 1.2; line-height: inherit;
margin-top: 6px; margin: 2px 0;
list-style: none; list-style: none;
} }
#listree-ol li a {
font-size: 0.82rem;
padding: 7px 9px 7px 10px;
}
.toc_nav .listree-btn.is-active i {
transform: rotate(90deg);
}
/* 手机端底部音乐按钮颜色 */ /* 手机端底部音乐按钮颜色 */
.footer_menu a.playing-music, .footer_menu a.playing-music,
.footer_menu a.playing-music i, .footer_menu a.playing-music i,
@@ -773,7 +786,11 @@
color: #4CAF50; color: #4CAF50;
} }
/* 手机端顶部工具按钮 */
.top_tool a {
padding: 6px;
display: flex;
}
}
}
+102 -62
View File
@@ -1697,7 +1697,7 @@ $('body').on('click', '.yiyan_box .change', function () {
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
const targetElement = document.querySelector('.yiyan_box p'); const targetElement = document.querySelector('.yiyan_box p');
if (url.includes('api.anian.cc')) { if (url.includes('api.anian.net')) {
// 新增处理逻辑 // 新增处理逻辑
targetElement.innerText = data.content || '一日不见如隔三秋'; targetElement.innerText = data.content || '一日不见如隔三秋';
const tooltipTitle = data.title || '失败:超时或发生错误'; const tooltipTitle = data.title || '失败:超时或发生错误';
@@ -1842,91 +1842,134 @@ if (currentElement) {
}); });
} }
$('body').on('click', '.listree-btn', function () { $('body').on('click', '.listree-btn', function (event) {
"目录[+]" == $(".listree-btn").text() ? $(".listree-btn").attr("title", "收起").text("目录[-]").parent().next().show() : $(".listree-btn").attr("title", "展开").text("目录[+]").parent().next().hide(); event.preventDefault();
return !1 setListreeOpen(!$('.listree-box').hasClass('is-open'));
return false;
}); });
$(document).on('click.listreeOutside', function (event) {
if (!$('body').hasClass('toc-open')) return;
if ($(event.target).closest('.listree-box, .toc_nav').length) return;
setListreeOpen(false);
});
$(document).on('keydown.listree', function (event) {
if (event.key === 'Escape') {
setListreeOpen(false);
}
});
function resetListree() {
$('body').removeClass('toc-ready toc-open');
$('.toc_nav').attr('aria-hidden', 'true');
$('.listree-btn')
.removeClass('is-active')
.attr({
'title': '展开目录',
'aria-label': '展开目录',
'aria-expanded': 'false'
});
$('.listree-box')
.removeClass('is-open')
.attr('aria-hidden', 'true');
}
function setListreeOpen(open) {
if (open && !$('body').hasClass('toc-ready')) return;
$('body').toggleClass('toc-open', open);
$('.listree-box')
.toggleClass('is-open', open)
.attr('aria-hidden', open ? 'false' : 'true');
$('.listree-btn')
.toggleClass('is-active', open)
.attr({
'title': open ? '收起目录' : '展开目录',
'aria-label': open ? '收起目录' : '展开目录',
'aria-expanded': open ? 'true' : 'false'
});
}
// toc // toc
function autotree() { function autotree() {
$(document).ready(function () { $(document).ready(function () {
$('.listree-titles').html('<a class="listree-btn" title="展开">目录[+]</a>') resetListree();
$('#listree-ol').empty();
$("#listree-ol").css("display", "none") $('#listree-ol').empty().hide();
// 获取所有标题元素 // 获取所有标题元素
var headings = document.querySelectorAll('.post-single .single-content *:is(h1, h2, h3, h4, h5, h6)'); var headings = document.querySelectorAll('.post-single .single-content *:is(h1, h2, h3, h4, h5, h6)');
// 为标题元素添加 listree-list 类,并修改 id
headings.forEach(function (heading, index) {
heading.classList.add('listree-list');
heading.id = 'listree-list' + index;
});
// 创建一个空的目录列表
var tocList = document.querySelector('#listree-ol'); var tocList = document.querySelector('#listree-ol');
if (!tocList || headings.length < 1) {
$(window).off('scroll.listree resize.listree');
return;
}
// 保存每个级别的父列表项 // 保存每个级别的父列表项
var parentItems = {}; var parentItems = {};
// 遍历每个标题元素 // 遍历每个标题元素
headings.forEach(function (heading, index) { headings.forEach(function (heading, index) {
// 创建列表项 heading.classList.add('listree-list');
var listItem = document.createElement('li'); heading.id = 'listree-list' + index;
// 创建标题链接 var level = parseInt(heading.tagName.slice(1));
var listItem = document.createElement('li');
var link = document.createElement('a'); var link = document.createElement('a');
// 直接设置链接的href为标题元素的id var parentItem = null;
listItem.setAttribute('data-level', level);
listItem.style.setProperty('--toc-index', index);
link.href = '#listree-list' + index; link.href = '#listree-list' + index;
link.classList.add('toc-link', 'node-name--' + heading.tagName); link.classList.add('toc-link', 'node-name--' + heading.tagName);
link.textContent = heading.textContent.trim(); link.textContent = heading.textContent.trim();
// 将标题链接添加到列表项中
listItem.appendChild(link); listItem.appendChild(link);
// 获取当前标题级别 for (var parentLevel = level - 1; parentLevel >= 1; parentLevel--) {
var level = parseInt(heading.tagName.slice(1)); if (parentItems[parentLevel]) {
parentItem = parentItems[parentLevel];
// 查找当前标题的父级列表项 break;
var parentItem = parentItems[level - 1];
// 如果存在父级列表项,则将当前列表项作为其子项
if (parentItem) {
// 如果父级列表项还没有子列表,则创建一个子列表
if (!parentItem.querySelector('ul')) {
var subList = document.createElement('ul');
parentItem.appendChild(subList);
} }
}
// 将当前列表项添加到父级列表的子列表中 if (parentItem) {
if (!parentItem.querySelector('ul')) {
parentItem.appendChild(document.createElement('ul'));
}
parentItem.querySelector('ul').appendChild(listItem); parentItem.querySelector('ul').appendChild(listItem);
} else { } else {
// 如果不存在父级列表项,则将当前列表项直接添加到根列表中
tocList.appendChild(listItem); tocList.appendChild(listItem);
} }
// 更新当前级别的父列表项为当前列表项
parentItems[level] = listItem; parentItems[level] = listItem;
Object.keys(parentItems).forEach(function (key) {
if (parseInt(key) > level) {
delete parentItems[key];
}
});
}); });
$('body').addClass('toc-ready');
$('.toc_nav').attr('aria-hidden', 'false');
$('#listree-ol').show();
$(".listree-btn").click(function () { $('body').off('click.listreeLink', 'a.toc-link').on('click.listreeLink', 'a.toc-link', function (event) {
"目录[+]" == $(".listree-btn").text() ? $(".listree-btn").attr("title", "收起").text("目录[-]").parent().next().show() : $(".listree-btn").attr("title", "展开").text("目录[+]").parent().next().hide();
return !1
});
$("a.toc-link").click(function (event) {
event.preventDefault(); event.preventDefault();
var targetId = $(this).attr("href"); var targetId = $(this).attr("href");
var $target = $(targetId);
if (!$target.length) return;
$("html, body").animate({ $("html, body").animate({
scrollTop: $(targetId).offset().top - 77 scrollTop: $target.offset().top - 77
}, 800); }, 500);
if (window.innerWidth <= 768) {
setListreeOpen(false);
}
}); });
// 判断是否存在目录,设置显示或隐藏
if ($('#listree-ol').children().length > 0) {
$(".listree-box").css("display", "block");
} else {
$(".listree-box").css("display", "none");
}
}) })
jQuery(document).ready(function (f) { jQuery(document).ready(function (f) {
var T = f(".listree-list"); var T = f(".listree-list");
@@ -1935,6 +1978,7 @@ function autotree() {
var b = []; var b = [];
function Q() { function Q() {
b = [];
T.each(function () { T.each(function () {
var T = f(this).offset(); var T = f(this).offset();
b.push(Math.floor(T.top)) b.push(Math.floor(T.top))
@@ -1943,16 +1987,11 @@ function autotree() {
function a(T) { function a(T) {
var b = f("#listree-ol li"); var b = f("#listree-ol li");
var Q = f(".listree-list dt");
if (b.length < 1) if (b.length < 1)
return; return;
var a = b.outerHeight();
if (!b.eq(T).hasClass("current")) { if (!b.eq(T).hasClass("current")) {
b.removeClass("current"); b.removeClass("current");
b.eq(T).addClass("current"); b.eq(T).addClass("current");
Q.animate({
top: a * T + (b.outerHeight() - Q.outerHeight()) / 2 + 1
}, 50)
} }
} }
@@ -1980,7 +2019,10 @@ function autotree() {
Q(); Q();
setTimeout(X, 0); setTimeout(X, 0);
f(window).on("scroll", X) f(window).off('scroll.listree resize.listree').on('scroll.listree', X).on('resize.listree', function () {
Q();
X();
})
}); });
} }
@@ -2420,7 +2462,7 @@ function initGreenDigitalClock() {
const COOKIE_EXPIRE_YEARS = 10; const COOKIE_EXPIRE_YEARS = 10;
const NOTICE_DETAIL_PATH = '/notice'; const NOTICE_DETAIL_PATH = '/notice';
const RSS_URLS = [ const RSS_URLS = [
'https://git.anian.cc/anian/halo-theme-pix/releases.rss', 'https://git.anian.net/anian/halo-theme-pix/releases.rss',
]; ];
async function getAllLatestNoticeDatesFromRSS() { async function getAllLatestNoticeDatesFromRSS() {
@@ -2555,7 +2597,7 @@ function anianxSpeedFetchLuckWithTimeout(timeout) {
const controller = new AbortController(); const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), timeout); const timer = setTimeout(() => controller.abort(), timeout);
return fetch("https://api.anian.cc/luck/api", { return fetch("https://api.anian.net/luck/api", {
signal: controller.signal signal: controller.signal
}).then(response => { }).then(response => {
if (!response.ok) { if (!response.ok) {
@@ -2690,7 +2732,7 @@ function anianxSpeedFetchIpWithTimeout(timeout) {
const controller = new AbortController(); const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), timeout); const timer = setTimeout(() => controller.abort(), timeout);
return fetch("https://api.anian.cc/ip/api", { return fetch("https://api.anian.net/ip/api", {
signal: controller.signal signal: controller.signal
}).then(response => { }).then(response => {
if (!response.ok) { if (!response.ok) {
@@ -2732,7 +2774,7 @@ function anianxSpeedFetchXiehouyuWithTimeout(timeout) {
const controller = new AbortController(); const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), timeout); const timer = setTimeout(() => controller.abort(), timeout);
return fetch("https://api.anian.cc/riddle/api", { return fetch("https://api.anian.net/riddle/api", {
signal: controller.signal signal: controller.signal
}).then(response => { }).then(response => {
if (!response.ok) { if (!response.ok) {
@@ -2948,7 +2990,7 @@ async function handleSubscribe(event) {
try { try {
const res = await fetch( const res = await fetch(
"https://anian.cc/apis/api.flow.post.kunkunyu.com/v1alpha1/follows/-/submit", "/apis/api.flow.post.kunkunyu.com/v1alpha1/follows/-/submit",
{ {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
@@ -3020,5 +3062,3 @@ $(document).ready(function () {
initjump(); initjump();
}); });
+2 -2
View File
@@ -42,8 +42,8 @@ $('body').on('click', '.moment_card_type a', function () {
$('body').on('click', '.edit_content .push_card', function () { $('body').on('click', '.edit_content .push_card', function () {
var card_url = $('.edit_card_box .edit_content input').val(); var card_url = $('.edit_card_box .edit_content input').val();
var num = $('.card_sortble .moment_card_item').length; var num = $('.card_sortble .moment_card_item').length;
if (num > 2) { if (num > 4) {
cocoMessage.error('最多插入3个卡片'); cocoMessage.error('最多插入5个卡片');
$('.edit_card_box .edit_content input').val(''); $('.edit_card_box .edit_content input').val('');
return false; return false;
} }
+1 -1
View File
@@ -77,7 +77,7 @@
<style th:if="${not #strings.isEmpty(theme.config.custom.code_css)}" th:utext="${theme.config.custom.code_css}"></style> <style th:if="${not #strings.isEmpty(theme.config.custom.code_css)}" th:utext="${theme.config.custom.code_css}"></style>
<style>:root { --toc-color: [(${theme.config.post.tocColor})]; } .wp-block-button__link { color: #fff; background-color: #32373c; border-radius: 9999px; text-decoration: none; padding: .6em 1.3em; } .wp-block-file__button { background: #32373c; color: #fff; text-decoration: none; }</style> <style>:root { --toc-color: [(${theme.config.post.tocColor})]; } .wp-block-button__link { color: #fff; background-color: #32373c; border-radius: 9999px; text-decoration: none; padding: .6em 1.3em; } .wp-block-file__button { background: #32373c; color: #fff; text-decoration: none; }</style>
<style th:if="${!theme.config.post.toc.mobile_open}">@media screen and (max-width: 768px) { .listree-box { display: none !important; } }</style> <style th:if="${!theme.config.post.toc.mobile_open}">@media screen and (max-width: 768px) { .listree-box, .toc_nav { display: none !important; } }</style>
<style th:if="${not #strings.isEmpty(theme.config.base_set.custom_fonts)}">@font-face { font-family: "HarmonyOS_M"; src: url("[(${theme.config.base_set.custom_fonts})]") format("truetype"); font-display: swap; }</style> <style th:if="${not #strings.isEmpty(theme.config.base_set.custom_fonts)}">@font-face { font-family: "HarmonyOS_M"; src: url("[(${theme.config.base_set.custom_fonts})]") format("truetype"); font-display: swap; }</style>
<th:block th:replace="~{modules/variables/cst-script-parameter}" /> <th:block th:replace="~{modules/variables/cst-script-parameter}" />
+1 -1
View File
@@ -102,7 +102,7 @@ function setBanner(lunarInfo) {
// 初始化逻辑(优化版) // 初始化逻辑(优化版)
// -------------------------- // --------------------------
(function() { (function() {
const apiUrl = 'https://api.anian.cc/lunar/api'; const apiUrl = 'https://api.anian.net/lunar/api';
const cookieName = 'anian_lunar_info'; const cookieName = 'anian_lunar_info';
// 1. 优先尝试从 Cookie 读取 // 1. 优先尝试从 Cookie 读取
+9 -3
View File
@@ -22,6 +22,12 @@
</div> </div>
</div> </div>
<div class="toc_nav top_tool icon_color" aria-hidden="true">
<a class="listree-btn" title="展开目录" aria-label="展开目录" aria-expanded="false">
<i class="ri-menu-line"></i>
</a>
</div>
<!-- <div class="m_top_nav top_tool is_mobile"> <!-- <div class="m_top_nav top_tool is_mobile">
<a class="top_nav_btn" uk-toggle="target: #m_offcanvas"><i class="ri-menu-2-line"></i></a> <a class="top_nav_btn" uk-toggle="target: #m_offcanvas"><i class="ri-menu-2-line"></i></a>
<div id="m_offcanvas" class="m_offcanvas uk-animation-fast" <div id="m_offcanvas" class="m_offcanvas uk-animation-fast"
@@ -94,8 +100,8 @@
</div> </div>
<!-- 回到顶部 --> <!-- 回到顶部 -->
<div class="is_mobile"> <div class="is_mobile top_tool">
<a class="tool_top" href="#page" uk-scroll="" data-pjax-state=""> <a class="tool_top" href="#page" uk-scroll="" data-pjax-state="">
<i class="ri-skip-up-line"></i></a> <i class="ri-skip-up-line tool_top_icon"></i></a>
</div> </div>
</div> </div>
+2 -3
View File
@@ -32,8 +32,7 @@
</div> </div>
<div class="listree-box" style="display: none;"> <div class="listree-box" aria-hidden="true">
<h3 class="listree-titles"></h3>
<ul id="listree-ol" style="display:none;"> <ul id="listree-ol" style="display:none;">
</ul> </ul>
</div> </div>
@@ -68,4 +67,4 @@
</body> </body>
</html> </html>