Closed PxPerfectMike closed 9 months ago
Amazing! I will take a look as soon as possible but it might take a few days (I usually work on the project on weekends). I have no doubt your PR will be fully merged, as this is looking like a major improvement to the code! Thanks a lot for your excellent contributions
This pull request introduces a series of optimizations and improvements aimed at enhancing the efficiency and readability of the codebase.
background.js Enhancements to Error Handling Incorporated try/catch blocks within the sendMessageToOffscreenDocument(), closeOffScreenDocument(), and hasDocument() methods to strengthen error handling.
content.js Code Refactor and Redundancy Reduction Introduced a new function named setStatusBarBackground to minimize code duplication and enhance code readability.
Refactored the CN_ToggleButtonClick() method along with its supporting functions to improve performance and make the code easier to follow.
Performance Improvements:
Transitioned MESSAGES_PLAYED in offscreen.js from an array structure to a Set() for performance enhancement, improving time complexity from O(n) to O(1).
Miscellaneous Changes Moved the setNativeValue function outside of CN_SetTextareaValue to prevent its re-definition, and cached descriptors externally for better performance.
Optimized the CN_InitScript() method to check for jQuery more precisely, providing a safer fallback assignment in scenarios where jQuery is undefined.
Removed the playDummySound function, as it doesn't appear to serve a functional purpose currently.
Testing All of these changes have been thoroughly tested in both Chrome and Edge browsers without encountering any issues.