@@ -447,6 +447,17 @@ export async function openSettings(): Promise<void> {
447447 const pageOpacityWrap = el ( 'div' , { style : 'flex:1;min-width:160px;display:flex;flex-direction:column;gap:6px' } ) ;
448448 pageOpacityWrap . append ( pageOpacityLabel , pageOpacityRange ) ;
449449
450+ /* 视频音量:仅当背景为视频时显示 */
451+ const volumeLabel = el ( 'div' , { class : 'field__hint' , text : `视频音量 ${ store . background . volume } %` } ) ;
452+ const volumeRange = el ( 'input' , { class : 'range' , type : 'range' , min : '0' , max : '100' , value : String ( store . background . volume ) } ) ;
453+ volumeRange . addEventListener ( 'input' , ( ) => {
454+ const v = Number ( volumeRange . value ) ;
455+ volumeLabel . textContent = `视频音量 ${ v } %` ;
456+ void store . setBackground ( { volume : v } ) ;
457+ } ) ;
458+ const volumeWrap = el ( 'div' , { style : 'flex:1;min-width:160px;display:flex;flex-direction:column;gap:6px' } ) ;
459+ volumeWrap . append ( volumeLabel , volumeRange ) ;
460+
450461 const enToggle = toggle ( '启用背景' , '' , store . background . enabled , ( v ) => { void store . setBackground ( { enabled : v } ) ; } ) ;
451462
452463 const fileInput = el ( 'input' , { type : 'file' , accept : 'image/*,video/*' } ) ;
@@ -457,8 +468,8 @@ export async function openSettings(): Promise<void> {
457468 fileInput . addEventListener ( 'change' , ( ) => {
458469 const f = fileInput . files ?. [ 0 ] ;
459470 if ( ! f ) return ;
460- if ( f . size > 10 * 1024 * 1024 ) {
461- toast ( '文件不能超过 10MB ' , { kind : 'warn' } ) ;
471+ if ( f . size > 100 * 1024 * 1024 ) {
472+ toast ( '文件不能超过 100MB ' , { kind : 'warn' } ) ;
462473 return ;
463474 }
464475 if ( ! / ^ i m a g e \/ | ^ v i d e o \/ / . test ( f . type ) ) {
@@ -503,11 +514,11 @@ export async function openSettings(): Promise<void> {
503514 bgPreview . addEventListener ( 'pointercancel' , ( ) => { dragging = false ; } ) ;
504515
505516 const bgControls = el ( 'div' , { style : 'display:flex;gap:12px;align-items:flex-start;flex-wrap:wrap;margin-top:10px' } ) ;
506- bgControls . append ( bgOpacityWrap , pageOpacityWrap ) ;
517+ bgControls . append ( bgOpacityWrap , pageOpacityWrap , volumeWrap ) ;
507518 const bgActions = el ( 'div' , { style : 'display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:8px' } ) ;
508519 bgActions . append ( enToggle , uploadBtn , clearBtn ) ;
509520 bgField . append ( bgPreview , bgControls , bgActions , fileInput ) ;
510- bgField . appendChild ( el ( 'p' , { class : 'field__hint' , text : '图片 / GIF / 视频 ≤10MB ,拖动预览可调位置' } ) ) ;
521+ bgField . appendChild ( el ( 'p' , { class : 'field__hint' , text : '图片 / GIF / 视频 ≤100MB ,拖动预览可调位置' } ) ) ;
511522 m . body . appendChild ( bgField ) ;
512523
513524 // 背景预览重绘
@@ -521,6 +532,9 @@ export async function openSettings(): Promise<void> {
521532 bgOpacityLabel . textContent = `背景不透明度 ${ bg . opacity } %` ;
522533 pageOpacityRange . value = String ( bg . pageOpacity ) ;
523534 pageOpacityLabel . textContent = `页面不透明度 ${ bg . pageOpacity } %` ;
535+ volumeRange . value = String ( bg . volume ) ;
536+ volumeLabel . textContent = `视频音量 ${ bg . volume } %` ;
537+ volumeWrap . style . display = bg . mime . startsWith ( 'video/' ) ? '' : 'none' ;
524538 } ;
525539 paintBg ( ) ;
526540
0 commit comments