Geoguessr | text with trembling and rainbow effect

Im The Best

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Geoguessr | text with trembling and rainbow effect
// @description  Im The Best
// @version      1.0
// @grant        none
// @match        https://www.geoguessr.com/*
// @license      MIT
// @namespace    https://greasyfork.org/it/users/1100610-pugliah
// ==/UserScript==

(function() {
  'use strict';

  // Seleziona gli elementi dei pulsanti
  var buttons = document.querySelectorAll('.game-menu-button_button__WPwVi');

  // Funzione per generare un numero casuale tra min e max
  function getRandomNumber(min, max) {
    return Math.random() * (max - min) + min;
  }

  // Funzione per aggiornare la posizione di un pulsante in modo casuale
  function shakeButton(button) {
    var xPos = getRandomNumber(-2, 2) + 'px';
    var yPos = getRandomNumber(-2, 2) + 'px';
    button.style.transform = 'translate(' + xPos + ', ' + yPos + ')';
  }

  // Funzione per generare un colore casuale dell'arcobaleno
  function getRandomRainbowColor() {
    var hue = Math.floor(Math.random() * 360);
    return 'hsl(' + hue + ', 100%, 50%)';
  }

  // Funzione per animare il colore dell'elemento
  function animateRainbowColor(element) {
    var hue = 0;
    var saturation = 100;
    var lightness = 50;
    setInterval(function() {
      hue = (hue + 1) % 360;
      var color = 'hsl(' + hue + ', ' + saturation + '%, ' + lightness + '%)';
      element.style.color = color;
    }, 10); // Regola la velocità dell'animazione cambiando il valore 10
  }

  // Funzione per avviare l'effetto di tremolio e colore arcobaleno per ogni pulsante
  function startShaking() {
    buttons.forEach(function(button) {
      shakeButton(button);
      animateRainbowColor(button);
      setInterval(function() {
        shakeButton(button);
      }, 100); // Regola la velocità del tremolio cambiando il valore 100
    });
  }

  // Avvia l'effetto di tremolio e colore arcobaleno quando la pagina è completamente caricata
  window.addEventListener('load', startShaking);
})();