18 const inputClass = "p-2 border rounded w-full";
19 const labelClass = "w-full text-sm font-bold uppercase text-emerald-800 [&>span]:pl-0.5 flex flex-col gap-2";
20 function parseCookies(cookie: string) {
21 const out: Record<string, string> = {};
22 const c = cookie.split(";");
72 <label class=${labelClass} for="description">
73 <span>Description</span>
74 <input required class=${inputClass} id="description" name="description" type="text" placeholder="Function to return a random number" autocomplete="off" />
75 </label>
76 <button class="p-2 bg-emerald-500 text-white rounded" type="submit">Generate!</button>
1import { Buffer } from "node:buffer";
2
3export async function pngTest(req: Request): Promise<Response> {
4 var { default: pnglib } = await import("npm:pnglib");
5 const w = 64;
2import { Buffer } from "node:buffer";
3
4export function png(
5 { width, height, depth = 256 }: {
6 width: number;
19 }) => void | Promise<void>,
20) {
21 return async function(req: Request) {
22 var img = await png64(
23 { width, height, depth },
10const clearBtn = document.getElementById('clearBtn');
11
12function detectDate() {
13 const inputText = inputEl.value;
14 const parsedResults = parse(inputText);
36}
37
38function clearAll() {
39 inputEl.value = '';
40 outputEl.innerHTML = '';
42}
43
44function formatDate(date) {
45 if (!date) return '';
46 return date.toLocaleString('en-US', {
3import process from "node:process";
4
5export default async function server(req: Request): Promise<Response> {
6 let responseBody = "{}";
7
6import { telegramSendMessage } from "https://esm.town/v/vtdocs/telegramSendMessage?v=5";
7
8export default async function server(req: Request): Promise<Response> {
9 // Verify this webhook came from our bot
10 if (
22 let chat = telegramValTownBotSecrets.find((c) => c.chatId === chatId);
23
24 // Helper function to message back the user that triggered this webhook
25 let messageBack = (message) =>
26 telegramSendMessage(Deno.env.get("telegramBot"), {
10- Shows both the parsed date and the original input text
11- Clean, minimalist UI with a clear input field
12- One-click clear functionality
13
14## How It Works
34
35- Modify the Tailwind CSS classes in the HTML to change the styling
36- Adjust the date formatting in the `formatDate` function
37- Change the parsing behavior by modifying the `detectDate` function
38
39## Dependencies
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export default async function server(req: Request): Promise<Response> {
4 async function inlineUrls(cssString: string) {
5 const urlRegex = /url\(['"]?(.*?)['"]?\)/g;
6 let result = cssString;
22const rest = new REST({ version: "9" }).setToken(process.env.DISCORD_BOT_TOKEN);
23
24async function findUserVoiceChannel(guildId, userId) {
25 try {
26 const channels = await rest.get(Routes.guildChannels(guildId));
39}
40
41async function sayMessage(guildId, channelId, message) {
42 const url = googleTTS.getAudioUrl(message, {
43 lang: "en",
68}
69
70function createDiscordJSAdapter(channelId, guildId) {
71 return {
72 sendPayload: (payload) => {
7import { createRoot } from "https://esm.sh/react-dom/client";
8
9function App() {
10 const [startMenuOpen, setStartMenuOpen] = useState(false);
11 const [windows, setWindows] = useState([]);
119}
120
121function DesktopIcon({ icon, label, onClick }) {
122 return (
123 <div className="desktop-icon" onClick={onClick}>
128}
129
130function Window({ window, isActive, onClose, onMinimize, isMinimized, onFocus, updatePosition }) {
131 const [isDragging, setIsDragging] = useState(false);
132 const [dragOffset, setDragOffset] = useState({ x: 0, y: 0 });
219}
220
221function Taskbar({ startMenuOpen, toggleStartMenu, openWindow, onInstagramClick, time, windows, minimizedWindows, restoreWindow }) {
222 return (
223 <div className="taskbar">
251}
252
253function client() {
254 createRoot(document.getElementById("root")).render(<App />);
255}
259}
260
261async function server(request: Request): Promise<Response> {
262 return new Response(`
263 <!DOCTYPE html>