Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*==========================================================
- Notabug voting script
- ----------------------------------------------------
- USAGE
- - Read the comments.
- - Adjust variables as needed.
- - Run in browser console.
- Helped as an example:
- https://notabug.io/t/userscripts/comments/c8fb995bc7e3411d314d904754e9a017832286b6/
- ==========================================================*/
- /* the number of times to vote */
- var times = 10;
- /* The time in milliseconds between each vote.
- Sometimes if the voting is too slow, some errors would occur and less votes
- than specified would be given, so set this interval to something higher if
- that happens. */
- var interval_ms = 5000;
- /* The index number of the target upvote button in the array of upvote buttons
- present on page. This value must be changed if the target upvote button index
- isn't correct. The following call will return the array:
- document.getElementsByClassName("arrow up login-required access-required");
- Some browsers will show you the location of each element on screen when you
- hover the pointer over the returned array elements in the console.
- The reason the default is set to 25 is because there will usually be 26
- upvote buttons on screen once you load a post with no comments present. The
- post's upvote button in this case should be the last in the array. 25 of
- these buttons are present in chat, so the array will increase once more chat
- messages are loaded. */
- var up_button_index = 25;
- /* calls the click function at specified intervals */
- var intID = setInterval(
- function(){
- /* simulate click on the upvote button */
- document.getElementsByClassName("arrow up login-required access-required")[up_button_index].click();
- },
- interval_ms
- );
- /* sets the timeout before executing clearInterval, which would stop the
- execution of the clicking function */
- setTimeout(
- function(){
- clearInterval(intID);
- },
- ((times+1)*interval_ms)
- );
Advertisement
Add Comment
Please, Sign In to add comment