Skin:Vector/2022年版
| This code base is maintained by the Reader Experience team. |
发行状态: 稳定版 |
|||
|---|---|---|---|
| 兼容性政策 | 快照跟随MediaWiki发布。 master分支不向后兼容。 | ||
| Composer | mediawiki/vector-skin | ||
| 许可协议 | GNU通用公共协议2.0或更新版本 | ||
| 下载 | |||
| 示例 | |||
|
|||
| 季度下載量 | 0 | ||
| 正在使用的公开wiki数 | 14,010 (Ranked 2nd) | ||
| 作为默认皮肤使用的公开wiki数 | 5,943 | ||
| 翻譯Vector/2022皮肤如果它在translatewiki.net是可用的話 | |||
| Vagrant角色 | vector | ||
| 问题 | 开启的任务 · 报告错误 | ||
Vector 2022是Vector皮肤的二次修改版。它是作为桌面版改进项目的一部分开发的。 它从MediaWiki 1.38起被加入到MediaWiki中。 它是多个维基媒体项目的默认皮肤。
Vector 2022 与大多数皮肤的不同之处在于它没有自己的代码库;相反,它的代码是 Vector 皮肤的一部分,两者一起下载。
该皮肤自 MediaWiki 1.38 版起有第三方的正式支持。 请注意:运行MediaWiki 1.36或1.37的网站若在使用Vector 2022,则在升级到1.38版本时会遇到困难。 详情请见T299104和擴展:WikimediaMaintenance。
安裝
- 下载文件,并将其放置在您
skins/文件夹中的Vector目录内。 - 将下列代码放置在您的LocalSettings.php文件的底部:
wfLoadSkin( 'Vector' );
- 按需求配置。
完成 - 在您的wiki上打开Special:Version,以确认皮肤已成功安装。
可选依赖
如果安装了以下扩展,Vector 2022 可以使用它们,尽管并不是必需的:
- UniversalLanguageSelector – 添加语言切换按钮
- PageImages – 在搜索栏中包含每个页面(如果有)的图像
- ShortDescription – 在搜索栏中包含每个页面的描述(Wikimedia 项目具有类似的功能,但不使用此扩展)
配置
将Vector 2022设为默认皮肤
自MediaWiki 1.38版本以来,将以下内容添加到LocalSettings.php即可使Vector 2022成为默认皮肤:
$wgDefaultSkin = 'vector-2022';
特性
深色模式
| MediaWiki版本: | 1.43 |
Vector 2022具有夜间模式或深色模式,其有三种可能的状态:
day– 也称为浅色模式night– 也称为深色模式os– 也称为自动模式。 此模式将自动适应操作系统的状态
夜间模式由功能标志控制。
要启用它,请按如下方式设置$wgVectorNightMode:
$wgVectorNightMode['beta'] = true;
$wgVectorNightMode['logged_out'] = true;
$wgVectorNightMode['logged_in'] = true;
启用后,默认主题模式为浅色模式。 要将所有用户的默认主题更改为自动模式或深色模式,可以通过以下方式设置用户选项的默认值:
$wgDefaultUserOptions['vector-theme'] = 'os';
// 或者
$wgDefaultUserOptions['vector-theme'] = 'night';
请注意,您的内容必须兼容深色模式。 You might want to read the recommendations for Wikimedia wikis.
Configurability
请注意,Vector 2022有几个不稳定的特性标志,它们可能随时消失。 这些特性标志中的大多数都与不完整的特性有关。 除非此处列出,否则建议不要更改任何特性标志的默认值。
$wgVectorMaxWidthOptions- 可用于配置是否适用 max-width。 目前相对稳定。$wgVectorLanguageInMainPageHeader- 控制语言按钮是否显示在主页的页眉中。$wgVectorTypeahead- 用于API URL和选项(例如showDescription和showThumbnail,均为布尔值)的配置键关联数组。
Pinning
Vector 2022 allows control over whether various menus appear pinned in the sidebar or collapsed into the header. These options can be configured both by users in their preferences and by administrators as default settings.
The following pinning options are available:
vector-main-menu-pinned– Controls the main navigation menu position- 1 (默认) – Menu is pinned in the left sidebar
- 0 – Menu is collapsed into header hamburger icon
vector-page-tools-pinned– Controls the page tools menu position- 1 (默认) – Tools are pinned in the right sidebar
- 0 – Tools are collapsed into header icon
vector-toc-pinned– Controls the table of contents position- 1 (默认) – Table of contents is pinned in the left sidebar
- 0 – Table of contents is collapsed into a floating button
vector-appearance-pinned– Controls the appearance menu position- 1 (默认) – Appearance options are pinned in the sidebar
- 0 – Appearance options are collapsed into header icon
To change any of these defaults for logged in users, add the corresponding lines to LocalSettings.php:
Note this will not work for anonymous users due until T366999 is worked on.
// 示例:折叠所有菜单
$wgDefaultUserOptions['vector-main-menu-pinned'] = 0;
$wgDefaultUserOptions['vector-page-tools-pinned'] = 0;
$wgDefaultUserOptions['vector-toc-pinned'] = 0;
$wgDefaultUserOptions['vector-appearance-pinned'] = 0;
Workarounds
To pin the sidebar for anonymous users by default, this code can be added at the beginning of MediaWiki:Common.js (see live example):
if (!mw.config.get('wgUserName')) {
const observer = new MutationObserver((mutationsList, observer) => {
for (const mutation of mutationsList) {
if (mutation.target.classList.contains('vector-animations-ready')) {
document.querySelector( '[data-event-name="pinnable-header.vector-main-menu.pin"]' ).click()
observer.disconnect();
break;
}
}
});
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });
}
If you also want to pin the tools for anonymous users by default, you can add the following line of code (after line 5):
document.querySelector( '[data-event-name="pinnable-header.vector-page-tools.pin"]' ).click()
参见
| 此皮肤用于一个或多个维基媒体项目。 这可能意味着皮肤足够稳定、运作足够良好,可以用在这样的高流量的网站上。 请在维基媒体的CommonSettings.php和InitialiseSettings.php配置文件中查找此皮肤的名称以查看哪些网站安装了该皮肤。 特定wiki上的已安装的皮肤的完整列表位于Special:Version页面。 |
| 此皮肤在以下wiki农场/托管网站和/或软件包中提供: |
- GPL licensed skins/zh
- Stable skins/zh
- Skins supporting Composer/zh
- Skins in Wikimedia version control/zh
- GetPreferences extensions/zh
- LocalUserCreated extensions/zh
- SkinPageReadyConfig extensions/zh
- All skins/zh
- Skins bundled with MediaWiki 1.38/zh
- Skins used on Wikimedia/zh
- Skins included in Canasta/zh
- Skins available as Debian packages/zh
- Skins included in Miraheze/zh
- Skins included in MyWikis/zh
- Skins included in ProWiki/zh
- Skins included in semantic::core/zh
- Skins included in ShoutWiki/zh
- Skins included in Telepedia/zh
- Skins included in Weird Gloop/zh
- Skins included in wiki.gg/zh
- Vector skin/zh
- Skins with dark mode/zh
