Grave_Phase

Hey, I’m Grave Phase, the Demon possessing an empty Robot, learning how to be a hero!

I play Fighting games (poorly) RPGs, and many more with my friends!



Proud member of The Gremlin Squad!

about me 
nameGrave
ageAgeless Demon
pronounsHe/Him
timezonePST

(function () { /* ===== Customize these ===== */ var CHANNEL = "grave_phase"; /* your Twitch username, lowercase */ /* Every domain this page is shown on, with no https:// and no path. Twitch will refuse to play on any domain not listed here. */ var PARENTS = ["gravephase.carrd.co", "www.gravephase.carrd.co"]; /* every domain this page is shown on, no https:// */ var GIVE_UP_MS = 15000; /* stop checking after this long if Twitch never answers */ /* =========================== */ var MIN_W = 400, MIN_H = 300; /* Twitch's required minimum embed size */ var root = document.getElementById("lv-root"); var box = document.getElementById("lv-box"); function remove() { box.className = "lv-box lv-gone"; } function reveal() { box.className = "lv-box"; } if (CHANNEL === "YOUR_TWITCH_NAME") { remove(); return; } /* Size the player from the space available, never below Twitch's minimum. Called on load and again whenever the window is resized. */ function applySize() { var boxW = Math.min(800, root.clientWidth || 800); var w = Math.max(MIN_W, boxW - 4); /* minus the 2px outline on each side */ var h = Math.max(MIN_H, Math.round(w * 9 / 16)); box.style.width = boxW + "px"; var f = document.querySelector("#lv-embed iframe"); if (f) { f.setAttribute("width", w); f.setAttribute("height", h); f.style.width = w + "px"; f.style.height = h + "px"; } return { w: w, h: h }; } var size = applySize(); var done = false; var timer = setTimeout(function () { if (!done) { done = true; remove(); } }, GIVE_UP_MS); var s = document.createElement("script"); s.src = "https://player.twitch.tv/js/embed/v1.js"; s.onerror = remove; s.onload = function () { /* Video-only player. Listeners are attached right away so we can't miss the live/offline signal. */ var player = new Twitch.Player("lv-embed", { width: size.w, height: size.h, channel: CHANNEL, autoplay: false, /* we start it once it's visible, since Twitch needs it visible to autoplay */ muted: true, /* muted autoplay is what browsers allow; viewers can unmute */ parent: PARENTS }); /* Keep the player sized to the screen (never below the minimum). Debounced so it isn't recalculated on every pixel. */ var resizeTimer; function onResize() { clearTimeout(resizeTimer); resizeTimer = setTimeout(applySize, 100); } window.addEventListener("resize", onResize); window.addEventListener("orientationchange", onResize); /* If the layout around the embed changes without the window resizing, follow that too */ if (window.ResizeObserver) { try { new ResizeObserver(onResize).observe(root); } catch (e) {} } var readyTimer, playing = false; function live() { if (done) return; done = true; clearTimeout(timer); clearTimeout(readyTimer); reveal(); applySize(); /* re-measure now that it's visible */ /* Start playback muted once the player is on screen (Twitch requires it to be visible to autoplay) */ function start() { try { player.setMuted(true); player.play(); } catch (e) {} } start(); setTimeout(start, 300); setTimeout(start, 1500); /* Some browsers (like Edge) refuse autoplay until the visitor interacts with the page. If it never started, play on their first click, tap, key press or scroll. */ setTimeout(function () { if (playing) return; var evs = ["pointerdown", "keydown", "touchstart", "wheel"], once = function () { evs.forEach(function (e) { window.removeEventListener(e, once, true); }); if (!playing) start(); }; evs.forEach(function (e) { window.addEventListener(e, once, true); }); }, 2500); } function offline() { if (done) return; done = true; clearTimeout(timer); clearTimeout(readyTimer); remove(); } player.addEventListener(Twitch.Player.ONLINE, live); player.addEventListener(Twitch.Player.PLAYING, function () { playing = true; live(); }); player.addEventListener(Twitch.Player.OFFLINE, offline); /* If the browser blocks playback, retry muted (muted autoplay is always allowed) */ player.addEventListener(Twitch.Player.PLAYBACK_BLOCKED, function () { try { player.setMuted(true); player.play(); } catch (e) {} }); /* Already-live channels don't always fire ONLINE on load. If the player is ready and no OFFLINE shows up shortly, treat it as live. */ player.addEventListener(Twitch.Player.READY, function () { readyTimer = setTimeout(live, 4000); }); }; /* Wait until the rest of the page has loaded so the player doesn't compete with it */ function go() { document.head.appendChild(s); } if (document.readyState === "complete") setTimeout(go, 1500); else window.addEventListener("load", function () { setTimeout(go, 1500); }); })();

