2 in 1 PiP Tool

Removes attributes and lets PiP run when you press `alt+ctrl+p`

当前为 2023-09-14 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 2 in 1 PiP Tool
  3. // @version 2.2
  4. // @description Removes attributes and lets PiP run when you press `alt+ctrl+p`
  5. // @author Edward D
  6. // @include http://*
  7. // @include https://*
  8. // @namespace https://edwarddk.github.io/EdwardD-Portfolio/
  9. // ==/UserScript==
  10.  
  11.  
  12. //FOR THE PIP PRESS ALT + CTRL + P
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. window.addEventListener("play", function(e) {
  18. e.target.removeAttribute("disablePictureInPicture")
  19. }, true)
  20.  
  21. window.addEventListener("pause", function(e) {
  22. e.target.removeAttribute("disablePictureInPicture")
  23. }, true)
  24.  
  25. console.log('RUNNING');
  26. document.body.addEventListener('keyup', function(e){
  27. if(e.altKey && e.ctrlKey && e.key === 'p') {
  28. var video = document.querySelector('video');
  29. video.requestPictureInPicture();
  30. }
  31. })
  32. })();