Let Me Multitask, Bro

A Tampermonkey script that allows picture-in-picture mode to be used for videos, even if the website has disabled it.

当前为 2023-07-16 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Let Me Multitask, Bro
  3. // @author Christopher Conley
  4. // @copyright Copyright (C) 2023 Christopher Conley
  5. // @license GPL-2.0-only
  6. // @version 0.2.1
  7. // @description A Tampermonkey script that allows picture-in-picture mode to be used for videos, even if the website has disabled it.
  8. // @namespace https://github.com/rosettast0ned/let-me-multitask-bro
  9. // @source https://github.com/rosettast0ned/let-me-multitask-bro
  10. // @supportURL https://github.com/rosettast0ned/let-me-multitask-bro/issues
  11. // @match *://*/*
  12. // @icon https://raw.githubusercontent.com/rosettast0ned/let-me-multitask-bro/main/tampermonkey/let_me_multitask_bro.png
  13. // @icon64 https://raw.githubusercontent.com/rosettast0ned/let-me-multitask-bro/main/tampermonkey/let_me_multitask_bro64.png
  14. // @run-at document-idle
  15. // ==/UserScript==
  16. //
  17. // Picture in picture icon by Ria Fitriana from https://thenounproject.com/browse/icons/term/picture-in-picture/ Noun Project (CC BY 3.0)
  18. //
  19.  
  20. (function () {
  21. console.log('LMMB: Let Me Multitask, Bro extension triggered.')
  22.  
  23. var poller = setInterval(function () {
  24. if (document.querySelector('video') !== null) {
  25. clearInterval(poller);
  26. console.log("LMMB: Found video element.");
  27.  
  28. var videos = document.querySelectorAll('video');
  29.  
  30. videos.forEach(video => {
  31. if (video.hasAttribute('disablepictureinpicture')) {
  32. console.log('LMMB: Removing disablepictureinpicture attribute from video element.');
  33. video.removeAttribute('disablepictureinpicture');
  34. }
  35. });
  36. }
  37. }, 50);
  38.  
  39. })();