NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Bilibili-macOS-PIPScript // @namespace https://gist.github.com/dimpurr/17872d8cae49f6ca2b62a4e12872ceba // @updateURL https://openuserjs.org/meta/dimpurr/Bilibili-macOS-PIPScript.meta.js // @version 0.2 // @description Enable PIP(Picture-In-Picture) on macOS for bilibili // @author Dimpurr // @include /^http:\/\/www.bilibili.com\/video\/av/ // @include /^http:\/\/bangumi.bilibili.com\/anime\/v/ // @run-at document-end // ==/UserScript== (function() { // 'use strict'; // diff function PIP() { var av = document.getElementsByTagName("video")[0]; var bangumi = document.getElementsByClassName("bilibiliHtml5Player")[0]; if (av !== undefined) { av.setAttribute("controls", "controls"); window.clearInterval(PIPInterval); } else { bangumi.contentDocument.getElementsByTagName("video")[0].setAttribute("controls", "controls"); window.clearInterval(PIPInterval); } window.clearInterval(PIPInterval); } // diff var PIPInterval = window.setInterval(PIP, 2000); PIP(); })();