Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Bonk.io Rainbow Name & Level (Lobby + In-Game) - Smooth
- // @namespace http://tampermonkey.net/
- // @version 2.1
- // @description Smooth glowing rainbow names and levels in lobby. Change speed here: setInterval(updateColors, 126) (line 64)
- // @author hello_me
- // @match *://bonk.io/*
- // @grant none
- // ==/UserScript==
- (function () {
- 'use strict';
- let hue = 0;
- let appliedElements = new Set(); // Track elements to avoid re-applying transitions
- function rainbowColor(h) {
- return `hsl(${h % 360}, 100%, 50%)`;
- }
- function applyTransition(element) {
- if (!appliedElements.has(element)) {
- element.style.transition = 'color 0.1s ease-in-out, text-shadow 0.1s ease-in-out';
- appliedElements.add(element);
- }
- }
- function updateColors() {
- hue = (hue + 5) % 360 // Faster color change - increased from 3.5 to 5
- // Apply to lobby
- const lobbyPlayers = document.querySelectorAll(".newbonklobby_playerentry");
- lobbyPlayers.forEach(player => {
- const nameTag = player.querySelector(".newbonklobby_playerentry_name");
- const levelTag = player.querySelector(".newbonklobby_playerentry_level");
- if (nameTag) {
- applyTransition(nameTag);
- nameTag.style.color = "#ffffff";
- nameTag.style.textShadow = `0 0 6px ${rainbowColor(hue)}, 0 0 12px ${rainbowColor(hue + 60)}, 0 0 18px ${rainbowColor(hue + 120)}`;
- nameTag.style.fontWeight = "bold";
- }
- if (levelTag) {
- applyTransition(levelTag);
- levelTag.style.color = rainbowColor(hue + 180);
- levelTag.style.fontWeight = "bold";
- }
- });
- // Apply to in-game player list (top-left scoreboard)
- const gamePlayers = document.querySelectorAll(".gamePlayers .gamePlayerText");
- gamePlayers.forEach(el => {
- applyTransition(el);
- el.style.color = rainbowColor(hue);
- el.style.textShadow = `0 0 6px ${rainbowColor(hue + 30)}, 0 0 12px ${rainbowColor(hue + 60)}`;
- el.style.fontWeight = "bold";
- });
- // Also check for other common player name selectors that might appear
- const otherPlayerElements = document.querySelectorAll(".playerName, .player-name, [class*='player'][class*='name']");
- otherPlayerElements.forEach(el => {
- applyTransition(el);
- el.style.color = rainbowColor(hue + 90);
- el.style.textShadow = `0 0 4px ${rainbowColor(hue + 120)}`;
- el.style.fontWeight = "bold";
- });
- }
- // Clean up tracked elements periodically to prevent memory leaks
- setInterval(() => {
- appliedElements.clear();
- }, 30000); // Clear every 30 seconds
- // Update colors every 100ms for faster animation - reduced from 150ms
- setInterval(updateColors, 126);
- // Initial update
- updateColors();
- })();
Advertisement