Media Kit

Survival · Horror · Simulation · Open World · Co-op · Cozy · Party Games

Loading stats…

(function () { /* 1) Where the bot publishes Grave's stats (raw GitHub URL of grave.json) */ var STATS_URL = "https://raw.githubusercontent.com/LunarGabriel/team-stats/main/grave.json"; /* 2) Icon colour for X and TikTok (their brand colour is black). Boxes are white, so keep black. */ var NEUTRAL = "000000"; /* 3) Grave's TikTok average views - TikTok has no public API, so type it in here (0 = hide) */ var TIKTOK_AVG_VIEWS = 396; /* 4) Grave's profile links */ var LINKS = { twitch: "https://www.twitch.tv/grave_phase", youtube: "https://www.youtube.com/@GravePhase", tiktok: "https://www.tiktok.com/@grave_phase", twitter: "https://x.com/GraveVT", bluesky: "https://bsky.app/profile/gravevt.vtubers.social" }; /* 5) Placeholder Twitch average viewers, used only until the bot's file has a real average (0 = hide) */ var TWITCH_AVG_CCV = 5; var PLATFORMS = [ { key: "twitch", name: "Twitch", slug: "twitch", color: "9146FF", avgKey: "avg_twitch_viewers", avgLabel: "Avg Viewers" }, { key: "youtube", name: "YouTube", slug: "youtube", color: "FF0000", avgKey: "avg_youtube_shorts_views", avgLabel: "Avg Views" }, { key: "tiktok", name: "TikTok", slug: "tiktok", color: null, avgKey: null, avgLabel: "Avg Views" }, { key: "twitter", name: "X", slug: "x", color: null }, { key: "bluesky", name: "Bluesky", slug: "bluesky", color: "1185FE" } ]; var compact = new Intl.NumberFormat("en", { notation: "compact", maximumFractionDigits: 1 }); var full = new Intl.NumberFormat("en"); var reduceMotion = window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches; function countUp(el, target) { if (reduceMotion || target < 2) { el.textContent = compact.format(target); return; } var start = null, ms = 1100; function step(t) { if (start === null) start = t; var p = Math.min((t - start) / ms, 1); el.textContent = compact.format(Math.round(target * (1 - Math.pow(1 - p, 3)))); if (p < 1) requestAnimationFrame(step); } requestAnimationFrame(step); } function addBox(grid, slug, color, value, label, url, name) { var li = document.createElement("li"); var a = document.createElement("a"); a.href = url; a.target = "_blank"; a.rel = "noopener noreferrer"; a.setAttribute("aria-label", name + ": " + compact.format(value) + " followers"); var img = document.createElement("img"); img.src = "https://cdn.simpleicons.org/" + slug + "/" + (color || NEUTRAL); img.alt = ""; var num = document.createElement("strong"); num.textContent = compact.format(value); a.appendChild(img); a.appendChild(num); if (label) { var lab = document.createElement("span"); lab.textContent = label; a.appendChild(lab); } li.appendChild(a); grid.appendChild(li); } /* Cache-bust in 5-minute buckets so visitors don't see a stale copy */ fetch(STATS_URL + "?t=" + Math.floor(Date.now() / 300000)) .then(function (r) { if (!r.ok) throw new Error(r.status); return r.json(); }) .then(function (data) { var totals = data.totals || {}; var grid = document.getElementById("tk-grid"); PLATFORMS.forEach(function (p) { var n = totals[p.key]; if (!n) return; /* hide platforms with no followers (e.g. X without an API token) */ /* Label shows the average (e.g. "6 Avg Viewers") when there is one; X and Bluesky show no label */ var avg = p.key === "tiktok" ? TIKTOK_AVG_VIEWS : data[p.avgKey]; if (p.key === "twitch" && !avg) avg = TWITCH_AVG_CCV; var noLabel = p.key === "twitter" || p.key === "bluesky"; addBox(grid, p.slug, p.color, n, avg ? compact.format(avg) + " " + p.avgLabel : (noLabel ? "" : p.name), LINKS[p.key], p.name); }); countUp(document.getElementById("tk-total-num"), totals.all || 0); if (data.growth_7d > 0) { document.getElementById("tk-growth").textContent = "(+" + full.format(data.growth_7d) + " this week)"; } if (data.updated) { document.getElementById("tk-updated").textContent = "Updated " + new Date(data.updated).toLocaleDateString("en", { year: "numeric", month: "short", day: "numeric" }); } document.getElementById("tk-status").style.display = "none"; document.getElementById("tk-kit").hidden = false; }) .catch(function (e) { console.warn("Stats unavailable:", e); document.getElementById("tk-status").textContent = "Stats couldn't load (" + e + ")."; }); })();

Open To: Sponsored Streams · TikTok/YouTube Clips · Social Promos · Playtest/Review Keys

Robo Mail

Ask me something!

(function () { /* Your Cloudflare Worker URL (same one as the doodle box) */ var WORKER_URL = "https://moon-mail.lunargabriel7.workers.dev"; /* Which site this is on the Worker (added with /mailsite add key:grave ...) */ var SITE_KEY = "grave"; /* Grave's website link as it should appear at the top of the image, e.g. "gravevt.com/#mail". Leave empty to use this page's own address automatically. */ var SITE_LINK = "gravephase.carrd.co/#robomail"; var TEXT_COLOR = "#AD0000", FRAME_COLOR = "#AD0000"; var W0 = 400, IMG_H = 280; /* sent image area, in pixels (same as the doodle image) */ var BOX_MIN_PX = 50; /* minimum height of the text box on the page, in pixels */ var FONT_PX = 24, PAD = 12; /* text size and margin, in image pixels */ var S = 2; /* image sharpness: sent image is S times the layout size */ var BAR = 6, HEAD = 44, FOOT = 44, RADIUS = 14; var TIMEZONE = "America/Los_Angeles"; /* Pacific time, always. Shows PST in winter and PDT in summer. */ var $ = function (id) { return document.getElementById(id); }; var box = $("aq-text"), measure = document.createElement("canvas").getContext("2d"); function linkText() { if (SITE_LINK) return SITE_LINK; return (location.host + location.pathname).replace(/\/$/, ""); } /* Word-wrap using the same font the sent image uses */ function wrap(text, maxW) { measure.font = FONT_PX + "px Itim, sans-serif"; var lines = []; text.split("\n").forEach(function (para) { var line = ""; para.split(" ").forEach(function (word) { var test = line ? line + " " + word : word; if (measure.measureText(test).width <= maxW) { line = test; return; } if (line) lines.push(line); line = ""; while (measure.measureText(word).width > maxW) { /* break very long words */ var i = word.length; while (i > 1 && measure.measureText(word.slice(0, i)).width > maxW) i--; lines.push(word.slice(0, i)); word = word.slice(i); } line = word; }); lines.push(line); }); return lines; } function bodyH(n) { return Math.ceil(n * FONT_PX * 1.25 + PAD * 2); } /* Keep the text centred (across and down) and scaled like the sent image as the page resizes */ function fitText() { var k = box.clientWidth / W0; box.style.fontSize = (FONT_PX * k) + "px"; box.style.lineHeight = (FONT_PX * 1.25 * k) + "px"; box.style.padding = (PAD * k) + "px"; centerText(); } function centerText() { var k = box.clientWidth / W0; var n = Math.max(1, wrap(box.value, W0 - PAD * 2).length); var hPx = Math.max(BOX_MIN_PX, bodyH(n) * k); box.style.height = hPx + "px"; box.style.paddingTop = ((hPx - n * FONT_PX * 1.25 * k) / 2) + "px"; } box.addEventListener("input", centerText); fitText(); window.addEventListener("resize", fitText); /* Image you receive: same frame as the doodle box, with the message in red */ function exportImage() { var lh = FONT_PX * 1.25, lines = wrap(box.value.replace(/\s+$/, ""), W0 - PAD * 2); var w = W0, h = Math.max(IMG_H, bodyH(lines.length)); /* same size as the doodle image */ var body = document.createElement("canvas"); body.width = w * S; body.height = h * S; var b = body.getContext("2d"); b.scale(S, S); b.fillStyle = "#fff"; b.fillRect(0, 0, w, h); b.font = FONT_PX + "px Itim, sans-serif"; b.textBaseline = "top"; b.textAlign = "center"; b.fillStyle = TEXT_COLOR; var y0 = (h - lines.length * lh) / 2 + (lh - FONT_PX) / 2; /* Light, semi-transparent red box behind the text */ var maxLw = 0; lines.forEach(function (l) { maxLw = Math.max(maxLw, b.measureText(l).width); }); var bp = 14, bw = Math.min(maxLw + bp * 2, w - 16), bh = lines.length * lh + bp * 2; var bx = (w - bw) / 2, by = (h - lines.length * lh) / 2 - bp, br = 12; b.fillStyle = "rgba(173,0,0,.13)"; b.beginPath(); b.moveTo(bx + br, by); b.arcTo(bx + bw, by, bx + bw, by + bh, br); b.arcTo(bx + bw, by + bh, bx, by + bh, br); b.arcTo(bx, by + bh, bx, by, br); b.arcTo(bx, by, bx + bw, by, br); b.closePath(); b.fill(); b.fillStyle = TEXT_COLOR; lines.forEach(function (l, i) { b.fillText(l, w / 2, y0 + i * lh); }); var W = w + BAR * 2, H = BAR + HEAD + BAR + h + BAR + FOOT + BAR; var out = document.createElement("canvas"); out.width = W * S; out.height = H * S; var o = out.getContext("2d"); o.scale(S, S); o.imageSmoothingQuality = "high"; function rr(x, y, a, c, r) { o.beginPath(); o.moveTo(x + r, y); o.arcTo(x + a, y, x + a, y + c, r); o.arcTo(x + a, y + c, x, y + c, r); o.arcTo(x, y + c, x, y, r); o.arcTo(x, y, x + a, y, r); o.closePath(); } o.save(); rr(0, 0, W, H, RADIUS); o.clip(); o.fillStyle = "#fff"; o.fillRect(0, 0, W, H); o.drawImage(body, BAR, BAR + HEAD + BAR, w, h); o.fillStyle = FRAME_COLOR; o.fillRect(0, BAR + HEAD, W, BAR); o.fillRect(0, BAR + HEAD + BAR + h, W, BAR); o.restore(); o.strokeStyle = FRAME_COLOR; o.lineWidth = BAR; rr(BAR / 2, BAR / 2, W - BAR, H - BAR, RADIUS - BAR / 2); o.stroke(); o.fillStyle = FRAME_COLOR; o.textAlign = "center"; o.textBaseline = "middle"; /* Top row: Grave's link (shrinks a little if it's very long) */ var link = linkText(), fs = 18; o.font = fs + "px Itim, sans-serif"; while (fs > 10 && o.measureText(link).width > W - 24) { fs--; o.font = fs + "px Itim, sans-serif"; } o.fillText(link, W / 2, BAR + HEAD / 2); /* Bottom row: sent time (Pacific) */ o.font = "18px Itim, sans-serif"; var now = new Date(); var d = now.toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric", timeZone: TIMEZONE }); var t = now.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit", timeZoneName: "short", timeZone: TIMEZONE }); o.fillText("Sent " + d + " at " + t, W / 2, BAR + HEAD + BAR + h + BAR + FOOT / 2); return out.toDataURL("image/png"); } /* Send */ var statusEl = $("aq-status"), sendBtn = $("aq-send"); function say(text, cls) { statusEl.textContent = text; statusEl.className = "aq-status " + (cls || ""); } sendBtn.addEventListener("click", function () { if (!box.value.trim()) { say("Type something first!", "err"); return; } sendBtn.disabled = true; say("Sending…"); /* Make sure the Itim font is ready so the sent image matches */ var ready = (document.fonts && document.fonts.load) ? document.fonts.load("24px Itim").catch(function () {}) : Promise.resolve(); ready.then(function () { return fetch(WORKER_URL, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ site: SITE_KEY, doodle: exportImage(), website: $("aq-website").value }) }); }) .then(function (r) { return r.json().catch(function () { return {}; }).then(function (d) { return { ok: r.ok, d: d }; }); }) .then(function (res) { if (!res.ok) throw new Error(res.d.error || "Something went wrong."); say("Sent! Thank you 💜", "ok"); box.value = ""; centerText(); setTimeout(function () { sendBtn.disabled = false; }, 4000); }) .catch(function (e) { say(e.message || "Couldn't send, please try again.", "err"); sendBtn.disabled = false; }); }); })();

