Update build:docs and trans:docs scripts

This commit is contained in:
Harvey Zack committed 2023-11-26 13:23:21 +08:00
1 parent a2d3e20479
commit a2b57495a2
20 files changed
+749 -775

No files matched your search

@@ -1,10 +1,10 @@
# 高级属性
# Advanced Properties
这里的 `高级属性` 是指挂载在 `实例` 的 `二级属性`,比较少用
The `advanced properties` here refer to the `secondary attributes` mounted on the `instance`, which are less commonly used
## `option`
播放器的选项
Options for the player
<div className="run-code">▶ Run Code</div>
@@ -17,15 +17,15 @@ var art = new Artplayer({
console.info(art.option);
```
:::warning 提示
:::warning Reminder
假如直接修改这个 `option` 对象,播放器不会马上做出响应
If you directly modify this `option` object, the player will not respond immediately.
:::
## `template`
管理播放器所有的 `DOM` 元素
Manages all of the `DOM` elements of the player
<div className="run-code">▶ Run Code</div>
@@ -38,22 +38,21 @@ var art = new Artplayer({
console.info(art.template);
console.info(art.template.$video);
```
:::warning Warning
:::warning 提示
To easily distinguish between `DOM` elements and plain objects, all `DOM` elements in the player are named starting with a `$`
为了方便区别 `DOM` 元素和普通对象,播放器里的所有 `DOM` 元素都是以 `$` 开头命名的
这是所有 `DOM` 元素的定义:[artplayer/types/template.d.ts](https://github.com/zhw2590582/ArtPlayer/blob/master/packages/artplayer/types/template.d.ts)
Here is the definition of all `DOM` elements: [artplayer/types/template.d.ts](https://github.com/zhw2590582/ArtPlayer/blob/master/packages/artplayer/types/template.d.ts)
:::
## `events`
管理播放器所有的 `DOM` 事件,实质上是代理了 `addEventListener` 和 `removeEventListener`, 当使用以下方法来处理事件,播放器销毁时也会自动销毁该事件
Manages all `DOM` events in the player, which is essentially a proxy for `addEventListener` and `removeEventListener`. When using the following methods to handle events, the event will also be automatically destroyed when the player is destroyed.
- `proxy` 方法用于代理 `DOM` 事件
- `hover` 方法用于代理自定义的 `hover` 事件
- `loadImg` 方法用于监听图片的 `load` 加载事件
- The `proxy` method is used to proxy `DOM` events
- The `hover` method is used to proxy custom `hover` events
- The `loadImg` method is used to listen for the `load` event of images
<div className="run-code">▶ Run Code</div>
@@ -66,7 +65,7 @@ var art = new Artplayer({
});
art.events.proxy(container, 'click', event => {
console.info('click', event);
console.info('click', event);
});
art.events.hover(container, (event) => {
@@ -79,22 +78,21 @@ art.events.loadImg('/assets/sample/poster.jpg').then(img => {
console.info('loadImg', img);
});
```
:::warning Warning
:::warning 提示
假如你需要一些 `DOM` 事件只存在于播放器的生命周期上时,强烈建议使用这些函数,以避免造成内存泄漏
If you need some `DOM` events to only exist during the lifecycle of the player, it is strongly recommended to use these functions to avoid causing memory leaks
:::
## `storage`
管理播放器的本地存储
Manages the local storage of the player
- `name` 属性用于设置缓存的 `key`
- `set` 方法用于设置缓存
- `get` 方法用于获取缓存
- `del` 方法用于删除缓存
- `clear` 方法用于清空缓存
- The `name` attribute is used to set the cache `key`
- The `set` method is used to set the cache
- The `get` method is used to get the cache
- The `del` method is used to delete the cache
- The `clear` method is used to clear the cache
<div className="run-code">▶ Run Code</div>
@@ -111,11 +109,11 @@ art.storage.del('test');
art.storage.clear();
```
:::warning 提示
:::warning Warning
默认所有播放器实例都是共享同一个 `localStorage` 的,而且默认的 `key` 是 `artplayer_settings`
By default, all player instances share the same `localStorage`, and the default `key` is `artplayer_settings`
如果你想不同的播放器使用不同的 `localStorage`,你可以修改 `art.storage.name` 即可
If you want different players to use different `localStorage`, you can modify `art.storage.name` accordingly
:::
@@ -133,7 +131,7 @@ art.storage.set('test', { foo: 'bar' });
## `icons`
管理播放器所有的 `svg` 图标
Manage all the `svg` icons of the player
<div className="run-code">▶ Run Code</div>
@@ -146,7 +144,7 @@ var art = new Artplayer({
console.info(art.icons.loading);
```
:::warning 这是所有图标的定义:
:::warning This is the definition of all icons:
[artplayer/types/icons.d.ts](https://github.com/zhw2590582/ArtPlayer/blob/master/packages/artplayer/types/icons.d.ts)
@@ -154,10 +152,10 @@ console.info(art.icons.loading);
## `i18n`
管理播放器的 `i18n`
Manage the player's `i18n`
- `get` 方法用于获取 `i18n` 的值
- `update` 方法用于更新 `i18n` 对象
- The `get` method is used to retrieve the value of `i18n`
- The `update` method is used to update the `i18n` object
<div className="run-code">▶ Run Code</div>
@@ -178,14 +176,14 @@ art.i18n.update({
:::warning
使用 `art.i18n.update` 只能更新实例化之后的 `i18n`,假如想在实例化之前更新 `i18n`,请使用基础选项的 `i18n` 来更新
Using `art.i18n.update` can only update `i18n` after instantiation. If you want to update `i18n` before instantiation, please use the `i18n` from the basic options for the update.
:::
## `notice`
管理播放器的提示语,只有一个 `show` 属性用于显示提示语
Manage the player's notices, there's only one `show` property used to display notices.
<div className="run-code">▶ Run Code</div>
@@ -202,19 +200,19 @@ art.on('ready', () => {
:::warning
如果想马上隐藏 `notice` 的显示:`art.notice.show = '';`
To immediately hide the display of `notice`: `art.notice.show = '';`
:::
## `layers`
管理播放器的层
Manage the layers of the player
- `add` 方法用于动态添加层
- `remove` 方法用于动态删除层
- `update` 方法用于动态更新层
- `show` 属性用于设置是否显示全部层
- `toggle` 方法用于切换是否显示全部层
- The `add` method is used for dynamically adding layers
- The `remove` method is used for dynamically removing layers
- The `update` method is used for dynamically updating layers
- The `show` property is used to set whether to display all layers or not
- The `toggle` method is used to toggle the display of all layers
<div className="run-code">▶ Run Code</div>
@@ -234,8 +232,7 @@ art.on('ready', () => {
}, 1000);
});
```
:::warning `组件配置` 请参考以下地址:
:::warning `Component configuration` Please refer to the following address:
[/component/layers.html](/component/layers.html)
@@ -243,13 +240,13 @@ art.on('ready', () => {
## `controls`
管理播放器的控制器
Manage the player's controllers
- `add` 方法用于动态添加控制器
- `remove` 方法用于动态删除控制器
- `update` 方法用于动态更新控制器
- `show` 属性用于设置是否显示全部控制器
- `toggle` 方法用于切换是否显示全部控制器
- `add` method is used to dynamically add controllers
- `remove` method is used to dynamically remove controllers
- `update` method is used to dynamically update controllers
- `show` property is used to set whether to display all controllers
- `toggle` method is used to toggle the display of all controllers
<div className="run-code">▶ Run Code</div>
@@ -271,7 +268,7 @@ art.on('ready', () => {
});
```
:::warning `组件配置` 请参考以下地址:
:::warning `Component Configuration` Please refer to the following address:
[/component/controls.html](/component/controls.html)
@@ -279,13 +276,13 @@ art.on('ready', () => {
## `contextmenu`
管理播放器的右键菜单
Manage the right-click context menu of the player
- `add` 方法用于动态添加菜单
- `remove` 方法用于动态删除菜单
- `update` 方法用于动态更新菜单
- `show` 属性用于设置是否显示全部菜单
- `toggle` 方法用于切换是否显示全部菜单
- The `add` method is used to dynamically add menu items
- The `remove` method is used to dynamically remove menu items
- The `update` method is used to dynamically update menu items
- The `show` attribute is used to set whether to show all menu items
- The `toggle` method is used to switch the visibility of all menu items
<div className="run-code">▶ Run Code</div>
@@ -301,13 +298,13 @@ art.on('ready', () => {
});
art.contextmenu.show = true;
setTimeout(() => {
art.contextmenu.show = false;
}, 1000);
setTimeout(() => {
art.contextmenu.show = false;
}, 1000);
});
```
:::warning `组件配置` 请参考以下地址:
:::warning `Component Configuration` Please refer to the following address:
[/component/contextmenu.html](/component/contextmenu.html)
@@ -315,11 +312,11 @@ art.on('ready', () => {
## `subtitle`
管理播放器的字幕功能
Manage the subtitle features of the player
- `url` 属性设置和返回当前字幕地址
- `style` 方法设置当前字幕的样式
- `switch` 方法设置当前字幕地址和选项
- `url` property sets and returns the current subtitle address
- `style` method sets the style of the current subtitle
- `switch` method sets the current subtitle address and options
<div className="run-code">▶ Run Code</div>
@@ -339,10 +336,10 @@ art.on('ready', () => {
## `loading`
管理播放器的加载层
Manage the loading layer of the player
- `show` 属性用于设置是否显示加载层
- `toggle` 属性用于切换是否显示加载层
- `show` property is used to set whether to display the loading layer
- The `toggle` attribute is used to toggle the display of the loading layer
<div className="run-code">▶ Run Code</div>
@@ -362,10 +359,10 @@ art.on('ready', () => {
## `hotkey`
管理播放器的快捷键功能
Manage the hotkey functionality of the player
- `add` 方法用于添加快捷键
- `remove` 方法用于删除快捷键
- The `add` method is used to add a hotkey
- The `remove` method is used to remove a hotkey
<div className="run-code">▶ Run Code</div>
@@ -386,19 +383,18 @@ art.on('ready', () => {
}, 5000);
});
```
:::warning Warning
:::warning 提示
只在播放器获得焦点后(如点击了播放器后),这些快捷键才会生效
Shortcut keys will only work after the player has gained focus (e.g., after clicking on the player).
:::
## `mask`
管理播放器的遮罩层
Manage the player's mask layer
- `show` 属性用于设置是否显示遮罩层
- `toggle` 属性用于切换是否显示遮罩层
- `show` property is used to set whether to display the mask layer
- `toggle` property is used to toggle the display of the mask layer
<div className="run-code">▶ Run Code</div>
@@ -410,21 +406,22 @@ var art = new Artplayer({
art.on('ready', () => {
art.mask.show = false;
setTimeout(() => {
art.mask.show = true;
}, 1000);
setTimeout(() => {
art.mask.show = true;
}, 1000);
});
```
## `setting`
管理播放器的设置面板
Manage the player's settings panel
- `add` method is used to dynamically add a setting item
- `remove` method is used to dynamically remove a setting item
- `update` method is used to dynamically update a setting item
- `show` property is used to set whether to display all the setting items
- `toggle` method is used to toggle whether to display all the setting items
- `add` 方法用于动态添加设置项
- `remove` 方法用于动态删除设置项
- `update` 方法用于动态更新设置项
- `show` 属性用于设置是否显示全部设置项
- `toggle` 方法用于切换是否显示全部设置项
<div className="run-code">▶ Run Code</div>
@@ -447,7 +444,7 @@ art.on('ready', () => {
});
```
:::warning `设置面板` 请参考以下地址
:::warning `Settings Panel` Please refer to the following link
[/component/setting.html](/component/setting.html)
@@ -455,7 +452,7 @@ art.on('ready', () => {
## `plugins`
管理播放器的插件功能,只有一个方法 `add` 用于动态添加插件
Manage the player's plugin features, with only one method `add` to dynamically add plugins
<div className="run-code">▶ Run Code</div>