Skip to content

Conversation

@rick-meng
Copy link

Created a fully functional Chrome browser extension with a magnifying glass feature:

  • Circular magnifier that follows mouse movement
  • Adjustable zoom level (1.5x - 5x)
  • Adjustable magnifier size (100px - 400px)
  • Keyboard shortcut support (Alt + M)
  • Modern popup UI with gradient design
  • Complete documentation in Chinese

Files included:

  • manifest.json: Extension configuration
  • popup.html & js/popup.js: Control interface
  • js/magnifier.js: Core magnifier functionality
  • css/magnifier.css: Styling
  • icons/: Generated icons in 16x16, 48x48, 128x128
  • generate_icons.py: Python script to generate icons
  • README.md: Comprehensive user guide

Created a fully functional Chrome browser extension with a magnifying glass feature:
- Circular magnifier that follows mouse movement
- Adjustable zoom level (1.5x - 5x)
- Adjustable magnifier size (100px - 400px)
- Keyboard shortcut support (Alt + M)
- Modern popup UI with gradient design
- Complete documentation in Chinese

Files included:
- manifest.json: Extension configuration
- popup.html & js/popup.js: Control interface
- js/magnifier.js: Core magnifier functionality
- css/magnifier.css: Styling
- icons/: Generated icons in 16x16, 48x48, 128x128
- generate_icons.py: Python script to generate icons
- README.md: Comprehensive user guide
@wuduande
Copy link

wuduande commented Nov 5, 2025 via email

@wenjunmo
Copy link

wenjunmo commented Nov 5, 2025 via email

@Hu-shaojie
Copy link

Hu-shaojie commented Nov 5, 2025 via email

rick-meng and others added 3 commits November 5, 2025 20:41
Fixed the "Could not establish connection. Receiving end does not exist" error.

Changes:
- Added comprehensive error handling in popup.js
- Implemented page type detection to identify unsupported pages (chrome://, etc.)
- Added automatic retry mechanism with 500ms delay
- Improved user feedback with clear status messages
- Added contentScriptReady flag to track connection state
- Updated version to 1.0.1

User-facing improvements:
- Shows "Please refresh the page and try again" when content script not loaded
- Shows "This page does not support the extension" on chrome:// pages
- Disables toggle button when extension is not ready
- Better error messages in all edge cases

Documentation:
- Updated README with detailed FAQ about connection errors
- Created TESTING.md with step-by-step testing instructions
- Added troubleshooting guide and debugging tips
Major update v1.1.0: The magnifier now displays actual webpage content instead of just placeholder text.

Changes:
- Completely rewrote magnifier.js to use DOM cloning technique
- Created magnifierLens container that holds a cloned copy of the page body
- Used CSS transform scale() and translate() to zoom and position content
- Added MutationObserver to detect page changes and update magnified content
- Implemented requestAnimationFrame for smooth performance
- Removed canvas-based placeholder implementation

Technical implementation:
- createMagnifierV2(): Creates magnifier with lens container
- updateMagnifierV2(): Calculates zoom and translation on mouse move
- syncPageContent(): Clones document body and removes scripts/magnifier
- MutationObserver: Marks content as needing update when page changes
- Transform: scale(zoom) translate(x, y) for smooth magnification

User-visible improvements:
- Magnifier now shows real text, images, buttons, links, etc.
- All CSS styles are preserved in the magnified view
- Smooth scrolling and real-time updates
- Circular mask with enhanced shadows for better appearance

Performance optimizations:
- Content only re-cloned when page changes (needsUpdate flag)
- Uses requestAnimationFrame to batch DOM updates
- Removes script tags from clones to prevent execution
- Efficient transform-based positioning (GPU accelerated)

Updated documentation:
- README: Added v1.1.0 changelog with feature highlights
- TESTING.md: Added verification steps for real content magnification
- manifest.json: Bumped version to 1.1.0

Fixes #issue: Magnifier displays real webpage content instead of placeholder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants