Skip to content

Instantly share code, notes, and snippets.

@ci7lus
Created July 24, 2021 08:20
Show Gist options
  • Save ci7lus/e28ae78502954d451726915aaf020f6c to your computer and use it in GitHub Desktop.
Save ci7lus/e28ae78502954d451726915aaf020f6c to your computer and use it in GitHub Desktop.
disable disable PiP in sports.nhk.or.jp
// ==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