无编辑摘要 |
无编辑摘要 |
||
| 第121行: | 第121行: | ||
</style> | </style> | ||
< | <img src="x" onerror=" | ||
( | (async () => { | ||
const API_URL = | const API_URL = 'https://apiv2.zhbuswx.com/ContentPublish/GetAll?appType=notice&pageIndex=1&pageSize=20'; | ||
const FIXED_FIRST = | const FIXED_FIRST = '珠海巴士频道公交调整信息'; | ||
const SEP = '<span class= | const SEP = '<span class="zhbus-sep">※</span>'; | ||
const FALLBACK = ['关于调整公交201路、K4路运行路线及停靠站点的公告','关于优化调整部分公交线路首尾班车时间的通告','关于针对雷雨恶劣天气实施公交应急保障预案的通知']; | |||
const track = document.getElementById('zhbusLedTrack'); | |||
const content = document.getElementById('zhbusLedContent'); | |||
const contentClone = document.getElementById('zhbusLedContentClone'); | |||
if (!track || !content || !contentClone || track.dataset.inited) return; | |||
track.dataset.inited = 'true'; | |||
let titles = []; | |||
try { | |||
const controller = new AbortController(); | const controller = new AbortController(); | ||
const id = setTimeout(() => controller.abort(), | const id = setTimeout(() => controller.abort(), 3000); | ||
const | const res = await fetch(API_URL, { signal: controller.signal }); | ||
clearTimeout(id); | clearTimeout(id); | ||
const data = await res.json(); | |||
const items = data.data || data.Data || data; | |||
if (Array.isArray(items)) { | |||
titles = items.map(i => i.Title || i.title).filter(Boolean).filter(t => !t.includes('【已恢复】')); | |||
} | } | ||
} catch(e) {} | |||
if (!titles.length) titles = FALLBACK.filter(t => !t.includes('【已恢复】')); | |||
const fullHtml = SEP + [FIXED_FIRST, ...titles].join(SEP) + SEP; | |||
content.innerHTML = fullHtml; | |||
contentClone.innerHTML = fullHtml; | |||
const tempDiv = document.createElement('div'); | |||
tempDiv.innerHTML = fullHtml; | |||
const duration = Math.max((tempDiv.textContent || '').length / 3, 2); | |||
track.style.animation = 'zhbusMarquee ' + duration + 's linear infinite'; | |||
})(); | })(); | ||
" style="display:none;" /> | |||
2026年7月29日 (三) 17:38的版本
<html>
加载中...
加载中...
<style> /* 容器:500px 宽度 */ .zhbus-led-wrapper {
width: 500px; margin: 15px auto; box-sizing: border-box;
}
/* 500px 外壳,高度 70px */ .zhbus-led-casing {
width: 500px; height: 70px; background: linear-gradient(180deg, #23252b 0%, #111215 100%); border-radius: 6px; padding: 8px 10px; 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; position: relative; box-sizing: border-box;
}
/* 螺丝钉细节 */ .zhbus-screw {
position: absolute; width: 5px; height: 5px; background: radial-gradient(circle, #777 30%, #333 80%); border-radius: 50%; box-shadow: inset 0 0 1px #000;
} .zhbus-screw.tl { top: 4px; left: 4px; } .zhbus-screw.tr { top: 4px; right: 4px; } .zhbus-screw.bl { bottom: 4px; left: 4px; } .zhbus-screw.br { bottom: 4px; right: 4px; }
/* 显示屏主区域:高度 50px */ .zhbus-led-screen {
position: relative; background-color: #000000; border-radius: 3px; overflow: hidden; border: 2px solid #0a0a0c; height: 50px; display: flex; align-items: center; box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.98);
}
/* 硬边缘点阵遮罩层:0.7px 到 0.75px 极窄过渡,彻底杜绝灯珠亮一半 */ .zhbus-led-overlay {
position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 10; pointer-events: none; background-image: radial-gradient(circle at 1.04px 1.04px, transparent 0.7px, #000000 0.75px); background-size: 2.08px 2.08px;
}
/* 滚动轨 */ .zhbus-led-track {
display: flex; white-space: nowrap; position: absolute; will-change: transform;
}
/* 专为真 LED 效果优化的字体与高对比度渲染 */ .zhbus-led-text {
font-family: "SimSun-ExtB", "NSimSun", "SimSun", "Courier New", monospace !important; font-size: 42px; font-weight: 900; color: #ffcc00; letter-spacing: 2px; line-height: 50px; padding-right: 40px; display: flex; align-items: center; /* 强制关闭字体平滑(抗锯齿),还原真实像素点 */ -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 {
color: #ffcc00; font-size: 34px; margin: 0 8px; font-weight: 900; filter: contrast(300%);
}
@keyframes zhbusMarquee {
0% { transform: translateX(0); }
100% { transform: translateX(-50%); }
} </style>
{
const API_URL = 'https://apiv2.zhbuswx.com/ContentPublish/GetAll?appType=notice&pageIndex=1&pageSize=20'; const FIXED_FIRST = '珠海巴士频道公交调整信息'; const SEP = '※'; const FALLBACK = ['关于调整公交201路、K4路运行路线及停靠站点的公告','关于优化调整部分公交线路首尾班车时间的通告','关于针对雷雨恶劣天气实施公交应急保障预案的通知']; const track = document.getElementById('zhbusLedTrack'); const content = document.getElementById('zhbusLedContent'); const contentClone = document.getElementById('zhbusLedContentClone'); if (!track || !content || !contentClone || track.dataset.inited) return; track.dataset.inited = 'true';
let titles = [];
try {
const controller = new AbortController();
const id = setTimeout(() => controller.abort(), 3000);
const res = await fetch(API_URL, { signal: controller.signal });
clearTimeout(id);
const data = await res.json();
const items = data.data || data.Data || data;
if (Array.isArray(items)) {
titles = items.map(i => i.Title || i.title).filter(Boolean).filter(t => !t.includes('【已恢复】'));
}
} catch(e) {}
if (!titles.length) titles = FALLBACK.filter(t => !t.includes('【已恢复】'));
const fullHtml = SEP + [FIXED_FIRST, ...titles].join(SEP) + SEP;
content.innerHTML = fullHtml;
contentClone.innerHTML = fullHtml;
const tempDiv = document.createElement('div');
tempDiv.innerHTML = fullHtml;
const duration = Math.max((tempDiv.textContent || ).length / 3, 2);
track.style.animation = 'zhbusMarquee ' + duration + 's linear infinite';
})(); " style="display:none;" />