hide twitter video controls (until hover)

6/3/2024, 1:04:59 AM

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        hide twitter video controls (until hover)
// @namespace   Violentmonkey Scripts
// @match       https://x.com/*
// @grant       none
// @version     1.0
// @author      minnieo
// @description 6/3/2024, 1:04:59 AM
// @license     MIT
// ==/UserScript==



document.addEventListener("DOMContentLoaded", () => {
  const videoControls = document.querySelector('div[data-testid="videoComponent"] div.css-175oi2r.r-18u37iz.r-n7gxbd');
  videoControls.style.display = 'none';

  if (videoControls) { // Check if videoControls exists
    // Show controls when the mouse enters the area
    videoControls.addEventListener('mouseenter', () => {
      videoControls.style.display = 'block';
    });

    // Hide controls when the mouse leaves the area
    videoControls.addEventListener('mouseout', () => {
      videoControls.style.display = 'none';
    });
  } else {
    console.error('Video controls element not found.');
  }
});