仪表盘和订阅详情的操作按钮改 text-button,公网 IP 带旗帜
检测公网 IP、重启内核、订阅详情右上三个按钮都去掉边框,hover 出浅底。 检测结果由国家代码换成旗帜 emoji 加 IP;Windows 的系统字体没有旗帜 字形,浏览器会退回显示两个字母,和原来的效果一致。
This commit is contained in:
@@ -33,6 +33,17 @@ export function formatAgo(at: Date, now: Date): string {
|
||||
return `${String(at.getFullYear())}-${p(at.getMonth() + 1)}-${p(at.getDate())}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 两位国家代码转成旗帜 emoji(区域指示符对)。不像国家代码的输入原样返回,
|
||||
* 显示端至少还有字母可看。注意 Windows 的系统字体没有旗帜字形,浏览器会
|
||||
* 把区域指示符退回显示成两个字母。
|
||||
*/
|
||||
export function flagEmoji(countryCode: string): string {
|
||||
const code = countryCode.trim().toUpperCase()
|
||||
if (!/^[A-Z]{2}$/.test(code)) return countryCode
|
||||
return String.fromCodePoint(...[...code].map((ch) => 0x1f1e6 + (ch.codePointAt(0) ?? 65) - 65))
|
||||
}
|
||||
|
||||
/** 运行时长。一小时内说分钟,一天内说时分,再长说天和小时;秒级抖动没有信息量。 */
|
||||
export function formatUptime(seconds: number): string {
|
||||
if (!Number.isFinite(seconds) || seconds < 0) return '—'
|
||||
|
||||
Reference in New Issue
Block a user