🏠 返回首頁 

Greasy Fork is available in English.

PurposeGames Hack

Answers all games on PurposeGames in record Time (with adjustable slider)


Installer dette script?
  1. // ==UserScript==
  2. // @name PurposeGames Hack
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Answers all games on PurposeGames in record Time (with adjustable slider)
  6. // @author longkidkoolstar
  7. // @match https://www.purposegames.com/*
  8. // @icon https://th.bing.com/th/id/R.201395eef044c88cd80bb137b6638932?rik=4SVeP8xG%2bGt2Tg&pid=ImgRaw&r=0
  9. // @license none
  10. // @grant none
  11. // ==/UserScript==
  12. (function() {
  13. 'use strict';
  14. let previousValue = document.querySelector('#question-box').getAttribute('data-text');
  15. // Function to simulate click
  16. function simulateClick(element) {
  17. const clickEvent = new MouseEvent("click", {
  18. bubbles: true,
  19. cancelable: true,
  20. view: window
  21. });
  22. element.dispatchEvent(clickEvent);
  23. }
  24. // Function to display the unit circle, the number to click, and the element
  25. function displayInfo() {
  26. const dots = document.querySelectorAll('.dot');
  27. dots.forEach(dot => {
  28. console.log(`Dot at (${dot.getAttribute('data-x')}, ${dot.getAttribute('data-y')}) represents ${dot.getAttribute('data-text')}`, dot);
  29. });
  30. const targetAngle = document.querySelector('#question-box').getAttribute('data-text');
  31. console.log(`Number to click: ${targetAngle}`);
  32. if (targetAngle !== previousValue) {
  33. solveUnitCircle();
  34. previousValue = targetAngle;
  35. }
  36. }
  37. // Main function to find and click the correct dot
  38. function solveUnitCircle() {
  39. const targetAngle = document.querySelector('#question-box').getAttribute('data-text');
  40. const dots = document.querySelectorAll('.dot');
  41. dots.forEach(dot => {
  42. if(dot.getAttribute('data-text') === targetAngle) {
  43. simulateClick(dot);
  44. }
  45. });
  46. }
  47. // Create GUI slider and popup
  48. function createSliderAndPopup() {
  49. const slider = document.createElement('input');
  50. slider.type = 'range';
  51. slider.min = '1';
  52. slider.max = '100';
  53. slider.value = localStorage.getItem('sliderValue') || '10'; // Retrieve saved value or use default
  54. slider.style.position = 'fixed';
  55. slider.style.left = '0';
  56. slider.style.bottom = '0';
  57. document.body.appendChild(slider);
  58. // Popup for displaying the current slider value
  59. var popup = document.createElement('div');
  60. popup.classList.add('slider-popup');
  61. popup.style.position = 'fixed';
  62. popup.style.backgroundColor = 'rgba(0, 0, 0, 0.8)';
  63. popup.style.color = 'white';
  64. popup.style.padding = '5px 10px';
  65. popup.style.borderRadius = '5px';
  66. popup.style.zIndex = '9999';
  67. popup.style.display = 'none'; // Initially hidden
  68. document.body.appendChild(popup);
  69. let intervalId;
  70. slider.oninput = function() {
  71. clearInterval(intervalId);
  72. const intervalTime = 1000 / this.value; // Calculate interval time based on slider value
  73. intervalId = setInterval(solveUnitCircle, intervalTime);
  74. localStorage.setItem('sliderValue', this.value); // Save slider value to localStorage
  75. // Show the popup with the current slider value
  76. popup.innerText = 'Speed: ' + this.value;
  77. popup.style.display = 'block';
  78. // Calculate slider position and adjust popup position
  79. var sliderRect = slider.getBoundingClientRect();
  80. var popupX = sliderRect.left + ((slider.value - slider.min) / (slider.max - slider.min)) * sliderRect.width - popup.clientWidth / 2;
  81. var popupY = sliderRect.top - popup.clientHeight - 10;
  82. popup.style.left = popupX + 'px';
  83. popup.style.top = popupY + 'px';
  84. // Start a timer to hide the popup after a certain duration (e.g., 2 seconds)
  85. setTimeout(function() {
  86. popup.style.display = 'none';
  87. }, 2000);
  88. };
  89. // Show popup when mouse hovers over the slider
  90. slider.onmouseover = function() {
  91. popup.style.display = 'block';
  92. };
  93. // Hide popup when mouse leaves the slider
  94. slider.onmouseout = function() {
  95. popup.style.display = 'none';
  96. };
  97. }
  98. createSliderAndPopup();
  99. //setInterval(displayInfo, 1000);
  100. })();