MissAV 防止自動暫停

防止 MissAV 在切換視窗視窗、標籤時自動暫停

질문, 리뷰하거나, 이 스크립트를 신고하세요.
// ==UserScript==
// @name         MissAV 防止自動暫停
// @namespace    https://github.com/DonkeyBear
// @version      0.2
// @description  防止 MissAV 在切換視窗視窗、標籤時自動暫停
// @author       DonkeyBear
// @match        https://missav.com/*
// @icon         https://missav.com/img/favicon.ico
// @grant        none
// ==/UserScript==

const videoPlayer = document.querySelector('video.player');
if (!videoPlayer) { return }

let windowIsBlurred = false;
window.onblur = () => { windowIsBlurred = true };
window.onfocus = () => { windowIsBlurred = false };

videoPlayer.onpause = () => {
  if (windowIsBlurred) { videoPlayer.play() }
};