Fix: Embedded images on reddit not zooming#1572
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 addresses an issue where embedded images on Reddit (specifically on sh.reddit) were not zooming correctly. I've added a new handler to target img tags with a src attribute containing //preview.redd.it. This handler prepares the link for the hover zoom functionality, enabling zooming for these embedded images. The author notes that it may only support sh.reddit embeds and hasn't been tested on old.reddit.
Highlights
- Bug Fix: Fixes zooming for embedded images on sh.reddit.
- New Handler: Adds a new handler for
img[src*="//preview.redd.it"]to enable zooming.
Changelog
- plugins/reddit.js
- Added a new event handler to support zooming for embedded images with
srcattributes containing//preview.redd.it. - The new handler uses
hoverZoom.prepareLinkto enable zooming functionality.
- Added a new event handler to support zooming for embedded images with
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.
Trivia time!
What is the origin of the name 'Reddit'?
Click here for the answer
The name 'Reddit' is a play on words, derived from 'I read it'.
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 adds support for embedded images on sh.reddit, which is a useful enhancement. The code is relatively simple, but there are a few points to consider for improvement.
Summary of Findings
- Specificity of selector: The selector
img[src*="//preview.redd.it"]might be too broad and could potentially match unintended images. Consider adding more specific attributes to the selector to target only the intended elements. - Lack of null check: There is no null check on
post.attr('src')before assigning it tolink. This could lead to errors if the attribute is not present. - Testing on old.reddit: The pull request description mentions that the changes haven't been tested on old.reddit. It's important to ensure compatibility across different versions of the site.
Merge Readiness
The code addresses the issue described in the title, but there are potential improvements regarding the specificity of the selector and null checks. Addressing these points would improve the robustness of the code. I am unable to directly approve this pull request, and users should have others review and approve this code before merging. Given the medium severity issues, I recommend addressing them before merging.
|



This may just support sh.reddit embeds, haven't tested in old.reddit