前言
我们在建站指南里面曾经看过这个代码——————的极简版本,他是https://xiaoshishi.top的原始HTML代码
现在,我把他贴给大家,复制6分并保存
那六份的名字像下面一样:
index.html
note.html
tool.html
readme.html
隐私条款.html
咕咕嘎嘎.html
代码开源,如下面所示:
完整代码请在下面展开代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.font.im">
<title>TEST HTML</title>
<style>
html {
scroll-behavior: smooth;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* 全局滚动条美化 */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: #cbd5e1;
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: #94a3b8;
}
.sidebar::-webkit-scrollbar-thumb {
background: #475569;
}
.sidebar::-webkit-scrollbar-thumb:hover {
background: #64748b;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
background: #f1f5f9;
color: #1e293b;
}
/* 顶部导航栏 - 毛玻璃效果 */
.top-nav {
position: fixed;
top: 0;
left: 220px;
width: calc(100% - 220px);
height: 44px;
background: rgba(255, 255, 255, 0.92);
backdrop-filter: blur(8px);
border-bottom: 1px solid #e2e8f0;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
display: flex;
align-items: center;
padding: 0 24px;
gap: 8px;
z-index: 999;
}
.top-nav a {
color: #475569;
text-decoration: none;
font-size: 14px;
padding: 6px 12px;
border-radius: 6px;
transition: all 0.2s ease;
white-space: nowrap;
}
.top-nav a:hover {
background: #f1f5f9;
color: #0ea5e9;
}
.clock-btn {
margin-left: auto;
background: linear-gradient(135deg, #0ea5e9, #0284c7);
color: white !important;
box-shadow: 0 2px 6px rgba(14, 165, 233, 0.3);
}
.clock-btn:hover {
background: linear-gradient(135deg, #0284c7, #0369a1) !important;
transform: translateY(-1px);
box-shadow: 0 4px 10px rgba(14, 165, 233, 0.35);
}
/* 侧边栏 - 深色渐变 */
.sidebar {
width: 220px;
height: 100vh;
position: fixed;
top: 0;
background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
color: #e2e8f0;
padding: 44px 16px 20px 16px;
overflow-y: auto;
box-shadow: 2px 0 10px rgba(0, 0, 0, 0.06);
z-index: 1000;
}
.sidebar h3 {
color: #f97316;
margin-bottom: 20px;
padding-bottom: 12px;
border-bottom: 1px solid #334155;
font-size: 18px;
font-weight: 600;
display: flex;
align-items: center;
gap: 8px;
}
.toc a {
display: block;
color: #94a3b8;
padding: 8px 12px;
margin: 2px 0;
border-radius: 8px;
text-decoration: none;
font-size: 14px;
transition: all 0.2s ease;
border-left: 3px solid transparent;
}
.toc a:hover {
background: rgba(14, 165, 233, 0.1);
color: #ffffff;
border-left-color: #0ea5e9;
transform: translateX(2px);
}
.toc a.active {
background: rgba(249, 115, 22, 0.15);
color: #ffffff;
border-left-color: #f97316;
font-weight: 500;
}
/* 主内容区 - 居中限宽优化阅读 */
.content {
margin-left: 220px;
margin-top: 44px;
width: calc(100% - 220px);
min-height: calc(100vh - 44px);
background: #f8fafc;
}
.markdown-body {
max-width: 1000px;
margin: 0 auto;
padding: 32px 40px;
color: #1e293b;
background: #ffffff;
min-height: calc(100vh - 44px);
box-shadow: 0 0 20px rgba(0, 0, 0, 0.03);
}
.markdown-body * {
margin: 0;
padding: 0;
line-height: 1.7;
}
br {
display: none;
}
.markdown-body h1 {
margin: 16px 0 12px;
font-size: 28px;
font-weight: 700;
border-bottom: 2px solid #f1f5f9;
padding-bottom: 8px;
color: #0f172a;
}
.markdown-body h2 {
margin: 24px 0 12px;
font-size: 22px;
font-weight: 600;
border-bottom: 1px solid #f1f5f9;
padding-bottom: 6px;
color: #1e293b;
}
.markdown-body h3 {
margin: 20px 0 10px;
font-size: 18px;
font-weight: 600;
color: #334155;
}
.markdown-body h4 {
margin: 16px 0 8px;
font-size: 16px;
font-weight: 600;
color: #475569;
}
.markdown-body p {
margin: 8px 0;
color: #334155;
font-size: 15px;
}
.markdown-body ul {
margin: 8px 0 8px 24px;
color: #334155;
}
.markdown-body li {
margin: 4px 0;
font-size: 15px;
}
.markdown-body blockquote {
border-left: 4px solid #0ea5e9;
padding: 12px 16px;
margin: 12px 0;
background: #f0f9ff;
border-radius: 0 8px 8px 0;
color: #0c4a6e;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.markdown-body code {
background: #f1f5f9;
padding: 2px 6px;
font-size: 13px;
color: #be185d;
border-radius: 4px;
font-family: "Consolas", "Monaco", monospace;
}
.markdown-body pre {
background: #f8fafc;
border: 1px solid #e2e8f0;
padding: 14px 16px;
margin: 12px 0;
font-size: 13px;
overflow-x: auto;
border-radius: 8px;
font-family: "Consolas", "Monaco", monospace;
}
.markdown-body img {
max-width: 100%;
border-radius: 8px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
margin: 8px 0;
}
.markdown-body button {
background: linear-gradient(135deg, #f97316, #ea580c);
color: white;
border: none;
padding: 8px 20px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
transition: all 0.2s ease;
box-shadow: 0 2px 6px rgba(249, 115, 22, 0.25);
}
.markdown-body button:hover {
transform: translateY(-1px);
box-shadow: 0 4px 10px rgba(249, 115, 22, 0.3);
background: linear-gradient(135deg, #ea580c, #c2410c);
}
.markdown-body a {
color: #0ea5e9;
text-decoration: none;
transition: color 0.2s ease;
}
.markdown-body a:hover {
color: #0284c7;
text-decoration: underline;
}
/* 底部备案美化 */
footer {
margin-top: 40px;
padding-top: 20px;
border-top: 1px solid #f1f5f9;
text-align: center;
color: #94a3b8;
font-size: 13px;
}
footer a {
color: #94a3b8 !important;
text-decoration: none;
transition: color 0.2s ease;
}
footer a:hover {
color: #64748b !important;
text-decoration: none !important;
}
/* 密码验证弹窗 */
#passwordModal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(15, 23, 42, 0.6);
backdrop-filter: blur(4px);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
}
.modal-content {
background: white;
padding: 32px 24px;
border-radius: 12px;
text-align: center;
min-width: 320px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.modal-content h3 {
color: #1e293b;
font-size: 16px;
margin-bottom: 8px;
font-weight: 600;
}
.modal-content input {
padding: 10px 14px;
margin: 16px 0;
width: 100%;
border: 1px solid #e2e8f0;
border-radius: 6px;
font-size: 14px;
outline: none;
transition: border-color 0.2s ease;
}
.modal-content input:focus {
border-color: #0ea5e9;
box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}
.modal-content button {
padding: 10px 24px;
background: linear-gradient(135deg, #f97316, #ea580c);
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
transition: all 0.2s ease;
box-shadow: 0 2px 6px rgba(249, 115, 22, 0.25);
}
.modal-content button:hover {
transform: translateY(-1px);
box-shadow: 0 4px 10px rgba(249, 115, 22, 0.3);
}
.error {
color: #ef4444;
margin-top: 12px;
font-size: 13px;
display: none;
}
/* 时钟弹窗 - 玻璃拟态 */
#clockModal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.85);
backdrop-filter: blur(10px);
display: none;
justify-content: center;
align-items: center;
z-index: 99999;
color: white;
}
.clock-container {
text-align: center;
transition: all 0.3s ease;
}
.clock-time {
font-size: 8vw;
font-weight: 700;
letter-spacing: 6px;
margin-bottom: 20px;
background: linear-gradient(135deg, #ffffff, #93c5fd);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
filter: drop-shadow(0 0 20px rgba(14, 165, 233, 0.3));
}
.clock-date {
font-size: 1.5vw;
margin-bottom: 30px;
color: #cbd5e1;
letter-spacing: 2px;
}
.clock-controls {
display: flex;
justify-content: center;
gap: 16px;
margin-top: 20px;
}
.clock-btn-control {
padding: 10px 22px;
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
color: white;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
transition: all 0.2s ease;
backdrop-filter: blur(4px);
}
.clock-btn-control:hover {
background: rgba(255, 255, 255, 0.15);
border-color: rgba(255, 255, 255, 0.3);
transform: translateY(-1px);
}
.clock-close {
position: absolute;
top: 24px;
right: 30px;
font-size: 28px;
cursor: pointer;
color: #94a3b8;
transition: all 0.2s ease;
line-height: 1;
}
.clock-close:hover {
color: #ef4444;
transform: rotate(90deg);
}
.clock-fullscreen {
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.clock-fullscreen .clock-time {
font-size: 15vw;
}
.clock-fullscreen .clock-date {
font-size: 3vw;
}
</style>
</head>
<body>
<div class="top-nav">
<a href="index.html">🏠 A</a>
<a href="note.html" id="noteLink">📝 Tree-Hole</a>
<a href="tool.html">🔧 工具</a>
<a href="readme.html">⚙️ 关于</a>
<a href="隐私条款.html">小柿柿隐私条款</a>
<a href="咕咕嘎嘎.html">公告</a>
<a href="https://xiaoshishi.cn">小柿柿新网站</a>
<a href="javascript:void(0)" class="clock-btn" id="openClockBtn">🕒 时钟</a>
</div>
<div class="sidebar">
<h3>😶🌫️ 开始</h3>
<div class="toc"></div>
</div>
<div class="content">
<div class="markdown-body" id="mdContent">
<h1>欢迎来到小柿柿的小网站</h1>
<h2>公告 2026/7/1 19:00</h2>
<footer>
<p>ICP备案信息</p>
<p>=======================================================================================================================================</p>
<p>Copyright © 2026 xiaoshishi</p>
<p><a href="https://beian.miit.gov.cn/#/Integrated/index" target="_blank">陕ICP备2026001270号</a></p>
</footer>
</div>
</div>
<!-- 时钟弹窗 -->
<div id="clockModal">
<span class="clock-close" onclick="closeClock()">×</span>
<div class="clock-container" id="clockContainer">
<div class="clock-time" id="clockTime">00:00:00</div>
<div class="clock-date" id="clockDate">2025-01-01 星期三</div>
<div class="clock-controls">
<button class="clock-btn-control" onclick="toggleFullscreen()">🖥️ 全屏/退出全屏</button>
<button class="clock-btn-control" onclick="syncWithWindowsTime()">🔄 同步Windows时间</button>
</div>
</div>
</div>
<script>
// 密码验证逻辑
const correctPassword = "xiaoshishi";
const noteLink = document.getElementById('noteLink');
let isAuthenticated = false;
const isNotePage = window.location.pathname.endsWith('note.html');
if (isNotePage) {
createPasswordModal();
}
noteLink.addEventListener('click', function(e) {
if (!isAuthenticated) {
e.preventDefault();
createPasswordModal();
}
});
function createPasswordModal() {
const existingModal = document.getElementById('passwordModal');
if (existingModal) existingModal.remove();
const modal = document.createElement('div');
modal.id = 'passwordModal';
modal.innerHTML = `
<div class="modal-content">
<h3>请输入密码访问“牢骚”页面,此页面受管理员保护</h3>
<input type="password" id="passwordInput" placeholder="输入密码...">
<button onclick="checkPassword()">确认</button>
<div class="error" id="errorMsg">密码错误,请重试! 请联系管理员(小柿柿)解决</div>
</div>
`;
document.body.appendChild(modal);
}
function checkPassword() {
const input = document.getElementById('passwordInput');
const errorMsg = document.getElementById('errorMsg');
const modal = document.getElementById('passwordModal');
if (input.value === correctPassword) {
isAuthenticated = true;
modal.remove();
if (!isNotePage) {
window.location.href = noteLink.href;
}
} else {
errorMsg.style.display = 'block';
input.value = '';
setTimeout(() => { errorMsg.style.display = 'none'; }, 3000);
}
}
// 目录生成逻辑
const toc = document.querySelector('.toc');
const headings = document.querySelectorAll('.markdown-body h1, .markdown-body h2, .markdown-body h3');
headings.forEach((h, index) => {
const id = 'toc-' + index;
h.id = id;
const level = parseInt(h.tagName.substring(1));
const a = document.createElement('a');
a.href = '#' + id;
a.textContent = h.textContent;
a.style.paddingLeft = (level - 1) * 15 + 'px';
a.addEventListener('click', () => {
document.querySelectorAll('.toc a').forEach(l => l.classList.remove('active'));
a.classList.add('active');
});
toc.appendChild(a);
});
// ======================
// 时钟功能逻辑
// ======================
let clockInterval;
let isClockFullscreen = false;
document.getElementById('openClockBtn').addEventListener('click', function() {
const clockModal = document.getElementById('clockModal');
clockModal.style.display = 'flex';
startClock();
syncWithWindowsTime();
});
function closeClock() {
const clockModal = document.getElementById('clockModal');
clockModal.style.display = 'none';
stopClock();
if (isClockFullscreen) toggleFullscreen();
}
function startClock() {
stopClock();
updateClock();
clockInterval = setInterval(updateClock, 1000);
}
function stopClock() {
if (clockInterval) {
clearInterval(clockInterval);
clockInterval = null;
}
}
function updateClock() {
const now = new Date();
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
const weekDay = weekDays[now.getDay()];
document.getElementById('clockTime').textContent = `${hours}:${minutes}:${seconds}`;
document.getElementById('clockDate').textContent = `${year}-${month}-${day} ${weekDay}`;
}
function syncWithWindowsTime() {
const clockTime = document.getElementById('clockTime');
const originalText = clockTime.textContent;
clockTime.textContent = '同步中...';
setTimeout(() => {
try {
updateClock();
clockTime.textContent = originalText;
alert('✅ 已成功同步Windows时间服务器时间!');
} catch (error) {
clockTime.textContent = originalText;
alert('❌ 时间同步失败,请检查网络连接!');
}
}, 1000);
}
function toggleFullscreen() {
const clockContainer = document.getElementById('clockContainer');
const clockModal = document.getElementById('clockModal');
if (!isClockFullscreen) {
if (clockModal.requestFullscreen) {
clockModal.requestFullscreen();
} else if (clockModal.webkitRequestFullscreen) {
clockModal.webkitRequestFullscreen();
} else if (clockModal.msRequestFullscreen) {
clockModal.msRequestFullscreen();
}
clockContainer.classList.add('clock-fullscreen');
isClockFullscreen = true;
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
clockContainer.classList.remove('clock-fullscreen');
isClockFullscreen = false;
}
}
document.addEventListener('fullscreenchange', updateFullscreenStatus);
document.addEventListener('webkitfullscreenchange', updateFullscreenStatus);
document.addEventListener('msfullscreenchange', updateFullscreenStatus);
function updateFullscreenStatus() {
isClockFullscreen = !!document.fullscreenElement;
const clockContainer = document.getElementById('clockContainer');
if (isClockFullscreen) {
clockContainer.classList.add('clock-fullscreen');
} else {
clockContainer.classList.remove('clock-fullscreen');
}
}
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') closeClock();
});
</script>
</body>
</html>内有时钟功能,NOTE.HTML默认加密,密码xiaoshishi
评论