Video Overlay Vanisher

A tool to eliminate web video player overlays with Shift+D.

Versione datata 17/05/2023. Vedi la nuova versione l'ultima versione.

Autore
𝖢𝖸 𝖥𝗎𝗇𝗀
Valutazione
0 0 0
Versione
1.2.2
Creato il
05/07/2021
Aggiornato il
17/05/2023
Dimensione
14,8 KB
Licenza
MIT
Applica a
Tutti i siti

Shift-D to toggle all the "floating elements" overlaying the video player (controls, danmaku, etc.)

Shift-Dを押すと、ビデオプレーヤーに重なるすべての「フローティング要素」がトグル切り替わります(コントロール弾幕など)。

Works for all websites, including videos inside iframe.

Script Description (generated by ChatGPT)

This userscript is designed to hide the overlay of any video player on a webpage. It does this by adding a new style to the webpage, which makes any overlay elements invisible. This script works by listening for changes in the webpage's DOM and checking for new elements that may be overlays on the video player.

Below is a detailed breakdown of what each part of the script does:

  1. keyCombination: This is a key combination (shift + KeyD) that when pressed, will trigger the script to check for overlays on the video player and hide them.

  2. addStyle: This function takes a string argument, which is the CSS to be added to the webpage. This CSS makes any overlay elements collapse (become invisible).

  3. callbackA, callbackB, and callbackBmicro1: These are callbacks that are invoked when the webpage's DOM changes (new elements are added). They check if the new element is an overlay, and if so, they add it to a list of elements to hide.

  4. MutationObserver: This is an object that observes changes in the webpage's DOM. When a new element is added, it triggers callbackA.

  5. resizeCallback and makeHide: These functions are invoked when the video player is resized. They adjust the hiding of overlays to the new size of the video player.

  6. getVideoState: This function checks the current state of the video player, including its size and whether it is playing.

  7. postMessage and spreadMessage: These functions are used to send a message to all iframes in the webpage. The message is used to trigger the hiding of overlays in the iframe.

  8. tryUnhide: This function is used to attempt to unhide the overlay. It is invoked when the key combination is pressed and no overlays are currently hidden.

  9. keydown event listener: This event listener listens for when the key combination is pressed. When it is, it either unhides the overlays (if they are currently hidden) or hides them (if they are not).

  10. video-controls-hidden675 event listener: This event listener listens for a custom event that is dispatched when the video player is resized. When this event is fired, it re-hides the overlays.

The script runs on all websites (@match https://*/*) except those explicitly excluded, such as live chats on YouTube (@exclude https://www.youtube.com/live_chat*) and certain file types (@exclude /^https?://\S+\.(txt|png|jpg|jpeg|gif|xml|svg|manifest|log|ini)[^\/]*$/).

Please note that userscripts like this can sometimes interfere with the functionality of websites, so use with caution. Always ensure you trust the source of the script and understand what it does before installing it.

YouTube as an example: