POPCAT 自動點擊器

POPCAT 自動點擊

  1. // ==UserScript==
  2. // @name POPCAT 自動點擊器
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.0.0
  5. // @description POPCAT 自動點擊
  6. // @author 聖冰如焰
  7. // @match https://popcat.click/
  8. // @require http://code.jquery.com/jquery-3.4.1.min.js
  9. // @grant GM_addStyle
  10. // ==/UserScript==
  11.  
  12. GM_addStyle(`
  13. #timeLeftBox {
  14. top: 100px;
  15. position: absolute;
  16. z-index: 10;
  17. font-size: 50px;
  18. margin: 10px;
  19. -webkit-text-stroke-width: 1.5px;
  20. height: 0;
  21. flex-grow: 1;
  22. background-position: bottom;
  23. background-size: contain;
  24. background-repeat: no-repeat;
  25. touch-action: manipulation;
  26. text-align: center;
  27. color: #fff;
  28. -webkit-text-stroke-width: 2px;
  29. -webkit-text-stroke-color: #000;
  30. font-weight: 900;
  31. word-wrap: break-word;
  32. }
  33. #timeLeftTitle {
  34. }
  35. #timeLeftCount {
  36. font-size: 40px;
  37. }
  38. `);
  39.  
  40. 'use strict';
  41. (() => {
  42. $('body').prepend('<div id="timeLeftBox"><div id="timeLeftTitle">剩餘時間</div><div id="timeLeftCount">30</div></div>');
  43.  
  44. //--------------------------------------------//
  45. let timeLeftCount = $('#timeLeftCount');
  46. let limitTime = 30000;
  47. let limitCount = 800;
  48. let time = +new Date();
  49. let clickCount = 0;
  50. let event = new KeyboardEvent('keydown', {
  51. key: 'g',
  52. ctrlKey: true
  53. });
  54. let rundo = () => {
  55. let nowTime = +new Date();
  56. let leftTime = nowTime - time;
  57. timeLeftCount.text((Math.round((30 - leftTime / 1000) * 1000)/1000).toFixed(3) + 's');
  58. if (leftTime >= limitTime) {
  59. time = nowTime;
  60. clickCount = 0;
  61. };
  62. if (++clickCount < limitCount)
  63. document.dispatchEvent(event);
  64. requestAnimationFrame(rundo);
  65. }
  66. requestAnimationFrame(rundo);
  67. })()