random bun scripts that dont fit anywhere else

Compare changes

Choose any two refs to compare.

+1
.data/tokensList.json
···
+
{"0c75ba92a404b78b7a47c5e7f7c0445a2c9b4da3710abbd8c86626a5a872914ef5ff3765e0c01e26a627f3a266ceed4dbe79b38d9550c857328dcb1a0729d389c9818bf66456bc2a468851134f0ff2a0c94693aa7a7bc27a79bd5daf6bfb5b7dd950ea0e457b7e117b92fbe586789b66c6369c0bf4343fc35f2d1bebf4253106647363dd946ce6c08000230073cdb1fabafd41cd6b3980826e0f6d5cef56dec0":1748872876777}
+1
.gitignore
···
# Finder (MacOS) folder config
.DS_Store
+
.data
+29
amazon-shortener.user.js
···
+
// ==UserScript==
+
// @name Amazon URL Cleaner
+
// @namespace https://tangled.sh/@dunkirk.sh/bunplayground/amazon-shortener
+
// @version 0.1
+
// @description Removes fluff from Amazon URLs to get clean product links
+
// @author You
+
// @match https://www.amazon.com/*
+
// @grant none
+
// @run-at document-start
+
// ==/UserScript==
+
+
(() => {
+
function cleanURL() {
+
const url = window.location.href;
+
const match = url.match(/amazon\.com.*?\/([A-Z0-9]{10})/);
+
if (match) {
+
const asin = match[1];
+
const clean = `https://www.amazon.com/dp/${asin}`;
+
if (url !== clean) {
+
window.history.replaceState(null, "", clean);
+
}
+
}
+
}
+
+
cleanURL();
+
+
window.addEventListener("locationchange", cleanURL);
+
window.addEventListener("popstate", cleanURL);
+
})();
bigboy.gz

This is a binary file and will not be displayed.

