Add pixel based details/caption offset#1580
Conversation
There was a problem hiding this comment.
Hello @LiliaDoe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request by LiliaDoe introduces the ability to specify the offset of details/captions in either pixels or percentages. It modifies the options page to include a dropdown to select the unit type (pixels or percentage) for both above and below position offsets. The changes also include updates to the locale file to add new messages and tooltips related to the new unit type options, and updates to the javascript files to handle the new options.
Highlights
- New Feature: Adds pixel-based offset functionality for details/captions.
- UI Enhancement: Introduces a dropdown to switch between pixel and percentage-based offsets in the options menu.
- Code Modification: Updates JavaScript code to apply pixel or percentage-based offsets based on user selection.
Changelog
Click here to see the changelog
- _locales/en/messages.json
- Added new messages and tooltips for pixel/percentage offset unit selection.
- Clarified existing offset option text.
- html/options.html
- Added dropdowns to select the unit type (pixel or percentage) for above and below position offsets.
- Adjusted input field widths for better layout.
- js/common.js
- Added default values for 'belowPositionOffsetUnit' and 'abovePositionOffsetUnit' to 'percent'.
- js/hoverzoom.js
- Modified the code to apply offsets based on the selected unit type (pixel or percentage).
- Adjusted the way the top and bottom css properties are set based on the unit type.
- js/options.js
- Modified saveOptions function to save the selected unit types for above and below position offsets.
- Modified restoreOptions function to restore the selected unit types from the options.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Did you know?
The first digital camera was created in 1975 by Steven Sasson, an engineer at Eastman Kodak. It weighed 3.75 pounds and recorded black and white images onto a cassette tape.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
The pull request introduces pixel-based offset functionality and allows switching between pixel and percentage-based offsets. The changes are well-structured and address the intended functionality. However, there are a few areas that could be improved to enhance the code's robustness and maintainability.
Summary of Findings
- Missing input validation: The code lacks input validation for the offset values. This could lead to unexpected behavior or errors if the user enters invalid data (e.g., non-numeric values, values outside the allowed range). I did not comment on this issue due to the review settings.
- Lack of error handling: The code does not include error handling for potential issues such as failed attempts to save or restore options. This could make it difficult to diagnose and resolve problems. I did not comment on this issue due to the review settings.
Merge Readiness
The pull request is not yet ready for merging. While the core functionality is implemented, the lack of input validation and error handling could lead to issues in production. I recommend addressing the identified issues before merging. I am unable to directly approve this pull request, and users should have others review and approve this code before merging.
|



Uh oh!
There was an error while loading. Please reload this page.