3,389
个编辑
MCBBS Wiki欢迎您共同参与编辑!在参与编辑之前请先阅读Wiki方针。
如果在编辑的过程中遇到了什么问题,可以去讨论板提问。
为了您能够无阻碍地参与编辑 未验证/绑定过邮箱的用户,请尽快绑定/验证。
MCBBS Wiki GitHub群组已上线!
您可以在回声洞中发表吐槽!
服务器状态监控。点击进入
本站由MCBBS用户自行搭建,与MCBBS及东银河系漫游指南(北京)科技有限公司没有从属关系。点此了解 MCBBS Wiki 不是什么>>
Salt lovely(留言 | 贡献) (新的主题切换功能) |
Salt lovely(留言 | 贡献) (区分新旧版vector皮肤) |
||
| 第177行: | 第177行: | ||
//! https://github.com/mcbbs-wiki/mcbbs-wiki-widget-repo/tree/master/widget/VectorThemeLoader | //! https://github.com/mcbbs-wiki/mcbbs-wiki-widget-repo/tree/master/widget/VectorThemeLoader | ||
addStyle(widget_t_default); | addStyle(widget_t_default); | ||
var themeMap = { | var isLegacy = document.body.classList.contains("skin-vector-legacy"); | ||
var themeMap = isLegacy ? { | |||
book: { | book: { | ||
name: "仿MCBBS书页风格", | name: "仿MCBBS书页风格", | ||
common: "MediaWiki:Vector-Book.css", | common: "MediaWiki:Vector-Legacy-Book.css", | ||
default: { | default: { | ||
name: "夏季主题", | name: "夏季主题", | ||
| 第189行: | 第190行: | ||
nether: { name: "下界主题", css: "MediaWiki:Vector-Book-Nether.css" }, | nether: { name: "下界主题", css: "MediaWiki:Vector-Book-Nether.css" }, | ||
winter: { name: "冬季主题", css: "MediaWiki:Vector-Book-Winter.css" } | winter: { name: "冬季主题", css: "MediaWiki:Vector-Book-Winter.css" } | ||
} | } | ||
} | |||
} : { | |||
v4: { | |||
name: "仿MCBBS v4风格", | |||
common: "MediaWiki:Vector-V4.css", | |||
default: { name: "默认风格", css: "MediaWiki:Vector-V4.css" }, | |||
other: {} | |||
} | } | ||
}; | }; | ||
var | var defaultStyle = Object.keys(themeMap)[0]; | ||
var styleKey = isLegacy ? "mcbbs-wiki-skin-vector-legacy-style" : "mcbbs-wiki-skin-vector-style"; | |||
var themeKey = "skin-vector-theme"; | var themeKey = isLegacy ? "mcbbs-wiki-skin-vector-legacy-theme" : "mcbbs-wiki-skin-vector-theme"; | ||
var loadThemeStyle = (style, theme) => { | var loadThemeStyle = (style, theme) => { | ||
const | const styleMap = themeMap[style] || themeMap[defaultStyle]; | ||
const currentCommonStyle = styleMap.common; | const currentCommonStyle = styleMap.common; | ||
loadWikiStyle(currentCommonStyle, "salt-wiki-style-common"); | loadWikiStyle(currentCommonStyle, "salt-wiki-style-common"); | ||
| 第213行: | 第211行: | ||
}; | }; | ||
var initTheme = () => { | var initTheme = () => { | ||
const current = { style: | const current = { style: defaultStyle, theme: "default" }; | ||
const [style] = readAndListen({ | const [style] = readAndListen({ | ||
key: styleKey, | key: styleKey, | ||
defaultValue: | defaultValue: defaultStyle, | ||
listener: (ev) => { | listener: (ev) => { | ||
if (ev.newValue) { | if (ev.newValue) { | ||