Kongregate RCM Auto-Racer + Scroll Fixes!

[Works in FF and Chrome!] Auto-Racing + Scroll Fixes!

  1. // ==UserScript==
  2. // @name Kongregate RCM Auto-Racer + Scroll Fixes!
  3. // @namespace RCM
  4. // @version 0.3
  5. // @description [Works in FF and Chrome!] Auto-Racing + Scroll Fixes!
  6. // @author William H
  7. // @contributor wOxxOm (https://greasyfork.org/en/forum/profile/323/wOxxOm) //for fixing my script so it worked in Firefox! Huge thank you.
  8. // @include *racing-clicker.github.io/*
  9. // @grant none
  10. // @require http://code.jquery.com/jquery-latest.js
  11. // @require https://greasyfork.org/scripts/12228/code/setMutationHandler.js
  12. // ==/UserScript==
  13.  
  14. window.addEventListener("load", StartMyAutoClicker(), false);
  15.  
  16. function StartMyAutoClicker(elemArray) {
  17. if(!localStorage.autoClickInterval){
  18. localStorage.autoClickInterval = prompt('Please enter the number of miliseconds you would like it to click at\n *Note: 1000ms = 1 second, it\'s not recommended to do less than 10ms', '25');
  19. }
  20. $($('.dropdown')[0]).before('<li class="ng-scope"><a href=""><div class="fa fa-play" style="width:30px;" onclick="toggleAuto(this)" id="autoToggle"></div><input type="text" size="3" onblur="updateInterval(this)" style="height:20px;width:30px;background-color:#000000;border:0;text-align:center;" placeholder="'+ localStorage.autoClickInterval +'"></a></li>');
  21. $('head').append("<script>function toggleAuto(elem){\n\tif(elem.className.search('fa-pause') > 0){\n\t\telem.className = elem.className.replace('pause', 'play');\n\t\tclearInterval(autoClicker);\n\t}else{\n\t\telem.className = elem.className.replace('play','pause');\n\t\tautoClicker = setInterval((function(){$($('.btn.btn-primary.btn-lg.ng-scope')[0]).click();}), localStorage.autoClickInterval);\n\t}\n}\nfunction updateInterval(elem){\n\tlocalStorage.autoClickInterval = elem.value;\n\tif(document.getElementById('autoToggle').className.search('play') == -1){\n\t\tclearInterval(autoClicker);\n\t\tautoClicker = setInterval((function(){$($('.btn.btn-primary.btn-lg.ng-scope')[0]).click();}), localStorage.autoClickInterval);\n\t}\n}</script>");
  22. fixMyBloodyGame();
  23. setMutationHandler(document, '.dropdown', function(observer, nodes) {
  24. $('<li class="ng-scope"><a href=""><div class="fa fa-play" style="width:30px;" onclick="toggleAuto(this)" id="autoToggle"></div><input type="text" size="3" onblur="updateInterval(this)" style="height:20px;width:30px;background-color:#000000;border:0;text-align:center;" placeholder="'+ localStorage.autoClickInterval +'"></a></li>').insertBefore($('.dropdown')[0]);
  25. fixMyBloodyGame();
  26. observer.disconnect();
  27. });
  28. }
  29.  
  30. function fixMyBloodyGame(){
  31. $.each($('div.panel-body.ps-container'), function() {
  32. $(this).replaceWith(function() {
  33. return $('<' + this.nodeName + '>').attr('class', 'panel-body ps-container ps-active-y').attr('style', 'overflow:scroll;').append($(this).contents());
  34. });
  35. });
  36. $("[class^='ps-scrollbar-']").remove();
  37. }