ShellShockers Theme Manager

Shellshockers theme manager.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

Yazar
菜鳥殺手
Günlük kurulumlar
0
Toplam kurulumlar
1.265
Değerlendirmeler
0 0 0
Versiyon
2.5
Oluşturulma
28.11.2021
Güncellenme
28.11.2021
Boyut
6,98 KB
Lisans
N/A
Geçerli

// ==UserScript==
// @name ShellShockers Theme Manager
// @version 2.5
// @description Shellshockers theme manager.
// @author helloworld
// @match https://shellshock.io/*
// @grant none
// ==/UserScript==

/*
Thank you to TDStuart for some code snippets
And Thank you to all the people who created the themes for the game!
*/

(function () {
let hideKey = localStorage.getItem("themeHideKey")
if (hideKey == "undefined" || hideKey == undefined) {
localStorage.setItem("themeHideKey", "KeyX")
}
document.addEventListener("keyup", e => {
if (e.code == localStorage.themeHideKey) { //default key is KeyX.
if (window.themeGui.panel) {
window.themeGui.panel.container.hidden = !window.themeGui.panel.container.hidden;
}
}
})
let themes = localStorage.getItem("themes");
if (themes == "undefined" || themes == undefined) {
localStorage.themes = `{"Professor Jax":{"stylecss":"https://myclientsites.com/adamx/profjax/style.css","gamecss":"https://myclientsites.com/adamx/profjax/game.css"},"Nipper Ninja":{"stylecss":"https://www.myclientsites.com/adamx/shell-themes/nipperstyle.css","gamecss":"https://www.myclientsites.com/adamx/shell-themes/nippergame.css"},"Black-Green":{"stylecss":"https://myclientsites.com/adamx/shell-themes/Black-Green/style.css","gamecss":"https://myclientsites.com/adamx/shell-themes/Black-Green/game.css"},"Purple-Pink":{"stylecss":"https://www.myclientsites.com/shell-themes/Purple-Pink.css"},"Grey":{"stylecss":"https://www.myclientsites.com/shell-themes/Grey.css"},"Black-Red":{"stylecss":"https://www.myclientsites.com/shell-themes/Black-Red.css"},"Black-Red-Blue":{"stylecss":"https://www.myclientsites.com/shell-themes/Black-Red-Blue.css"},"Darkmode Goon (by MK)":{"stylecss":"https://shellmods.helloworld1976.repl.co/themes/darktheme.css"}}`
themes = JSON.parse(localStorage.getItem("themes"))
}
else { themes = JSON.parse(localStorage.getItem("themes")) }

window.themeMod = {
loadGui: () => { },
loadComponents: () => { },
deleteComponents: () => { },
modMenu: {
themeSettings: {
type: "None",
container: {
label: {},
},
},
},
};
window._utils = {};
window._utils.requirelib = async function (url, global) {
return new Promise(async function (resolve) {
async function getCode() {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", url, false);
xmlHttp.send(null);
return xmlHttp.responseText;
}
let code = await getCode();

if (global) {
code += 'window["' + global + '"] = ' + global + ";";
}
let evaluateCode = new Function(code);
evaluateCode();
resolve("done");
});
};
window._utils.requirelib("https://unpkg.com/[email protected]/lib/guify.min.js")
.then(() => {
window.themeMod.loadGui();
});

function updateTheme(theme) {
localStorage.setItem("theme", theme);
if (theme == "Default") { removeTheme() }
else { removeTheme(); loadTheme(); }
}
function loadTheme() {
const loadtheme = localStorage.getItem("theme")
if (loadtheme == "Default" || !loadtheme || loadtheme == undefined || loadtheme == "undefined") { return; }
const addScript = () => {
let style = document.createElement('link');
style.id = "customstylecss"
style.rel = 'stylesheet';
style.href = themes[loadtheme].stylecss;
document.head.appendChild(style);
if (themes[loadtheme].gamecss) {
let style2 = document.createElement('link');
style2.id = "customgamecss"
style2.rel = 'stylesheet';
style2.href = themes[loadtheme].gamecss;
document.head.appendChild(style2)
}
}
if (document.body) {
addScript();
}
else {
document.addEventListener('DOMContentLoaded', function (e) {
addScript();
})
}
}
function removeTheme() {
if (document.getElementById("customstylecss")) { document.getElementById("customstylecss").remove() }
if (document.getElementById("customgamecss")) { document.getElementById("customgamecss").remove() }
}

if (localStorage.getItem("theme")) { loadTheme(); }
if (localStorage.getItem("theme") == undefined || localStorage.getItem("theme") == "undefined") { localStorage.setItem("theme", "default"); }
function changeHideHotkey() {
let newkey = prompt(`Enter key name (eg. "KeyX")`)
if (newkey.startsWith("Key") && newkey.length == 4) {
localStorage.themeHideKey = newkey
}
else {
alert(`The new key must start with "Key" (eg. "KeyX")`)
}
}
function addThemeSheet() {
let url = prompt("Please enter theme stylesheet url"),
name = prompt("Please enter name", "New Theme")
if (url.startsWith("https://") && !name.includes('"')) {
themes[name] = { stylecss: url };
localStorage.themes = JSON.stringify(themes);
window.themeMod.deleteComponents()
window.themeMod.loadComponents()
}
else {
alert(`url must start with "https://" and name must not include "`)
}
}
function removeThemeSheet() {
if (localStorage.theme !== "Default") {
try {
delete themes[localStorage.theme]
localStorage.themes = JSON.stringify(themes);
window.themeMod.deleteComponents()
window.themeMod.loadComponents()
updateTheme("Default")
}
catch {
alert("Something went wrong.")
}

}
}
let menu, addThemeButton, removeThemeButton, hideButton, credits;
window.themeMod.loadGui = function () {
window.themeGui = new window.guify({
title: "ShellShockers Theme Manager",
theme: "dark",
align: "left",
width: 400,
barMode: "none",
opacity: 0.90,
root: document.body,
open: true,
});
window.themeMod.loadComponents()
};
window.themeMod.deleteComponents = () => {
window.themeGui.Remove(menu)
window.themeGui.Remove(addThemeButton)
window.themeGui.Remove(removeThemeButton)
window.themeGui.Remove(hideButton)
window.themeGui.Remove(credits)
}
window.themeMod.loadComponents = () => {
menu = window.themeGui.Register({
type: "select",
label: "Theme",
object: window.themeMod.modMenu.themeSettings,
property: "type",
initial: localStorage.theme,
options: ["Default", ...Object.keys(themes)],
onChange: updateTheme,
});
addThemeButton = window.themeGui.Register({
type: "button",
label: "Add Theme",
action: addThemeSheet,
});
removeThemeButton = window.themeGui.Register({
type: "button",
label: "Remove Current Theme",
action: removeThemeSheet,
});
hideButton = window.themeGui.Register({
type: "button",
label: "Change Hide Hotkey",
action: changeHideHotkey,
});
credits = window.themeGui.Register({
type: "text",
label: "Credits",
});
credits.container.innerHTML = `

Made by Helloworld

`;
}
})();