Skip to content

Fix: Embedded images on reddit not zooming#1572

Merged
extesy merged 2 commits intoextesy:masterfrom
LiliaDoe:Fix-Embedded-images-on-reddit-not-zooming
Mar 16, 2025
Merged

Fix: Embedded images on reddit not zooming#1572
extesy merged 2 commits intoextesy:masterfrom
LiliaDoe:Fix-Embedded-images-on-reddit-not-zooming

Conversation

@LiliaDoe
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 src attributes containing //preview.redd.it.
    • The new handler uses hoverZoom.prepareLink to enable zooming functionality.
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

  1. 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.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 to link. 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.

Comment thread plugins/reddit.js Outdated
Comment thread plugins/reddit.js
@LiliaDoe LiliaDoe marked this pull request as draft March 16, 2025 00:33
@LiliaDoe LiliaDoe marked this pull request as ready for review March 16, 2025 00:43
@sonarqubecloud
Copy link
Copy Markdown

@extesy extesy merged commit 103f99f into extesy:master Mar 16, 2025
@LiliaDoe LiliaDoe deleted the Fix-Embedded-images-on-reddit-not-zooming branch March 17, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants