fixed 友圈bug
This commit is contained in:
1 parent
05ba086e76
commit
744d6cce8b
12 files changed
+2148
-39
No files matched your search
@@ -95,14 +95,6 @@ blogs:
|
||||
url: https://sumiler.com
|
||||
description: 微风轻轻起 夏日不再来
|
||||
image: https://cravatar.cn/avatar//a35f5ef7a4bce3b7cfa6f538ffcae7aa
|
||||
- name: 林林杂语
|
||||
url: https://www.xiaozonglin.cn
|
||||
description: 一位来自福建泉州的高中生
|
||||
image: https://cravatar.cn/avatar/04bfc914bd50b42eb507bf66aad0cc31?d=mp
|
||||
- name: 西瓜撞地球
|
||||
url: https://www.bio-w.cn
|
||||
description: 我在人间贩卖彩虹
|
||||
image: https://bu.dusays.com/2022/10/17/634d313602a1e.png
|
||||
- name: Kris Yan
|
||||
url: https://blog.krisyan.dev
|
||||
description: 無限進步 @Schale夏萊
|
||||
@@ -159,3 +151,7 @@ blogs:
|
||||
url: https://aloner.ink
|
||||
description: 随便写写
|
||||
image: https://cravatar.cn/avatar/af1874b7856255302fc3df5102a6ce6d
|
||||
- name: 子舒
|
||||
url: https://www.zhishu.me
|
||||
description: 子舒的博客
|
||||
image: https://gravatar.zishu.me/avatar/bdad602f1f9d29ce83944c4f6225d1cc?s=200&d=retro
|
||||
@@ -2,23 +2,398 @@
|
||||
<div id="pjax-container">
|
||||
<div class="post-content" itemprop="articleBody">
|
||||
{{ .Content }}
|
||||
<div id="hexo-circle-of-friends-root"
|
||||
uk-scrollspy="target: > .cf-article-item; cls: uk-animation-slide-bottom-small; delay: 100"></div>
|
||||
<div id="friend-circle-container" class="friend-circle-list">
|
||||
<div class="loading-container">
|
||||
<div class="loading-spinner"></div>
|
||||
<p>正在探索朋友们的新动态...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// 定义几个全局变量
|
||||
let UserConfig = {
|
||||
// 填写你的api地址
|
||||
private_api_url: 'https://usj.cc/json/link_lite.json',
|
||||
// 点击加载更多时,一次最多加载几篇文章,默认10
|
||||
page_turning_number: 10,
|
||||
// 头像加载失败时,默认头像地址
|
||||
error_img: 'https://cravatar.cn/avatar/e1e7ba949ade0936e071132d2edd3b3c?f=mp',
|
||||
// 进入页面时第一次的排序规则
|
||||
sort_rule: 'created'
|
||||
|
||||
<style>
|
||||
/* Container Layout */
|
||||
.friend-circle-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 12px; /* Tighter gap to make cards wider */
|
||||
margin-top: 20px;
|
||||
padding: 0; /* Remove padding to maximize width */
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Mobile Layout */
|
||||
@media (max-width: 768px) {
|
||||
.friend-circle-list {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Card Style - Refined based on User Request */
|
||||
.fc-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
position: relative;
|
||||
height: 160px;
|
||||
justify-content: space-between;
|
||||
background: rgba(255, 255, 255, 0.4);
|
||||
backdrop-filter: blur(16px) saturate(180%);
|
||||
-webkit-backdrop-filter: blur(16px) saturate(180%);
|
||||
border: 1px solid #111827;
|
||||
box-shadow: none;
|
||||
transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
overflow: hidden;
|
||||
opacity: 0;
|
||||
animation: ukFadeInUp 0.8s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Light Mode Override - if theme is light, keep it readable but consistent layout */
|
||||
/* Assuming the user wants the dark look as shown in the reference, we prioritize that feel
|
||||
or make it adapt. Let's make it adapt but keep the structure. */
|
||||
:root {
|
||||
/* --fc-bg: rgba(255, 255, 255, 0.8); */
|
||||
--fc-text: #333;
|
||||
--fc-meta-bg: rgba(0, 0, 0, 0.05);
|
||||
/* --fc-border: rgba(0, 0, 0, 0.05); */
|
||||
}
|
||||
|
||||
[data-theme="dark"] {
|
||||
/* --fc-bg: rgba(35, 35, 35, 0.8); */
|
||||
--fc-text: #fff;
|
||||
--fc-meta-bg: rgba(255, 255, 255, 0.1);
|
||||
/* --fc-border: rgba(255, 255, 255, 0.1); */
|
||||
}
|
||||
|
||||
/*
|
||||
.fc-item {
|
||||
background: var(--fc-bg);
|
||||
border-color: var(--fc-border);
|
||||
}
|
||||
*/
|
||||
|
||||
/* UK Style Animation & Hover */
|
||||
.fc-item:hover {
|
||||
transform: translateY(-8px) scale(1.02);
|
||||
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
|
||||
background: rgba(255, 255, 255, 0.6);
|
||||
border-color: #000;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
@keyframes ukFadeInUp {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: translateY(40px) scale(0.95);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Top: Title */
|
||||
.fc-title {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: var(--fc-text);
|
||||
text-decoration: none;
|
||||
line-height: 1.4;
|
||||
z-index: 2;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
margin-right: 60px; /* Space for the image */
|
||||
}
|
||||
|
||||
.fc-item:hover .fc-title {
|
||||
color: #3498db;
|
||||
}
|
||||
|
||||
/* Background Image (Decorative) */
|
||||
.fc-bg-image {
|
||||
position: absolute;
|
||||
right: -20px;
|
||||
bottom: -20px;
|
||||
width: 140px;
|
||||
height: 140px;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
opacity: 0.15;
|
||||
transition: all 0.5s ease;
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
filter: grayscale(20%);
|
||||
}
|
||||
|
||||
.fc-item:hover .fc-bg-image {
|
||||
opacity: 0.3;
|
||||
transform: scale(1.1) rotate(5deg);
|
||||
filter: grayscale(0%);
|
||||
}
|
||||
|
||||
/* Bottom Row: Author Pill & Date */
|
||||
.fc-bottom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/* Author Pill */
|
||||
.fc-author-pill {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: var(--fc-meta-bg);
|
||||
padding: 4px 10px 4px 4px;
|
||||
border-radius: 20px;
|
||||
transition: background 0.3s;
|
||||
}
|
||||
|
||||
.fc-item:hover .fc-author-pill {
|
||||
background: rgba(52, 152, 219, 0.1);
|
||||
}
|
||||
|
||||
.fc-avatar {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
margin-right: 8px;
|
||||
border: 1px solid rgba(255,255,255,0.2);
|
||||
}
|
||||
|
||||
.fc-author-name {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--fc-text);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* Date */
|
||||
.fc-date {
|
||||
font-size: 12px;
|
||||
color: var(--fc-text);
|
||||
opacity: 0.6;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.fc-date i {
|
||||
margin-right: 4px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
/* FontAwesome fallback if not available, simple calendar icon via CSS or Unicode */
|
||||
.fc-icon-calendar::before {
|
||||
content: '\f133';
|
||||
font-family: "Font Awesome 5 Free", "FontAwesome";
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
/* Loading Animation */
|
||||
.loading-container {
|
||||
grid-column: 1 / -1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 60px;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 3px solid rgba(127,127,127,0.2);
|
||||
border-radius: 50%;
|
||||
border-top-color: #3498db;
|
||||
animation: spin 1s ease-in-out infinite;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
/* Dark Mode Specific Adjustments to match the reference exactly */
|
||||
[data-theme="dark"] .fc-item {
|
||||
background: rgba(35, 35, 35, 0.65); /* More transparent for glass effect */
|
||||
box-shadow: none;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
[data-theme="dark"] .fc-author-pill {
|
||||
background: #1a1a1a;
|
||||
border: 1px solid #333;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .fc-bg-image {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
/* Removed unused fadeInUp to keep clean, utilizing ukFadeInUp instead */
|
||||
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
/* Load More Button */
|
||||
.fc-load-more-btn {
|
||||
grid-column: 1 / -1;
|
||||
padding: 12px 30px;
|
||||
margin: 30px auto 10px;
|
||||
background: #000; /* Black background */
|
||||
border: 1px solid rgba(255,255,255,0.1);
|
||||
border-radius: 30px;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: all 0.3s ease;
|
||||
backdrop-filter: blur(10px);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.fc-load-more-btn:hover {
|
||||
background: #333;
|
||||
color: #fff;
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
[data-theme="dark"] .fc-load-more-btn {
|
||||
background: #000;
|
||||
border-color: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
[data-theme="dark"] .fc-load-more-btn:hover {
|
||||
background: #222;
|
||||
}
|
||||
|
||||
/* Artalk Dark Mode Adjustment */
|
||||
[data-theme="dark"] .artalk .atk-main-editor {
|
||||
border: 1px solid rgba(255, 255, 255, 0.1) !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
function timeAgo(dateStr) {
|
||||
const date = new Date(dateStr);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
|
||||
let allPosts = [];
|
||||
let currentIndex = 0;
|
||||
const BATCH_SIZE = 10;
|
||||
|
||||
function renderPosts(posts) {
|
||||
const container = document.getElementById('friend-circle-container');
|
||||
// Check if button exists, if so, remove it temporarily to append items before it?
|
||||
// Or just insertAdjacentHTML 'beforeend' and then append button.
|
||||
|
||||
// Remove existing button if any
|
||||
const existingBtn = document.getElementById('fc-load-more-btn');
|
||||
if (existingBtn) existingBtn.remove();
|
||||
|
||||
let html = '';
|
||||
posts.forEach((post, index) => {
|
||||
const dateStr = timeAgo(post.date);
|
||||
// Stagger delay based on index in this batch
|
||||
const delay = index * 0.05;
|
||||
|
||||
const bgImageSrc = post.image || post.avatar;
|
||||
|
||||
html += `
|
||||
<a href="${post.link}" target="_blank" class="fc-item" style="animation-delay: ${delay}s">
|
||||
<div class="fc-title" title="${post.title}">${post.title}</div>
|
||||
|
||||
<img src="${bgImageSrc}" class="fc-bg-image" loading="lazy" onerror="this.style.opacity=0">
|
||||
|
||||
<div class="fc-bottom">
|
||||
<div class="fc-author-pill">
|
||||
<img src="${post.avatar}" class="fc-avatar" loading="lazy" onerror="this.src='https://cravatar.cn/avatar/default?s=50'">
|
||||
<span class="fc-author-name">${post.author}</span>
|
||||
</div>
|
||||
<div class="fc-date">
|
||||
<i class="ri-calendar-line"></i> ${dateStr}
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
`;
|
||||
});
|
||||
|
||||
container.insertAdjacentHTML('beforeend', html);
|
||||
|
||||
// Check if we need a load more button
|
||||
if (currentIndex < allPosts.length) {
|
||||
const btn = document.createElement('button');
|
||||
btn.id = 'fc-load-more-btn';
|
||||
btn.className = 'fc-load-more-btn';
|
||||
btn.innerText = '加载更多';
|
||||
btn.onclick = loadMore;
|
||||
container.appendChild(btn);
|
||||
} else {
|
||||
// Add update time footer if all loaded
|
||||
// We need to retrieve updateTime from somewhere, or just don't show it repeatedly.
|
||||
// Let's store updateTime globally or just append it at the very end.
|
||||
if (window.fcUpdateTime) {
|
||||
const footer = document.createElement('div');
|
||||
footer.style.cssText = "grid-column: 1 / -1; text-align: center; margin-top: 20px; font-size: 12px; color: #999; opacity: 0.6;";
|
||||
footer.innerText = `最近更新: ${window.fcUpdateTime}`;
|
||||
container.appendChild(footer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadMore() {
|
||||
const nextBatch = allPosts.slice(currentIndex, currentIndex + BATCH_SIZE);
|
||||
currentIndex += BATCH_SIZE;
|
||||
renderPosts(nextBatch);
|
||||
}
|
||||
|
||||
function loadFriendCircle() {
|
||||
const container = document.getElementById('friend-circle-container');
|
||||
if (!container) return; // Prevent errors if container not found
|
||||
|
||||
// Reset state if needed, though loadMore will handle rendering
|
||||
// But we need to make sure we don't re-fetch if we don't have to?
|
||||
// Actually PJAX reload means we are on a "new" page state, so re-fetching is safer to ensure data is fresh and DOM is rebuilt.
|
||||
|
||||
fetch('/json/friend_circle_data.json?t=' + new Date().getTime())
|
||||
.then(res => {
|
||||
if (!res.ok) throw new Error('Network response was not ok');
|
||||
return res.json();
|
||||
})
|
||||
.then(data => {
|
||||
if (!data.posts || data.posts.length === 0) {
|
||||
container.innerHTML = '<div class="empty" style="grid-column: 1/-1; text-align:center; padding:20px;">暂无动态</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
allPosts = data.posts;
|
||||
window.fcUpdateTime = new Date(data.updated).toLocaleString();
|
||||
currentIndex = 0;
|
||||
|
||||
// Clear loading spinner
|
||||
container.innerHTML = '';
|
||||
|
||||
loadMore(); // Load first batch
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Friend Circle Error:', err);
|
||||
container.innerHTML = '<div class="error" style="grid-column: 1/-1; text-align:center; padding:20px; color:#d9534f;">加载失败,请稍后刷新重试</div>';
|
||||
});
|
||||
}
|
||||
|
||||
// Initial load
|
||||
document.addEventListener('DOMContentLoaded', loadFriendCircle);
|
||||
|
||||
// PJAX support - listen for pjax:complete event
|
||||
document.addEventListener('pjax:complete', loadFriendCircle);
|
||||
|
||||
if (document.readyState === 'interactive' || document.readyState === 'complete') {
|
||||
loadFriendCircle();
|
||||
}
|
||||
</script>
|
||||
<script src="/js/circles/app.min.js"></script>
|
||||
<script src="/js/circles/bundle.js"></script>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@@ -26,10 +26,10 @@
|
||||
<ul class="flat">
|
||||
<li class="active"><a href="/">首页</a></li>
|
||||
<li class="active"><a href="/about.html">关于</a></li>
|
||||
<li class="active"><a href="/circles.html">友圈</a></li>
|
||||
<li class="active"><a href="/ly.html">留言</a></li>
|
||||
<li class="active"><a href="/archives.html">归档</a></li>
|
||||
<li class="active"><a href="/links.html">友链</a></li>
|
||||
<li class="active"><a href="/circles.html">友圈</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -120,16 +120,6 @@
|
||||
"https://sumiler.com",
|
||||
"https://cravatar.cn/avatar//a35f5ef7a4bce3b7cfa6f538ffcae7aa"
|
||||
],
|
||||
[
|
||||
"林林杂语",
|
||||
"https://www.xiaozonglin.cn",
|
||||
"https://cravatar.cn/avatar/04bfc914bd50b42eb507bf66aad0cc31?d=mp"
|
||||
],
|
||||
[
|
||||
"西瓜撞地球",
|
||||
"https://www.bio-w.cn",
|
||||
"https://bu.dusays.com/2022/10/17/634d313602a1e.png"
|
||||
],
|
||||
[
|
||||
"Kris Yan",
|
||||
"https://blog.krisyan.dev",
|
||||
@@ -199,6 +189,11 @@
|
||||
"如约而至",
|
||||
"https://aloner.ink",
|
||||
"https://cravatar.cn/avatar/af1874b7856255302fc3df5102a6ce6d"
|
||||
],
|
||||
[
|
||||
"子舒",
|
||||
"https://www.zhishu.me",
|
||||
"https://gravatar.zishu.me/avatar/bdad602f1f9d29ce83944c4f6225d1cc?s=200&d=retro"
|
||||
]
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user