CHATTERMAX
Hang out with your friends. Chat in rooms, talk out loud, and play games together.
Hang out with your friends. Chat in rooms, talk out loud, and play games together.
Start a room or join with a code, then talk live with up to 8 friends.
Tic-Tac-Toe, Connect 4, and Rock Paper Scissors with friends or the computer.
Add friends, see who's online, and join the room they're in.
Chat with an AI helper anytime, even when your friends are offline.
Send private messages to a friend, just the two of you.
Pick something from the sidebar to get started.
AI answers can be wrong. Don't share private info like your address or passwords.
A blocky 100-player battle royale. Drop in, loot up, outlast everyone.
' + 'Works with a keyboard and mouse, an Xbox or other controller, or touch controls. Online matches use peer-to-peer connections, so one player hosts each match.
'; w.querySelector(".wzplay").onclick = async () => { try { if (window.CMGameSave) await Promise.race([window.CMGameSave.restore(), new Promise(r => setTimeout(r, 2500))]); } catch (e) {} launch(); }; root.appendChild(w); try { drawExtras(w); } catch (e) {} } function wzTier(rp){ return rp >= 1000 ? "Champion" : rp >= 700 ? "Diamond" : rp >= 450 ? "Platinum" : rp >= 250 ? "Gold" : rp >= 100 ? "Silver" : "Bronze"; } function el(tag, cls, txt){ const e = document.createElement(tag); if (cls) e.className = cls; if (txt != null) e.textContent = txt; return e; } function ago(t){ const m = Math.max(0, Math.floor((Date.now() - t) / 60000)); return m < 1 ? "just now" : m < 60 ? m + "m ago" : m < 1440 ? Math.floor(m / 60) + "h ago" : Math.floor(m / 1440) + "d ago"; } function drawExtras(w){ let prog = null, x4 = null; try { prog = JSON.parse(localStorage.getItem("wz_prog_v1") || "null"); } catch (e) {} try { x4 = JSON.parse(localStorage.getItem("wz_x4") || "null"); } catch (e) {} const tot = (prog && prog.tot) || {}, rp = Math.max(0, +(prog && prog.rp) || 0), box = el("div", "wzstats"); const head = el("div", "wzrow"); head.append(el("b", "", "Your rank"), el("span", "", wzTier(rp) + " · " + Math.round(rp) + " RP")); box.append(head); const grid = el("div", "wzgrid"); for (const [k, v] of [["Matches", tot.games || 0], ["Wins", tot.wins || 0], ["Kills", tot.kills || 0], ["Best kills", tot.bestK || 0], ["Top 3s", tot.top3 || 0], ["Revives", tot.rev || 0]]) { const c = el("div", "wzcell"); c.append(el("b", "", String(v)), el("span", "", k)); grid.append(c); } box.append(grid); const hist = (x4 && Array.isArray(x4.hist) ? x4.hist : []).slice(0, 8), hb = el("div", "wzhist"); hb.append(el("b", "", "Recent matches")); if (!hist.length) hb.append(el("span", "wzmu", "No matches yet. Play one and it shows up here.")); for (const m of hist) { const r = el("div", "wzmrow"); r.append(el("span", m.win ? "wzwin" : "", m.win ? "Victory" : "#" + (m.place || "?")), el("span", "", (m.kills || 0) + " kills · " + (m.dmg || 0) + " dmg"), el("span", "wzmu", (m.mode || "Classic") + (m.online ? " · online" : "") + " · " + ago(m.t || 0))); hb.append(r); } box.append(hb); const lb = el("div", "wzlb"), lbh = el("div", "wzrow"); lbh.append(el("b", "", "Leaderboard")); const sel = el("select", "wzsel"); for (const [v, t] of [["all", "Everyone"], ["friends", "Friends"]]) { const o = el("option", "", t); o.value = v; sel.append(o); } lbh.append(sel); lb.append(lbh); const list = el("div", "wzlist"); lb.append(list); box.append(lb); const load = async () => { list.replaceChildren(el("span", "wzmu", "Loading...")); const A = window.CM_WZ_SHOP; let r = null; try { r = await window.CMUI.call("sys/leaderboard", {kind: "rank", game: "warzone", scope: sel.value}); } catch (e) {} const d = r && r.data; list.replaceChildren(); if (!d || d.ok === false) { list.append(el("span", "wzmu", "Log in to see the leaderboard.")); return; } if (!d.rows.length) list.append(el("span", "wzmu", "Nobody is ranked yet. Win some matches to be first.")); d.rows.slice(0, 10).forEach((x, i) => { const row = el("div", "wzmrow" + (x.you ? " wzyou" : "")); row.append(el("span", "", String(i + 1)), el("span", "", x.username + (x.you ? " (you)" : "")), el("span", "wzmu", wzTier(x.v) + " · " + x.v + " RP")); list.append(row); }); }; sel.onchange = load; load(); w.append(box); } window.CM_WZ_REPORT = async function(name, where){ try { const nm = String(name || "").trim().slice(0, 30); if (!nm) return {ok: false, error: "No name to report."}; const s = await window.CMUI.call("social/search", {q: nm}), list = (s && s.data && s.data.results) || [], hit = list.find(x => String(x.username || "").toLowerCase() === nm.toLowerCase()); if (!hit) return {ok: false, error: "Couldn't find that player on ChatterMax."}; const r = await window.CMUI.call("social/report", {target: hit.id, reason: "Game chat", detail: String(where || "Cube Crazy Royale").slice(0, 200)}); return r && r.data && r.data.ok ? {ok: true} : {ok: false, error: (r && r.data && r.data.error && r.data.error.message) || "Couldn't send the report."}; } catch (e) { return {ok: false, error: "Couldn't send the report."}; } }; window.CM_WZ_JOIN = function(code){ close(); const b = document.querySelector('.side-item[data-sec="warzone"]'); if (b) b.click(); setTimeout(() => launch({join: code}), 150); }; window.CM_WZ_INVITE_UI = async function(code, custom){ const a = window.getAccount && window.getAccount(); if (!a || !a.token) { alert("Log in to invite friends. Your code is " + code); return; } let friends = []; try { const r = await api("social/me", {token: a.token}); if (r && r.data && r.data.ok) friends = r.data.friends || []; } catch (e) {} const ov = document.createElement("div"); ov.style.cssText = "position:fixed;inset:0;z-index:9500;background:rgba(5,8,14,.8);display:flex;align-items:center;justify-content:center;padding:16px"; const card = document.createElement("div"); card.style.cssText = "background:#1d1a16;border:1px solid #2e2a24;border-radius:16px;padding:20px;width:min(380px,100%);max-height:80vh;overflow:auto;color:#efe8dd;font:14px ui-sans-serif,system-ui,sans-serif;display:flex;flex-direction:column;gap:10px"; card.innerHTML = ""; card.children[0].textContent = custom ? custom.title : "Invite friends to your match"; card.children[1].textContent = custom ? custom.note : "They get a DM with a Join button. Code: " + code; if (!friends.length) card.innerHTML += "No friends to invite yet. Share the code instead."; for (const f of friends) { const row = document.createElement("div"); row.style.cssText = "display:flex;justify-content:space-between;align-items:center;gap:10px;background:#2a2620;border-radius:10px;padding:8px 12px"; const nm = document.createElement("span"); nm.textContent = f.username; const bt = document.createElement("button"); bt.type = "button"; bt.textContent = custom ? custom.btn : "Invite"; bt.style.cssText = "border:0;border-radius:8px;padding:6px 14px;background:#ff8a1a;color:#1a0d00;font-weight:700;cursor:pointer"; bt.onclick = async () => { bt.disabled = true; bt.textContent = "Sending..."; try { const r = await api("dm/send", {token: a.token, to: f.id, text: custom ? custom.text : "Join my Cube Crazy Royale match! Code: WZ-" + code}); bt.textContent = r && r.data && r.data.ok ? "Sent ✓" : "Failed"; } catch (e) { bt.textContent = "Failed"; } }; row.append(nm, bt); card.appendChild(row); } const x = document.createElement("button"); x.type = "button"; x.textContent = "Close"; x.style.cssText = "border:1px solid #3a352d;background:transparent;color:inherit;border-radius:10px;padding:8px;cursor:pointer"; x.onclick = () => ov.remove(); card.appendChild(x); ov.appendChild(card); ov.onclick = e => { if (e.target === ov) ov.remove(); }; (shell || document.body).appendChild(ov); }; function drawZ(){ root.innerHTML = ""; const w = document.createElement("div"); w.className = "wzcard"; w.innerHTML = 'The dead have risen. Hold out against endless waves, or fight your way through a story.
' + 'Play solo or bring an AI squad. Works with a keyboard and mouse, a controller, or touch controls.
'; try { const best = JSON.parse(localStorage.getItem("wz_zbest") || "[]"); if (best.length) { const bx = document.createElement("div"); bx.className = "wzstats"; bx.innerHTML = "Best runs on this device"; for (const r of best.slice(0, 5)) { const row = document.createElement("div"); row.className = "wzmrow"; const a = document.createElement("span"); a.textContent = "Wave " + r.w; const c = document.createElement("span"); c.textContent = r.k + " kills"; const m = document.createElement("span"); m.className = "wzmu"; m.textContent = ({zinsane: "Insanity", zombies: "Survival"})[r.m] || "Survival"; row.append(a, c, m); bx.append(row); } w.append(bx); } } catch (e) {} w.querySelector(".wzplay").onclick = () => launch({zg: true}); root.appendChild(w); } window.CM_VIEWS = window.CM_VIEWS || {}; window.CM_VIEWS.zombies = {open(el){ root = el; drawZ(); }, leave(){ close(); }}; window.CM_VIEWS.warzone = {open(el){ root = el; draw(); }, leave(){ close(); }}; function drawShop(){ root.innerHTML = ""; root.style.cssText = "position:relative;height:calc(100vh - 20px);min-height:520px"; const f = document.createElement("iframe"); f.title = "Skin Shop"; f.style.cssText = "width:100%;height:100%;border:0;display:block;background:#0b0f16;border-radius:12px"; f.setAttribute("allow", "autoplay"); f.addEventListener("load", () => { try { f.contentWindow.Warzone.setName(userName()); f.contentWindow.Warzone.shopOnly(); } catch (e) {} }); f.srcdoc = gameHtml(false); root.appendChild(f); shopFrame = f; } let shopFrame = null; window.CM_VIEWS.skinshop = {open(el){ root = el; drawShop(); }, leave(){ try { if (shopFrame) { shopFrame.remove(); shopFrame = null; } root.style.cssText = ""; } catch (e) {} }}; })(); /* TUMBLE DASH inside ChatterMax: a bright one-button runner that opens full screen in an iframe. */ (function(){ let root = null, shell = null, frame = null; function close(){ if (frame) { frame.remove(); frame = null; } if (shell) { shell.remove(); shell = null; } document.documentElement.style.overflow = ""; } window.CM_TUMBLE_EXIT = close; /* ghosts: the best runs on each level are kept on the server so you can race other people's ghosts */ window.CM_TUMBLE_GHOST = { get: async k => { try { const a = window.getAccount && window.getAccount(); if (!a || !a.token) return []; const r = await window.forge("/x/tdg/get", {token: a.token, lvl: k}); return (r.data && r.data.ok && r.data.list) || []; } catch (e) { return []; } }, put: async (k, g) => { try { const a = window.getAccount && window.getAccount(); if (!a || !a.token) return; await window.forge("/x/tdg/put", {token: a.token, lvl: k, t: g.t, c: g.c, p: g.p}); } catch (e) {} } }; function launch(){ if (frame) return; const el = document.getElementById("tumbleSrc"); if (!el) return; shell = document.createElement("div"); shell.style.cssText = "position:fixed;inset:0;z-index:9000;background:#7fd3ff"; frame = document.createElement("iframe"); frame.title = "Tumble Dash"; frame.setAttribute("allow", "autoplay; fullscreen"); frame.style.cssText = "width:100%;height:100%;border:0;display:block;background:#7fd3ff"; frame.addEventListener("load", () => { try { frame.contentWindow.focus(); } catch (e) {} }); frame.srcdoc = el.textContent.split("__WZ_CLOSE_SCRIPT__").join("TUMBLE DASHOne button. Jump, double jump, and tumble through 23 levels. Race see-through ghosts of the fastest players on every level, or strap on a jetpack in The Verts.
' + 'Space, up arrow, click or tap to jump. Tap again in the air to double jump. P pauses, M mutes.
'; w.querySelector(".wzplay").onclick = launch; root.appendChild(w); } window.CM_VIEWS = window.CM_VIEWS || {}; window.CM_VIEWS.tumble = {open(el){ root = el; draw(); }, leave(){ close(); }}; })(); /* CONNECTORS: a directory of MCP servers people apply to add. The admin approves them; once switched on, Claude models in AI Chat can use their tools. */ (function(){ let root = null, alive = 0; const H = (...a) => window.T2.h(...a), B = (t, fn, cls) => H("button", {type: "button", class: "gbtn" + (cls ? " " + cls : ""), text: t, onclick: fn}); const tok = () => { try { return (window.getAccount() || {}).token; } catch (e) { return null; } }; const say = t => { try { window.CMUI.toast(t); } catch (e) {} }; const call = async (a, b) => { try { const r = await window.forge("/x/conn/" + a, Object.assign({token: tok()}, b || {})); return r.data || {}; } catch (e) { return {ok: false, error: {message: "Couldn't reach ChatterMax."}}; } }; const err = r => (r && r.error && r.error.message) || "Something went wrong. Is the server on build 177?"; const ico = (src, name) => src ? H("img", {src, alt: "", width: "44", height: "44", style: "width:44px;height:44px;border-radius:12px;object-fit:cover;flex:none;background:#2e2a24"}) : H("div", {style: "width:44px;height:44px;border-radius:12px;flex:none;background:#2e2a24;display:grid;place-items:center;font:800 18px Figtree,system-ui,sans-serif", text: (name || "?")[0].toUpperCase()}); const shrink = f => new Promise((ok, no) => { const r = new FileReader(); r.onload = () => { const im = new Image(); im.onload = () => { const c = document.createElement("canvas"); c.width = c.height = 96; const x = c.getContext("2d"), m = Math.min(im.width, im.height); x.drawImage(im, (im.width - m) / 2, (im.height - m) / 2, m, m, 0, 0, 96, 96); ok(c.toDataURL("image/png")); }; im.onerror = () => no(); im.src = r.result; }; r.onerror = () => no(); r.readAsDataURL(f); }); async function draw(){ const my = ++alive; root.replaceChildren(H("p", {class: "cm-muted", text: "Loading connectors…"})); if (!tok()) { root.replaceChildren(H("p", {class: "cm-muted", text: "Log in to use connectors."})); return; } const d = await call("list"); if (my !== alive) return; if (!d.ok) { root.replaceChildren(H("p", {class: "cm-muted", text: err(d)})); return; } const on = new Set(d.on || []), wrap = H("div", {class: "t2-wrap"}); /* the directory */ const list = H("div", {class: "cm-list"}); for (const c of d.list) { const sw = H("input", {type: "checkbox", "aria-label": "Use " + c.name + " in AI chat", style: "width:22px;height:22px;accent-color:#ff7a2f"}); sw.checked = on.has(c.id); sw.onchange = async () => { const r = await call("toggle", {id: c.id, on: sw.checked}); if (!r.ok) { sw.checked = !sw.checked; say(err(r)); } else say(sw.checked ? c.name + " is on. Claude models in AI Chat can use it now." : c.name + " is off."); }; list.append(H("div", {class: "cm-item"}, ico(c.icon, c.name), H("div", {class: "cm-grow"}, H("b", {text: c.name}), H("span", {class: "cm-muted", text: (c.desc || "No description.") + (c.by ? " · added by " + c.by : "")}), c.tools && c.tools.length ? H("span", {class: "cm-muted", style: "font-size:12px", text: "Tools: " + c.tools.join(", ")}) : null), H("label", {style: "display:flex;gap:8px;align-items:center;cursor:pointer"}, sw, H("span", {text: "Use in AI chat"})))); } wrap.append(H("section", {class: "cm-card t2-card"}, H("h2", {text: "Connectors", style: "margin:0"}), H("p", {class: "cm-muted", text: "Connectors give the AI extra tools, like looking things up in another app. Switch one on and the Claude models in AI Chat can use it when it helps (up to 5 at once). The free Llama models can't use connectors. Only switch on connectors you trust: what you ask the AI can be sent to that connector's server."}), d.list.length ? list : H("p", {class: "cm-muted", text: "No connectors yet. Be the first to add one below."}))); /* apply */ let icon = "", nm = "", url = "", desc = ""; const prev = H("div", {}, ico("", "?")); const file = H("input", {type: "file", accept: "image/png,image/jpeg,image/webp", "aria-label": "Icon", onchange: async e => { const f = e.target.files && e.target.files[0]; if (!f) return; try { icon = await shrink(f); prev.replaceChildren(ico(icon, nm)); } catch (x) { say("That picture couldn't be opened."); } }}); const go = B("Send for approval", async () => { go.disabled = true; const r = await call("apply", {name: nm, url, desc, icon}); go.disabled = false; if (r.ok) { say("Sent! The admin will look at it. You'll get a message when it's approved."); draw(); } else say(err(r)); }); wrap.append(H("section", {class: "cm-card t2-card"}, H("h2", {text: "Add a connector", style: "margin:0"}), H("p", {class: "cm-muted", text: "Give it a name, an icon and the address of its MCP server (it must start with https:// and work without a sign-in). The admin checks it before anyone can use it."}), H("div", {style: "display:flex;gap:12px;align-items:center;flex-wrap:wrap"}, prev, H("label", {class: "cm-muted", style: "display:flex;flex-direction:column;gap:4px"}, "Icon (square works best)", file)), H("input", {class: "cm-in", type: "text", maxlength: "30", placeholder: "Name, like Weather", "aria-label": "Connector name", oninput: e => { nm = e.target.value; if (!icon) prev.replaceChildren(ico("", nm || "?")); }}), H("input", {class: "cm-in", type: "url", maxlength: "300", placeholder: "https://example.com/mcp", "aria-label": "MCP server address", oninput: e => { url = e.target.value.trim(); }}), H("input", {class: "cm-in", type: "text", maxlength: "200", placeholder: "What it does (optional)", "aria-label": "What it does", oninput: e => { desc = e.target.value; }}), H("div", {}, go), (d.mine && d.mine.length) ? H("div", {class: "cm-list"}, H("b", {text: "Yours"}), ...d.mine.slice().reverse().map(m => H("div", {class: "cm-item"}, H("span", {text: m.name}), H("span", {class: "cm-tag" + (m.state === "approved" ? " ok" : m.state === "waiting" ? "" : " bad"), text: m.state === "waiting" ? "Waiting for the admin" : m.state === "approved" ? "Approved" : "Not approved"})))) : null)); /* admin review */ if (d.admin) { const a = await call("admin"); if (my !== alive) return; const box = H("div", {class: "cm-list"}); const row = (c, waiting) => { const info = H("span", {class: "cm-muted", style: "font-size:12px", text: c.url}); let tools = c.tools || []; const test = B("Test it", async () => { test.disabled = true; info.textContent = "Checking " + c.url + " …"; const r = await call("test", {url: c.url}); test.disabled = false; if (r.ok && r.ok2) { tools = r.tools.map(t => t.name); info.textContent = "Works" + (r.server ? " (" + r.server + ")" : "") + ". Tools: " + (tools.join(", ") || "none"); } else info.textContent = (r && r.msg) || err(r); }, "sec"); const btns = waiting ? [test, B("Approve", async () => { const r = await call("review", {id: c.id, approve: true, tools}); say(r.ok ? c.name + " approved." : err(r)); draw(); }), B("Turn down", async () => { const r = await call("review", {id: c.id, approve: false}); say(r.ok ? c.name + " turned down." : err(r)); draw(); }, "sec")] : [test, B("Remove", async () => { const r = await call("remove", {id: c.id}); say(r.ok ? c.name + " removed." : err(r)); draw(); }, "sec")]; return H("div", {class: "cm-item"}, ico(c.icon, c.name), H("div", {class: "cm-grow"}, H("b", {text: c.name + (c.by ? " · from " + c.by : "")}), H("span", {class: "cm-muted", text: c.desc || "No description."}), info), H("div", {style: "display:flex;gap:6px;flex-wrap:wrap"}, ...btns)); }; if (a.ok) { box.append(H("b", {text: "Waiting for you (" + a.waiting.length + ")"}), ...(a.waiting.length ? a.waiting.map(c => row(c, true)) : [H("p", {class: "cm-muted", text: "Nothing to review."})]), H("b", {text: "Live (" + a.live.length + ")"}), ...a.live.map(c => row(c, false))); } else box.append(H("p", {class: "cm-muted", text: err(a)})); wrap.append(H("section", {class: "cm-card t2-card"}, H("h2", {text: "Review connectors (admin only)", style: "margin:0"}), H("p", {class: "cm-muted", text: "Test a connector to see which tools it has, then approve it or turn it down. The person gets a message from ChatterMax either way."}), box)); } root.replaceChildren(wrap); } window.CM_VIEWS = window.CM_VIEWS || {}; window.CM_VIEWS.connectors = {open(el){ root = el; draw(); }, leave(){ alive++; }}; })(); /* DUSTFALL inside ChatterMax: 8 vs 8 team deathmatch against bots, full screen in an iframe. */ (function(){ let root = null, shell = null, frame = null; function close(){ if (frame) { try { frame.contentWindow.document.exitPointerLock && frame.contentWindow.document.exitPointerLock(); } catch (e) {} frame.remove(); frame = null; } if (shell) { shell.remove(); shell = null; } document.documentElement.style.overflow = ""; } window.CM_DUST_EXIT = close; function launch(){ if (frame) return; const el = document.getElementById("dustSrc"); if (!el) return; shell = document.createElement("div"); shell.style.cssText = "position:fixed;inset:0;z-index:9000;background:#000"; frame = document.createElement("iframe"); frame.title = "Dustfall"; frame.setAttribute("allow", "autoplay; fullscreen; pointer-lock"); frame.style.cssText = "width:100%;height:100%;border:0;display:block;background:#000"; frame.addEventListener("load", () => { try { frame.contentWindow.focus(); } catch (e) {} }); frame.srcdoc = el.textContent.split("__WZ_CLOSE_SCRIPT__").join("DUSTFALLTeam Deathmatch · 8 vs 8. Rangers versus Militia. First team to 60 kills wins.
' + 'Needs a keyboard and mouse. WASD to move, Shift to sprint, C to crouch or slide, Space to jump, right click to aim, R to reload, G for a grenade, E for supply crates, Esc to pause.
'; w.querySelector(".wzplay").onclick = launch; root.appendChild(w); } window.CM_VIEWS = window.CM_VIEWS || {}; window.CM_VIEWS.dustfall = {open(el){ root = el; draw(); }, leave(){ close(); }}; })(); /* THE HOUSE inside ChatterMax: sidebar section that opens the horror game full screen in an iframe. */ (function(){ let root = null, shell = null, frame = null; function close(){ if (frame) { try { frame.contentWindow.document.exitPointerLock && frame.contentWindow.document.exitPointerLock(); } catch (e) {} frame.remove(); frame = null; } if (shell) { shell.remove(); shell = null; } document.documentElement.style.overflow = ""; } window.CM_HOUSE_EXIT = close; function launch(){ if (frame) return; const el = document.getElementById("houseSrc"); if (!el) return; shell = document.createElement("div"); shell.style.cssText = "position:fixed;inset:0;z-index:9000;background:#000"; frame = document.createElement("iframe"); frame.title = "THE HOUSE"; frame.setAttribute("allow", "autoplay; fullscreen"); frame.style.cssText = "width:100%;height:100%;border:0;display:block;background:#000"; frame.addEventListener("load", () => { try { frame.contentWindow.focus(); } catch (e) {} }); frame.srcdoc = el.textContent.split("__WZ_CLOSE_SCRIPT__").join("THE HOUSEYour parents are away. The house is quiet. It will not stay that way.
' + 'Best with a keyboard and mouse and headphones. WASD to move, Shift to run, C to crouch, E to use, F for the flashlight. Contains jump scares and blood.
'; w.querySelector(".wzplay").onclick = launch; root.appendChild(w); } window.CM_VIEWS = window.CM_VIEWS || {}; window.CM_VIEWS.house = {open(el){ root = el; draw(); }, leave(){ close(); }}; })(); /* BACKROOMS inside ChatterMax: sidebar section that opens the game full screen in an iframe, and a small bridge to the /br/ routes on the server. */ (function(){ let root = null, shell = null, frame = null; function close(){ if (frame) { try { frame.contentWindow.document.exitPointerLock && frame.contentWindow.document.exitPointerLock(); } catch (e) {} frame.remove(); frame = null; } if (shell) { shell.remove(); shell = null; } document.documentElement.style.overflow = ""; } window.CM_BR_EXIT = close; /* where the game opens its multiplayer WebSocket, and who is playing */ window.CM_BR_CFG = function(){ const a = window.getAccount && window.getAccount(); return {url: typeof FORGE_URL !== "undefined" ? String(FORGE_URL).replace(/\/$/, "") : "", pin: typeof FORGE_PIN !== "undefined" ? FORGE_PIN : "", token: a && a.token ? a.token : "", name: a && a.username ? String(a.username) : ""}; }; window.CM_BR = async function(path, body){ if (!/^br\/[a-z]+$/.test(String(path))) return null; const url = typeof FORGE_URL !== "undefined" ? String(FORGE_URL).replace(/\/$/, "") : "", pin = typeof FORGE_PIN !== "undefined" ? FORGE_PIN : ""; if (!url) return null; const a = window.getAccount && window.getAccount(), b = Object.assign({}, body || {}); if (a && a.token) b.token = a.token; const r = await fetch(url + "/" + path, {method: "POST", headers: {"Content-Type": "application/json", "X-Forge-Pin": pin}, body: JSON.stringify(b)}); return await r.json(); }; function launch(){ if (frame) return; const el = document.getElementById("backroomsSrc"); if (!el) return; shell = document.createElement("div"); shell.style.cssText = "position:fixed;inset:0;z-index:9000;background:#000"; frame = document.createElement("iframe"); frame.title = "BACKROOMS"; frame.setAttribute("allow", "autoplay; fullscreen"); frame.style.cssText = "width:100%;height:100%;border:0;display:block;background:#000"; frame.addEventListener("load", () => { try { frame.contentWindow.focus(); } catch (e) {} }); frame.srcdoc = el.textContent.split("__WZ_CLOSE_SCRIPT__").join("BACKROOMSYou fell through a wall that was not quite there. Find the door before it finds you.
' + 'Best with a keyboard, mouse and headphones. WASD to move, Shift to run, C to crouch, F for the flashlight, E to use, X and R to spray the floor, N to write on a wall. Contains jump scares.
'; w.querySelector(".wzplay").onclick = launch; root.appendChild(w); } window.CM_VIEWS = window.CM_VIEWS || {}; window.CM_VIEWS.backrooms = {open(el){ root = el; draw(); }, leave(){ close(); }}; })();