mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-22 05:11:20 -08:00
chore: Update danmuku plugin configuration handling and improve performance
This commit is contained in:
1 parent
0af549189a
commit
20752bc170
8 files changed
+30
-4
No files matched your search
@@ -73,6 +73,7 @@ export default class Danmuku {
|
||||
beforeEmit: () => true, // 弹幕发送前的过滤器,支持返回 Promise
|
||||
beforeVisible: () => true, // 弹幕显示前的过滤器,支持返回 Promise
|
||||
visible: true, // 弹幕层是否可见
|
||||
emitter: true, // 是否开启弹幕发射器
|
||||
maxLength: 200, // 弹幕输入框最大长度, 范围在[1 ~ 1000]
|
||||
lockTime: 5, // 输入框锁定时间,范围在[1 ~ 60]
|
||||
theme: 'dark', // 弹幕主题,支持 dark 和 light,只在自定义挂载时生效
|
||||
@@ -104,6 +105,7 @@ export default class Danmuku {
|
||||
beforeEmit: 'function',
|
||||
beforeVisible: 'function',
|
||||
visible: 'boolean',
|
||||
emitter: 'boolean',
|
||||
maxLength: 'number',
|
||||
lockTime: 'number',
|
||||
theme: 'string',
|
||||
|
||||
@@ -628,6 +628,7 @@ export default class Setting {
|
||||
this.setData('danmukuAntiOverlap', this.option.antiOverlap);
|
||||
this.setData('danmukuSyncVideo', this.option.synchronousPlayback);
|
||||
this.setData('danmukuTheme', this.option.theme);
|
||||
this.setData('danmukuEmitter', this.option.emitter);
|
||||
|
||||
const colors = $colors.children;
|
||||
const $color = Array.from(colors).find((item) => item.dataset.color === this.option.color.toUpperCase());
|
||||
@@ -636,7 +637,7 @@ export default class Setting {
|
||||
tooltip($toggle, this.option.visible ? '关闭弹幕' : '打开弹幕');
|
||||
}
|
||||
|
||||
mount(target = this.template.$controlsCenter) {
|
||||
mount(target) {
|
||||
const $el = typeof target === 'string' ? document.querySelector(target) : target;
|
||||
$el.appendChild(this.template.$danmuku);
|
||||
this.template.$mount = $el;
|
||||
|
||||
@@ -297,6 +297,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
[data-danmuku-emitter='false'] {
|
||||
.apd-emitter {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.art-controls-center {
|
||||
.artplayer-plugin-danmuku {
|
||||
justify-content: flex-end;
|
||||
gap: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[data-danmuku-theme='light'] > .artplayer-plugin-danmuku {
|
||||
.apd-icon {
|
||||
fill: #333;
|
||||
|
||||
@@ -146,6 +146,11 @@ type Option = {
|
||||
*/
|
||||
visible?: boolean;
|
||||
|
||||
/**
|
||||
* 是否开启弹幕发射器
|
||||
*/
|
||||
emitter?: boolean;
|
||||
|
||||
/**
|
||||
* 弹幕输入框最大长度, 范围在[1 ~ 1000]
|
||||
*/
|
||||
|
||||
@@ -78,6 +78,7 @@ https://unpkg.com/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js
|
||||
beforeEmit: () => true, // 弹幕发送前的过滤器,支持返回 Promise
|
||||
beforeVisible: () => true, // 弹幕显示前的过滤器,支持返回 Promise
|
||||
visible: true, // 弹幕层是否可见
|
||||
emitter: true, // 是否开启弹幕发射器
|
||||
maxLength: 200, // 弹幕输入框最大长度, 范围在[1 ~ 1000]
|
||||
lockTime: 5, // 输入框锁定时间,范围在[1 ~ 60]
|
||||
theme: 'dark', // 弹幕主题,支持 dark 和 light,只在自定义挂载时生效
|
||||
|
||||
Reference in new issue
Block a user