+63
bomb.ts
···
+
import { serve } from "bun";
+
import { file } from "bun";
+
+
const PORT = Number.parseInt(process.env.PORT || "3000");
+
const ZIP_FILE_PATH = "./bigboy.gz"; // Path to your compressed file
+
+
serve({
+
port: PORT,
+
async fetch(req) {
+
const url = new URL(req.url);
+
+
// Only serve the file at the /download endpoint
+
if (url.pathname === "/download") {
+
try {
+
// Use Bun's file API to get the compressed file
+
const compressedFile = file(ZIP_FILE_PATH);
+
const fileSize = compressedFile.size;
+
+
// Set headers to trigger browser decompression
+
const headers = new Headers();
+
headers.set("Content-Type", "application/octet-stream");
+
headers.set("Content-Length", fileSize.toString());
+
headers.set("Content-Encoding", "gzip");
+
headers.set("Content-Disposition", `attachment; filename="bomb.gz"`);
+
headers.set("Cache-Control", "no-store, max-age=0");
+
headers.set("ETag", `"${Math.random().toString(36).substring(2, 15)}"`);
+
headers.set("X-Compression-Ratio", "666:1");
+
+
return new Response(compressedFile.stream(), {
+
status: 200,
+
headers: headers,
+
});
+
} catch (error) {
+
console.error("Error serving file:", error);
+
return new Response("Error serving file", { status: 500 });
+
}
+
}
+
+
// Serve a simple HTML page with a download link
+
return new Response(
+
`
+
<!DOCTYPE html>
+
<html>
+
<head>
+
<title>File Download</title>
+
</head>
+
<body>
+
<h1>Compressed File Server</h1>
+
<p>Click below to download the file (104MB compressed, 100GB uncompressed)</p>
+
<a href="/download">Download File</a>
+
</body>
+
</html>
+
`,
+
{
+
headers: {
+
"Content-Type": "text/html",
+
},
+
},
+
);
+
},
+
});
+
+
console.log(`Server running at http://localhost:${PORT}`);
+46
bun.lock
···
"": {
"name": "bunplayground",
"dependencies": {
+
"@cap.js/middleware-elysia": "^0.0.1",
+
"elysia": "^1.3.3",
"terser": "^5.39.0",
},
"devDependencies": {
···
},
},
"packages": {
+
"@cap.js/middleware-elysia": ["@cap.js/middleware-elysia@0.0.1", "", { "dependencies": { "@cap.js/server": "^1.0.15", "elysia": "^1.3.3" } }, "sha512-cIGggp+gF+m3qr8DZ5Vcx9/+xohn616611X4uODDdOrgN7qhA57bXjKxEQS8+fo1gMGTMR8qomdUqI0TRJ3YNw=="],
+
+
"@cap.js/server": ["@cap.js/server@1.0.15", "", { "dependencies": { "@types/node": "^22.14.1", "typescript": "^5.8.3" } }, "sha512-mcDbHAL4ar5O4gnDE+62ZPeXhLXxd1KKHzJCsZfn81HY8Fgo5ousxYCnzhsLfki5sH6sO6jpNtS4MZXlKDq+fA=="],
+
"@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.8", "", { "dependencies": { "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA=="],
"@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="],
···
"@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="],
"@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.25", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ=="],
+
+
"@sinclair/typebox": ["@sinclair/typebox@0.34.33", "", {}, "sha512-5HAV9exOMcXRUxo+9iYB5n09XxzCXnfy4VTNW4xnDv+FgjzAGY989C28BIdljKqmF+ZltUwujE3aossvcVtq6g=="],
+
+
"@tokenizer/inflate": ["@tokenizer/inflate@0.2.7", "", { "dependencies": { "debug": "^4.4.0", "fflate": "^0.8.2", "token-types": "^6.0.0" } }, "sha512-MADQgmZT1eKjp06jpI2yozxaU9uVs4GzzgSL+uEq7bVcJ9V1ZXQkeGNql1fsSI0gMy1vhvNTNbUqrx+pZfJVmg=="],
+
+
"@tokenizer/token": ["@tokenizer/token@0.3.0", "", {}, "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A=="],
"@types/bun": ["@types/bun@1.2.6", "", { "dependencies": { "bun-types": "1.2.6" } }, "sha512-fY9CAmTdJH1Llx7rugB0FpgWK2RKuHCs3g2cFDYXUutIy1QGiPQxKkGY8owhfZ4MXWNfxwIbQLChgH5gDsY7vw=="],
···
"commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="],
+
"cookie": ["cookie@1.0.2", "", {}, "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA=="],
+
+
"debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="],
+
+
"elysia": ["elysia@1.3.3", "", { "dependencies": { "cookie": "^1.0.2", "exact-mirror": "0.1.2", "fast-decode-uri-component": "^1.0.1" }, "optionalDependencies": { "@sinclair/typebox": "^0.34.33", "openapi-types": "^12.1.3" }, "peerDependencies": { "file-type": ">= 20.0.0", "typescript": ">= 5.0.0" } }, "sha512-x6a89d4h0xX9TB0CSGkUuKNqIK776HBJw0WHtK1B3ViQqZijsLnOor6be/7TwVl8MG6m59NHGHbmbBS6lnCXSw=="],
+
+
"exact-mirror": ["exact-mirror@0.1.2", "", { "peerDependencies": { "@sinclair/typebox": "^0.34.15" }, "optionalPeers": ["@sinclair/typebox"] }, "sha512-wFCPCDLmHbKGUb8TOi/IS7jLsgR8WVDGtDK3CzcB4Guf/weq7G+I+DkXiRSZfbemBFOxOINKpraM6ml78vo8Zw=="],
+
+
"fast-decode-uri-component": ["fast-decode-uri-component@1.0.1", "", {}, "sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg=="],
+
+
"fflate": ["fflate@0.8.2", "", {}, "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A=="],
+
+
"file-type": ["file-type@21.0.0", "", { "dependencies": { "@tokenizer/inflate": "^0.2.7", "strtok3": "^10.2.2", "token-types": "^6.0.0", "uint8array-extras": "^1.4.0" } }, "sha512-ek5xNX2YBYlXhiUXui3D/BXa3LdqPmoLJ7rqEx2bKJ7EAUEfmXgW0Das7Dc6Nr9MvqaOnIqiPV0mZk/r/UpNAg=="],
+
+
"ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],
+
+
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
+
+
"openapi-types": ["openapi-types@12.1.3", "", {}, "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw=="],
+
+
"peek-readable": ["peek-readable@7.0.0", "", {}, "sha512-nri2TO5JE3/mRryik9LlHFT53cgHfRK0Lt0BAZQXku/AW3E6XLt2GaY8siWi7dvW/m1z0ecn+J+bpDa9ZN3IsQ=="],
+
"source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="],
"source-map-support": ["source-map-support@0.5.21", "", { "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w=="],
+
"strtok3": ["strtok3@10.2.2", "", { "dependencies": { "@tokenizer/token": "^0.3.0", "peek-readable": "^7.0.0" } }, "sha512-Xt18+h4s7Z8xyZ0tmBoRmzxcop97R4BAh+dXouUDCYn+Em+1P3qpkUfI5ueWLT8ynC5hZ+q4iPEmGG1urvQGBg=="],
+
"terser": ["terser@5.39.0", "", { "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.8.2", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, "bin": { "terser": "bin/terser" } }, "sha512-LBAhFyLho16harJoWMg/nZsQYgTrg5jXOn2nCYjRUcZZEdE3qa2zb8QEDRUGVZBW4rlazf2fxkg8tztybTaqWw=="],
+
+
"token-types": ["token-types@6.0.0", "", { "dependencies": { "@tokenizer/token": "^0.3.0", "ieee754": "^1.2.1" } }, "sha512-lbDrTLVsHhOMljPscd0yitpozq7Ga2M5Cvez5AjGg8GASBjtt6iERCAJ93yommPmz62fb45oFIXHEZ3u9bfJEA=="],
"typescript": ["typescript@5.8.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ=="],
+
"uint8array-extras": ["uint8array-extras@1.4.0", "", {}, "sha512-ZPtzy0hu4cZjv3z5NW9gfKnNLjoz4y6uv4HlelAjDK7sY/xOkKZv9xK/WQpcsBB3jEybChz9DPC2U/+cusjJVQ=="],
+
"undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="],
+
+
"@cap.js/server/@types/node": ["@types/node@22.15.29", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-LNdjOkUDlU1RZb8e1kOIUpN1qQUlzGkEtbVNo53vbrwDg5om6oduhm4SiUaPW5ASTXhAiP0jInWG8Qx9fVlOeQ=="],
+
+
"@cap.js/server/typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
+
+
"@cap.js/server/@types/node/undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
}
}
+17
cap.ts
···
+
import { Elysia, file } from "elysia";
+
import { capMiddleware } from "@cap.js/middleware-elysia";
+
+
new Elysia()
+
.use(
+
capMiddleware({
+
token_validity_hours: 0, // how long the token is valid for
+
tokens_store_path: ".data/tokensList.json",
+
token_size: 1600, // token size in bytes
+
scoping: "scoped", // 'global' | 'scoped'
+
}),
+
)
+
.get("/", () => "Hello Elysia!")
+
.listen(3000);
+
+
console.log("Server started on port 3000");
+
console.log("http://localhost:3000");
+2
package.json
···
"typescript": "^5"
},
"dependencies": {
+
"@cap.js/middleware-elysia": "^0.0.1",
+
"elysia": "^1.3.3",
"terser": "^5.39.0"
}
}
+282
som-shortcuts.user.js
···
+
// ==UserScript==
+
// @name Hack Club Summer Votes Helper
+
// @namespace http://tampermonkey.net/
+
// @version 0.2
+
// @description Enhance the voting experience on Hack Club Summer votes page
+
// @author You
+
// @match https://summer.hackclub.com/votes/new
+
// @match https://summer.hackclub.com/votes/*
+
// @grant none
+
// ==/UserScript==
+
+
(() => {
+
console.log("Hack Club Summer Votes Helper loaded");
+
+
function addHackClubSummerVotesHelperButton() {
+
// Prevent adding multiple buttons
+
if (document.getElementById("hackclub-summer-votes-helper-btn")) {
+
console.log("Button already exists, skipping");
+
return;
+
}
+
+
// Find the <p class="text-center"> element
+
const p = document.querySelector("p.text-center");
+
if (!p) {
+
console.log("Target element not found yet");
+
return;
+
}
+
+
console.log("Adding helper button");
+
+
// Create a new button
+
const openButton = document.createElement("button");
+
openButton.textContent = "Open Project Links";
+
openButton.style.margin = "10px";
+
openButton.style.display = "block";
+
openButton.style.marginLeft = "auto";
+
openButton.style.marginRight = "auto";
+
openButton.className = "som-button-primary";
+
openButton.id = "hackclub-summer-votes-helper-btn";
+
+
// Add click event to open the URLs
+
function openProjectLinks() {
+
console.log("Helper button clicked");
+
+
// Find all buttons with a div > span whose text is "Demo" or "Repository"
+
const allButtons = Array.from(
+
document.getElementsByClassName("som-button-primary"),
+
);
+
const filteredButtons = allButtons.filter((btn) => {
+
const spans = btn.querySelectorAll("div > span");
+
return Array.from(spans).some((span) => {
+
const text = span.textContent.trim();
+
return text === "Demo" || text === "Repository";
+
});
+
});
+
+
console.log(`Found ${filteredButtons.length} project buttons`);
+
+
filteredButtons.forEach((btn) => {
+
const url = btn.href || btn.getAttribute("data-href");
+
if (url) {
+
console.log(`Opening: ${url}`);
+
window.open(url, "_blank");
+
}
+
});
+
+
// Set the hidden inputs to true
+
const inputIds = [
+
"vote_project_1_demo_opened",
+
"vote_project_1_repo_opened",
+
"vote_project_2_demo_opened",
+
"vote_project_2_repo_opened",
+
];
+
+
inputIds.forEach((id) => {
+
const input = document.getElementById(id);
+
if (input) {
+
input.value = "true";
+
console.log(`Set ${id} to true`);
+
}
+
});
+
}
+
+
openButton.addEventListener("click", openProjectLinks);
+
+
p.appendChild(openButton);
+
console.log("Button added successfully");
+
}
+
+
function runHelperOnPageLoad() {
+
// Only run on the correct page
+
if (
+
window.location.pathname === "/votes/new" ||
+
window.location.pathname.startsWith("/votes/")
+
) {
+
console.log("Running helper on correct page");
+
addHackClubSummerVotesHelperButton();
+
}
+
}
+
+
// Initial run
+
runHelperOnPageLoad();
+
+
// Method 1: Intercept fetch/XMLHttpRequest to detect page changes
+
const originalFetch = window.fetch;
+
window.fetch = function (...args) {
+
return originalFetch.apply(this, args).then((response) => {
+
if (response.url.includes("/votes/new")) {
+
console.log("Detected fetch to votes page");
+
setTimeout(runHelperOnPageLoad, 100);
+
}
+
return response;
+
});
+
};
+
+
const originalXHROpen = XMLHttpRequest.prototype.open;
+
XMLHttpRequest.prototype.open = function (method, url, ...rest) {
+
this.addEventListener("load", () => {
+
if (url.includes("/votes/new")) {
+
console.log("Detected XHR to votes page");
+
setTimeout(runHelperOnPageLoad, 100);
+
}
+
});
+
return originalXHROpen.call(this, method, url, ...rest);
+
};
+
+
// Method 2: Enhanced MutationObserver
+
let observerTimeout;
+
const observer = new MutationObserver((_mutations) => {
+
// Debounce to avoid excessive calls
+
clearTimeout(observerTimeout);
+
observerTimeout = setTimeout(() => {
+
console.log("DOM mutation detected");
+
runHelperOnPageLoad();
+
}, 50);
+
});
+
+
// Observe the entire document for changes
+
observer.observe(document.documentElement, {
+
childList: true,
+
subtree: true,
+
attributes: false,
+
});
+
+
// Method 3: Polling fallback (less elegant but very reliable)
+
setInterval(() => {
+
if (
+
window.location.pathname === "/votes/new" ||
+
window.location.pathname.startsWith("/votes/")
+
) {
+
if (!document.getElementById("hackclub-summer-votes-helper-btn")) {
+
console.log("Button missing, re-adding via polling");
+
addHackClubSummerVotesHelperButton();
+
}
+
}
+
}, 2000);
+
+
// Method 4: Listen for history changes
+
const originalPushState = history.pushState;
+
const originalReplaceState = history.replaceState;
+
+
history.pushState = function (...args) {
+
originalPushState.apply(this, args);
+
setTimeout(runHelperOnPageLoad, 100);
+
};
+
+
history.replaceState = function (...args) {
+
originalReplaceState.apply(this, args);
+
setTimeout(runHelperOnPageLoad, 100);
+
};
+
+
window.addEventListener("popstate", () => {
+
setTimeout(runHelperOnPageLoad, 100);
+
});
+
+
// Method 5: Listen for focus events (when user returns to tab)
+
window.addEventListener("focus", () => {
+
setTimeout(runHelperOnPageLoad, 100);
+
});
+
+
// Add listener for Shift + S shortcut
+
window.addEventListener("keydown", (e) => {
+
// Ignore if input/textarea/select is focused
+
const tag = document.activeElement.tagName;
+
if (
+
tag === "INPUT" ||
+
tag === "TEXTAREA" ||
+
tag === "SELECT" ||
+
document.activeElement.isContentEditable
+
) {
+
return;
+
}
+
if (e.shiftKey && (e.key === "s" || e.key === "S")) {
+
// Only run on the correct page
+
if (
+
window.location.pathname === "/votes/new" ||
+
window.location.pathname.startsWith("/votes/")
+
) {
+
const btn = document.getElementById("hackclub-summer-votes-helper-btn");
+
if (btn) {
+
btn.click();
+
} else {
+
// If button not present, run the logic directly
+
// (duplicate logic from openButton click)
+
// Find all buttons with a div > span whose text is "Demo" or "Repository"
+
const allButtons = Array.from(
+
document.getElementsByClassName("som-button-primary"),
+
);
+
const filteredButtons = allButtons.filter((btn) => {
+
const spans = btn.querySelectorAll("div > span");
+
return Array.from(spans).some((span) => {
+
const text = span.textContent.trim();
+
return text === "Demo" || text === "Repository";
+
});
+
});
+
+
filteredButtons.forEach((btn) => {
+
const url = btn.href || btn.getAttribute("data-href");
+
if (url) {
+
window.open(url, "_blank");
+
}
+
});
+
+
// Set the hidden inputs to true
+
const inputIds = [
+
"vote_project_1_demo_opened",
+
"vote_project_1_repo_opened",
+
"vote_project_2_demo_opened",
+
"vote_project_2_repo_opened",
+
];
+
+
inputIds.forEach((id) => {
+
const input = document.getElementById(id);
+
if (input) {
+
input.value = "true";
+
}
+
});
+
}
+
// Prevent default browser behavior
+
e.preventDefault();
+
}
+
}
+
});
+
+
// Add listener for Ctrl+Enter to submit vote, even in a textbox
+
window.addEventListener("keydown", (e) => {
+
if (e.ctrlKey && (e.key === "Enter" || e.keyCode === 13)) {
+
// Only run on the correct page
+
if (
+
window.location.pathname === "/votes/new" ||
+
window.location.pathname.startsWith("/votes/")
+
) {
+
// Find the submit vote button
+
// <button name="button" type="submit" class="som-button-primary " data-form-target="submitButton">
+
// <div class="flex items-center justify-center gap-2">
+
// <span class="flex items-center gap-1">Submit Vote</span>
+
// </div>
+
// </button>
+
const submitButtons = Array.from(
+
document.querySelectorAll(
+
'button.som-button-primary[data-form-target="submitButton"]',
+
),
+
);
+
let found = false;
+
for (const btn of submitButtons) {
+
// Check if the button contains a span with text "Submit Vote"
+
const span = btn.querySelector("span");
+
if (span && span.textContent.trim() === "Submit Vote") {
+
btn.click();
+
found = true;
+
break;
+
}
+
}
+
if (found) {
+
e.preventDefault();
+
}
+
}
+
}
+
});
+
+
console.log("All event listeners and observers set up");
+
})();