Merge branch 'R74nCom:main' into main

This commit is contained in:
Cube14yt 2025-07-20 10:47:09 +08:00 committed by GitHub
commit ab0887383b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 417 additions and 1705 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");
}
@ -18071,7 +18076,7 @@ for (var k = 0; k < b0.split(" AND ").length; k++) {
}
saveDiscordList.setAttribute("data-page",page.toString());
let url = "https://sandboxels.live/browser/api/threads?limit=10&";
let url = (standaloneType === "discord" ? "/.proxy/api" : "https://sandboxels.live/browser/api") + "/threads?limit=10&";
url += "page="+page+"&";
if (sort) url += "sort="+sort+"&";
if (tag) url += "tags="+tag+"&";
@ -20249,7 +20254,16 @@ if (document.referrer && document.referrer.indexOf("r74n.") === -1) {
document.getElementById("gameDiv").classList.add("mobile");
}
if (standaloneType === "discord") {
document.getElementById("savesButton").style.display = "none";
// document.getElementById("savesButton").style.display = "none";
// document.querySelector("#savesMenu .menuTabs").style.display = "none";
document.querySelector("#savesMenu div.menuTab[data-tab='local']").classList.remove("selected");
document.querySelector("#savesMenu div.menuTab[data-tab='discord']").classList.add("selected");
document.querySelector("#savesMenu button.menuTab[data-tab='local']").classList.remove("selected");
document.querySelector("#savesMenu button.menuTab[data-tab='discord']").classList.add("selected");
document.querySelectorAll("#savesMenu button.menuTab").forEach((e) => {
if (e.id !== "savesTabDiscord") e.style.display = "none";
})
document.getElementById("savesButton").addEventListener("click", showDiscordSaves);
document.getElementById("modsButton").style.display = "none";
}
if (standaloneType === "steam") {

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);

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,6 @@
/*
Version 2.1.0
*/
let is2d = (arr)=>{
return arr.some(item => Array.isArray(item));
}

View File

@ -1,3 +1,6 @@
/*
Version 1.1.0
*/
Array.prototype.getClosest = function(num){
let arr = [];
for(value of this){
@ -129,7 +132,7 @@ elements.generate = {
b[b.length] = key;
}
}
promptInput("There are the following biomes available: \n"+ b.join(", "), (out)=>{
promptChoose("", b, (out)=>{
if(biomes[out] == undefined){
alert("Invalid Selection.");
} else {
@ -138,7 +141,7 @@ elements.generate = {
elements.generate.default = out;
selectElement("dirt");
}
}, "Enter biome to generate: ", elements.generate.default);
}, "Select a biome to generate: ");
}
}
for(item of enabledMods){