Doodle Box

Send me an anonymous doodle!

(function () { /* Your Cloudflare Worker URL (see setup steps) */ var WORKER_URL = "https://moon-mail.lunargabriel7.workers.dev"; /* Which site this is on the Worker (added with /mailsite add key:grave ...) */ var SITE_KEY = "grave"; /* Grave's website link as it should appear at the top of the image, e.g. "gravevt.com/#mail". Leave empty to use this page's own address automatically. */ var SITE_LINK = "gravephase.carrd.co/#robomail"; var S = 2; /* image sharpness: canvas and sent image are S times the 400x280 layout size */ var $ = function (id) { return document.getElementById(id); }; var canvas = $("ms-canvas"), vctx = canvas.getContext("2d"); /* Ink (lines and shapes) sits on top of a separate fill layer, so fills show cleanly under soft edges */ var inkL = document.createElement("canvas"), fillL = document.createElement("canvas"); inkL.width = fillL.width = canvas.width; inkL.height = fillL.height = canvas.height; var ctx = inkL.getContext("2d"), fctx = fillL.getContext("2d"); var color = "#111111", size = 3, drawing = false, last = null, dirty = false, undoStack = []; function render() { vctx.fillStyle = "#fff"; vctx.fillRect(0, 0, canvas.width, canvas.height); vctx.drawImage(fillL, 0, 0); vctx.drawImage(inkL, 0, 0); } function blank() { ctx.clearRect(0, 0, canvas.width, canvas.height); fctx.clearRect(0, 0, canvas.width, canvas.height); render(); } blank(); ctx.lineCap = "round"; ctx.lineJoin = "round"; /* Drawing */ function pos(e) { var r = canvas.getBoundingClientRect(); return { x: (e.clientX - r.left - canvas.clientLeft) * canvas.width / canvas.clientWidth, y: (e.clientY - r.top - canvas.clientTop) * canvas.height / canvas.clientHeight }; } function snapshot() { undoStack.push({ i: ctx.getImageData(0, 0, canvas.width, canvas.height), f: fctx.getImageData(0, 0, canvas.width, canvas.height) }); if (undoStack.length > 12) undoStack.shift(); } var tool = "draw", start = null, base = null, EDGE = 64; /* Pencil and eraser. The eraser removes both lines and fills (back to white) and is twice the brush size. */ function paint(a, b, to) { var erase = tool === "erase", w = size * S * (erase ? 2 : 1); (erase ? [ctx, fctx] : [ctx]).forEach(function (c) { c.save(); c.globalCompositeOperation = erase ? "destination-out" : "source-over"; c.strokeStyle = color; c.fillStyle = color; c.lineWidth = w; c.lineCap = "round"; c.lineJoin = "round"; c.beginPath(); if (to) { c.moveTo(a.x, a.y); c.quadraticCurveTo(b.x, b.y, to.x, to.y); c.stroke(); } else if (a.x === b.x && a.y === b.y) { c.arc(a.x, a.y, w / 2, 0, Math.PI * 2); c.fill(); } else { c.moveTo(a.x, a.y); c.lineTo(b.x, b.y); c.stroke(); } c.restore(); }); render(); } /* Bucket fill: finds the enclosed area using the ink layer as walls, then paints UNDER the ink. The paint also tucks 2px beneath the walls, so soft line edges blend into the fill with no light fringe. */ function floodFill(pt) { var w = canvas.width, h = canvas.height, x0 = Math.floor(pt.x), y0 = Math.floor(pt.y); if (x0 < 0 || y0 < 0 || x0 >= w || y0 >= h) return false; var ink = ctx.getImageData(0, 0, w, h).data, fi = fctx.getImageData(0, 0, w, h), f = fi.data, i0 = (y0 * w + x0) * 4; if (ink[i0 + 3] >= EDGE) return false; /* tapped on a line itself */ var r = parseInt(color.slice(1, 3), 16), g = parseInt(color.slice(3, 5), 16), b = parseInt(color.slice(5, 7), 16); var sr = f[i0], sg = f[i0 + 1], sb = f[i0 + 2], sa = f[i0 + 3]; if (sa === 255 && sr === r && sg === g && sb === b) return false; var mark = new Uint8Array(w * h), list = [], stack = [x0, y0]; while (stack.length) { var y = stack.pop(), x = stack.pop(), idx = y * w + x, o = idx * 4; if (mark[idx]) continue; if (ink[o + 3] >= EDGE || f[o] !== sr || f[o + 1] !== sg || f[o + 2] !== sb || f[o + 3] !== sa) continue; mark[idx] = 1; list.push(idx); if (x > 0) stack.push(x - 1, y); if (x < w - 1) stack.push(x + 1, y); if (y > 0) stack.push(x, y - 1); if (y < h - 1) stack.push(x, y + 1); } var front = list.slice(), all = list.slice(); for (var pass = 0; pass < 2; pass++) { var next = []; front.forEach(function (idx) { var x = idx % w, y = (idx - x) / w; [[x - 1, y], [x + 1, y], [x, y - 1], [x, y + 1]].forEach(function (n) { if (n[0] < 0 || n[1] < 0 || n[0] >= w || n[1] >= h) return; var j = n[1] * w + n[0]; if (!mark[j] && ink[j * 4 + 3] >= EDGE) { mark[j] = 1; next.push(j); all.push(j); } }); }); front = next; } all.forEach(function (idx) { var o = idx * 4; f[o] = r; f[o + 1] = g; f[o + 2] = b; f[o + 3] = 255; }); fctx.putImageData(fi, 0, 0); render(); return true; } /* Outline shapes: line and square go corner to corner, circle goes from its centre outwards */ function shape(a, b) { ctx.strokeStyle = color; ctx.lineWidth = size * S; ctx.beginPath(); if (tool === "line") { ctx.moveTo(a.x, a.y); ctx.lineTo(b.x, b.y); } else if (tool === "rect") ctx.rect(a.x, a.y, b.x - a.x, b.y - a.y); else ctx.arc(a.x, a.y, Math.hypot(b.x - a.x, b.y - a.y), 0, Math.PI * 2); ctx.stroke(); } var mid = null; canvas.addEventListener("pointerdown", function (e) { e.preventDefault(); if (tool === "fill") { snapshot(); if (floodFill(pos(e))) dirty = true; else undoStack.pop(); return; } canvas.setPointerCapture(e.pointerId); snapshot(); drawing = true; last = pos(e); if (tool === "draw" || tool === "erase") { dirty = true; mid = last; paint(last, last); } else { start = last; base = undoStack[undoStack.length - 1]; } }); canvas.addEventListener("pointermove", function (e) { if (!drawing) return; if (tool === "draw" || tool === "erase") { var evs = e.getCoalescedEvents ? e.getCoalescedEvents() : []; if (!evs.length) evs = [e]; evs.forEach(function (ev) { var p = pos(ev), m = { x: (last.x + p.x) / 2, y: (last.y + p.y) / 2 }; paint(mid, last, m); /* curve through the midpoints */ mid = m; last = p; }); } else { var p = pos(e); ctx.putImageData(base.i, 0, 0); shape(start, p); render(); dirty = true; } }); ["pointerup", "pointercancel"].forEach(function (t) { canvas.addEventListener(t, function () { if (drawing && (tool === "draw" || tool === "erase") && mid) paint(mid, last); /* finish the last bit */ drawing = false; mid = null; }); }); var toolBtns = document.querySelectorAll(".ms-tool[data-tool]"); function setTool(name) { tool = name; Array.prototype.forEach.call(toolBtns, function (b) { b.classList.toggle("on", b.dataset.tool === name); }); } Array.prototype.forEach.call(toolBtns, function (b) { b.addEventListener("click", function () { setTool(b.dataset.tool); }); }); /* Zoom: makes the whole box (and the canvas in it) bigger or smaller. When zoomed in, the box is allowed to grow wider than its Carrd column, staying centred on it. */ var ZOOMS = [21, 26, 31, 36], zi = 0, boxEl = document.querySelector(".ms-box"); function layoutBox() { if (zi === 0) { boxEl.style.maxWidth = ZOOMS[0] + "em"; boxEl.style.width = boxEl.style.marginLeft = boxEl.style.marginRight = ""; return; } var fs = parseFloat(getComputedStyle(boxEl).fontSize) || 16; var w = Math.min(ZOOMS[zi] * fs, document.documentElement.clientWidth - 24); /* never wider than the screen */ boxEl.style.maxWidth = "none"; boxEl.style.width = w + "px"; boxEl.style.marginLeft = "calc(50% - " + (w / 2) + "px)"; boxEl.style.marginRight = "0"; } function setZoom(n) { zi = Math.max(0, Math.min(ZOOMS.length - 1, n)); layoutBox(); $("ms-zout").disabled = zi === 0; $("ms-zin").disabled = zi === ZOOMS.length - 1; } window.addEventListener("resize", layoutBox); $("ms-zout").addEventListener("click", function () { setZoom(zi - 1); }); $("ms-zin").addEventListener("click", function () { setZoom(zi + 1); }); setZoom(0); /* Tools */ $("ms-size").addEventListener("input", function () { size = +this.value; }); $("ms-picker").addEventListener("input", function () { color = this.value; $("ms-wheel").style.setProperty("--c", color); }); $("ms-undo").addEventListener("click", function () { var s = undoStack.pop(); if (s) { ctx.putImageData(s.i, 0, 0); fctx.putImageData(s.f, 0, 0); render(); } if (!undoStack.length) dirty = false; }); $("ms-clear").addEventListener("click", function () { blank(); undoStack = []; dirty = false; }); /* Image you receive: header link, red bars top and bottom, and a sent timestamp */ var FRAME_COLOR = "#AD0000", BAR = 6, HEAD = 44, FOOT = 44, RADIUS = 14; var TIMEZONE = "America/Los_Angeles"; /* Pacific time, always. Shows PST in winter and PDT in summer. */ function linkText() { if (SITE_LINK) return SITE_LINK; return (location.host + location.pathname).replace(/\/$/, ""); } function exportImage() { var w = canvas.width / S, h = canvas.height / S, W = w + BAR * 2, H = BAR + HEAD + BAR + h + BAR + FOOT + BAR; var out = document.createElement("canvas"); out.width = W * S; out.height = H * S; var o = out.getContext("2d"); o.scale(S, S); o.imageSmoothingQuality = "high"; function rr(x, y, a, b, r) { o.beginPath(); o.moveTo(x + r, y); o.arcTo(x + a, y, x + a, y + b, r); o.arcTo(x + a, y + b, x, y + b, r); o.arcTo(x, y + b, x, y, r); o.arcTo(x, y, x + a, y, r); o.closePath(); } o.save(); rr(0, 0, W, H, RADIUS); o.clip(); o.fillStyle = "#fff"; o.fillRect(0, 0, W, H); o.drawImage(canvas, BAR, BAR + HEAD + BAR, w, h); o.fillStyle = FRAME_COLOR; o.fillRect(0, BAR + HEAD, W, BAR); o.fillRect(0, BAR + HEAD + BAR + h, W, BAR); o.restore(); o.strokeStyle = FRAME_COLOR; o.lineWidth = BAR; rr(BAR / 2, BAR / 2, W - BAR, H - BAR, RADIUS - BAR / 2); o.stroke(); o.fillStyle = FRAME_COLOR; o.textAlign = "center"; o.textBaseline = "middle"; /* Top row: Grave's link (shrinks a little if it's very long) */ var link = linkText(), fs = 18; o.font = fs + "px Itim, sans-serif"; while (fs > 10 && o.measureText(link).width > W - 24) { fs--; o.font = fs + "px Itim, sans-serif"; } o.fillText(link, W / 2, BAR + HEAD / 2); /* Bottom row: sent time (Pacific) */ o.font = "18px Itim, sans-serif"; var now = new Date(); var d = now.toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric", timeZone: TIMEZONE }); var t = now.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit", timeZoneName: "short", timeZone: TIMEZONE }); o.fillText("Sent " + d + " at " + t, W / 2, BAR + HEAD + BAR + h + BAR + FOOT / 2); return out.toDataURL("image/png"); } /* Send */ var statusEl = $("ms-status"), sendBtn = $("ms-send"); function say(text, cls) { statusEl.textContent = text; statusEl.className = "ms-status " + (cls || ""); } sendBtn.addEventListener("click", function () { if (!dirty) { say("Draw something first!", "err"); return; } sendBtn.disabled = true; say("Sending…"); fetch(WORKER_URL, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ site: SITE_KEY, doodle: exportImage(), website: $("ms-website").value }) }) .then(function (r) { return r.json().catch(function () { return {}; }).then(function (d) { return { ok: r.ok, d: d }; }); }) .then(function (res) { if (!res.ok) throw new Error(res.d.error || "Something went wrong."); say("Sent! Thank you 💜", "ok"); blank(); undoStack = []; dirty = false; setTimeout(function () { sendBtn.disabled = false; }, 4000); }) .catch(function (e) { say(e.message || "Couldn't send, please try again.", "err"); sendBtn.disabled = false; }); }); })();

