v1.1.12
Major Improvements:
-
Context Menu Feature:
The most significant addition is the implementation of a context menu (right-click on selected text). This menu offers two options:- Rephrase Selection: Enhances the style and clarity of the selected text using OpenAI's GPT API.
- Translate Selection: Translates the selected text into a chosen language via a submenu. The available languages are those already supported by the extension.
The original text is directly replaced by the rephrased/translated text on the web page.
-
Enhanced Dialog Box:
The dialog box (used as an alternative to direct insertion into the text field) has been significantly improved:- Visual Timer: A visual countdown (progress bar) indicates the time remaining before the dialog box automatically closes.
- "Keep Open" Option: A switch allows the user to disable automatic closing and keep the dialog box open indefinitely. The timer then transforms into an "infinite" indicator.
- Copy Button: A button allows the user to easily copy the transcribed/translated text to the clipboard.
- Aesthetic Improvements: The dialog box now features a more modern style (rounded borders, shadows, better organization).
-
Improved Error and Connection Management:
- Connection Check: Before making an API call, the code now explicitly checks whether the device is online using navigator.onLine. This prevents unnecessary API call attempts and improves the offline user experience.
- Clearer Error Messages: Error messages (for example, for API key issues, network errors, etc.) have been enhanced to be more informative and to help the user resolve problems. Specific suggestions are provided (e.g., checking the API key, verifying the internet connection).
- Automatic Retries: In the event of a temporary network error, the extension automatically retries the API call after a short pause (1.5 seconds).
-
Code Refactoring and Organization:
- Separate Language Files: The supported languages are now defined in separate files (src/utils/languages-shared.js for the content script and src/utils/languages-data.js for the service worker), which makes the code cleaner and easier to maintain. The service worker loads languages-data.js via importScripts.
- Centralized Constants: Constants (for states, actions, etc.) are defined in src/constants.js, improving readability and maintainability.
- UI Utilities: Utility functions for managing the user interface (banner, dialog box) have been grouped in src/utils/ui.js.
- Modularization: The code is overall better structured and modularized, making it easier to understand and modify.
- Updated README Files: The README files (in various languages) have been updated to reflect the new features, particularly the context menu and dialog box options.
-
Security:
- Uses window.clearTimeout instead of clearTimeout for enhanced security.
- Employs secure methods to access timers and prevent object injection.
-
Minor Changes:
- The extension version has been updated from 1.1.11 to 1.1.12.
- The type
"module"has been removed from the service_worker definition in manifest.json. - Some CSS style adjustments have been made for the dialog box.
- Improvements have been implemented in the management of the dialog box timer (no more requestAnimationFrame, cleaner timer management).
- Unused or commented-out code has been removed.