自定义代码
V1 中的自定义代码
这篇文档将会介绍 V1 中的自定义代码。
| 变量名 | 含义 | 示例 |
|---|---|---|
window.CustomBackgroundImage | 自定义背景图 | |
window.CustomMobileBackgroundImage | 自定义手机端背景图 | |
window.CustomLogo | 自定义Logo | 示例:"https://...png" |
window.CustomDesc | 自定义描述 | |
window.ShowNetTransfer | 卡片显示上下行流量 | true |
window.DisableAnimatedMan | 关掉动画人物插图 | true |
window.CustomIllustration | 自定义插图(请移除DisableAnimatedMan) | |
window.FixedTopServerName | 固定顶部服务器名称 | true |
window.CustomLinks | 自定义外链 | [{\"link\":\"https://github.com/hamster1963/nezha-dash\",\"name\":\"GitHub\"}] |
window.ForceTheme | 强制默认颜色主题 | "light" 或 "dark" |
window.ForceUseSvgFlag | 强制使用 SVG 旗帜 | true |
window.ForceShowServices | 强制显示服务面板 | true |
window.ForceShowMap | 强制显示地图 | true |
window.ForceCardInline | 强制列表单行显示 | true |
window.ForcePeakCutEnabled | 强制开启延迟图表削峰 | true |
window.ForceSortType | 默认排序类型 | default |
window.ForceSortOrder | 默认排序顺序 | asc |

外部链接格式

原始 json 格式:
[{ "link": "https://github.com/hamster1963/nezha-dash", "name": "GitHub" },{ "link": "https://buycoffee.top/coffee", "name": "Buycoffee☕️" }]
需要对 json 进行转义,然后填入环境变量中。可通过 https://www.jsont.run 转义。

转换结果如下:
[{\"link\":\"https://github.com/hamster1963/nezha-dash\",\"name\":\"GitHub\"}]
填写示例
<script>window.CustomBackgroundImage = 'https://....png'window.CustomMobileBackgroundImage = 'https://....png'window.CustomLogo = 'https://....png'window.CustomDesc = '这是一个自定义描述'window.ShowNetTransfer = truewindow.DisableAnimatedMan = falsewindow.CustomIllustration = 'https://....png'window.FixedTopServerName = truewindow.CustomLinks ='[{"link":"https://github.com/hamster1963/nezha-dash","name":"GitHub"}]'window.ForceTheme = 'light'</script>