Skip to content

Commit

Permalink
fix: do not upvote same comments if dry run mode is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
double-beep authored Dec 18, 2024
1 parent 71083ba commit 049e65f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/UserscriptTools/Post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,17 @@ export default class Post {
if (text !== stripped && text !== strippedAlt) return;

const parent = element.closest('li');

parent
const button = parent
?.querySelector<HTMLAnchorElement>(
'a.js-comment-up.comment-up-off' // voting button
)
?.click(); // click it!
);

if (Store.dryRun) {
console.log('Upvote', element, 'by clicking', button);
return;
}

button?.click();
});
}

Expand Down

0 comments on commit 049e65f

Please sign in to comment.