Greasy Fork

Greasy Fork is available in English.

Udemy Hide Video Playback Controls

Hide Playback Controls by pressing Alt + h, and unhide it by ALT + d

当前为 2024-11-28 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Udemy Hide Video Playback Controls
// @namespace    https://github.com/RahulSabinkar
// @version      2024-11-28
// @description  Hide Playback Controls by pressing Alt + h, and unhide it by ALT + d
// @author       Rahul Sabinkar
// @match        https://www.udemy.com/course/*
// @icon         https://www.udemy.com/staticx/udemy/images/v7/apple-touch-icon.png
// @license      MIT
// @grant        none
// ==/UserScript==

(function () {
  "use strict";
  window.addEventListener("keydown", (event) => {
    const controls = document.querySelector(
      ".shaka-control-bar--control-bar-container--OfnMI"
    );
    const nextAndPrevious = document.querySelectorAll(
      ".next-and-previous--container--kZxyo"
    );
    const headerGradient = document.querySelector(
      ".video-viewer--header-gradient--x4Zw0"
    );
    const headerTitle = document.querySelector(
      ".video-viewer--title-overlay--YZQuH"
    );
    if (event.key === "h" && event.altKey) {
      controls.setAttribute("style", "opacity: 0 !important");
      nextAndPrevious.forEach((element) => {
        element.setAttribute("style", "opacity: 0 !important");
      });
      headerGradient.setAttribute("style", "display: none !important");
      headerTitle.setAttribute("style", "display: none !important");
    } else if (event.key === "d" && event.altKey) {
      controls.setAttribute("style", "opacity: 1 !important");
      nextAndPrevious.forEach((element) => {
        element.setAttribute("style", "opacity: 1 !important");
      });
      headerGradient.setAttribute("style", "display: block !important");
      headerTitle.setAttribute("style", "display: block !important");
    }
  });
})();