Advertisement
Guest User

Untitled

a guest
Jun 4th, 2015
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         a button presser
  3. // @namespace    N/A
  4. // @version      0.1
  5. // @description  Presses The Button at ~1s
  6. // @author       justastranger
  7. // @match        https://www.reddit.com/r/thebutton/
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. var sock = new WebSocket(reddit.thebutton_websocket);
  12. var timer = 60;
  13. sock.onmessage = function(msg){
  14.     timer = JSON.parse(msg.data).payload.seconds_left;
  15. }
  16.  
  17. function check(time){
  18.     if(time <= 5) console.log("THE TIME HAS COME:", time);
  19.     if(time <= 2) {
  20.         $("#thebutton")[0].click();
  21.         alert("I PRESSED THE BUTTON");
  22.     }
  23. }
  24.  
  25. setInterval(function(){check(timer)}, 500);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement