RedGifs Auto-hide Controls

A userscript that automatically hides RedGifs player controls and the cursor when the mouse is idle, restoring them on movement.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         RedGifs Auto-hide Controls
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  A userscript that automatically hides RedGifs player controls and the cursor when the mouse is idle, restoring them on movement.
// @author       vexxowo
// @icon         https://www.google.com/s2/favicons?sz=64&domain=redgifs.com
// @match        https://www.redgifs.com/*
// @match        https://redgifs.com/*
// @license      MIT
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function () {
  'use strict';

  const HIDE_DELAY = 2000; // ms of stillness before hiding

  const style = document.createElement('style');
  style.textContent = `
    .progressBar,
	  .SoundButton,
    .download-svg,
    .viewButton,
    .shareButton,
    .gifQualityButton,
    .FSButton {
      opacity: 0 !important;
      transition: opacity 0.3s ease !important;
      pointer-events: none !important;
    }
    body.rgf-active .progressBar,
	  body.rgf-active .SoundButton,
    body.rgf-active .download-svg,
    body.rgf-active .viewButton,
    body.rgf-active .shareButton,
    body.rgf-active .gifQualityButton,
    body.rgf-active .FSButton {
      opacity: 1 !important;
      pointer-events: auto !important;
    }
    body:not(.rgf-active) {
      cursor: none !important;
    }
  `;
  document.head.appendChild(style);

  let timer;

  document.addEventListener('mousemove', () => {
    document.body.classList.add('rgf-active');
    clearTimeout(timer);
    timer = setTimeout(() => {
      document.body.classList.remove('rgf-active');
    }, HIDE_DELAY);
  });
})();