duxtoogleMenu.js2 matches
1/**
2* Initializes a mobile menu toggle functionality.
3* Toggles the visibility of the mobile menu and updates the toggle button icon.
4*/
27* @param {Event} event - The click event
28*/
29function handleToggle(event) {
30event.preventDefault();
31
duxtoogleTheme.js3 matches
1/**
2* Initializes a theme toggle functionality.
3* Switches between light and dark modes, updates the toggle button icon, and persists the theme in localStorage.
4*/
46* Initializes the theme based on localStorage when the DOM is fully loaded.
47*/
48function initializeTheme() {
49const savedTheme = localStorage.getItem("theme");
50if (savedTheme === "dark") {
62* @param {Event} event - The click event
63*/
64function handleThemeToggle(event) {
65event.preventDefault();
66
1/**
2* Initializes a theme toggle functionality.
3* Switches between light and dark modes, updates the toggle button icon, and persists the theme in localStorage.
4*/
46* Initializes the theme based on localStorage when the DOM is fully loaded.
47*/
48function initializeTheme() {
49const savedTheme = localStorage.getItem("theme");
50if (savedTheme === "dark") {
62* @param {Event} event - The click event
63*/
64function handleThemeToggle(event) {
65event.preventDefault();
668182/**
83* Initializes a mobile menu toggle functionality.
84* Toggles the visibility of the mobile menu and updates the toggle button icon.
85*/
108* @param {Event} event - The click event
109*/
110function handleToggle(event) {
111event.preventDefault();
112
FarcasterSpacesanalytics.tsx13 matches
4import { dbQuery } from './supabase.ts'
56export function handleAnalyticsEndpoints(app: Hono) {
7app.get('/analytics', async (c) => {
8// todo: load all data in parallel (postgress connection issue)
53}
5455function Table({ data, title, props, w = 84 }) {
56const renderRow = (item) =>
57props
87}
8889function B({ children }) {
90return <span className="text-neutral-300 dark:text-neutral-600">{children}</span>
91}
9293function Spacer({ w }) {
94return (
95<div>
99}
100101function queryHistoricalCountUsersOverPeriod({ periodFormat = 'YYYY-MM-DD' }) {
102return analyticsQuery(`
103select TO_CHAR(created_at, '${periodFormat}') as period, COUNT(distinct fid)
108limit 10`)
109}
110function topOpenLocations() {
111return analyticsQuery(`
112select param, COUNT(*)
117limit 10`).then(miniappLocationDataTransformer)
118}
119function topScreens() {
120return analyticsQuery(`
121select param, COUNT(*)
126limit 10`)
127}
128function topUsers() {
129return analyticsQuery(`
130select fid, COUNT(*)
136}
137138function miniappLocationDataTransformer(data: any) {
139return data.map((item: any) => {
140return {
145}
146147function getLocationText(param: string) {
148let locationText = ''
149if (param) {
162return locationText
163}
164function getClientFidText(clientFid: any) {
165if (!clientFid) return `[W] `
166if (clientFid == 9152) return `[W] `
169}
170171async function analyticsQuery(query: string, args: any[] = []) {
172const result = await dbQuery(query, args)
173return safeRows(result.rows)
174}
175176function safeRows(rows: any[]) {
177return rows.map((row) => {
178const newRow: Record<string, any> = {}
reactHonoStarterApp.tsx2 matches
8}
910function DeweyDigit({
11digit,
12isLocked,
32}
3334export function App() {
35const [dewey, setDewey] = useState<(number | null)[]>([
36null,
45// Key-Value DB āĻĨā§āĻā§ āĻā§āϝāĻžāϞ⧠āĻĒāĻžāĻā§āĻžāϰ āĻĢāĻžāĻāĻļāύ
6async function kvGet(key: string): Promise<number> {
7const res = await fetch(`https://api.val.town/v1/kv/get?key=${key}`, {
8headers: { "X-API-Key": API_KEY },
1415// Key-Value DB āϤ⧠āĻā§āϝāĻžāϞ⧠āϏā§āĻ āĻāϰāĻžāϰ āĻĢāĻžāĻāĻļāύ
16async function kvSet(key: string, value: number) {
17await fetch(`https://api.val.town/v1/kv/set`, {
18method: "POST",
2627// āϰā§āĻĢāĻžāϰ āĻāĻžāĻāύā§āĻ āĻĒāĻžāĻā§āĻžāϰ āĻĢāĻžāĻāĻļāύ
28async function getReferCount(user_id: number) {
29return await kvGet(`refer_${user_id}`);
30}
3132// āϰā§āĻĢāĻžāϰ āĻŦāĻžā§āĻžāύā§āϰ āĻĢāĻžāĻāĻļāύ
33async function addRefer(user_id: number) {
34const current = await getReferCount(user_id);
35await kvSet(`refer_${user_id}`, current + 1);
3738// āĻŦā§āϝāĻžāϞā§āύā§āϏ āĻĒāĻžāĻā§āĻžāϰ āĻĢāĻžāĻāĻļāύ
39async function getBalance(user_id: number) {
40return await kvGet(`balance_${user_id}`);
41}
4243// āĻŦā§āϝāĻžāϞā§āύā§āϏ āĻŦāĻžā§āĻžāύā§āϰ āĻĢāĻžāĻāĻļāύ
44async function addBalance(user_id: number, amount: number) {
45const current = await getBalance(user_id);
46await kvSet(`balance_${user_id}`, current + amount);
4849// āĻŽā§āϏā§āĻ āĻĒāĻžāĻ āĻžāύā§āϰ āĻĢāĻžāĻāĻļāύ
50async function sendMessage(chat_id: number, text: string, reply_markup: any = null) {
51await fetch(`https://api.telegram.org/bot${BOT_TOKEN}/sendMessage`, {
52method: "POST",
56}
5758export default async function(req: Request): Promise<Response> {
59if (req.method !== "POST") {
60return new Response("đĸ Telegram Bot Webhook Active (POST only)");
reactHonoStarterApp.tsx1 match
2import { useState } from "https://esm.sh/react@18.2.0";
34export function App() {
5const [clicked, setClicked] = useState(0);
6return (
basic-html-starterindex.html24 matches
585586// Apply dark mode on load
587function applyDarkMode() {
588if (darkMode) {
589document.documentElement.classList.add('dark-mode');
596597// Toggle dark mode
598function toggleDarkMode() {
599darkMode = !darkMode;
600localStorage.setItem('darkMode', darkMode);
603604// Show login/register forms
605function showLogin() {
606document.getElementById('login-form').style.display = 'block';
607document.getElementById('register-form').style.display = 'none';
608}
609610function showRegister() {
611document.getElementById('login-form').style.display = 'none';
612document.getElementById('register-form').style.display = 'block';
614615// Toggle mobile menu
616function showMobileMenu() {
617mobileMenu.style.display = 'flex';
618}
619620function hideMobileMenu() {
621mobileMenu.style.display = 'none';
622}
623624// Show/hide sections
625function showSection(sectionId) {
626document.querySelectorAll('.section').forEach(section => {
627section.classList.add('hidden');
631632// Show/hide withdraw modal
633function showWithdrawModal() {
634document.getElementById('withdraw-modal').style.display = 'flex';
635}
636637function hideWithdrawModal() {
638document.getElementById('withdraw-modal').style.display = 'none';
639}
665666// Check if user is admin
667function checkAdmin(userId) {
668database.ref('admins/' + userId).once('value', snapshot => {
669if (snapshot.exists()) {
675676// Load user data
677function loadUserData(userId) {
678// Load balance and tasks
679database.ref('users/' + userId).on('value', snapshot => {
817}
818819// Auth functions
820function login() {
821const email = document.getElementById('login-email').value;
822const password = document.getElementById('login-password').value;
828}
829830function register() {
831const username = document.getElementById('register-username').value;
832const email = document.getElementById('register-email').value;
859}
860861function logout() {
862auth.signOut();
863}
864865// Task functions
866function completeTask(taskId) {
867const userId = auth.currentUser.uid;
868
891}
892893function completeOffer(offerId) {
894const userId = auth.currentUser.uid;
895
920}
921922// Withdrawal functions
923function submitWithdrawal() {
924const userId = auth.currentUser.uid;
925const amount = parseFloat(document.getElementById('withdraw-amount').value);
973}
974975// Admin functions
976function addTask() {
977const title = document.getElementById('task-title').value;
978const reward = parseFloat(document.getElementById('task-reward').value);
999}
10001001function deleteTask(taskId) {
1002if (confirm('Are you sure you want to delete this task?')) {
1003database.ref('tasks/' + taskId).remove();
10061007// Initialize sample data if empty
1008function initializeSampleData() {
1009database.ref('tasks').once('value', snapshot => {
1010if (!snapshot.exists()) {
saveImdbToDebridindex.ts2 matches
1export default async function(req: Request): Promise<Response> {
2try {
3const url = new URL(req.url);
61}
62
63// Helper function to parse size from title and convert to MB
64const parseSizeInMB = (title: string): number => {
65// Look for GB format: "đž X.XX GB"
56// āϰā§āĻĢāĻžāϰ āĻ āĻŦā§āϝāĻžāϞā§āύā§āϏ āĻĄāĻžāĻāĻžāĻŦā§āĻ āĻĢāĻžāĻāĻļāύ
7async function getReferCount(user_id: number) {
8return (await get(`refer_${user_id}`)) || 0;
9}
1011async function addRefer(user_id: number) {
12const current = await getReferCount(user_id);
13await set(`refer_${user_id}`, current + 1);
14}
1516async function getBalance(user_id: number) {
17return (await get(`balance_${user_id}`)) || 0;
18}
1920async function addBalance(user_id: number, amount: number) {
21const current = await getBalance(user_id);
22await set(`balance_${user_id}`, current + amount);
23}
2425export default async function(req: Request): Promise<Response> {
26const { message } = await req.json();
27if (!message) return new Response("No message found");
131132// â āĻŽā§āϏā§āĻ āĻĒāĻžāĻ āĻžāύ⧠āĻĢāĻžāĻāĻļāύ
133async function sendMessage(chat_id: number, text: string, reply_markup: any = null) {
134await fetch(`https://api.telegram.org/bot${BOT_TOKEN}/sendMessage`, {
135method: "POST",