Custom ShellShock Theme

Custom theme for ShellShock.io with background and skybox fixes

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Custom ShellShock Theme
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Custom theme for ShellShock.io with background and skybox fixes
// @author       Anonymous
// @match        *://shellshock.io/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Ensure the custom background image is applied
    function setCustomBackground() {
        document.body.style.backgroundImage = "url('https://images.wallpapersden.com/image/download/obito-uchiha-cool-4k_bGllbm6UmZqaraWkpJRoa2lprWdlaW4.jpg')";
        document.body.style.backgroundSize = "cover";
        document.body.style.backgroundRepeat = "no-repeat";
        document.body.style.backgroundAttachment = "fixed";
    }
    setCustomBackground();

    // Ensure the skybox is set to the base64 image
    function setSkybox() {
        const sky = document.querySelector('.skybox'); // Adjust the selector based on the game's DOM
        if (sky) {
            sky.style.backgroundImage = "url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxITEhISEhIVFRUWFRcVFRUVFRUVFRUVFRcYFhUVFRUYHSggGBolGxcVITEhJSkrLi4uFx8zODMtNygtLisBCgoKDg0OGhAQFy0dHR0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0rKy0tLS0tLS0tNi0tLSstK//AABEIALEBHAMBIgACEQEDEQH/xAAbAAADAQEBAQEAAAAAAAAAAAADBAUCAQAGB//EADUQAAIBAgMFCAEEAgEFAAAAAAABAgMRBCExBUFRcYESIjJhkbHB8KETQtHhI3IzFFJigsL/xAAZAQADAQEBAAAAAAAAAAAAAAABAgMABAX/xAAhEQACAgMAAwADAQAAAAAAAAAAAQIRAyExEjJBBCJhQv/aAAwDAQACEQMRAD8A/...')";
            sky.style.backgroundSize = "cover";
            sky.style.backgroundRepeat = "no-repeat";
            sky.style.backgroundAttachment = "fixed";
        }
    }
    setSkybox();

    // Observer to apply the skybox fix whenever the skybox is re-rendered
    new MutationObserver(setSkybox).observe(document.body, { childList: true, subtree: true });

    // Modify the kill message
    const originalFunction = window.someKillFunction; // Replace `someKillFunction` with the actual function name that handles kill messages
    window.someKillFunction = function(killer, victim) {
        const message = `${killer} obliterated ${victim}`;
        originalFunction.call(this, killer, victim, message);
    };

    // Ensure scope colors are set for specific weapons
    const customScopeColor = "#880808";
    const css = `
        .scope-crackshot { border-color: ${customScopeColor} !important; }
        .scope-rpegg { border-color: ${customScopeColor} !important; }
        .scope-free-ranger { border-color: ${customScopeColor} !important; }
    `;
    const style = document.createElement("style");
    style.type = "text/css";
    style.appendChild(document.createTextNode(css));
    document.head.appendChild(style);
})();