AyrA

Reddit Robin Autovoter

Apr 1st, 2016
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Robin Autovoter
  3. // @namespace    http://ayra.ch
  4. // @version      0.2
  5. // @description  Autovotes via text on /r/robin
  6. // @author       /u/AyrA_ch
  7. // @match        https://www.reddit.com/robin*
  8. // @grant        none
  9. // ==/UserScript==
  10. /* jshint -W097 */
  11. 'use strict';
  12.  
  13. function sendMessage(message){
  14.     $("#robinSendMessage > input[type='text']").val(message);
  15.     $("#robinSendMessage > input[type='submit']").click();
  16. }
  17.  
  18. function rnd(l,h)
  19. {
  20.     var i=(Math.random()*(h-l)+l)|0;
  21.     console.debug("rnd",i);
  22.     return i;
  23. }
  24.  
  25. //wait 5 seconds before initializing
  26. setTimeout(function(){
  27.     sendMessage("/vote grow");
  28.     //reaload after some time for safety (5 Minutes)
  29.     setTimeout(function(){
  30.         window.location.reload();
  31.     }, rnd(200,400)*1000);
  32.     console.debug("Initialized voter");
  33. }, 5*1000);
Add Comment
Please, Sign In to add comment