191 lines
8.1 KiB
Plaintext
191 lines
8.1 KiB
Plaintext
╔══════════════════════════════════════════════════════════════════════════════╗
|
|
║ PAGE EDITOR CHROME EXTENSION ║
|
|
║ Complete Structure ║
|
|
╚══════════════════════════════════════════════════════════════════════════════╝
|
|
|
|
📁 Project Structure:
|
|
├── manifest.json [Configuration & permissions]
|
|
├── content.js [Main script that runs on pages]
|
|
├── background.js [Service worker for extension]
|
|
├── popup.html [Extension popup UI]
|
|
├── popup.js [Popup interactions]
|
|
├── styles.css [Styling for editable elements]
|
|
├── README.md [Full documentation]
|
|
├── QUICKSTART.md [Installation & quick start guide]
|
|
└── EXTENSION_OVERVIEW.txt [This file]
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
🎯 KEY FEATURES:
|
|
|
|
✏️ Edit Any Text
|
|
- Click any text element on any website to edit it
|
|
- Visual feedback with yellow highlight on hover
|
|
- Works on paragraphs, headings, lists, divs, and more
|
|
|
|
💾 Auto-Save
|
|
- Changes auto-save when you click outside an element
|
|
- Manual save with Ctrl+S
|
|
- Save all with Ctrl+Shift+S
|
|
|
|
🔄 Persistent Storage
|
|
- Uses Chrome's Local Storage API
|
|
- Changes survive page reloads
|
|
- Per-domain storage (each website has separate edits)
|
|
|
|
📥 Export & Backup
|
|
- Export all edits as JSON file
|
|
- Backup your changes before clearing browser data
|
|
- Import workflow (manual JSON editing)
|
|
|
|
🧹 Clear & Reset
|
|
- Clear all edits for a page
|
|
- Reset to original website content
|
|
- Individual element clearing by deleting text
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
🔧 HOW IT WORKS:
|
|
|
|
1. CONTENT INJECTION (content.js)
|
|
├─ Runs on every webpage (all_urls match)
|
|
├─ Makes text elements contenteditable
|
|
├─ Adds visual styling with styles.css
|
|
├─ Detects blur events and auto-saves
|
|
├─ Loads saved edits on page load
|
|
└─ Monitors for new dynamic content
|
|
|
|
2. STORAGE (chrome.storage.local)
|
|
├─ Key: "page_edits_<base64_encoded_url>"
|
|
├─ Value: { element_id: new_html, ... }
|
|
├─ Persists across sessions
|
|
└─ ~10MB limit per domain
|
|
|
|
3. POPUP INTERFACE (popup.html/js)
|
|
├─ Shows edit count
|
|
├─ Save all changes button
|
|
├─ Clear all edits button
|
|
├─ Export edits as JSON
|
|
└─ Keyboard shortcuts guide
|
|
|
|
4. BACKGROUND SERVICE WORKER (background.js)
|
|
└─ Minimal - mostly handles popup interactions
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
⌨️ KEYBOARD SHORTCUTS:
|
|
|
|
Ctrl+S (Cmd+S on Mac) Save current edit
|
|
Ctrl+Shift+S (Cmd+Shift+S) Save all edits on page
|
|
Click Edit any text element
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
📋 INSTALLATION CHECKLIST:
|
|
|
|
☐ 1. Open chrome://extensions/
|
|
☐ 2. Enable "Developer mode" (top right toggle)
|
|
☐ 3. Click "Load unpacked"
|
|
☐ 4. Select the page_editor folder
|
|
☐ 5. Extension should appear in your list
|
|
☐ 6. Extension icon appears in toolbar
|
|
☐ 7. Visit any website to test
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
🧪 TEST IT:
|
|
|
|
1. Open https://example.com
|
|
2. You'll see yellow highlights on text elements
|
|
3. Click "Example Domain" heading to edit it
|
|
4. Change it to anything, click outside
|
|
5. Reload the page (Ctrl+R)
|
|
6. Your change persists! ✨
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
📝 MANIFEST DETAILS:
|
|
|
|
manifest_version: 3 (latest Chrome standard)
|
|
Permissions:
|
|
- storage: Save/load edits from local storage
|
|
- scripting: Inject content script
|
|
|
|
Host Permissions:
|
|
- <all_urls>: Works on any website
|
|
|
|
Content Scripts:
|
|
- Runs on all URLs
|
|
- Loads content.js and styles.css at document start
|
|
- Executes before page content loads
|
|
|
|
Action (Popup):
|
|
- popup.html: Shows controls and status
|
|
- Default title: "Page Editor"
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
💾 STORAGE MECHANISM:
|
|
|
|
URL: https://example.com/page
|
|
Storage Key: page_edits_aHR0cHM6Ly9leGFtcGxlLmNvbS9wYWdl
|
|
|
|
Storage Value Example:
|
|
{
|
|
"DIV[0]/P[1]": "<strong>New content</strong>",
|
|
"DIV[0]/H1[0]": "Updated heading"
|
|
}
|
|
|
|
Element identification uses XPath-like structure for reliability.
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
🎨 STYLING:
|
|
|
|
Editable Elements:
|
|
├─ Default: 1px gray outline + light yellow background
|
|
├─ Hover: Yellow outline + darker yellow background
|
|
└─ Focus: 2px blue outline + light blue background
|
|
|
|
Notifications:
|
|
├─ Auto-save indicator (bottom right)
|
|
└─ Save confirmation (top right)
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
⚠️ IMPORTANT NOTES:
|
|
|
|
1. Changes are stored LOCALLY in your browser
|
|
- Not synced across devices
|
|
- Not uploaded anywhere
|
|
- Only visible to you on this browser
|
|
|
|
2. Some websites may block editing due to Content Security Policy
|
|
|
|
3. Clearing browser cache will also clear your edits
|
|
- Use "Export Edits" to backup before clearing
|
|
|
|
4. Maximum ~10MB storage per domain
|
|
|
|
5. Dynamic content added after page load needs page refresh
|
|
to become editable
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
📞 SUPPORT:
|
|
|
|
For issues, check:
|
|
1. README.md - Full feature documentation
|
|
2. QUICKSTART.md - Installation and quick reference
|
|
3. Browser console (F12) for error messages
|
|
4. chrome://extensions/ - Extension status and logs
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
🚀 READY TO USE!
|
|
|
|
The extension is fully functional and ready to install.
|
|
Follow the installation steps in QUICKSTART.md to get started.
|
|
|
|
═══════════════════════════════════════════════════════════════════════════════
|