2.1 KiB
2.1 KiB
Minimal Implementation Steps
What You Need to Do:
1. Add the Enhanced Extractor File
- Copy
enhanced_thread_extractor.jsto your extension folder (same directory ascontent.js)
2. Update manifest.json
Add the new file to web_accessible_resources:
"web_accessible_resources": [
{
"resources": ["email_parser.js", "enhanced_thread_extractor.js"],
"matches": ["https://mail.google.com/*"]
}
]
3. Update content.js
Add this at the TOP of content.js (around line 10, after the color definitions):
// Load enhanced thread extractor
const script = document.createElement('script');
script.src = chrome.runtime.getURL('enhanced_thread_extractor.js');
script.onload = function() {
console.log('Enhanced thread extractor loaded');
};
(document.head || document.documentElement).appendChild(script);
4. Comment Out Old Functions
In content.js, comment out or remove these functions (lines ~1000-1100):
function extractThreadId(context = 'current')function getSelectedThreadIds()
Just add /* before the function and */ after it:
/*
function extractThreadId(context = 'current') {
// ... existing code ...
}
*/
/*
function getSelectedThreadIds() {
return extractThreadId('selected');
}
*/
5. Reload Extension
- Go to
chrome://extensions/ - Find your extension
- Click the refresh icon
- Test on Gmail
That's It! 🎉
The enhanced extractor provides the same function names (extractThreadId and getSelectedThreadIds), so your existing code will automatically use the enhanced versions.
What You Get:
- ✅ 7+ extraction methods (vs current 4)
- ✅ Automatic fallbacks
- ✅ Better logging
- ✅ Session history tracking
- ✅ No breaking changes
Test It:
- Open Gmail
- Open DevTools Console (F12)
- Try selecting threads in inbox - you'll see detailed extraction logs
- Try opening a thread - you'll see which method found the ID
If Something Goes Wrong:
Simply uncomment the old functions and remove the script injection - takes 30 seconds to rollback.