无编辑摘要 |
无编辑摘要 |
||
| 第6行: | 第6行: | ||
<div class="zhbus-led-screen"> | <div class="zhbus-led-screen"> | ||
<!-- | <!-- 24行精准硬切 LED 点阵遮罩层(消除半亮灯珠) --> | ||
<div class="zhbus-led-overlay"></div> | <div class="zhbus-led-overlay"></div> | ||
| 第19行: | 第19行: | ||
<style> | <style> | ||
/* | /* 容器:500px 宽度 */ | ||
.zhbus-led-wrapper { | .zhbus-led-wrapper { | ||
width: | width: 500px; | ||
margin: 15px auto; | margin: 15px auto; | ||
box-sizing: border-box; | box-sizing: border-box; | ||
} | } | ||
/* | /* 500px 外壳,高度 70px */ | ||
.zhbus-led-casing { | .zhbus-led-casing { | ||
width: | width: 500px; | ||
height: | height: 70px; | ||
background: linear-gradient(180deg, #23252b 0%, #111215 100%); | background: linear-gradient(180deg, #23252b 0%, #111215 100%); | ||
border-radius: | border-radius: 6px; | ||
padding: 10px | padding: 8px 10px; | ||
box-shadow: 0 | box-shadow: 0 6px 16px rgba(0, 0, 0, 0.85), inset 0 1px 1px rgba(255, 255, 255, 0.15); | ||
border: 2px solid #30333d; | border: 2px solid #30333d; | ||
position: relative; | position: relative; | ||
| 第39行: | 第39行: | ||
} | } | ||
/* | /* 螺丝钉细节 */ | ||
.zhbus-screw { | .zhbus-screw { | ||
position: absolute; | position: absolute; | ||
width: | width: 5px; | ||
height: | height: 5px; | ||
background: radial-gradient(circle, #777 30%, #333 80%); | background: radial-gradient(circle, #777 30%, #333 80%); | ||
border-radius: 50%; | border-radius: 50%; | ||
box-shadow: inset 0 0 1px #000; | box-shadow: inset 0 0 1px #000; | ||
} | } | ||
.zhbus-screw.tl { top: | .zhbus-screw.tl { top: 4px; left: 4px; } | ||
.zhbus-screw.tr { top: | .zhbus-screw.tr { top: 4px; right: 4px; } | ||
.zhbus-screw.bl { bottom: | .zhbus-screw.bl { bottom: 4px; left: 4px; } | ||
.zhbus-screw.br { bottom: | .zhbus-screw.br { bottom: 4px; right: 4px; } | ||
/* | /* 显示屏主区域:高度 50px */ | ||
.zhbus-led-screen { | .zhbus-led-screen { | ||
position: relative; | position: relative; | ||
background-color: # | background-color: #000000; | ||
border-radius: | border-radius: 3px; | ||
overflow: hidden; | overflow: hidden; | ||
border: 2px solid #0a0a0c; | border: 2px solid #0a0a0c; | ||
height: | height: 50px; | ||
display: flex; | display: flex; | ||
align-items: center; | align-items: center; | ||
box-shadow: inset 0 0 | box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.98); | ||
} | } | ||
/* | /* 硬边缘点阵遮罩层:0.7px 到 0.75px 极窄过渡,彻底杜绝灯珠亮一半 */ | ||
.zhbus-led-overlay { | .zhbus-led-overlay { | ||
position: absolute; | position: absolute; | ||
| 第73行: | 第73行: | ||
pointer-events: none; | pointer-events: none; | ||
background-image: | background-image: | ||
radial-gradient(circle at 1. | radial-gradient(circle at 1.04px 1.04px, transparent 0.7px, #000000 0.75px); | ||
background-size: 2.08px 2.08px; | |||
background-size: | |||
} | } | ||
| 第87行: | 第85行: | ||
} | } | ||
/* | /* 专为真 LED 效果优化的字体与高对比度渲染 */ | ||
.zhbus-led-text { | .zhbus-led-text { | ||
font-family: "SimSun", " | font-family: "SimSun-ExtB", "NSimSun", "SimSun", "Courier New", monospace !important; | ||
font-size: | font-size: 42px; | ||
font-weight: 900; | font-weight: 900; | ||
color: # | color: #ffcc00; | ||
letter-spacing: 2px; | letter-spacing: 2px; | ||
line-height: | line-height: 50px; | ||
padding-right: | padding-right: 40px; | ||
display: flex; | display: flex; | ||
align-items: center; | align-items: center; | ||
-webkit-font-smoothing: none; | |||
-moz-osx-font-smoothing: unset; | /* 强制关闭字体平滑(抗锯齿),还原真实像素点 */ | ||
font-smooth: never; | -webkit-font-smoothing: none !important; | ||
-moz-osx-font-smoothing: unset !important; | |||
font-smooth: never !important; | |||
/* 使用 300% 对比度滤镜进行二值化,使字边缘要么全亮要么完全不亮 */ | |||
filter: contrast(300%) drop-shadow(0 0 1px #ffc400); | |||
} | } | ||
/* ※ | /* ※ 间隔符 */ | ||
.zhbus-sep { | .zhbus-sep { | ||
color: # | color: #ffcc00; | ||
font-size: | font-size: 34px; | ||
margin: 0 | margin: 0 8px; | ||
font-weight: | font-weight: 900; | ||
filter: contrast(300%); | |||
} | } | ||
| 第135行: | 第134行: | ||
"关于开通高考专线及学生高考免费乘车政策的通告" | "关于开通高考专线及学生高考免费乘车政策的通告" | ||
]; | ]; | ||
async function fetchWithTimeout(resource, options = {}) { | |||
const { timeout = 3000 } = options; | |||
const controller = new AbortController(); | |||
const id = setTimeout(() => controller.abort(), timeout); | |||
const response = await fetch(resource, { | |||
...options, | |||
signal: controller.signal | |||
}); | |||
clearTimeout(id); | |||
return response; | |||
} | |||
async function initZhbusLed() { | async function initZhbusLed() { | ||
let titles = []; | let titles = []; | ||
try { | try { | ||
const res = await | const res = await fetchWithTimeout(API_URL, { timeout: 3000 }); | ||
if (!res.ok) throw new Error('网络响应异常'); | |||
const data = await res.json(); | const data = await res.json(); | ||
const items = data.data || data.Data || (data.data && data.data.list) || data; | const items = data.data || data.Data || (data.data && data.data.list) || data; | ||
titles = items.map(i => i.Title || i.title).filter(Boolean); | if (Array.isArray(items)) { | ||
if (!titles.length) throw new Error(); | titles = items.map(i => i.Title || i.title).filter(Boolean); | ||
} | |||
if (!titles.length) throw new Error('解析数据为空'); | |||
} catch(e) { | } catch(e) { | ||
titles = FALLBACK; | titles = FALLBACK; | ||
| 第160行: | 第174行: | ||
contentClone.innerHTML = fullHtml; | contentClone.innerHTML = fullHtml; | ||
const tempDiv = document.createElement("div"); | const tempDiv = document.createElement("div"); | ||
tempDiv.innerHTML = fullHtml; | tempDiv.innerHTML = fullHtml; | ||
| 第169行: | 第182行: | ||
} | } | ||
if (document.readyState === ' | if (document.readyState === 'complete' || document.readyState === 'interactive') { | ||
setTimeout(initZhbusLed, 100); | |||
} else { | |||
document.addEventListener('DOMContentLoaded', initZhbusLed); | document.addEventListener('DOMContentLoaded', initZhbusLed); | ||
} | } | ||
})(); | })(); | ||
</script> | </script> | ||
</html> | </html> | ||
2026年7月29日 (三) 09:01的版本
加载中...
加载中...