Last active
September 17, 2022 00:17
-
-
Save Ophuscado/5eb53694d32744caa5e308b7c8dbcabf to your computer and use it in GitHub Desktop.
Reddit automatisation for clicking on upvote and downvote arrows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The following script is meant to undo upvotes on Reddit using the JavaScript console. | |
| // You can change its behaviour by modifying the following parameters. | |
| async function main() { | |
| // Arrow modes are "upvote" or "downvote". | |
| var mode = "upvote" | |
| // Arrow states are "true" or "false". | |
| // Click on the "true" arrows to disable them. | |
| // Click on the "false" arrows to enable them. | |
| var state = "true" | |
| // Loop over all posts loaded in the page | |
| var items = document.querySelectorAll("button.voteButton"); | |
| for (var i = 0; i < items.length; i++) { | |
| if (items[i].getAttribute("aria-label") === mode && items[i].getAttribute("aria-pressed") === state) { | |
| items[i].click(); | |
| await new Promise(resolve => setTimeout(resolve, 1000)); | |
| } | |
| } | |
| } | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment