- Clone/Download the extension folder
- Open Chrome → Navigate to
chrome://extensions/ - Enable "Developer mode" (toggle in top right)
- Click "Load unpacked"
- Select the extension folder
- Done! Extension is now active
- Edit the relevant module file
- Go to
chrome://extensions/ - Click the refresh icon on the extension card
- Reload any YouTube pages
- Test your changes
| What you want to change | Edit this file |
|---|---|
| Error messages | errors.js |
| Time formatting, utilities | utils.js |
| Transcript parsing (XML/JSON/VTT) | parsers.js |
| API calls, data fetching | extraction.js |
| Video playback sync | video-sync.js |
| UI appearance, buttons | ui.js + styles.css |
| Event handlers, initialization | content-main.js |
| Extension permissions | manifest.json |
| CORS bypass logic | page-script.js |
- Identify which module it belongs to
- Add the function to that module
- Export it in the module's return statement
- Use it from other modules via the namespace (e.g.,
TranscriptUtils.newFunction())
Example:
// In utils.js
const TranscriptUtils = (function() {
// ... existing code ...
function newUtilityFunction() {
// Your code here
}
return {
// ... existing exports ...
newUtilityFunction // Add this
};
})();
// In another module
TranscriptUtils.newUtilityFunction();- Check browser console for error messages
- Note which module the error is from
- Open that module file
- Fix the issue
- Test thoroughly
- Create new file (e.g.,
feature.js) - Use IIFE pattern:
const FeatureName = (function() {
'use strict';
// Your code here
return {
publicFunction: function() { }
};
})();- Add to
manifest.jsoncontent_scripts (in correct order) - Use from other modules
- Open YouTube video page
- Press F12 (or Cmd+Option+I on Mac)
- Click Console tab
- Look for messages with ✓, ❌, 🔄, etc.
Module Not Found
- Check file name spelling in
manifest.json - Verify file exists in folder
Function is not defined
- Check module load order in
manifest.json - Verify function is exported in return statement
- Check namespace name (e.g.,
TranscriptUtilsnotUtils)
Panel Not Appearing
- Check if video ID exists
- Check console for injection errors
- Verify secondary sidebar element exists
Video Sync Not Working
- Verify video element is found
- Check if listeners are attached
- Look for errors in
video-sync.js
- Modules: PascalCase (e.g.,
TranscriptUtils) - Functions: camelCase (e.g.,
formatTime) - Constants: UPPER_SNAKE_CASE (e.g.,
RE_XML_TRANSCRIPT) - Private vars: camelCase with descriptive names
/**
* Function description
* @param {Type} paramName - Description
* @returns {Type} Description
*/
function myFunction(paramName) {
// Implementation
}const ModuleName = (function() {
'use strict';
// Private variables
let privateVar = 'value';
/**
* Private function
*/
function privateFunction() {
// ...
}
/**
* Public function
*/
function publicFunction() {
// Can use private variables
}
// Public API
return {
publicFunction
};
})();- Load extension
- Open YouTube video
- Click "Load Transcript"
- Search for a word
- Click on timestamp
- Navigate to different video
- ARCHITECTURE.md - Technical architecture details
- TESTING_CHECKLIST.md - Complete testing guide
- REFACTORING_SUMMARY.md - What changed and why
Open browser console and look for red messages
chrome://extensions/ → Click refresh icon
Browser console on any YouTube page
cp errors.js errors.js.backup// In content-main.js, check:
const videoId = TranscriptUtils.getVideoId();
console.log('Video ID:', videoId);// In extraction.js, add logging:
console.log('Fetching transcript...');
console.log('Response:', data);// In ui.js, check:
console.log('Search term:', searchTerm);
console.log('Filtered results:', filtered.length);- Always test after making changes
- Check console for errors
- Use console.log liberally during development
- Comment complex logic
- Keep functions small and focused
- Update docs when adding features
- Test on multiple videos
- Check both light and dark themes
- ❌ Don't modify
manifest_version(must be 3) - ❌ Don't change module load order without understanding dependencies
- ❌ Don't use
import/exportsyntax (not compatible) - ❌ Don't forget to export public functions
- ❌ Don't assume DOM elements exist (always check)
- ❌ Don't forget to remove event listeners on cleanup
- Use Chrome DevTools to debug
- Test with different video types (regular, Shorts, live)
- Check both English and non-English videos
- Test with videos that don't have transcripts
- Keep browser console open while testing
- Use
debugger;statement for breakpoints
Happy Coding! 🎉
For more details, see the other documentation files.