mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-18 07:02:27 +00:00
fix: "Pause when tabbing out" Feature not working as expected #369
fix: scrollbars
This commit is contained in:
parent
ebc65133ed
commit
2c3af49f76
3 changed files with 11 additions and 5 deletions
|
|
@ -17,6 +17,7 @@
|
|||
import Keybinds, { loadWithDefaults, condition } from 'svelte-keybinds'
|
||||
import { SUPPORTS } from '@/modules/support.js'
|
||||
import 'rvfc-polyfill'
|
||||
import IPC from '@/modules/ipc.js'
|
||||
|
||||
const emit = createEventDispatcher()
|
||||
|
||||
|
|
@ -263,17 +264,19 @@
|
|||
function toggleMute () {
|
||||
muted = !muted
|
||||
}
|
||||
let visibilityPaused = true
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
const handleVisibility = visibility => {
|
||||
if (!video?.ended && $settings.playerPause && !pip) {
|
||||
if (document.visibilityState === 'hidden') {
|
||||
if (visibility === 'hidden') {
|
||||
visibilityPaused = paused
|
||||
paused = true
|
||||
} else {
|
||||
if (!visibilityPaused) paused = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
let visibilityPaused = true
|
||||
document.addEventListener('visibilitychange', () => handleVisibility(document.visibilityState))
|
||||
IPC.on('visibilitychange', handleVisibility)
|
||||
function tryPlayNext () {
|
||||
if ($settings.playerAutoplay && !state.value) playNext()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ module.exports = (parentDir, alias = {}, aliasFields = 'browser', filename = 'ap
|
|||
${htmlWebpackPlugin.tags.headTags}
|
||||
</head>
|
||||
|
||||
<body class="dark-mode with-custom-webkit-scrollbars with-custom-css-scrollbars">
|
||||
<body class="dark-mode with-custom-webkit-scrollbars">
|
||||
${htmlWebpackPlugin.tags.bodyTags}
|
||||
</body>
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ function createWindow () {
|
|||
webtorrentWindow.webContents.openDevTools()
|
||||
})
|
||||
|
||||
mainWindow.on('minimize', () => mainWindow.webContents.postMessage('visibilitychange', 'hidden'))
|
||||
mainWindow.on('restore', () => mainWindow.webContents.postMessage('visibilitychange', 'visible'))
|
||||
|
||||
mainWindow.on('closed', () => {
|
||||
mainWindow = null
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in a new issue