2 in 1

Removes attributes and lets Pip

目前为 2023-09-14 提交的版本。查看 最新版本

// ==UserScript==
// @name         2 in 1
// @version      1.7
// @description  Removes attributes and lets Pip
// @author       Edward D
// @include      http://*
// @include      https://*
// @namespace    https://edwarddk.github.io/EdwardD-Portfolio/
// ==/UserScript==


//FOR THE PIP PRESS ALT + CTRL + P

(function() {
    'use strict';

    window.addEventListener("play", function(e) {
    e.target.removeAttribute("disablePictureInPicture")
}, true)

window.addEventListener("pause", function(e) {
    e.target.removeAttribute("disablePictureInPicture")
}, true)

    console.log('RUNNING');
    document.body.addEventListener('keyup', function(e){
        if(e.altKey && e.ctrlKey && e.key === 'p') {
            var video = document.querySelector('video');
            video.requestPictureInPicture();
        }
    })
})();