Commit graph

173 commits

Author SHA1 Message Date
ba7885afe6 fix: convert relative CSS URLs to absolute in translated pages
- Convert relative CSS URLs to absolute URLs using current origin
- Ensure translated pages can load original blog CSS in new window
- Maintain modal functionality with external CSS files
- Skip URLs that are already absolute (http/https or protocol-relative)
2025-07-09 16:23:38 -04:00
761c4ec259 debug: add console logging to CSS inlining for translated pages
- Add logging to see how many CSS links are found
- Log each CSS file being inlined and success/failure
- Help diagnose why translated pages may not have modal styling
2025-07-09 16:21:40 -04:00
c65bde327c fix: inline external CSS in translated pages for new window compatibility
- Fetch external uncloseai CSS files and inline them as <style> tags
- Replace body content with translated version while preserving page structure
- Ensure new window is self-contained and doesn't need external CSS requests
- Maintain new window approach to avoid breaking current page
2025-07-09 16:18:36 -04:00
1b7597501a revert: restore original translateCurrentPage function
The CSS refactoring broke translated page rendering. The original function
was working correctly by translating the complete HTML document structure.
Translated pages don't need modal CSS, just the original page styling.
2025-07-09 16:14:44 -04:00
fbe81a8298 fix: preserve HTML structure and styling in translated pages
- Update translateCurrentPage() to preserve original page HTML structure
- Extract only text content for translation while keeping head/styles
- Create properly formatted translated page with clean typography
- Fix issue where translated pages opened in new windows lacked CSS styling
2025-07-09 16:13:25 -04:00
f3bd60e578 fix: correct CSS file domain from ai.unturf.com to uncloseai.com 2025-07-09 16:07:47 -04:00
20a95224fd fix: use actual PicoCSS presence detection instead of USE_CUSTOM_STYLING flag
- Change CSS loading logic to detect actual PicoCSS link tags on page
- Blog sites without PicoCSS now correctly load uncloseai-modal-builtin.css
- PicoCSS sites load uncloseai-modal-pico.css with proper overrides
- Fix modal appearing full-screen on blog sites that don't use PicoCSS
2025-07-09 16:04:49 -04:00
121d79d838 fix: add !important to PicoCSS overrides to force proper modal sizing 2025-07-09 16:00:25 -04:00
b46aedcdf3 fix: restore isMobile variable definition for responsive text sizing 2025-07-09 15:23:06 -04:00
e3e6e08449 feat: complete CSS refactoring - remove all inline styles
- Remove all inline CSS from translate-modal.js, tts-modal.js, and widget-library.js
- Replace inline styles with CSS classes in both builtin and pico CSS files
- Eliminate USE_CUSTOM_STYLING conditionals from styling code
- Add proper CSS classes: translate-modal-*, tts-modal-*, widget-*
- Maintain all functionality while achieving clean separation of concerns
- Fix modal sizing issues on large displays through proper PicoCSS overrides
- Support responsive design with mobile-first approach (≤480px full screen)
- Pass all tests: formatting, exports, translations, and integration
2025-07-09 15:20:06 -04:00
adfbdc395b feat: refactor all modal styles to dedicated CSS files
- Create uncloseai-modal-builtin.css for blog versions
- Create uncloseai-modal-pico.css for PicoCSS override
- Add conditional CSS loading to all modal JavaScript files
- Remove inline styles from main modal, translate modal, TTS modal, and widget library
- Fix modal full-screen issue on large displays with proper PicoCSS overrides
- Maintain mobile-first responsive design (≤480px full screen)
- Support both USE_CUSTOM_STYLING modes for maximum compatibility
2025-07-09 14:57:30 -04:00
f0d27bbbef fix: reduce modal width and enforce max-width constraint
Changed desktop modal width from 90vw to 70vw and added \!important
to max-width to ensure modal doesn't fill entire screen on large displays.
2025-07-09 14:26:03 -04:00
de9eeffe70 fix: prevent modal from filling full screen on laptops
Changed mobile detection threshold from 768px to 480px to ensure
centered modal behavior on desktop/laptop screens while preserving
full-screen experience on actual mobile devices.
2025-07-09 10:00:45 -04:00
ce7014e83a fix: resolve handleFileUpload ReferenceError while preserving upload code for future
- Restore handleFileUpload import in widget-library.js to fix ReferenceError
- Keep all upload functionality code intact for future development
- Disable upload features in demo.html with "Under Development" messaging
- Remove upload from feature button examples but preserve the code
- Style disabled upload demo with greyed-out appearance
- Fix demo page functionality while maintaining upload code for future fixes
2025-07-04 12:43:04 -04:00
d7cc5531b8 feat: improve streaming completion detection and add syntax highlighting with copy buttons
- Detect when model streaming is complete in all streaming locations
- Add syntax highlighting (hljs) to code blocks after streaming finishes
- Add copy buttons to code blocks after highlighting is applied
- Prevent duplicate copy buttons with CSS class detection
- Optimize performance by doing syntax highlighting and copy buttons only once per message
- Apply improvements to both modal streaming and standalone chat
- Add copy buttons to intro message generation as well

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-04 12:22:18 -04:00
91f446f5ed Revert "fix: explicitly set white color for uncloseai logo text in PicoCSS light mode"
This reverts commit f50ccabcd1.
2025-07-04 12:03:57 -04:00
f50ccabcd1 fix: explicitly set white color for uncloseai logo text in PicoCSS light mode 2025-07-04 11:59:32 -04:00
b49e52678b Revert "fix: use original page content for title generation instead of processed TTS content"
This reverts commit b178e039b2.
2025-07-03 22:40:55 -04:00
b178e039b2 fix: use original page content for title generation instead of processed TTS content 2025-07-03 22:39:55 -04:00
7bb43c7613 fix: make dropdown text color conditional for PicoCSS and fix download button positioning to be next to play buttons 2025-07-03 22:32:44 -04:00
2e655a206b fix: make tab styling conditional - only apply custom CSS for blog version, let PicoCSS handle native styling 2025-07-03 22:20:55 -04:00
f4c39823b1 fix: add proper tab styling to replace bullet points with visual tab design 2025-07-03 22:17:40 -04:00
d8642675df update translate modal title from 'Translate Page' to 'Translate' across all 19 languages 2025-07-03 22:17:01 -04:00
375471e81a feat: replace button-based tabs with PicoCSS tab navigation in translate modal 2025-07-03 22:11:20 -04:00
d24b6fa1bb fix: use correct variable name targetLanguage instead of targetLanguageCode 2025-07-03 22:04:43 -04:00
28d0b516f1 fix: use exact tokenization in translate modal UI instead of rough estimate 2025-07-03 22:01:01 -04:00
e300a93545 fix: replace tokenInfo reference with roughTokenEstimate in translate modal 2025-07-03 21:49:44 -04:00
f53742a9d5 fix: tokenize actual prompt sent to AI instead of raw HTML and remove duplicate tokenization from modal 2025-07-03 21:46:22 -04:00
cda3455a22 fix: remove enforceModalTextColors function and set black text directly on textarea and dropdowns 2025-07-03 21:36:13 -04:00
a8de98a56a fix: improve tokenizer response parsing and force black text on all modal elements 2025-07-03 21:30:41 -04:00
04b062f3f8 fix: strip v1 from tokenize endpoint since it uses base URL not v1 API 2025-07-03 21:24:37 -04:00
5364b6c446 fix: revert v1 prefix from API endpoints to restore Read Page functionality 2025-07-03 21:20:14 -04:00
c2aa8f1fbd fix: ensure form elements have black text on white backgrounds 2025-07-03 21:18:58 -04:00
969dcbc31e fix: simplify modal text colors and add v1 prefix to API endpoints 2025-07-03 21:16:05 -04:00
29a6a82fa1 fix: enforce modal text colors to prevent white-on-white text issues
- Add enforceModalTextColors() function with high CSS specificity
- Use !important declarations to override blog CSS
- Force dark text (#212529) on inputs, buttons, and general content
- Keep white text on user messages for proper contrast
- Add user-message class to user messages for targeted styling
- Prevents unreadable white text on white backgrounds on blog
2025-07-03 21:11:05 -04:00
401d245fe4 CRITICAL FIX: trash buttons now properly update localStorage
- All delete buttons now call loadConversationHistory/saveConversationHistory
- Update both localStorage and chat.js module for consistency
- User message delete: filters by content match
- AI message delete: removes both user and AI messages in pair
- Historical message delete: removes by array index
- Intro message delete: filters by assistant role and content
- No more localStorage sync issues with deleted messages
2025-07-03 21:02:12 -04:00
933ad570ac feat: major TTS improvements for chat messages and Read Page
- Chat TTS now uses speakTextDirect (no Hermes preprocessing, faster)
- Add download buttons (💾) next to all TTS buttons after processing
- Download buttons use generateTitleForTTS for smart filenames
- Read Page download now uses title generator instead of document.title
- Download buttons appear for user messages, AI responses, and historical messages
- Fallback filenames if title generation fails
- All TTS processing is now direct without Hermes delay
2025-07-03 20:58:40 -04:00
cb88b2da38 debug: add error logging to sendMessage wrapper
- Add try/catch with detailed error logging
- Check if sendMessage exists in imported module
- Log module contents if function not found
- Helps diagnose 'sendMessage(...) is not iterable' error
2025-07-03 20:51:50 -04:00
0213a7e632 fix: improve TTS filename generation with strict prompt and fallback
- Enhanced system prompt: MUST generate title, NEVER refuse
- Clear instructions for edge cases (empty, inappropriate, nonsensical text)
- Added fallback logic if Hermes returns empty or refusal messages
- Fallback uses first 30 chars of text or 'audio-file' as last resort
- Ensures downloads always have a valid filename
2025-07-03 20:48:47 -04:00
46f74eab59 CRITICAL FIX: restore chat functionality - sendMessage must be generator
- Change sendMessage to async generator function with yield*
- Fixes 'Error: sendMessage(...) is not iterable' error
- Restores chat functionality in Hermes modal
2025-07-03 20:45:28 -04:00
20ed410ff0 fix: multiple improvements to TTS modal and language switching
- Fix TTS speed control: change default to 0.9, step by 0.05, max 2.0
- Apply playbackRate to audio element so speed actually works
- Add refreshModalUI() function to update UI when language changes
- Re-add upstream tokenizer API with simplified token counting
- Format token counts with commas (e.g., 8,432 tokens)
- Add getTokenCount() for simple integer token counts
- Language switching now refreshes modal UI without hard refresh
2025-07-03 20:42:11 -04:00
beab5d01a8 feat: reuse markdown extraction logic for TTS spoken tokens
- extractSpokenTokens now detects if input is already markdown format
- Updated prompt to handle both markdown and HTML input
- Added markdown to plain text conversion in prompt (bold, links)
- processContentWithHermes now delegates to extractSpokenTokens
- Consistent processing pipeline whether from Batman button or Read Page
- Better reuse of extractWebpageContent markdown format
2025-07-03 20:28:18 -04:00
4dc9568079 feat: improve extractSpokenTokens with JavaScript pre and post-processing
- Pre-clean HTML before sending to Hermes (remove scripts, styles, ads, iframes)
- Decode HTML entities (&nbsp; &amp; etc.) before Hermes processing
- Simplified, clearer system prompt focused on extraction tasks
- Post-process Hermes output with cleanTextForTTS() for final cleanup
- Reduces Hermes workload and improves extraction quality
- Three-stage pipeline: JS pre-clean → Hermes extraction → JS post-clean
2025-07-03 20:23:52 -04:00
17925537a6 feat: optimize TTS with direct processing for modal and Hermes for Read Page
- TTS modal now uses speakTextDirect() with simple JavaScript text cleaning
- No more Hermes preprocessing for modal text (faster, simpler)
- Read Page button still uses speakText() with Hermes for article extraction
- Reduced textarea height from 240px to 100px with vertical resize
- Added cleanTextForTTS() to remove markdown, HTML, and excess whitespace
- Modal gets instant TTS while Read Page gets intelligent content extraction
2025-07-03 20:20:59 -04:00
78ab413e8e fix: remove manual positioning from TTS modal for proper centering
- Remove top, left, and transform properties
- Let dialog element use native browser centering
- Fixes positioning issues across different viewports
- Cleaner solution that works better with dialog element
2025-07-03 20:14:35 -04:00
6cd16664f7 modified: src/tts-modal.js 2025-07-03 20:03:12 -04:00
67408f0b1a feat: improve TTS filename generation with better system prompt
- Enhanced system prompt to generate 5-10 word descriptive filenames
- Added robust text cleaning to remove quotes, special characters
- Limit filename length to 50 chars for filesystem compatibility
- Better dash-separated filename format like 'javascript-array-methods-guide.mp3'
2025-07-03 19:33:49 -04:00
da4ff80655 feat: improve TTS filename generation with better system prompt
- Enhanced system prompt to generate 3-5 word descriptive filenames
- Added robust text cleaning to remove quotes, special characters
- Limit filename length to 50 chars for filesystem compatibility
- Better dash-separated filename format like 'javascript-tutorial.mp3'
2025-07-03 19:32:53 -04:00
76bd27bea8 feat: generate smart filenames for TTS downloads using Hermes
- Use generateTitleForTTS to create dash-separated filenames based on textarea content
- Hermes analyzes the text and generates descriptive filenames like 'hello-world-tts.mp3'
- Fallback to default filename if generation fails
2025-07-03 19:31:52 -04:00
69fd142004 fix: TTS modal audio playback and download functionality
- Add missing blobUrl to speakText return value
- TTS modal now correctly receives blobUrl for audio playback and download
- Fixes missing MP3 download and autoplay functionality
2025-07-03 19:08:21 -04:00