Reference Sheet

Featured Art

Merch Shop

Stream Schedule

Loading streams…
(function () { var REPO = "LunarGabriel/team-stats"; /* same repo the bot publishes to (STATS_PUBLISH_REPO) */ var BRANCH = "main"; var SCHEDULE_FILE = "grave_schedule.json"; /* the bot builds this from the Twitch schedule */ var TZ = "America/Los_Angeles"; /* times and days are shown in Pacific time (PST/PDT) */ var REFRESH_MIN = 10; var BOX_STICKERS = 4; /* max stickers in a day box; the details below show all of them */ var BASE = "https://raw.githubusercontent.com/" + REPO + "/" + BRANCH + "/"; var root = document.getElementById("lsc-cal"); var timeFmt = new Intl.DateTimeFormat("en-US", { hour: "numeric", minute: "2-digit", timeZoneName: "short", timeZone: TZ }); var ptDayFmt = new Intl.DateTimeFormat("en-US", { year: "numeric", month: "numeric", day: "numeric", timeZone: TZ }); var dayFmt = new Intl.DateTimeFormat(undefined, { weekday: "long", month: "short", day: "numeric" }); var monthFmt = new Intl.DateTimeFormat(undefined, { month: "long", year: "numeric" }); var wkFmt = new Intl.DateTimeFormat(undefined, { weekday: "short" }); function el(tag, cls, text) { var n = document.createElement(tag); if (cls) n.className = cls; if (text) n.textContent = text; return n; } function dayKey(d) { return d.getFullYear() + "-" + d.getMonth() + "-" + d.getDate(); } function ptKey(d) { /* same key format as dayKey, but for the Pacific-time date of a moment */ var p = {}; ptDayFmt.formatToParts(d).forEach(function (x) { p[x.type] = x.value; }); return p.year + "-" + (p.month - 1) + "-" + Number(p.day); } function stickers(ev, cls) { var row = el("div", cls); (ev.stickers || []).forEach(function (p) { if (typeof p !== "string" || p.indexOf("..") > -1) return; var img = el("img", "lsc-stk"); img.alt = ""; img.loading = "lazy"; img.src = BASE + p; img.onerror = function () { img.remove(); }; row.appendChild(img); }); return row.firstChild ? row : null; } var view = new Date(); view = new Date(view.getFullYear(), view.getMonth(), 1); var selected = null, selDate = null, cache = []; function shift(n) { view = new Date(view.getFullYear(), view.getMonth() + n, 1); selected = null; selDate = null; draw(); } function navBtn(label, text, fn) { var b = el("button", "lsc-nav", text); b.type = "button"; b.setAttribute("aria-label", label); b.onclick = fn; return b; } function draw() { var y = view.getFullYear(), m = view.getMonth(), todayKey = ptKey(new Date()), byDay = {}; var total = new Date(y, m + 1, 0).getDate(), lead = view.getDay(); cache.forEach(function (ev) { var s = new Date(ev.start); if (isNaN(s.getTime())) return; var k = ptKey(s); (byDay[k] = byDay[k] || []).push(ev); }); root.textContent = ""; var head = el("div", "lsc-head"); head.appendChild(navBtn("Previous month", "‹", function () { shift(-1); })); head.appendChild(el("div", "lsc-month", monthFmt.format(view))); head.appendChild(navBtn("Next month", "›", function () { shift(1); })); root.appendChild(head); var grid = el("div", "lsc-grid"), wkRow = el("div", "lsc-row"); for (var i = 0; i < 7; i++) wkRow.appendChild(el("div", "lsc-wk", wkFmt.format(new Date(2023, 0, 1 + i)))); grid.appendChild(wkRow); for (var w = 0; w < Math.ceil((lead + total) / 7); w++) { var row = el("div", "lsc-row"); for (var d = 0; d < 7; d++) { var dn = w * 7 + d - lead + 1; if (dn < 1 || dn > total) { row.appendChild(el("div", "lsc-cell lsc-blank")); continue; } row.appendChild(cell(new Date(y, m, dn))); } grid.appendChild(row); } root.appendChild(grid); function cell(date) { var k = dayKey(date), evs = byDay[k] || []; var c = el("button", "lsc-cell"); c.type = "button"; if (k === todayKey) c.classList.add("lsc-today"); if (k === selected) c.classList.add("lsc-sel"); c.appendChild(el("span", "lsc-num", String(date.getDate()))); evs.slice(0, 2).forEach(function (ev) { var chip = el("span", "lsc-chip"); chip.appendChild(el("b", "", ev.game)); c.appendChild(chip); }); if (evs.length > 2) c.appendChild(el("span", "lsc-more", "+" + (evs.length - 2) + " more")); var seen = {}, pics = { stickers: [] }; evs.forEach(function (ev) { (ev.stickers || []).forEach(function (p) { if (!seen[p]) { seen[p] = 1; pics.stickers.push(p); } }); }); pics.stickers = pics.stickers.slice(0, BOX_STICKERS); var strip = stickers(pics, "lsc-stk-row"); if (strip) c.appendChild(strip); /* stickers sit at the bottom of the day box */ c.onclick = function () { selected = k; selDate = date; draw(); }; return c; } var panel = el("div", "lsc-panel"); if (selected) { panel.appendChild(el("h2", "lsc-day", dayFmt.format(selDate))); var list = byDay[selected] || []; if (!list.length) panel.appendChild(el("p", "lsc-empty", "No streams this day.")); list.forEach(function (ev) { var card = el("article", "lsc-ev"); var st = stickers(ev, "lsc-stk-row"); if (st) { var n = st.children.length; /* even rows: 4 -> 2 + 2, 6 -> 3 + 3, 5 -> 3 + 2 */ st.style.gridTemplateColumns = "repeat(" + (n <= 3 ? n : Math.ceil(n / 2)) + ", max-content)"; card.appendChild(st); } var body = el("div"); body.appendChild(el("h3", "lsc-title", ev.game)); body.appendChild(el("div", "lsc-meta", timeFmt.format(new Date(ev.start)))); if (ev.title) body.appendChild(el("div", "lsc-meta", ev.title)); card.appendChild(body); panel.appendChild(card); }); } root.appendChild(panel); } function load() { fetch(BASE + SCHEDULE_FILE + "?t=" + Math.floor(Date.now() / 60000)) .then(function (r) { if (!r.ok) throw new Error(r.status); return r.json(); }) .then(function (data) { cache = (data.events || []).map(function (ev) { ev.game = ev.game || ev.title || "Stream"; return ev; }) .sort(function (a, b) { return new Date(a.start) - new Date(b.start); }); draw(); }) .catch(function (e) { if (!root.querySelector(".lsc-grid")) root.textContent = "Couldn't load the schedule: " + e.message; }); } load(); setInterval(load, REFRESH_MIN * 60000); })();