Created
July 24, 2021 08:20
-
-
Save ci7lus/e28ae78502954d451726915aaf020f6c to your computer and use it in GitHub Desktop.
disable disable PiP in sports.nhk.or.jp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name sports.nhk.or.jp disable disable PiP | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://sports.nhk.or.jp/* | |
// @icon https://www.google.com/s2/favicons?domain=nhk.or.jp | |
// @grant none | |
// ==/UserScript== | |
;(function () { | |
"use strict" | |
const run = () => { | |
const video = document.querySelector("video[disablepictureinpicture]") | |
if (!video) { | |
return setTimeout(run, 1000) | |
} | |
video.disablePictureInPicture = false | |
} | |
const addEventListener = HTMLVideoElement.prototype.addEventListener | |
HTMLVideoElement.prototype.addEventListener = function (...args) { | |
const [eventName] = args | |
if (eventName.includes("pictureinpicture")) return | |
addEventListener.apply(this, args) | |
} | |
window.addEventListener("load", run) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment