Advertisement
Haze2910

BtcSpinner script

Mar 17th, 2018
2,951
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. function mouseEvent(type, sx, sy, cx, cy) {
  2. var evt;
  3. var e = {
  4. bubbles: true,
  5. cancelable: (type != "mousemove"),
  6. view: window,
  7. detail: 0,
  8. screenX: sx,
  9. screenY: sy,
  10. clientX: cx,
  11. clientY: cy,
  12. ctrlKey: false,
  13. altKey: false,
  14. shiftKey: false,
  15. metaKey: false,
  16. button: 0,
  17. relatedTarget: undefined
  18. };
  19. if (typeof( document.createEvent ) == "function") {
  20. evt = document.createEvent("MouseEvents");
  21. evt.initMouseEvent(type,
  22. e.bubbles, e.cancelable, e.view, e.detail,
  23. e.screenX, e.screenY, e.clientX, e.clientY,
  24. e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
  25. e.button, document.body.parentNode);
  26. } else if (document.createEventObject) {
  27. evt = document.createEventObject();
  28. for (prop in e) {
  29. evt[prop] = e[prop];
  30. }
  31. evt.button = { 0:1, 1:4, 2:2 }[evt.button] || evt.button;
  32. }
  33. return evt;
  34. }
  35. var a = document.getElementsByClassName("spinner")[0],
  36. b = document.getElementById("speed");
  37. a.addEventListener("mousemove", function(e){console.log("clientX:" + e.clientX +", clientY:" + e.clientY +", screenX:" + e.screenX +", screenY:" + e.screenY +", movementX:" + e.movementX);});
  38.  
  39. function bootRot(x, y){
  40. a.dispatchEvent(mouseEvent("mousemove", x, y, x, y));
  41. }
  42.  
  43. function bootStart(){
  44. if ((b.innerHTML != "Dragging") && parseInt(b.innerHTML) < 1800){
  45. var xInicial = 0, yInicial = 0;
  46.  
  47. // "parseInt(b.innerHTML) < 1800": 1800 is the minimum value in RPMs from which the spinner rotates again.
  48. // This value can be edited!
  49.  
  50. for(var ofParent = a; ofParent; ofParent = ofParent.offsetParent){
  51. xInicial += ofParent.offsetLeft;
  52. yInicial += ofParent.offsetTop;
  53. }
  54.  
  55. var bootWidth = xInicial + a.offsetWidth,
  56. bootHeight = xInicial + a.offsetHeight;
  57.  
  58. var Xs = [xInicial, (bootWidth)/2, bootHeight, (bootWidth)/2], /*[462, 591, 729, 869],*/
  59. Ys = [(bootHeight)/2, yInicial, (bootHeight)/2, bootHeight], /*[77, 77, 77, 77],*/
  60. count = 0, speedBoot = 20;
  61.  
  62. // speedBoot = 20: Time in milliseconds that the mouse pointer would by points (Xs,Ys) forming a perfect circle.
  63. // This value can also be edited.
  64.  
  65. a.dispatchEvent(mouseEvent("mousedown", Xs[0], Ys[0], Xs[0], Ys[0]));
  66.  
  67. bootRot(Xs[0], Ys[0]);
  68.  
  69. setTimeout(function(){
  70. bootRot(Xs[1], Ys[1]);
  71. }, (count++)*speedBoot);
  72.  
  73. setTimeout(function(){
  74. bootRot(Xs[2], Ys[2]);
  75. }, (count++)*speedBoot);
  76.  
  77. setTimeout(function(){
  78. bootRot(Xs[3], Ys[3]);
  79. a.dispatchEvent(mouseEvent("mouseup", Xs[3], Ys[3], Xs[3], Ys[3]));
  80. }, (count++)*speedBoot);
  81. }
  82. }
  83.  
  84. var bootIntervalId = setInterval(bootStart, 1800);
  85.  
  86. // bootStart, 20: Time in milliseconds to swing reset after reaching the minimum RPM value.
  87. // This value can also be edited.
  88. // It is recommended that greater values for computers that do not have advanced hardware configuration!
  89.  
  90. function bootStop(){ // bootStop(): Command stops the execution of the script.
  91. clearInterval(bootIntervalId);
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement