mirror of
https://github.com/Wcowin/Mkdocs-Wcowin.git
synced 2025-07-21 09:26:34 +00:00
Introduced a function to handle and validate user input, improving the robustness of the input processing workflow.
532 lines
16 KiB
HTML
532 lines
16 KiB
HTML
<!-- Footer -->
|
|
<footer class="md-footer">
|
|
<!-- Link to previous and/or next page - 移到最上面 -->
|
|
{% if "navigation.footer" in features %} {% if page.previous_page or
|
|
page.next_page %} {% if page.meta and page.meta.hide %} {% set hidden =
|
|
"hidden" if "footer" in page.meta.hide %} {% endif %}
|
|
<nav
|
|
class="md-footer__inner md-grid"
|
|
aria-label="{{ lang.t('footer') }}"
|
|
{{ hidden }}
|
|
>
|
|
<!-- Link to previous page -->
|
|
{% if page.previous_page %} {% set direction = lang.t("footer.previous") %}
|
|
<a
|
|
href="{{ page.previous_page.url | url }}"
|
|
class="md-footer__link md-footer__link--prev"
|
|
aria-label="{{ direction }}: {{ page.previous_page.title | e }}"
|
|
>
|
|
<div class="md-footer__button md-icon">
|
|
{% set icon = config.theme.icon.previous or "material/arrow-left" %} {%
|
|
include ".icons/" ~ icon ~ ".svg" %}
|
|
</div>
|
|
<div class="md-footer__title">
|
|
<span class="md-footer__direction"> {{ direction }} </span>
|
|
<div class="md-ellipsis">{{ page.previous_page.title }}</div>
|
|
</div>
|
|
</a>
|
|
{% endif %}
|
|
|
|
<!-- Link to next page -->
|
|
{% if page.next_page %} {% set direction = lang.t("footer.next") %}
|
|
<a
|
|
href="{{ page.next_page.url | url }}"
|
|
class="md-footer__link md-footer__link--next"
|
|
aria-label="{{ direction }}: {{ page.next_page.title | e }}"
|
|
>
|
|
<div class="md-footer__title">
|
|
<span class="md-footer__direction"> {{ direction }} </span>
|
|
<div class="md-ellipsis">{{ page.next_page.title }}</div>
|
|
</div>
|
|
<div class="md-footer__button md-icon">
|
|
{% set icon = config.theme.icon.next or "material/arrow-right" %} {%
|
|
include ".icons/" ~ icon ~ ".svg" %}
|
|
</div>
|
|
</a>
|
|
{% endif %}
|
|
</nav>
|
|
{% endif %} {% endif %}
|
|
|
|
<!-- Further information -->
|
|
<div class="md-footer-meta md-typeset">
|
|
<div class="md-footer-meta__inner md-grid">
|
|
<div class="footer-wrapper">
|
|
<!-- 访问统计区域 -->
|
|
<div class="footer-content">
|
|
<div class="footer-visit-count">
|
|
<div class="footer-item">
|
|
<!-- <span class="footer-icon">👀</span> -->
|
|
<span>本站访问量:</span>
|
|
<span id="finicount_views" class="footer-highlight"></span>
|
|
</div>
|
|
|
|
<div class="footer-item">
|
|
<!-- <span class="footer-icon">📝</span> -->
|
|
<a
|
|
href="https://icp.gov.moe/?keyword=20230640"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
class="icp-link"
|
|
>萌ICP备20230640号</a>
|
|
</div>
|
|
|
|
<div class="footer-item runtime-info">
|
|
<!-- <span class="footer-icon">⏱️</span> -->
|
|
<span>本站已经运行</span>
|
|
<span id="box1" class="footer-highlight"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 移动端简洁布局 (仿 footercopy.html) -->
|
|
<div class="footer-visit-count-mobile">
|
|
<span>本站访问量:</span>
|
|
<span id="finicount_views_mobile" class="footer-highlight"></span>
|
|
|
|
|
<a
|
|
href="https://icp.gov.moe/?keyword=20230640"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
class="icp-link"
|
|
>萌ICP备20230640号</a>
|
|
<!-- | -->
|
|
<span class="runtime-info">
|
|
<span>本站已经运行</span>
|
|
<span id="box1_mobile"></span>
|
|
</span>
|
|
</div>
|
|
|
|
<!-- 版权信息和社交媒体水平布局 -->
|
|
<div class="footer-bottom-section">
|
|
<div class="md-footer-copyright">
|
|
<p>Copyright © 2022-2025 Wcowin</p>
|
|
<p>Made with <a href="https://squidfunk.github.io/mkdocs-material/" style="color: #518FC1; text-decoration: none;">Material for MkDocs</a></p>
|
|
</div>
|
|
|
|
{% if config.extra.social %}
|
|
<div class="footer-social">
|
|
{% include "partials/social.html" %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
(function() {
|
|
// 避免变量冲突,将所有代码包装在立即执行函数中
|
|
|
|
function timingTime() {
|
|
const start = "2023-10-14T00:00:00";
|
|
const startTime = new Date(start).getTime();
|
|
const now = Date.now();
|
|
let diff = Math.floor((now - startTime) / 1000);
|
|
const days = Math.floor(diff / 86400);
|
|
diff %= 86400;
|
|
const hours = Math.floor(diff / 3600);
|
|
diff %= 3600;
|
|
const minutes = Math.floor(diff / 60);
|
|
const seconds = diff % 60;
|
|
return `${days}天${hours}时${minutes}分${seconds}秒`;
|
|
}
|
|
|
|
// 简化的计时器更新函数
|
|
function updateTime() {
|
|
const el = document.getElementById("box1");
|
|
const elMobile = document.getElementById("box1_mobile");
|
|
const time = timingTime();
|
|
|
|
if (el) el.textContent = time;
|
|
if (elMobile) elMobile.textContent = time;
|
|
}
|
|
|
|
// 加载访问量计数器
|
|
async function loadVisitCounter() {
|
|
try {
|
|
const script = document.createElement('script');
|
|
script.src = '//finicounter.eu.org/finicounter.js';
|
|
script.async = true;
|
|
script.onerror = function() {
|
|
console.log('访问量计数器加载失败,使用备用显示');
|
|
const desktop = document.getElementById("finicount_views");
|
|
const mobile = document.getElementById("finicount_views_mobile");
|
|
if (desktop) desktop.textContent = '统计中...';
|
|
if (mobile) mobile.textContent = '统计中...';
|
|
};
|
|
document.head.appendChild(script);
|
|
} catch (e) {
|
|
console.log('访问量计数器初始化失败:', e);
|
|
}
|
|
}
|
|
|
|
// 同步访问量显示
|
|
function syncVisitCount() {
|
|
const desktop = document.getElementById("finicount_views");
|
|
const mobile = document.getElementById("finicount_views_mobile");
|
|
if (desktop && mobile && desktop.textContent && desktop.textContent !== '加载中...') {
|
|
mobile.textContent = desktop.textContent;
|
|
}
|
|
}
|
|
|
|
// 监听访问量更新
|
|
function setupVisitCountObserver() {
|
|
try {
|
|
const observer = new MutationObserver(syncVisitCount);
|
|
const visitCountTarget = document.getElementById("finicount_views");
|
|
if (visitCountTarget) {
|
|
observer.observe(visitCountTarget, { childList: true, subtree: true });
|
|
}
|
|
} catch (e) {
|
|
console.log('访问量监听器设置失败:', e);
|
|
}
|
|
}
|
|
|
|
// 初始化所有功能
|
|
function init() {
|
|
// 启动计时器
|
|
updateTime();
|
|
setInterval(updateTime, 1000);
|
|
|
|
// 加载访问量计数器
|
|
loadVisitCounter();
|
|
|
|
// 设置访问量同步
|
|
setupVisitCountObserver();
|
|
|
|
// 调试信息
|
|
console.log('页脚功能已启动');
|
|
console.log('当前时间:', timingTime());
|
|
}
|
|
|
|
// 确保DOM加载完成后再初始化
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', init);
|
|
} else {
|
|
init();
|
|
}
|
|
|
|
})();
|
|
</script>
|
|
|
|
<style>
|
|
/* 页脚背景配色方案 - 可根据喜好选择 */
|
|
|
|
/* 方案1: 现代深蓝灰色调 (当前使用) */
|
|
.md-footer {
|
|
background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
|
|
}
|
|
|
|
.md-footer-meta {
|
|
background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
|
|
}
|
|
|
|
/* 方案2: 优雅紫色调 (取消注释使用)
|
|
.md-footer {
|
|
background: linear-gradient(135deg, #2d1b69 0%, #4c1d95 100%);
|
|
}
|
|
|
|
.md-footer-meta {
|
|
background: linear-gradient(135deg, #1e1b4b 0%, #2d1b69 100%);
|
|
}
|
|
*/
|
|
|
|
/* 方案3: 温暖深绿色调 (取消注释使用)
|
|
.md-footer {
|
|
background: linear-gradient(135deg, #14532d 0%, #166534 100%);
|
|
}
|
|
|
|
.md-footer-meta {
|
|
background: linear-gradient(135deg, #052e16 0%, #14532d 100%);
|
|
}
|
|
*/
|
|
|
|
/* 方案4: 经典深灰色调 (取消注释使用)
|
|
.md-footer {
|
|
background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
|
|
}
|
|
|
|
.md-footer-meta {
|
|
background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
|
|
}
|
|
*/
|
|
|
|
/* 整体页脚容器 */
|
|
.footer-wrapper {
|
|
width: 100%;
|
|
padding: 0.2rem 0;
|
|
text-align: center;
|
|
}
|
|
|
|
/* 版权信息和社交媒体水平布局 */
|
|
.footer-bottom-section {
|
|
max-width: 900px;
|
|
margin: 0.4rem auto 0;
|
|
padding: 0.4rem 1rem;
|
|
border-top: 1px solid rgba(255, 255, 255, 0.15);
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
/* 版权信息 */
|
|
.md-footer-copyright {
|
|
text-align: left;
|
|
font-size: 0.75rem;
|
|
opacity: 0.8;
|
|
line-height: 1.2;
|
|
}
|
|
|
|
/* 社交媒体图标 */
|
|
.footer-social {
|
|
display: -webkit-flex;
|
|
display: flex;
|
|
gap: 0.3rem;
|
|
-webkit-align-items: center;
|
|
align-items: center;
|
|
}
|
|
|
|
/* Safari兼容性修复 */
|
|
.footer-social .md-social__link svg {
|
|
-webkit-transform: translateZ(0);
|
|
transform: translateZ(0);
|
|
backface-visibility: hidden;
|
|
-webkit-backface-visibility: hidden;
|
|
opacity: 1 !important;
|
|
visibility: visible !important;
|
|
pointer-events: auto;
|
|
}
|
|
|
|
/* 强制Safari显示SVG图标 */
|
|
.footer-social .md-social__link {
|
|
opacity: 1 !important;
|
|
visibility: visible !important;
|
|
}
|
|
|
|
/* 内容区域样式 */
|
|
.footer-content {
|
|
max-width: 900px;
|
|
margin: 0 auto;
|
|
padding: 0.4rem 0 0;
|
|
}
|
|
|
|
.footer-visit-count {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 0.3rem;
|
|
font-size: 0.75rem;
|
|
color: var(--md-footer-fg-color--light);
|
|
}
|
|
|
|
.footer-item {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 0.4rem 0.8rem;
|
|
border-radius: 16px;
|
|
background: rgba(255, 255, 255, 0.1);
|
|
border: 1px solid rgba(255, 255, 255, 0.15);
|
|
backdrop-filter: blur(10px);
|
|
min-width: 160px;
|
|
font-size: 0.8rem;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.footer-item:hover {
|
|
background: rgba(255, 255, 255, 0.15);
|
|
border-color: rgba(81, 143, 193, 0.4);
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
.footer-icon {
|
|
margin-right: 0.5rem;
|
|
font-size: 1rem;
|
|
}
|
|
|
|
.footer-highlight {
|
|
color: #939ba2;
|
|
font-weight: 600;
|
|
margin-left: 0.3rem;
|
|
}
|
|
|
|
.icp-link {
|
|
color: inherit;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.icp-link:hover {
|
|
color: #518FC1;
|
|
}
|
|
|
|
/* 社交媒体图标样式 - 仅桌面端 */
|
|
@media (min-width: 76.1875em) {
|
|
.footer-social .md-social__link {
|
|
padding: 0.3rem;
|
|
border-radius: 50%;
|
|
background: rgba(255, 255, 255, 0.1);
|
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
width: 2rem;
|
|
height: 2rem;
|
|
display: -webkit-inline-flex;
|
|
display: inline-flex;
|
|
-webkit-align-items: center;
|
|
align-items: center;
|
|
-webkit-justify-content: center;
|
|
justify-content: center;
|
|
-webkit-transition: all 0.2s ease;
|
|
transition: all 0.2s ease;
|
|
-webkit-box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.footer-social .md-social__link svg {
|
|
width: 1.2rem;
|
|
height: 1.2rem;
|
|
fill: currentColor;
|
|
-webkit-flex-shrink: 0;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.footer-social .md-social__link:hover {
|
|
background: rgba(81, 143, 193, 0.2);
|
|
border-color: rgba(81, 143, 193, 0.4);
|
|
}
|
|
}
|
|
|
|
/* 移动端社交媒体图标样式 - 恢复默认样式 */
|
|
@media (max-width: 76.1875em) {
|
|
.footer-social .md-social__link {
|
|
padding: 0.4rem;
|
|
background: transparent;
|
|
border: none;
|
|
width: auto;
|
|
height: auto;
|
|
display: inline-block;
|
|
border-radius: 0;
|
|
-webkit-transition: color 0.2s ease;
|
|
transition: color 0.2s ease;
|
|
-webkit-box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.footer-social .md-social__link:hover {
|
|
background: transparent;
|
|
border: none;
|
|
color: var(--md-accent-fg-color);
|
|
}
|
|
|
|
.footer-social .md-social__link svg {
|
|
width: 1.6rem;
|
|
height: 1.6rem;
|
|
fill: currentColor;
|
|
-webkit-flex-shrink: 0;
|
|
flex-shrink: 0;
|
|
display: block;
|
|
}
|
|
}
|
|
|
|
/* 导航链接样式 */
|
|
.md-footer__link {
|
|
transition: opacity 0.2s ease;
|
|
}
|
|
|
|
.md-footer__link:hover {
|
|
opacity: 1;
|
|
}
|
|
|
|
/* 移动端响应式 - 使用 footercopy.html 样式 */
|
|
@media (max-width: 76.1875em) {
|
|
/* 隐藏桌面端的卡片式布局 */
|
|
.footer-visit-count {
|
|
display: none;
|
|
}
|
|
|
|
.footer-bottom-section {
|
|
flex-direction: column;
|
|
gap: 0.6rem;
|
|
text-align: center;
|
|
}
|
|
|
|
.md-footer-copyright {
|
|
text-align: center;
|
|
font-size: 0.75rem;
|
|
}
|
|
|
|
.footer-social .md-social__link {
|
|
width: 1.8rem;
|
|
height: 1.8rem;
|
|
}
|
|
|
|
/* 显示移动端的简洁布局 */
|
|
.footer-visit-count-mobile {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
justify-content: center;
|
|
align-items: center;
|
|
gap: 0.4em 0.8em;
|
|
padding: 0.2em 0;
|
|
font-size: 0.75rem;
|
|
color: var(--md-footer-fg-color--light);
|
|
text-align: center;
|
|
}
|
|
|
|
.footer-visit-count-mobile > * {
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.footer-visit-count-mobile .icp-link {
|
|
color: var(--md-footer-fg-color--light);
|
|
text-decoration: none;
|
|
}
|
|
|
|
.footer-visit-count-mobile .icp-link:hover {
|
|
color: #596875;
|
|
text-decoration: underline;
|
|
}
|
|
|
|
/* .runtime-info {
|
|
display: none; 移动端隐藏运行时间
|
|
} */
|
|
}
|
|
|
|
/* 桌面端隐藏移动端布局 */
|
|
@media (min-width: 76.1875em) {
|
|
.footer-visit-count-mobile {
|
|
display: none;
|
|
}
|
|
}
|
|
|
|
@media (min-width: 768px) {
|
|
.footer-visit-count {
|
|
flex-direction: row;
|
|
justify-content: center;
|
|
gap: 2rem;
|
|
}
|
|
}
|
|
|
|
/* 深色模式适配 */
|
|
[data-md-color-scheme="slate"] .md-footer {
|
|
background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
|
|
}
|
|
|
|
[data-md-color-scheme="slate"] .md-footer-meta {
|
|
background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
|
|
}
|
|
|
|
[data-md-color-scheme="slate"] .footer-item {
|
|
background: rgba(255, 255, 255, 0.08);
|
|
border-color: rgba(255, 255, 255, 0.12);
|
|
}
|
|
|
|
[data-md-color-scheme="slate"] .footer-item:hover {
|
|
background: rgba(255, 255, 255, 0.12);
|
|
border-color: rgba(81, 143, 193, 0.3);
|
|
}
|
|
|
|
[data-md-color-scheme="slate"] .footer-social .md-social__link {
|
|
background: rgba(255, 255, 255, 0.08);
|
|
border-color: rgba(255, 255, 255, 0.12);
|
|
}
|
|
</style>
|
|
</div>
|
|
</div>
|
|
</footer> |