Fullscreen Shortcut

Add a shortcut to enable fullscreen mode of several streaming-media websites

当前为 2020-08-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Fullscreen Shortcut
  3. // @namespace https://gf.qytechs.cn/users/673298
  4. // @version 1.1
  5. // @author Fingalzzz
  6. // @description Add a shortcut to enable fullscreen mode of several streaming-media websites
  7. // @homepage https://gf.qytechs.cn/en/scripts/408194-fullscreen-shortcut
  8. // @supportURL https://gf.qytechs.cn/en/scripts/408194-fullscreen-shortcut
  9. // @match https://www.bilibili.com/video/*
  10. // @match https://www.bilibili.com/bangumi/play/*
  11. // @match https://www.iqiyi.com/*
  12. // @match https://v.qq.com/x/*
  13. // @match https://www.youtube.com/*
  14. // @grant none
  15. // ==/UserScript==
  16.  
  17. (function () {
  18. 'use strict';
  19. const shortcut = '\\';
  20.  
  21. // var selector = null;
  22. // var btn = null;
  23. // var link = window.location.href;
  24. // if (link.includes("bilibili.com")) {
  25. // selector = ".bilibili-player-iconfont-fullscreen-on";
  26. // } else if (link.includes('iqiyi.com')) {
  27. // selector = ".iqp-btn.iqp-btn-fullscreen";
  28. // } else if (link.includes('v.qq.com')) {
  29. // selector = ".txp_btn.txp_btn_fullscreen";
  30. // }
  31.  
  32. // (new MutationObserver(check)).observe(document, { childList: true, subtree: true });
  33.  
  34. // function check(changes, observer) {
  35. // if (document.querySelector(selector)) {
  36. // observer.disconnect();
  37. // btn = document.querySelector(selector);
  38. // }
  39. // }
  40.  
  41. document.addEventListener('keydown', (e) => {
  42. //if (e.ctrlKey && e.key === shortcut) {
  43. if (e.key === shortcut) {
  44. var selector = null;
  45. var btn = null;
  46. var link = window.location.href;
  47. if (link.includes("bilibili.com")) {
  48. selector = ".bilibili-player-iconfont-fullscreen-on";
  49. } else if (link.includes('iqiyi.com')) {
  50. selector = ".iqp-btn.iqp-btn-fullscreen";
  51. } else if (link.includes('v.qq.com')) {
  52. selector = ".txp_btn.txp_btn_fullscreen";
  53. } else if (link.includes('youtube.com')) {
  54. selector = ".ytp-fullscreen-button.ytp-button";
  55. }
  56. btn = document.querySelector(selector);
  57. btn.click();
  58. }
  59. })
  60.  
  61. })();
  62.  

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址