Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(valaxy-addon-meting): abnormal configuration of music player #382

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions packages/valaxy-addon-meting/client/observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ export function setupHiddenLyricHidingObserver() {
})
})
observer.observe(document.body, { childList: true, subtree: true })

onUnmounted(() => {
observer?.disconnect()
})
}

export function useMetingLoadObserver(addon: MetingOptions) {
Expand Down
22 changes: 5 additions & 17 deletions packages/valaxy-addon-meting/client/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useEventListener } from '@vueuse/core'
import { onMounted, onUnmounted } from 'vue'
import type { MetingOptions } from '../node/index'
import { Hook } from './hook'

Expand All @@ -19,8 +18,8 @@ export function handleOptions(options: MetingOptions['options'], rules: Rules) {
* APlayer mini switcher
*/
export function useAPlayerMiniSwitcherEventListener() {
let aplayerFixedElement: HTMLElement
let aplayerIconButton: HTMLElement
const aplayerFixedElement = document.querySelector('.aplayer.aplayer-fixed .aplayer-body') as HTMLElement
const aplayerIconButton = document.querySelector('.aplayer-body .aplayer-miniswitcher .aplayer-icon') as HTMLElement
let aplayerNarrow = true

function toggleAplayerVisibility() {
Expand All @@ -36,20 +35,9 @@ export function useAPlayerMiniSwitcherEventListener() {
aplayerFixedElement.style.left = '0'
}

onMounted(() => {
aplayerFixedElement = document.querySelector('.aplayer.aplayer-fixed .aplayer-body') as HTMLElement
aplayerIconButton = document.querySelector('.aplayer-body .aplayer-miniswitcher .aplayer-icon') as HTMLElement

useEventListener(aplayerFixedElement, 'mouseenter', showAplayer)
useEventListener(aplayerFixedElement, 'mouseleave', hiddenAplayer)
useEventListener(aplayerIconButton, 'click', toggleAplayerVisibility)
})

onUnmounted(() => {
aplayerFixedElement?.removeEventListener('mouseenter', showAplayer)
aplayerFixedElement?.removeEventListener('mouseleave', hiddenAplayer)
aplayerIconButton?.removeEventListener('click', toggleAplayerVisibility)
})
useEventListener(aplayerFixedElement, 'mouseenter', showAplayer)
useEventListener(aplayerFixedElement, 'mouseleave', hiddenAplayer)
useEventListener(aplayerIconButton, 'click', toggleAplayerVisibility)
}

function handleAplayerAction(action: string, leftValue: string) {
Expand Down
2 changes: 1 addition & 1 deletion packages/valaxy-addon-meting/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "valaxy-addon-meting",
"global": true,
"version": "0.1.1",
"version": "0.1.2",
"license": "MIT",
"repository": {
"url": "https://github.com/YunYouJun/valaxy/tree/main/packages/valaxy-addon-meting",
Expand Down
Loading