discord edition patch

This commit is contained in:
slweeb 2025-07-19 13:54:04 -04:00
parent ec3ea2e783
commit e9fa0d65b5
2 changed files with 41 additions and 0 deletions

View File

@ -13263,6 +13263,11 @@ if (standalone) {
script.src = "mods/steam_port.js";
document.head.appendChild(script);
}
else if (standaloneType === "discord") {
var script = document.createElement('script');
script.src = "mods/discord_port.js";
document.head.appendChild(script);
}
document.documentElement.classList.add("standalone");
}

36
mods/discord_port.js Normal file
View File

@ -0,0 +1,36 @@
// For the Sandboxels Discord activity: https://discord.com/oauth2/authorize?client_id=1360770918732796117
function convertListeners() {
document.querySelectorAll("*[onclick]").forEach((e) => {
e.addEventListener("click", e.onclick);
e.removeAttribute("onclick");
})
document.querySelectorAll("*[oninput]").forEach((e) => {
e.addEventListener("input", e.oninput);
e.removeAttribute("oninput");
})
document.querySelectorAll("*[onchange]").forEach((e) => {
e.addEventListener("change", e.onchange);
e.removeAttribute("onchange");
})
}
_showPromptScreen = showPromptScreen;
showPromptScreen = function() {
_showPromptScreen();
convertListeners();
}
_showInfo = showInfo;
showInfo = function() {
_showInfo();
convertListeners();
}
_getDiscordSaves = getDiscordSaves;
getDiscordSaves = function() {
_getDiscordSaves();
convertListeners();
}
window.addEventListener("load", convertListeners);