added 文章一篇
This commit is contained in:
1 parent
558020036f
commit
f1865dca6c
9 files changed
+478
-151
No files matched your search
@@ -289,11 +289,108 @@ code::-webkit-scrollbar {
|
||||
color: #8be9fd;
|
||||
}
|
||||
|
||||
/* Artalk AI Comment Integration */
|
||||
/* Link Status Badge - Optimized */
|
||||
.links-item {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Card View - Active */
|
||||
.link-active-badge {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
background-color: #4ade80; /* Soft Green */
|
||||
border-radius: 50%;
|
||||
border: 2px solid #fff; /* White border for contrast */
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .link-active-badge {
|
||||
background-color: #22c55e;
|
||||
border-color: #1f2933; /* Dark theme bg color */
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* Card View - Dead */
|
||||
.link-dead-badge {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
background-color: #f87171; /* Soft Red */
|
||||
border-radius: 50%;
|
||||
border: 2px solid #fff;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .link-dead-badge {
|
||||
background-color: #ef4444;
|
||||
border-color: #1f2933;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* List View - Common */
|
||||
.links ul>li.link-active-li,
|
||||
.links ul>li.link-dead-li {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* List View - Active */
|
||||
.links ul>li.link-active-li::before {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 10px; /* Aligned with text usually */
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background-color: #4ade80 !important;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* List View - Dead */
|
||||
.links ul>li.link-dead-li::before {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background-color: #f87171 !important;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .links ul>li.link-active-li::before {
|
||||
background-color: #22c55e !important;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .links ul>li.link-dead-li::before {
|
||||
background-color: #ef4444 !important;
|
||||
}
|
||||
|
||||
.atk-list.has-ai-comment .atk-list-no-comment {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* AI Comment Badge - Black & White Style */
|
||||
.atk-comment .atk-badge {
|
||||
background: #000 !important;
|
||||
color: #fff !important;
|
||||
border: 1px solid #000 !important;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .atk-comment .atk-badge {
|
||||
background: #fff !important;
|
||||
color: #000 !important;
|
||||
border: 1px solid #fff !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[data-theme="dark"] pre,
|
||||
|
||||
@@ -905,3 +905,105 @@ function initSearchFunctionality() {
|
||||
document.addEventListener('DOMContentLoaded', initSearchFunctionality);
|
||||
// Re-init on Pjax complete
|
||||
document.addEventListener('pjax:complete', initSearchFunctionality);
|
||||
|
||||
// Call on ready
|
||||
$(document).ready(function() {
|
||||
window.initLinkStatus();
|
||||
});
|
||||
|
||||
// Link Status Check
|
||||
window.initLinkStatus = function() {
|
||||
console.log('initLinkStatus called');
|
||||
|
||||
// Selectors for both Card View (.links-item) and List View (.links li)
|
||||
var $cardLinks = $('.links-item a');
|
||||
var $listLinks = $('.links ul > li > a');
|
||||
|
||||
console.log('Found card links:', $cardLinks.length);
|
||||
console.log('Found list links:', $listLinks.length);
|
||||
|
||||
// Only run if there are any links to check
|
||||
if ($cardLinks.length === 0 && $listLinks.length === 0) return;
|
||||
|
||||
console.log('Fetching /link_status.json...');
|
||||
fetch('/link_status.json?t=' + new Date().getTime())
|
||||
.then(response => {
|
||||
console.log('Fetch response status:', response.status);
|
||||
if (!response.ok) throw new Error('Status file not found');
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
console.log('Link status data loaded, keys:', Object.keys(data).length);
|
||||
let activeCount = 0;
|
||||
let deadCount = 0;
|
||||
|
||||
// Helper function to check URL status
|
||||
const getUrlStatus = (url) => {
|
||||
if (!url) return 'unknown';
|
||||
var cleanUrl = url.replace(/\/$/, '');
|
||||
var httpsUrl = cleanUrl.replace(/^http:/, 'https:');
|
||||
var httpUrl = cleanUrl.replace(/^https:/, 'http:');
|
||||
|
||||
const keys = [
|
||||
url,
|
||||
cleanUrl,
|
||||
cleanUrl + '/',
|
||||
httpsUrl,
|
||||
httpUrl,
|
||||
httpsUrl + '/',
|
||||
httpUrl + '/'
|
||||
];
|
||||
|
||||
let isDead = false;
|
||||
for (const key of keys) {
|
||||
if (data[key] === true) return 'alive';
|
||||
if (data[key] === false) isDead = true;
|
||||
}
|
||||
|
||||
return isDead ? 'dead' : 'unknown';
|
||||
};
|
||||
|
||||
// Process Card View Links
|
||||
$cardLinks.each(function() {
|
||||
var $link = $(this);
|
||||
var url = $link.attr('href');
|
||||
var status = getUrlStatus(url);
|
||||
|
||||
if (status === 'alive') {
|
||||
var $item = $link.closest('.links-item');
|
||||
if ($item.find('.link-active-badge').length === 0) {
|
||||
$item.append('<span class="link-active-badge" title="可访问"></span>');
|
||||
activeCount++;
|
||||
}
|
||||
} else if (status === 'dead') {
|
||||
var $item = $link.closest('.links-item');
|
||||
if ($item.find('.link-dead-badge').length === 0) {
|
||||
$item.append('<span class="link-dead-badge" title="无法访问"></span>');
|
||||
deadCount++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Process List View Links
|
||||
$listLinks.each(function() {
|
||||
var $link = $(this);
|
||||
var url = $link.attr('href');
|
||||
var status = getUrlStatus(url);
|
||||
|
||||
if (status === 'alive') {
|
||||
var $li = $link.closest('li');
|
||||
$li.addClass('link-active-li');
|
||||
$li.attr('title', '可访问');
|
||||
activeCount++;
|
||||
} else if (status === 'dead') {
|
||||
var $li = $link.closest('li');
|
||||
$li.addClass('link-dead-li');
|
||||
$li.attr('title', '无法访问');
|
||||
deadCount++;
|
||||
}
|
||||
});
|
||||
|
||||
console.log('Link status updated. Active:', activeCount, 'Dead:', deadCount);
|
||||
})
|
||||
.catch(err => console.error('Link status check failed:', err));
|
||||
};
|
||||
@@ -177,6 +177,10 @@ document.addEventListener("pjax:complete", function () {
|
||||
initCodeCopy()
|
||||
// 初始化代码折叠
|
||||
initCodeFold()
|
||||
// 初始化友链状态
|
||||
if (typeof window.initLinkStatus === 'function') {
|
||||
window.initLinkStatus();
|
||||
}
|
||||
// 重载评论
|
||||
if (typeof window.initArtalk === 'function') {
|
||||
window.initArtalk();
|
||||
|
||||
Reference in new issue
Block a user