Greasy Fork is available in English.

Scroll and prop

Scrolls fitocracy feed and gives props to everyone

  1. // ==UserScript==
  2. // @name Scroll and prop
  3. // @version 0.0.1
  4. // @description Scrolls fitocracy feed and gives props to everyone
  5. // @match https://www.fitocracy.com/home/*
  6. // @match https://www.fitocracy.com/profile/*
  7. // @namespace https://github.com/artm
  8. // @require https://cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/1.4.14/jquery.scrollTo.min.js
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. createPropButton();
  13.  
  14. function createPropButton() {
  15. var button = $('<label for="autoprop">prop</label>')
  16. .appendTo('body')
  17. .css({position: "fixed"});
  18. $('<input id="autoprop" type="checkbox">')
  19. .appendTo('body')
  20. .button()
  21. .change(function(e) {
  22. if (this.checked) {
  23. scrollToUnpropped();
  24. } else {
  25. $(window)._scrollable().clearQueue().scrollTo("0%", 500);
  26. }
  27. });
  28. $(window)
  29. .resize(button, function(e) { keepCornered(e.data); })
  30. .resize();
  31. }
  32.  
  33. function scrollToUnpropped(unpropped) {
  34. if (!unpropped || !unpropped.length) {
  35. unpropped = $(".stream_item .give_prop").get();
  36. }
  37. var topUnpropped = unpropped.shift();
  38. if (topUnpropped) {
  39. propAndContinue(topUnpropped, unpropped);
  40. } else {
  41. scrollForMore();
  42. }
  43. }
  44.  
  45. function propAndContinue(topUnpropped, unpropped) {
  46. $(window)
  47. ._scrollable()
  48. .scrollTo(topUnpropped, 1000, {
  49. offset: -60
  50. })
  51. .delay(250)
  52. .queue(function() {
  53. $(this).dequeue();
  54. $(topUnpropped).click();
  55. })
  56. .delay(250)
  57. .queue(function() {
  58. $(this).dequeue();
  59. scrollToUnpropped(unpropped);
  60. });
  61. }
  62.  
  63. function scrollForMore() {
  64. $(window)
  65. ._scrollable()
  66. .scrollTo("100%", 500)
  67. .delay(1000)
  68. .queue(function() {
  69. $(this).dequeue();
  70. scrollToUnpropped();
  71. });
  72. }
  73.  
  74. function keepCornered(widget) {
  75. widget.position({
  76. my: "right bottom",
  77. at: "right-10 bottom-10",
  78. of: window,
  79. collision: "none"
  80. });
  81. }