fix(ui): 补齐 generator.html 和 listmanager.html 的问号剥离兜底
- generator.html: 新增 ds() 钩子,在 renderList / batch 预览 / showToast 三个渲染点统一问号剥离 - listmanager.html: 新增 ds() 钩子,在 renderList / renderSequence / 自定义 select 选项 / showToast 四个点统一问号剥离 - APP_VERSION_TEXT bump 到 v1.0.107
This commit is contained in:
@@ -358,6 +358,14 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function ds(x) {
|
||||
let v = String(x == null ? '' : x)
|
||||
.replace(/[?¿?]+/g, '')
|
||||
.replace(/\s+/g, ' ')
|
||||
.trim();
|
||||
return v === '' ? '-' : v;
|
||||
}
|
||||
|
||||
// --- Icons (SVG) ---
|
||||
const ICONS = {
|
||||
chevronDown: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>`,
|
||||
@@ -443,7 +451,7 @@
|
||||
icon = ICONS.broadcast;
|
||||
}
|
||||
|
||||
messageLog.unshift({ time, content: msg, type, icon, important });
|
||||
messageLog.unshift({ time: ds(time), content: ds(msg), type, icon, important });
|
||||
if (messageLog.length > MAX_MESSAGES) messageLog.pop();
|
||||
renderMessages();
|
||||
}
|
||||
@@ -486,18 +494,22 @@
|
||||
const isBroadcasting = broadcastingStations.has(st.name);
|
||||
const dotClass = isBroadcasting ? 'dot-broadcasting' : (isOnline ? 'dot-online' : 'dot-offline');
|
||||
const hasCC = Array.isArray(st.tags) && st.tags.includes('CC');
|
||||
const dsName = ds(st.name);
|
||||
const dsCode = ds(st.code || '');
|
||||
const dsPlatform = st.platform ? ds(st.platform) : '';
|
||||
const stationKey = String(st.name || '').replace(/[^a-zA-Z0-9]/g, '_');
|
||||
|
||||
const div = document.createElement('div');
|
||||
div.className = 'status-item';
|
||||
div.innerHTML = `
|
||||
<div class="item-info">
|
||||
<div class="item-title">
|
||||
${st.name}
|
||||
${dsName}
|
||||
${hasCC ? '<span style="font-size:0.65rem; background:rgba(16, 185, 129, 0.1); color:#34d399; padding:1px 5px; border-radius:4px; margin-left:6px; font-weight:normal; border:1px solid rgba(16, 185, 129, 0.2)">CC</span>' : ''}
|
||||
</div>
|
||||
<div class="item-sub">${st.code}${st.platform ? ` - 站台 ${st.platform}` : ''}</div>
|
||||
<div class="item-sub">${dsCode}${dsPlatform && dsPlatform !== '-' ? ` - 站台 ${dsPlatform}` : ''}</div>
|
||||
</div>
|
||||
<div class="status-dot ${dotClass}" id="station-dot-${st.name.replace(/[^a-zA-Z0-9]/g, '_')}" data-online="${isOnline}" data-name="${st.name}"></div>
|
||||
<div class="status-dot ${dotClass}" id="station-dot-${stationKey}" data-online="${isOnline}" data-name="${dsName}"></div>
|
||||
`;
|
||||
list.appendChild(div);
|
||||
});
|
||||
@@ -519,13 +531,18 @@
|
||||
|
||||
const currentStCode = stationCodeMap[tr.currentStation] || tr.currentStation || '-';
|
||||
const statusColor = tr.status === 'At Station' ? 'var(--success)' : 'var(--warning)';
|
||||
const dsTrainId = ds(tr.trainId);
|
||||
const dsDest = ds(tr.destination || '');
|
||||
const dsCurCode = ds(currentStCode);
|
||||
const rawStatus = tr.status === 'At Station' ? '在站' : (tr.status === 'Departed' ? '已发车' : '运行中');
|
||||
const dsStatus = ds(rawStatus);
|
||||
|
||||
div.innerHTML = `
|
||||
<div style="width:100%">
|
||||
<div style="display:flex; justify-content:space-between; align-items:center;">
|
||||
<div class="item-info">
|
||||
<div class="item-title">${tr.trainId} <span style="font-size:0.7rem; color:var(--text-muted); font-weight:normal; margin-left:8px;">${tr.destination || ''}</span></div>
|
||||
<div class="item-sub">${currentStCode} <span style="color:${statusColor}; margin-left:8px;">${tr.status === 'At Station' ? '在站' : (tr.status === 'Departed' ? '已发车' : '运行中')}</span></div>
|
||||
<div class="item-title">${dsTrainId}${dsDest && dsDest !== '-' ? ' <span style="font-size:0.7rem; color:var(--text-muted); font-weight:normal; margin-left:8px;">' + dsDest + '</span>' : ''}</div>
|
||||
<div class="item-sub">${dsCurCode} <span style="color:${statusColor}; margin-left:8px;">${dsStatus}</span></div>
|
||||
</div>
|
||||
<div class="status-dot ${tr.status === 'At Station' ? 'dot-online' : 'dot-warn'}"></div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user