worldclockscript-with-map.js5 matches
10
11// Initialize the map
12function initMap() {
13// Create the map with a default view
14map = L.map('map').setView([0, 0], 2);
21
22// Prevent scrolling the page when scrolling the map
23map.getContainer().addEventListener('wheel', function(e) {
24e.stopPropagation();
25});
84
85// Update the map based on selected timezone
86function updateMap(timezone) {
87if (!map) return;
88
205206// Populate timezone dropdown with optgroups
207function populateTimezoneSelect() {
208// Clear existing options
209timezoneSelect.innerHTML = '';
245246// Update the clock display
247function updateClock() {
248const selectedTimezone = timezoneSelect.value;
249const now = new Date();
UnescapeJsonindex.js2 matches
13* Handles common escape sequences without requiring JSON validity
14*/
15function unescapeString(str) {
16return str
17.replace(/\\n/g, '\n') // newline
29}
30
31function updateOutput() {
32// Get input and unescape it
33const input = inputArea.value;
UnescapeJsonutils.ts1 match
1/**
2* Shared utility functions and types for the Escape Sequence Visualizer
3*/
4
worldclockscript.js2 matches
7475// Populate timezone dropdown with optgroups
76function populateTimezoneSelect() {
77// Clear existing options
78timezoneSelect.innerHTML = '';
114115// Update the clock display
116function updateClock() {
117const selectedTimezone = timezoneSelect.value;
118const now = new Date();
MyPortfolioREADME.md2 matches
32- **TailwindCSS**: Utility-first CSS framework for styling
33- **Font Awesome**: Icon library
34- **Val Town**: Hosting and serverless functions
3536## Project Structure
42โ โโโ index.html # Main HTML file
43โ โโโ styles.css # Custom CSS styles
44โ โโโ main.js # JavaScript functionality
45โโโ assets/
46โ โโโ favicon.svg # Site favicon
MyPortfoliomain.js14 matches
1// Wait for DOM to be fully loaded
2document.addEventListener('DOMContentLoaded', function() {
3// Initialize theme
4initTheme();
14});
1516// Theme toggle functionality
17function initTheme() {
18const themeToggle = document.getElementById('theme-toggle');
19const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)');
31
32// Toggle theme when button is clicked
33themeToggle.addEventListener('click', function() {
34let theme;
35
47}
4849// Mobile menu functionality
50function initMobileMenu() {
51const mobileMenuButton = document.getElementById('mobile-menu-button');
52const mobileMenu = document.getElementById('mobile-menu');
53
54mobileMenuButton.addEventListener('click', function() {
55mobileMenu.classList.toggle('hidden');
56
69const mobileLinks = mobileMenu.querySelectorAll('a');
70mobileLinks.forEach(link => {
71link.addEventListener('click', function() {
72mobileMenu.classList.add('hidden');
73const icon = mobileMenuButton.querySelector('i');
7980// Scroll animations
81function initScrollAnimations() {
82// Animate sections when they come into view
83const sections = document.querySelectorAll('section');
100const navLinks = document.querySelectorAll('nav a[href^="#"]');
101
102window.addEventListener('scroll', function() {
103let current = '';
104
123124// Contact form handling
125function initContactForm() {
126const contactForm = document.getElementById('contact-form');
127const formStatus = document.getElementById('form-status');
128
129if (contactForm) {
130contactForm.addEventListener('submit', async function(e) {
131e.preventDefault();
132
188189// Skill bar animation (for future use)
190function animateSkillBars() {
191const skillBars = document.querySelectorAll('.skill-bar');
192
201// Smooth scroll for anchor links
202document.querySelectorAll('a[href^="#"]').forEach(anchor => {
203anchor.addEventListener('click', function(e) {
204e.preventDefault();
205
20// Initialize database on startup
21let dbInitialized = false;
22async function ensureDbInitialized() {
23if (!dbInitialized) {
24await initDatabase();
bananananaindex.ts3 matches
1// A whimsical love story with bananas
2export default function (req: Request) {
3return new Response(HTML, {
4headers: {
241// Simple banana click animation
242document.querySelectorAll('.banana').forEach(banana => {
243banana.addEventListener('click', function() {
244this.style.transform = 'rotate(15deg) scale(1.2)';
245setTimeout(() => {
252const loveButton = document.getElementById('loveButton');
253if (loveButton) {
254loveButton.addEventListener('click', function() {
255alert('๐ Their love will last forever! ๐');
256});
aimemoryindex.html2 matches
67// Debug helper
68const debug = {
69log: function(message, data) {
70const debugElement = document.getElementById('debug');
71const timestamp = new Date().toISOString().split('T')[1].split('.')[0];
78debugElement.appendChild(logEntry);
79},
80clear: function() {
81document.getElementById('debug').innerHTML = '';
82}
1011// Initialize the database table
12async function initializeDatabase() {
13await sqlite.execute(`
14CREATE TABLE IF NOT EXISTS ${MEMORY_TABLE} (
2223// Save a new memory snippet
24async function saveMemory(content: string, tags: string = "") {
25await sqlite.execute(
26`INSERT INTO ${MEMORY_TABLE} (content, tags) VALUES (?, ?)`,
3132// Search for relevant memories based on a query
33async function searchMemories(query: string): Promise<Array<{ id: number; content: string; tags: string; created_at: string }>> {
34// Simple search implementation - could be improved with embeddings or more sophisticated search
35const results = await sqlite.execute(
4243// Get all memories from the database
44async function getAllMemories(): Promise<Array<{ id: number; content: string; tags: string; created_at: string }>> {
45const results = await sqlite.execute(
46`SELECT * FROM ${MEMORY_TABLE} ORDER BY created_at DESC`
5152// Fallback response generator when OpenAI is not available
53function generateFallbackResponse(query: string, memories: Array<{ content: string; tags?: string }> = []) {
54if (memories.length === 0) {
55return `I don't have any memories stored yet. You can teach me by saving some information.`;
7273// Generate a response using OpenAI, incorporating memories if available
74async function generateResponse(query: string, memories: Array<{ content: string; tags?: string }> = []) {
75try {
76// Format all memories as context
114115// Process the incoming request
116async function processRequest(req: Request) {
117// Initialize database on each request (only creates if not exists)
118await initializeDatabase();
183184// HTTP handler
185export default async function(req: Request) {
186// Handle OPTIONS for CORS
187if (req.method === "OPTIONS") {