honestbleeps / Reddit-Enhancement-Suite

Reddit Enhancement Suite
http://redditenhancementsuite.com
GNU General Public License v3.0
4.17k stars 877 forks source link

Vote Enhancements - redesign compatibility #4965

Open jewel-andraia opened 5 years ago

jewel-andraia commented 5 years ago

probably easiest to add these UI elements into the post/comment tools jsapi container

codevenkat commented 5 years ago

Hello. I am a beginner. Can I try to fix this issue?

jewel-andraia commented 5 years ago

Hi @codevenkat! Here's a high-level overview:

Since this is your first RES project, before you dive into the code, follow the instructions in CONTRIBUTING.md to get a dev build of RES running in your browser.

For this project, you'll be working in the "Vote Enhancements" module. There's already functionality in there to add little dots of color on comments corresponding to the score. I'm hoping to see those dots added to posts and comments in new.reddit.com.

RES has a helper function for "do stuff when a post element is loaded in the redesign": watchForEvent("post", function(container, data) { / do stuff / }) . In that callback function, you can add new elements to the container. data contains metadata about the post or comment, including score.

Small gotcha: that callback can be called multiple times for the same post/comment. You can account for this by querying for an existing color dot inside the container and, if it exists, update it instead of adding a new dot.

austinrutledge0 commented 5 years ago

@codevenkat have you made any progress on the issue? @andytuba I will be taking a crack at this