Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. javascript:
  2. var delayInput = prompt("Delay between actions (ms)", "1000");
  3. var stopAfter = prompt("Stop after how many friend requests are sent?", "100");
  4. var workDelay = parseInt(delayInput, 10);
  5.  
  6. var loading = document.createElement("div");
  7. loading.setAttribute("id", "noni_loading");
  8. loading.setAttribute("style", "position: fixed; background: rgba(255,255,255,0.8); top: 0; left: 0; width: 100%; font-size: 24px; z-index: 1000; padding: 12px;");
  9. document.body.appendChild(loading);
  10. document.getElementById("noni_loading").innerHTML = "No friends added.";
  11.  
  12. var inputs = document.querySelectorAll('.FriendRequestAdd:not(.hidden_elem)');
  13.  
  14.  
  15. var i=0;
  16. var delay=0;
  17. var cont=true;
  18. var stopAfterNumber=0;
  19. if(parseInt(stopAfter, 10)>inputs.length) {
  20. stopAfterNumber=inputs.length;
  21. } else {
  22. stopAfterNumber=parseInt(stopAfter, 10);
  23. }
  24.  
  25. function addFriends(max){
  26.  
  27. if(inputs.length<=0) {
  28. document.getElementById("noni_loading").setAttribute("style", "position: fixed; background: rgba(140,60,60,0.8); top: 0; left: 0; width: 100%; font-size: 24px; color: #fff; z-index: 1000; padding: 12px;");
  29. document.getElementById("noni_loading").innerHTML = "No 'Add Friend'-buttons found :(";
  30.  
  31. alert("That didn't work...");
  32. document.getElementById("noni_loading").setAttribute("style", "display: none;");
  33.  
  34. } else {
  35.  
  36. if(workDelay <= 0) {
  37. delay=0;
  38. } else if(workDelay <= 10) {
  39. delay=workDelay+(Math.floor((Math.random()*5)));
  40. } else {
  41. delay=workDelay+(Math.floor(Math.random()*(0.1*delay))-(0.05*workDelay));
  42. }
  43.  
  44. if(i<stopAfterNumber) {
  45. inputs[i].click();
  46. document.getElementById("noni_loading").innerHTML = i+" friends added. "+delay+"ms waiting...";
  47. cont=true;
  48. } else {
  49. document.getElementById("noni_loading").innerHTML = i+" friends successfully added!";
  50. document.getElementById("noni_loading").setAttribute("style", "position: fixed; background: rgba(60,140,60,0.8); top: 0; left: 0; width: 100%; font-size: 24px; color: #fff; z-index: 1000; padding: 12px;");
  51. cont=false;
  52. }
  53.  
  54. i++;
  55. if(cont==true) {
  56. setTimeout(addFriends, delay);
  57. } else {
  58. alert("Success!");
  59. document.getElementById("noni_loading").setAttribute("style", "display: none;")
  60. }
  61. }
  62. }
  63.  
  64. addFriends();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement